diff mbox

[U-Boot,V2,1/9] omap_hsmmc: update struct hsmmc to accommodate omap3 from DT

Message ID a1302e2d5c129f3597d2ff80b6d60b63519a4d84.1492434551.git.aford173@gmail.com
State Accepted
Commit 46831c1a4cda75d92f7ad18d4e2b1eb196c62b2f
Delegated to: Tom Rini
Headers show

Commit Message

Adam Ford April 17, 2017, 1:09 p.m. UTC
This patch changes the way DM_MMC calculates offset to the base register of
MMC. Previously this was through an #ifdef but that wasn't necessary for OMAP3.

This patch will now add in the offset to the base address based on the
.compatible flags.

Signed-off-by: Adam Ford <aford173@gmail.com>

V2: Remove ifdef completely and reference offset from the omap_hsmmc_ids table.

V1: Change ifdef to ignore OMAP3

Comments

Lokesh Vutla April 26, 2017, 4:57 a.m. UTC | #1
On Monday 17 April 2017 06:39 PM, Adam Ford wrote:
> This patch changes the way DM_MMC calculates offset to the base register of
> MMC. Previously this was through an #ifdef but that wasn't necessary for OMAP3.
> 
> This patch will now add in the offset to the base address based on the
> .compatible flags.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh
Simon Glass April 29, 2017, 12:27 a.m. UTC | #2
On 25 April 2017 at 22:57, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>
>
> On Monday 17 April 2017 06:39 PM, Adam Ford wrote:
>> This patch changes the way DM_MMC calculates offset to the base register of
>> MMC. Previously this was through an #ifdef but that wasn't necessary for OMAP3.
>>
>> This patch will now add in the offset to the base address based on the
>> .compatible flags.
>>
>> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
>
> Thanks and regards,
> Lokesh
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini May 10, 2017, 5:52 p.m. UTC | #3
On Mon, Apr 17, 2017 at 08:09:37AM -0500, Adam Ford wrote:

> This patch changes the way DM_MMC calculates offset to the base register of
> MMC. Previously this was through an #ifdef but that wasn't necessary for OMAP3.
> 
> This patch will now add in the offset to the base address based on the
> .compatible flags.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> V2: Remove ifdef completely and reference offset from the omap_hsmmc_ids table.
> 
> V1: Change ifdef to ignore OMAP3
> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
> index f2bf645..93e003a 100644

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
index f2bf645..93e003a 100644
--- a/arch/arm/include/asm/omap_mmc.h
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -26,9 +26,6 @@ 
 #define OMAP_MMC_H_
 
 struct hsmmc {
-#ifdef CONFIG_DM_MMC
-	unsigned char res0[0x100];
-#endif
 	unsigned char res1[0x10];
 	unsigned int sysconfig;		/* 0x10 */
 	unsigned int sysstatus;		/* 0x14 */
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 83dda09..d151fe7 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -61,6 +61,10 @@  struct omap_hsmmc_plat {
 	struct mmc mmc;
 };
 
+struct omap2_mmc_platform_config {
+	u32 reg_offset;
+};
+
 struct omap_hsmmc_data {
 	struct hsmmc *base_addr;
 #ifndef CONFIG_DM_MMC
@@ -778,12 +782,14 @@  static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 	struct omap_hsmmc_data *priv = dev_get_priv(dev);
 	struct omap_hsmmc_plat *plat = dev_get_platdata(dev);
 	struct mmc_config *cfg = &plat->cfg;
+	struct omap2_mmc_platform_config *data =
+		(struct omap2_mmc_platform_config *)dev_get_driver_data(dev);
 	const void *fdt = gd->fdt_blob;
 	int node = dev_of_offset(dev);
 	int val;
 
 	priv->base_addr = map_physmem(dev_get_addr(dev), sizeof(struct hsmmc *),
-				      MAP_NOCACHE);
+				      MAP_NOCACHE) + data->reg_offset;
 
 	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
 	val = fdtdec_get_int(fdt, node, "bus-width", -1);
@@ -854,10 +860,31 @@  static int omap_hsmmc_probe(struct udevice *dev)
 	return 0;
 }
 
+static const struct omap2_mmc_platform_config omap3_mmc_pdata = {
+	.reg_offset = 0,
+};
+
+static const struct omap2_mmc_platform_config am33xx_mmc_pdata = {
+	.reg_offset = 0x100,
+};
+
+static const struct omap2_mmc_platform_config omap4_mmc_pdata = {
+	.reg_offset = 0x100,
+};
+
 static const struct udevice_id omap_hsmmc_ids[] = {
-	{ .compatible = "ti,omap3-hsmmc" },
-	{ .compatible = "ti,omap4-hsmmc" },
-	{ .compatible = "ti,am33xx-hsmmc" },
+	{
+			.compatible = "ti,omap3-hsmmc",
+			.data = (ulong)&omap3_mmc_pdata
+	},
+	{
+			.compatible = "ti,omap4-hsmmc",
+			.data = (ulong)&omap4_mmc_pdata
+	},
+	{
+			.compatible = "ti,am33xx-hsmmc",
+			.data = (ulong)&am33xx_mmc_pdata
+	},
 	{ }
 };