* [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode
@ 2021-12-16 6:08 fred
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: fred @ 2021-12-16 6:08 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson, linux-mmc
Cc: shaper.liu, chevron.li, xiaoguang.yu, shirley.her, fred.ai
From: Fred Ai <fred.ai@bayhubtech.com>
Card input timing is margin, need to adjust the hold timing of card input.
Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
---
Change in V3:
1.Select suit DLL phase's output clock as SD interface clock at SDR104/HS200 mode.
2.Deselect DLL output phase as SD interface clock before next card initialization.
---
drivers/mmc/host/sdhci-pci-o2micro.c | 56 +++++++++++++++++++++++-----
1 file changed, 47 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
index f045c1ee4667..f55602609f8c 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -43,11 +43,15 @@
#define O2_SD_CAP_REG0 0x334
#define O2_SD_UHS1_CAP_SETTING 0x33C
#define O2_SD_DELAY_CTRL 0x350
+#define O2_SD_OUTPUT_CLK_SOURCE_SWITCH 0x354
#define O2_SD_UHS2_L1_CTRL 0x35C
#define O2_SD_FUNC_REG3 0x3E0
#define O2_SD_FUNC_REG4 0x3E4
#define O2_SD_LED_ENABLE BIT(6)
#define O2_SD_FREG0_LEDOFF BIT(13)
+#define O2_SD_SEL_DLL BIT(16)
+#define O2_SD_FIX_PHASE (BIT(23) | BIT(20))
+#define O2_SD_PHASE_MASK GENMASK(23, 20)
#define O2_SD_FREG4_ENABLE_CLK_SET BIT(22)
#define O2_SD_VENDOR_SETTING 0x110
@@ -301,9 +305,13 @@ static int sdhci_o2_dll_recovery(struct sdhci_host *host)
static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
{
struct sdhci_host *host = mmc_priv(mmc);
+ struct sdhci_pci_slot *slot = sdhci_priv(host);
+ struct sdhci_pci_chip *chip = slot->chip;
int current_bus_width = 0;
u32 scratch32 = 0;
u16 scratch = 0;
+ u8 scratch_8 = 0;
+ u32 reg_val;
/*
* This handler only implements the eMMC tuning that is specific to
@@ -322,6 +330,32 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
scratch |= O2_SD_PWR_FORCE_L0;
sdhci_writew(host, scratch, O2_SD_MISC_CTRL);
+ /* Stop clk */
+ reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+ reg_val &= ~SDHCI_CLOCK_CARD_EN;
+ sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
+
+ /* UnLock WP */
+ pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
+ scratch_8 &= 0x7f;
+ pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
+
+ /* Set pcr 0x354[16] to choose dll clock, and set the default phase */
+ pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, ®_val);
+ reg_val &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
+ reg_val |= (O2_SD_SEL_DLL | O2_SD_FIX_PHASE);
+ pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, reg_val);
+
+ /* Lock WP */
+ pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
+ scratch_8 |= 0x80;
+ pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
+
+ /* Start clk */
+ reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+ reg_val |= SDHCI_CLOCK_CARD_EN;
+ sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
+
/* wait DLL lock, timeout value 5ms */
if (readx_poll_timeout(sdhci_o2_pll_dll_wdt_control, host,
scratch32, (scratch32 & O2_DLL_LOCK_STATUS), 1, 5000))
@@ -533,22 +567,26 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
if (clock == 0)
return;
- if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
- pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
-
- scratch &= 0x7f;
- pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
+ /* UnLock WP */
+ pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
+ scratch &= 0x7f;
+ pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
+ if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
o2_pci_set_baseclk(chip, 0x2c280000);
+ }
- pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
+ pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
+ scratch_32 &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
+ pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, scratch_32);
- scratch |= 0x80;
- pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
- }
+ /* Lock WP */
+ pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
+ scratch |= 0x80;
+ pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
sdhci_o2_enable_clk(host, clk);
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode
2021-12-16 6:08 [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode fred
@ 2021-12-16 6:08 ` fred
2021-12-17 6:49 ` Adrian Hunter
2021-12-28 16:57 ` Ulf Hansson
2021-12-17 6:37 ` [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode Adrian Hunter
2021-12-17 6:38 ` Adrian Hunter
2 siblings, 2 replies; 6+ messages in thread
From: fred @ 2021-12-16 6:08 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson, linux-mmc
Cc: shaper.liu, chevron.li, xiaoguang.yu, shirley.her, fred.ai
From: Fred Ai <fred.ai@bayhubtech.com>
Remove SDR104 card, SD clock's base clock
frequency is not right when insert SD2.0/SDR50 card
Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
---
Change in V3:
1.Set SD clock's base clock frequency to 208MHz when card mode is SDR104/HS200.
2.Set SD clock's base clock frequency to 200MHz when card mode is SD2.0/SDR50.
---
drivers/mmc/host/sdhci-pci-o2micro.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
index f55602609f8c..4ca1e8c5b631 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -577,6 +577,11 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
o2_pci_set_baseclk(chip, 0x2c280000);
+ } else {
+ pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
+
+ if ((scratch_32 & 0xFFFF0000) != 0x25100000)
+ o2_pci_set_baseclk(chip, 0x25100000);
}
pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode
2021-12-16 6:08 [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode fred
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
@ 2021-12-17 6:37 ` Adrian Hunter
2021-12-17 6:38 ` Adrian Hunter
2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2021-12-17 6:37 UTC (permalink / raw)
To: fred, ulf.hansson, linux-mmc
Cc: shaper.liu, chevron.li, xiaoguang.yu, shirley.her
On 16/12/2021 08:08, fred wrote:
> From: Fred Ai <fred.ai@bayhubtech.com>
>
> Card input timing is margin, need to adjust the hold timing of card input.
>
> Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
> ---
> Change in V3:
> 1.Select suit DLL phase's output clock as SD interface clock at SDR104/HS200 mode.
> 2.Deselect DLL output phase as SD interface clock before next card initialization.
> ---
> drivers/mmc/host/sdhci-pci-o2micro.c | 56 +++++++++++++++++++++++-----
> 1 file changed, 47 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index f045c1ee4667..f55602609f8c 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -43,11 +43,15 @@
> #define O2_SD_CAP_REG0 0x334
> #define O2_SD_UHS1_CAP_SETTING 0x33C
> #define O2_SD_DELAY_CTRL 0x350
> +#define O2_SD_OUTPUT_CLK_SOURCE_SWITCH 0x354
> #define O2_SD_UHS2_L1_CTRL 0x35C
> #define O2_SD_FUNC_REG3 0x3E0
> #define O2_SD_FUNC_REG4 0x3E4
> #define O2_SD_LED_ENABLE BIT(6)
> #define O2_SD_FREG0_LEDOFF BIT(13)
> +#define O2_SD_SEL_DLL BIT(16)
> +#define O2_SD_FIX_PHASE (BIT(23) | BIT(20))
> +#define O2_SD_PHASE_MASK GENMASK(23, 20)
Can use FIELD_PREP here e.g.
#define O2_SD_PHASE_MASK GENMASK(23, 20)
#define O2_SD_FIX_PHASE FIELD_PREP(O2_SD_PHASE_MASK, 0x9)
> #define O2_SD_FREG4_ENABLE_CLK_SET BIT(22)
>
> #define O2_SD_VENDOR_SETTING 0x110
> @@ -301,9 +305,13 @@ static int sdhci_o2_dll_recovery(struct sdhci_host *host)
> static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
> {
> struct sdhci_host *host = mmc_priv(mmc);
> + struct sdhci_pci_slot *slot = sdhci_priv(host);
> + struct sdhci_pci_chip *chip = slot->chip;
> int current_bus_width = 0;
> u32 scratch32 = 0;
> u16 scratch = 0;
> + u8 scratch_8 = 0;
> + u32 reg_val;
>
> /*
> * This handler only implements the eMMC tuning that is specific to
> @@ -322,6 +330,32 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
> scratch |= O2_SD_PWR_FORCE_L0;
> sdhci_writew(host, scratch, O2_SD_MISC_CTRL);
>
> + /* Stop clk */
> + reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> + reg_val &= ~SDHCI_CLOCK_CARD_EN;
> + sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
> +
> + /* UnLock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> + scratch_8 &= 0x7f;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> + /* Set pcr 0x354[16] to choose dll clock, and set the default phase */
> + pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, ®_val);
> + reg_val &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
> + reg_val |= (O2_SD_SEL_DLL | O2_SD_FIX_PHASE);
> + pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, reg_val);
> +
> + /* Lock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> + scratch_8 |= 0x80;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> + /* Start clk */
> + reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> + reg_val |= SDHCI_CLOCK_CARD_EN;
> + sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
> +
> /* wait DLL lock, timeout value 5ms */
> if (readx_poll_timeout(sdhci_o2_pll_dll_wdt_control, host,
> scratch32, (scratch32 & O2_DLL_LOCK_STATUS), 1, 5000))
> @@ -533,22 +567,26 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
> if (clock == 0)
> return;
>
> - if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
> - pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> -
> - scratch &= 0x7f;
> - pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
> + /* UnLock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + scratch &= 0x7f;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
>
> + if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
> pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
>
> if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
> o2_pci_set_baseclk(chip, 0x2c280000);
> + }
>
> - pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
> + scratch_32 &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
> + pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, scratch_32);
>
> - scratch |= 0x80;
> - pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
> - }
> + /* Lock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + scratch |= 0x80;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
>
> clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
> sdhci_o2_enable_clk(host, clk);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode
2021-12-16 6:08 [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode fred
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
2021-12-17 6:37 ` [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode Adrian Hunter
@ 2021-12-17 6:38 ` Adrian Hunter
2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2021-12-17 6:38 UTC (permalink / raw)
To: fred, ulf.hansson, linux-mmc
Cc: shaper.liu, chevron.li, xiaoguang.yu, shirley.her
On 16/12/2021 08:08, fred wrote:
> From: Fred Ai <fred.ai@bayhubtech.com>
>
> Card input timing is margin, need to adjust the hold timing of card input.
>
> Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
> ---
> Change in V3:
> 1.Select suit DLL phase's output clock as SD interface clock at SDR104/HS200 mode.
> 2.Deselect DLL output phase as SD interface clock before next card initialization.
> ---
> drivers/mmc/host/sdhci-pci-o2micro.c | 56 +++++++++++++++++++++++-----
> 1 file changed, 47 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index f045c1ee4667..f55602609f8c 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -43,11 +43,15 @@
> #define O2_SD_CAP_REG0 0x334
> #define O2_SD_UHS1_CAP_SETTING 0x33C
> #define O2_SD_DELAY_CTRL 0x350
> +#define O2_SD_OUTPUT_CLK_SOURCE_SWITCH 0x354
> #define O2_SD_UHS2_L1_CTRL 0x35C
> #define O2_SD_FUNC_REG3 0x3E0
> #define O2_SD_FUNC_REG4 0x3E4
> #define O2_SD_LED_ENABLE BIT(6)
> #define O2_SD_FREG0_LEDOFF BIT(13)
> +#define O2_SD_SEL_DLL BIT(16)
> +#define O2_SD_FIX_PHASE (BIT(23) | BIT(20))
> +#define O2_SD_PHASE_MASK GENMASK(23, 20)
> #define O2_SD_FREG4_ENABLE_CLK_SET BIT(22)
>
> #define O2_SD_VENDOR_SETTING 0x110
> @@ -301,9 +305,13 @@ static int sdhci_o2_dll_recovery(struct sdhci_host *host)
> static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
> {
> struct sdhci_host *host = mmc_priv(mmc);
> + struct sdhci_pci_slot *slot = sdhci_priv(host);
> + struct sdhci_pci_chip *chip = slot->chip;
> int current_bus_width = 0;
> u32 scratch32 = 0;
> u16 scratch = 0;
> + u8 scratch_8 = 0;
> + u32 reg_val;
>
> /*
> * This handler only implements the eMMC tuning that is specific to
> @@ -322,6 +330,32 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode)
> scratch |= O2_SD_PWR_FORCE_L0;
> sdhci_writew(host, scratch, O2_SD_MISC_CTRL);
>
> + /* Stop clk */
> + reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> + reg_val &= ~SDHCI_CLOCK_CARD_EN;
> + sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
> +
> + /* UnLock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> + scratch_8 &= 0x7f;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> + /* Set pcr 0x354[16] to choose dll clock, and set the default phase */
> + pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, ®_val);
> + reg_val &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
> + reg_val |= (O2_SD_SEL_DLL | O2_SD_FIX_PHASE);
> + pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, reg_val);
> +
> + /* Lock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch_8);
> + scratch_8 |= 0x80;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch_8);
> +
> + /* Start clk */
> + reg_val = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
> + reg_val |= SDHCI_CLOCK_CARD_EN;
> + sdhci_writew(host, reg_val, SDHCI_CLOCK_CONTROL);
> +
> /* wait DLL lock, timeout value 5ms */
> if (readx_poll_timeout(sdhci_o2_pll_dll_wdt_control, host,
> scratch32, (scratch32 & O2_DLL_LOCK_STATUS), 1, 5000))
> @@ -533,22 +567,26 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
> if (clock == 0)
> return;
>
> - if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
> - pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> -
> - scratch &= 0x7f;
> - pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
> + /* UnLock WP */
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + scratch &= 0x7f;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
>
> + if ((host->timing == MMC_TIMING_UHS_SDR104) && (clock == 200000000)) {
> pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
>
> if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
> o2_pci_set_baseclk(chip, 0x2c280000);
> + }
>
> - pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
> + scratch_32 &= ~(O2_SD_SEL_DLL | O2_SD_PHASE_MASK);
> + pci_write_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, scratch_32);
>
> - scratch |= 0x80;
> - pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
> - }
> + /* Lock WP */
Also please nudge this indent into line.
> + pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch);
> + scratch |= 0x80;
> + pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
>
> clk = sdhci_calc_clk(host, clock, &host->mmc->actual_clock);
> sdhci_o2_enable_clk(host, clk);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
@ 2021-12-17 6:49 ` Adrian Hunter
2021-12-28 16:57 ` Ulf Hansson
1 sibling, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2021-12-17 6:49 UTC (permalink / raw)
To: fred, ulf.hansson, linux-mmc
Cc: shaper.liu, chevron.li, xiaoguang.yu, shirley.her
On 16/12/2021 08:08, fred wrote:
> From: Fred Ai <fred.ai@bayhubtech.com>
>
> Remove SDR104 card, SD clock's base clock
> frequency is not right when insert SD2.0/SDR50 card
>
> Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> Change in V3:
> 1.Set SD clock's base clock frequency to 208MHz when card mode is SDR104/HS200.
> 2.Set SD clock's base clock frequency to 200MHz when card mode is SD2.0/SDR50.
> ---
> drivers/mmc/host/sdhci-pci-o2micro.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index f55602609f8c..4ca1e8c5b631 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -577,6 +577,11 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
>
> if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
> o2_pci_set_baseclk(chip, 0x2c280000);
> + } else {
> + pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
> +
> + if ((scratch_32 & 0xFFFF0000) != 0x25100000)
> + o2_pci_set_baseclk(chip, 0x25100000);
> }
>
> pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
2021-12-17 6:49 ` Adrian Hunter
@ 2021-12-28 16:57 ` Ulf Hansson
1 sibling, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2021-12-28 16:57 UTC (permalink / raw)
To: fred
Cc: adrian.hunter, linux-mmc, shaper.liu, chevron.li, xiaoguang.yu,
shirley.her
On Thu, 16 Dec 2021 at 07:08, fred <fred.ai@bayhubtech.com> wrote:
>
> From: Fred Ai <fred.ai@bayhubtech.com>
>
> Remove SDR104 card, SD clock's base clock
> frequency is not right when insert SD2.0/SDR50 card
>
> Signed-off-by: Fred Ai <fred.ai@bayhubtech.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> Change in V3:
> 1.Set SD clock's base clock frequency to 208MHz when card mode is SDR104/HS200.
> 2.Set SD clock's base clock frequency to 200MHz when card mode is SD2.0/SDR50.
> ---
> drivers/mmc/host/sdhci-pci-o2micro.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c
> index f55602609f8c..4ca1e8c5b631 100644
> --- a/drivers/mmc/host/sdhci-pci-o2micro.c
> +++ b/drivers/mmc/host/sdhci-pci-o2micro.c
> @@ -577,6 +577,11 @@ static void sdhci_pci_o2_set_clock(struct sdhci_host *host, unsigned int clock)
>
> if ((scratch_32 & 0xFFFF0000) != 0x2c280000)
> o2_pci_set_baseclk(chip, 0x2c280000);
> + } else {
> + pci_read_config_dword(chip->pdev, O2_SD_PLL_SETTING, &scratch_32);
> +
> + if ((scratch_32 & 0xFFFF0000) != 0x25100000)
> + o2_pci_set_baseclk(chip, 0x25100000);
> }
>
> pci_read_config_dword(chip->pdev, O2_SD_OUTPUT_CLK_SOURCE_SWITCH, &scratch_32);
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-28 16:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 6:08 [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode fred
2021-12-16 6:08 ` [PATCH V3 2/2] mmc:sdhci-pci-o2micro:Make the SD clock's base clock frequency correctly according to different card mode fred
2021-12-17 6:49 ` Adrian Hunter
2021-12-28 16:57 ` Ulf Hansson
2021-12-17 6:37 ` [PATCH V3 1/2] mmc:sdhci-pci-o2micro:Improve card input timing at SDR104/HS200 mode Adrian Hunter
2021-12-17 6:38 ` Adrian Hunter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.