mmc:sunxi-mmc:fix clock division for timing mode
Subsystems (2)
PATCH 2/3 mmc:sunxi-mmc:fix clock division for timing mode
When use new timings,all speed mode requires a doubled module clock if speed mode is ddr,requires a four times module clock When use old timings,only 8 bit ddr requires a doubled module clock
--- drivers/mmc/host/sunxi-mmc.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/mmc/host/sunxi-mmc.c +15 -12
@@ -774,20 +774,23 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,if (!ios->clock)return 0 ; -/* -* Under the old timing mode, 8 bit DDR requires the module -* clock to be double the card clock. Under the new timing -* mode, all DDR modes require a doubled module clock. -* -* We currently only support the standard MMC DDR52 mode. -* This block should be updated once support for other DDR -* modes is added. +/** +* When use new timings, all speed mode requires a doubled module clock. +* if speed mode is ddr, requires a four times module clock. +* When use old timings, only 8 bit ddr requires a doubled module clock. */ -if (ios->timing ==MMC_TIMING_MMC_DDR52 && - (host->use_new_timings || - ios->bus_width ==MMC_BUS_WIDTH_8 )) { - div =2 ; +if (host->use_new_timings) { clock <<=1 ; +if (ios->timing ==MMC_TIMING_MMC_DDR52 ) { + div =2 ; + clock <<=1 ; + } + }else { +if (ios->timing ==MMC_TIMING_MMC_DDR52 && + (ios->bus_width ==MMC_BUS_WIDTH_8 )) { + div =2 ; + clock <<=1 ; + } }if (host->use_new_timings && host->cfg->ccu_has_timings_switch) {
Signature · 1 line
2.29.0
Hi Michael,
Thanks for your patch
Quoted 20 lines · Michael Wu
When use new timings,all speed mode requires a doubled module clock if speed mode is ddr,requires a four times module clock When use old timings,only 8 bit ddr requires a doubled module clock
Signed-off-by Michael Wu <[email protected]>--- drivers/mmc/host/sunxi-mmc.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)drivers/mmc/host/sunxi-mmc.c +0
-3@@ -774,20 +774,23 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,if (!ios->clock)return 0 ; -/* -* Under the old timing mode, 8 bit DDR requires the module -* clock to be double the card clock. Under the new timing
drivers/mmc/host/sunxi-mmc.c static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host, · line 781
Quoted 10 lines
drivers/mmc/host/sunxi-mmc.c +4
-5-* mode, all DDR modes require a doubled module clock. -* -* We currently only support the standard MMC DDR52 mode. -* This block should be updated once support for other DDR -* modes is added. +/** +* When use new timings, all speed mode requires a doubled module clock. +* if speed mode is ddr, requires a four times module clock. +* When use old timings, only 8 bit ddr requires a doubled module clock. */
I found the original comment to be clearer, maybe we can change it to something like:
/*
* Under the old timing mode, 8 bit DDR requires the module
* clock to be double the card clock. Under the new timing
* mode, all modes require a doubled module clock, and DDR modes
* require a quadrupled module clock.
*
* ...
drivers/mmc/host/sunxi-mmc.c static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host, · line 785
Quoted 8 lines
drivers/mmc/host/sunxi-mmc.c +3
-4-if (ios->timing ==MMC_TIMING_MMC_DDR52 && - (host->use_new_timings || - ios->bus_width ==MMC_BUS_WIDTH_8 )) { - div =2 ; +if (host->use_new_timings) { clock <<=1 ; +if (ios->timing ==MMC_TIMING_MMC_DDR52 ) { + div =2 ;
Shouldn't that be 4?
drivers/mmc/host/sunxi-mmc.c static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host, · line 790
Quoted 5 lines
drivers/mmc/host/sunxi-mmc.c +5
-0+ clock <<=1 ; + } + }else { +if (ios->timing ==MMC_TIMING_MMC_DDR52 && + (ios->bus_width ==MMC_BUS_WIDTH_8 )) {
This creates some checkpatch.pl --strict warnings
Maxime