Skip to contentSkip to conversation

atmel-mci: fix initialization of 8bit-bus-width-mode for at91sam9g45

RFC PATCH Applied Hubert Feurstein 2 participants 2 messages Jun 21, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 atmel-mci: fix initialization of 8bit-bus-width-mode for at91sam9g45

When the bus_width was set to 8, then only one data-line has been initialized.

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Sascha Hauer <[email protected]>

---
It seems that nobody tried the 8bit mode yet, because this init-bug is present in the linux kernel as well.

@Sascha: I assume the mci-host-driver should set both bits (MMC_MODE_4BIT and MMC_MODE_8BIT) when bus_width == 8 ???

 arch/arm/mach-at91/at91sam9g45_devices.c |    4 ++--
 drivers/mci/atmel_mci.c                  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +2 -2
index dc01705..a474bd7 100644
@@ -285,7 +285,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 
 		/* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
 		at91_set_A_periph(AT91_PIN_PA2, 1);
-		if (data->bus_width == 4) {
+		if (data->bus_width >= 4) {
 			at91_set_A_periph(AT91_PIN_PA3, 1);
 			at91_set_A_periph(AT91_PIN_PA4, 1);
 			at91_set_A_periph(AT91_PIN_PA5, 1);
@@ -310,7 +310,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 
 		/* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
 		at91_set_A_periph(AT91_PIN_PA23, 1);
-		if (data->bus_width == 4) {
+		if (data->bus_width >= 4) {
 			at91_set_A_periph(AT91_PIN_PA24, 1);
 			at91_set_A_periph(AT91_PIN_PA25, 1);
 			at91_set_A_periph(AT91_PIN_PA26, 1);
drivers/mci/atmel_mci.c +2 -2
index 49a7851..d8bcf81 100644
@@ -451,9 +451,9 @@ static int mci_probe(struct device_d *hw_dev)
 	host->mci.init = mci_reset;
 
 	host->mci.host_caps = pd->host_caps;
-	if (pd->bus_width == 4)
+	if (pd->bus_width >= 4)
 		host->mci.host_caps |= MMC_MODE_4BIT;
-	else if (pd->bus_width == 8)
+	if (pd->bus_width == 8)
 		host->mci.host_caps |= MMC_MODE_8BIT;
 
 	host->base = (void __iomem *)hw_dev->map_base;
Signature · 7 lines
1.7.4.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 3 lines · Hubert Feurstein

When the bus_width was set to 8, then only one data-line has been initialized.

applied to -next

Sascha

Quoted 55 lines
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Cc Sascha Hauer <[email protected]>

---
It seems that nobody tried the 8bit mode yet, because this init-bug is present in the linux kernel as well.

@Sascha: I assume the mci-host-driver should set both bits (MMC_MODE_4BIT and MMC_MODE_8BIT) when bus_width == 8 ???

 arch/arm/mach-at91/at91sam9g45_devices.c |    4 ++--
 drivers/mci/atmel_mci.c                  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +2 -2
index dc01705..a474bd7 100644
@@ -285,7 +285,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 
 		/* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
 		at91_set_A_periph(AT91_PIN_PA2, 1);
-		if (data->bus_width == 4) {
+		if (data->bus_width >= 4) {
 			at91_set_A_periph(AT91_PIN_PA3, 1);
 			at91_set_A_periph(AT91_PIN_PA4, 1);
 			at91_set_A_periph(AT91_PIN_PA5, 1);
@@ -310,7 +310,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 
 		/* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */
 		at91_set_A_periph(AT91_PIN_PA23, 1);
-		if (data->bus_width == 4) {
+		if (data->bus_width >= 4) {
 			at91_set_A_periph(AT91_PIN_PA24, 1);
 			at91_set_A_periph(AT91_PIN_PA25, 1);
 			at91_set_A_periph(AT91_PIN_PA26, 1);
drivers/mci/atmel_mci.c +2 -2
index 49a7851..d8bcf81 100644
@@ -451,9 +451,9 @@ static int mci_probe(struct device_d *hw_dev)
 	host->mci.init = mci_reset;
 
 	host->mci.host_caps = pd->host_caps;
-	if (pd->bus_width == 4)
+	if (pd->bus_width >= 4)
 		host->mci.host_caps |= MMC_MODE_4BIT;
-	else if (pd->bus_width == 8)
+	if (pd->bus_width == 8)
 		host->mci.host_caps |= MMC_MODE_8BIT;
 
 	host->base = (void __iomem *)hw_dev->map_base;
Signature · 1 line
1.7.4.1
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox