mci: atmel_mci: Merge at91_mci_bio_set_highcapacity() with at91_mci_bio_init()
Subsystems (4)
PATCH 1/1 mci: atmel_mci: Merge at91_mci_bio_set_highcapacity() with at91_mci_bio_init()
The high-capacity parameter is always set to one of the possible values at initialization, so there is no need to have a separate function to configure it.
--- arch/arm/mach-at91/at91sam9_xload_mmc.c | 5 +---- arch/arm/mach-at91/xload.c | 2 +- drivers/mci/atmel_mci_pbl.c | 10 +++------- include/mach/at91/xload.h | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-)
arch/arm/mach-at91/at91sam9_xload_mmc.c +1 -4
@@ -94,15 +94,12 @@ void __noreturn sam9263_atmci_start_image(u32 mmc_id, unsigned int clock,at91_pmc_enable_periph_clock (IOMEM (AT91SAM926X_BASE_PMC ),AT91SAM9263_ID_MCI1 ); } - ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b); + ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b, false);if (ret) {pr_err ("atmci_start_image: bio init faild: %d\n" , ret); goto out_panic; } -/* at91sam9x do not support high capacity */ -at91_mci_bio_set_highcapacity (false); - ret =pbl_fat_load (&bio,"barebox.bin" , buf,SZ_16M );if (ret <0 ) {pr_err ("pbl_fat_load: error %d\n" , ret);
arch/arm/mach-at91/xload.c +1 -1
@@ -228,7 +228,7 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,sama5d3_pmc_enable_periph_clock (instance->id); - ret =at91_mci_bio_init (&bio, instance->base, clock, slot); + ret =at91_mci_bio_init (&bio, instance->base, clock, slot, true);if (ret) goto out_panic;
drivers/mci/atmel_mci_pbl.c +3 -7
@@ -83,7 +83,8 @@ static int at91_mci_bio_read(struct pbl_bio *bio, off_t start, }int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot) +unsigned int clock,unsigned int slot, +bool highcapacity_card) {struct atmel_mci_priv *priv = &atmci_sdcard;struct atmel_mci *host = &priv->host;
@@ -111,12 +112,7 @@ int at91_mci_bio_init(struct pbl_bio *bio, void __iomem *base,atmci_common_set_ios (host, &ios); - priv->highcapacity_card =1 ; + priv->highcapacity_card = highcapacity_card;return 0 ; } - -void at91_mci_bio_set_highcapacity (bool highcapacity_card) -{ - atmci_sdcard.highcapacity_card = highcapacity_card; -}
include/mach/at91/xload.h +2 -2
@@ -12,8 +12,8 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,int at91_sdhci_bio_init (struct pbl_bio *bio,void __iomem *base);int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot); -void at91_mci_bio_set_highcapacity (bool highcapacity_card); +unsigned int clock,unsigned int slot, +bool highcapacity_card);void __noreturn sam9263_atmci_start_image (u32 mmc_id,unsigned int clock,bool slot_b);
Signature · 1 line
2.39.1
PATCH 1/1 reset: Fix name of exported symbol
--- drivers/reset/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/reset/core.c +1 -1
@@ -392,7 +392,7 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id, boreturn ERR_CAST (rstc); } -EXPORT_SYMBOL_GPL (reset_control_get); +EXPORT_SYMBOL_GPL (__reset_control_get);/** * reset_control_put - free the reset controller
Signature · 1 line
2.39.1
Sascha Hauer
AppliedRe: [PATCH] reset: Fix name of exported symbol
Quoted 1 line · Alexander Shiyan
Applied, thanks!
[1/1] reset: Fix name of exported symbol
https://git.pengutronix.de/cgit/barebox/commit/?id=48f7eba7e463 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>
Hello Alexander,
Quoted 3 lines · Alexander Shiyan
The high-capacity parameter is always set to one of the possible values at initialization, so there is no need to have a separate function to configure it.
here's an idea from IRC by the way to get rid of the parameter:
ye, that [checking CSD] is what is used normally, but the problem is doing it while in transmission state.
I looked into Part1_Physical_Layer_Simplified_Specification_Ver9.00.pdf again and for the first time I see
"Figure 4-13 : SD Memory Card State Diagram (data transfer mode)"
Apparently, you don't necessarily need CMD0 (Go idle) to be able to get to a state where you can execute CMD9 (SEND CSD), but one could also execute CMD7 (SELECT CARD) to deselect card and then run CMD9 and get back to transmission mode
One would need to issue a CMD3 (SEND_RELATIVE_ADDR) to get the RCA to communicate with the correct SD (it's argument to CMD9), but this might work.
Perhaps you're interested in trying this out :D
Cheers,
Ahmad
Quoted 86 lines
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/mach-at91/at91sam9_xload_mmc.c | 5 +---- arch/arm/mach-at91/xload.c | 2 +- drivers/mci/atmel_mci_pbl.c | 10 +++------- include/mach/at91/xload.h | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-)arch/arm/mach-at91/at91sam9_xload_mmc.c +1
-4@@ -94,15 +94,12 @@ void __noreturn sam9263_atmci_start_image(u32 mmc_id, unsigned int clock,at91_pmc_enable_periph_clock (IOMEM (AT91SAM926X_BASE_PMC ),AT91SAM9263_ID_MCI1 ); } - ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b); + ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b, false);if (ret) {pr_err ("atmci_start_image: bio init faild: %d\n" , ret); goto out_panic; } -/* at91sam9x do not support high capacity */ -at91_mci_bio_set_highcapacity (false); - ret =pbl_fat_load (&bio,"barebox.bin" , buf,SZ_16M );if (ret <0 ) {pr_err ("pbl_fat_load: error %d\n" , ret);arch/arm/mach-at91/xload.c +1
-1@@ -228,7 +228,7 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,sama5d3_pmc_enable_periph_clock (instance->id); - ret =at91_mci_bio_init (&bio, instance->base, clock, slot); + ret =at91_mci_bio_init (&bio, instance->base, clock, slot, true);if (ret) goto out_panic;drivers/mci/atmel_mci_pbl.c +3
-7@@ -83,7 +83,8 @@ static int at91_mci_bio_read(struct pbl_bio *bio, off_t start, }int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot) +unsigned int clock,unsigned int slot, +bool highcapacity_card) {struct atmel_mci_priv *priv = &atmci_sdcard;struct atmel_mci *host = &priv->host;@@ -111,12 +112,7 @@ int at91_mci_bio_init(struct pbl_bio *bio, void __iomem *base,atmci_common_set_ios (host, &ios); - priv->highcapacity_card =1 ; + priv->highcapacity_card = highcapacity_card;return 0 ; } - -void at91_mci_bio_set_highcapacity (bool highcapacity_card) -{ - atmci_sdcard.highcapacity_card = highcapacity_card; -}include/mach/at91/xload.h +2
-2@@ -12,8 +12,8 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,int at91_sdhci_bio_init (struct pbl_bio *bio,void __iomem *base);int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot); -void at91_mci_bio_set_highcapacity (bool highcapacity_card); +unsigned int clock,unsigned int slot, +bool highcapacity_card);void __noreturn sam9263_atmci_start_image (u32 mmc_id,unsigned int clock,bool slot_b);
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Hello.
Unfortunately I don't have such hardware to test. The CPU I have (SAMA5D2) uses a different MCI driver.
Thanks!
чт, 27 мар. 2025 г. в 09:41, Ahmad Fatoum <[email protected]>:
Quoted 122 lines
Hello Alexander,
Quoted 3 lines · Alexander Shiyan
The high-capacity parameter is always set to one of the possible values at initialization, so there is no need to have a separate function to configure it.
here's an idea from IRC by the way to get rid of the parameter:
ye, that [checking CSD] is what is used normally, but the problem is doing it while in transmission state.
I looked into Part1_Physical_Layer_Simplified_Specification_Ver9.00.pdf again and for the first time I see
"Figure 4-13 : SD Memory Card State Diagram (data transfer mode)"Apparently, you don't necessarily need CMD0 (Go idle) to be able to get to a state where you can execute CMD9 (SEND CSD), but one could also execute CMD7 (SELECT CARD) to deselect card and then run CMD9 and get back to transmission mode
One would need to issue a CMD3 (
SEND_RELATIVE_ADDR) to get the RCA to communicate with the correct SD (it's argument to CMD9), but this might work.Perhaps you're interested in trying this out :D
Cheers,
AhmadQuoted 76 lines
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/mach-at91/at91sam9_xload_mmc.c | 5 +---- arch/arm/mach-at91/xload.c | 2 +- drivers/mci/atmel_mci_pbl.c | 10 +++------- include/mach/at91/xload.h | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-)arch/arm/mach-at91/at91sam9_xload_mmc.c +1
-4@@ -94,15 +94,12 @@ void __noreturn sam9263_atmci_start_image(u32 mmc_id, unsigned int clock,at91_pmc_enable_periph_clock (IOMEM (AT91SAM926X_BASE_PMC ),AT91SAM9263_ID_MCI1 ); } - ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b); + ret =at91_mci_bio_init (&bio, base, clock, (int )slot_b, false);if (ret) {pr_err ("atmci_start_image: bio init faild: %d\n" , ret); goto out_panic; } -/* at91sam9x do not support high capacity */ -at91_mci_bio_set_highcapacity (false); - ret =pbl_fat_load (&bio,"barebox.bin" , buf,SZ_16M );if (ret <0 ) {pr_err ("pbl_fat_load: error %d\n" , ret);arch/arm/mach-at91/xload.c +1
-1@@ -228,7 +228,7 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,sama5d3_pmc_enable_periph_clock (instance->id); - ret =at91_mci_bio_init (&bio, instance->base, clock, slot); + ret =at91_mci_bio_init (&bio, instance->base, clock, slot, true);if (ret) goto out_panic;drivers/mci/atmel_mci_pbl.c +3
-7@@ -83,7 +83,8 @@ static int at91_mci_bio_read(struct pbl_bio *bio, off_t start, }int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot) +unsigned int clock,unsigned int slot, +bool highcapacity_card) {struct atmel_mci_priv *priv = &atmci_sdcard;struct atmel_mci *host = &priv->host;@@ -111,12 +112,7 @@ int at91_mci_bio_init(struct pbl_bio *bio, void __iomem *base,atmci_common_set_ios (host, &ios); - priv->highcapacity_card =1 ; + priv->highcapacity_card = highcapacity_card;return 0 ; } - -void at91_mci_bio_set_highcapacity (bool highcapacity_card) -{ - atmci_sdcard.highcapacity_card = highcapacity_card; -}include/mach/at91/xload.h +0
-0include/mach/at91/xload.h void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock, · line 19
Quoted 10 lines
include/mach/at91/xload.h +2
-2@@ -12,8 +12,8 @@ void __noreturn sama5d3_atmci_start_image(u32 r4, unsigned int clock,int at91_sdhci_bio_init (struct pbl_bio *bio,void __iomem *base);int at91_mci_bio_init (struct pbl_bio *bio,void __iomem *base, -unsigned int clock,unsigned int slot); -void at91_mci_bio_set_highcapacity (bool highcapacity_card); +unsigned int clock,unsigned int slot, +bool highcapacity_card);void __noreturn sam9263_atmci_start_image (u32 mmc_id,unsigned int clock,bool slot_b);--
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |