Hi,
In current PSLA u-boot (processor-sdk-linux-automotive-3.01.00.03), the pin gpmc_ad0 (at offset 0x0) gets muxed every time an hsmmc port gets muxed, because of an error in structure allocation and iteration. The provided patch solves this issue.
Feel free to integrate in mainline repo.
From 92a05b672ed447f83f35141b92d77ec2b3829256 Mon Sep 17 00:00:00 2001
From: Francesco Valla <francesco.valla@mta.it>
Date: Mon, 14 Nov 2016 16:08:21 +0100
Subject: [PATCH] omap: hsmmc: allocate only one padconf structure per pin
For each offset-value pair found in a pinctrl, only one
pad_conf_entry structure has to be allocated, containing both values.
This commit fixes the unwanted muxing of gpmc_ad0, that previously
was happening on empty pad_conf_entry entries.
Signed-off-by: Francesco Valla <francesco.valla@mta.it>
---
drivers/mmc/omap_hsmmc.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index e3c64bb..24ef2c2 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -1414,6 +1414,15 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
#endif
break;
#endif
+#ifdef OMAP_HSMMC4_BASE
+ case 3:
+ priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC4_BASE;
+#if defined(CONFIG_DRA7XX) && defined(CONFIG_HSMMC4_8BIT)
+ /* Enable 8-bit interface for eMMC on DRA7XX */
+ host_caps_val |= MMC_MODE_8BIT;
+#endif
+ break;
+#endif
default:
priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE;
return 1;
@@ -1469,15 +1478,15 @@ omap_hsmmc_get_pad_conf_entry(const fdt32_t *pinctrl, int count)
int index = 0;
struct pad_conf_entry *padconf;
- padconf = (struct pad_conf_entry *)malloc(sizeof(*padconf) * count);
+ padconf = (struct pad_conf_entry *)malloc(sizeof(*padconf) * count / 2);
if (!padconf) {
printf("failed to allocate memory\n");
return 0;
}
while (index < count) {
- padconf[index].offset = fdt32_to_cpu(pinctrl[index]);
- padconf[index].val = fdt32_to_cpu(pinctrl[index + 1]);
+ padconf[index/2].offset = fdt32_to_cpu(pinctrl[index]);
+ padconf[index/2].val = fdt32_to_cpu(pinctrl[index + 1]);
index += 2;
}
@@ -1594,7 +1603,7 @@ omap_hsmmc_get_pad_conf(struct mmc *mmc, char *prop_name, int *npads)
if (!padconf)
return ERR_PTR(-EINVAL);
- *npads = count;
+ *npads = count / 2;
return padconf;
}
--
2.7.4