All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation
@ 2011-02-23 17:47 Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC Kishore Kadiyala
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Kishore Kadiyala

Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
Adapting the omap_hsmmc driver to hwmod framework.

The patch series is based on -rc6 and tested on OMAP2430, OMAP3430SDP
& OMAP4430SDP.

V3:
---
Omap2420 platform consists of mmc block as in omap1 and not the
hsmmc block as present in omap2430, omap3, omap4 platforms. 
The series takes care of hwmod adaptation of hsmmc drivers and 
thus excluding the omap2420 platforms.

The patch series has dependency on :
 1)https://patchwork.kernel.org/patch/585281/ 
 2)https://patchwork.kernel.org/patch/538301/

V2:
---
http://www.spinics.net/lists/linux-omap/msg45443.html

V1:
---
http://www.spinics.net/lists/linux-mmc/msg05689.html


Anand Gadiyar (1):
  OMAP4: hwmod data: enable HSMMC

Kishore Kadiyala (2):
  OMAP: hwmod data: Add dev_attr and use in the host driver
  OMAP: adapt hsmmc to hwmod framework

Paul Walmsley (2):
  OMAP2430: hwmod data: Add HSMMC
  OMAP3: hwmod data: Add HSMMC

 arch/arm/mach-omap2/devices.c              |  251 ----------------------------
 arch/arm/mach-omap2/hsmmc.c                |  153 ++++++++++++++++--
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 +++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 ++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   26 +++-
 arch/arm/mach-omap2/prcm-common.h          |    4 +
 arch/arm/plat-omap/include/plat/mmc.h      |   24 +--
 drivers/mmc/host/omap_hsmmc.c              |    4 +-
 8 files changed, 554 insertions(+), 284 deletions(-)


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
@ 2011-02-23 17:47 ` Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 2/5] OMAP3: " Kishore Kadiyala
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Kishore Kadiyala, Benoit Cousson

From: Paul Walmsley <paul@pwsan.com>

Update the omap2430 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  146 ++++++++++++++++++++++++++++
 1 files changed, 146 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 7ba688a..4d45b7d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -49,6 +49,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod;
 static struct omap_hwmod omap2430_mcspi1_hwmod;
 static struct omap_hwmod omap2430_mcspi2_hwmod;
 static struct omap_hwmod omap2430_mcspi3_hwmod;
+static struct omap_hwmod omap2430_mmc1_hwmod;
+static struct omap_hwmod omap2430_mmc2_hwmod;
 
 /* L3 -> L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
@@ -232,6 +234,42 @@ static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = {
 	&omap2430_l4_core__usbhsotg,
 };
 
+/* L4 CORE -> MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+	{
+		.pa_start	= 0x4809c000,
+		.pa_end		= 0x4809c1ff,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_mmc1_hwmod,
+	.clk		= "mmchs1_ick",
+	.addr		= omap2430_mmc1_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_mmc1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE -> MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+	{
+		.pa_start	= 0x480b4000,
+		.pa_end		= 0x480b41ff,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_mmc2_hwmod,
+	.addr		= omap2430_mmc2_addr_space,
+	.clk		= "mmchs2_ick",
+	.addr_cnt	= ARRAY_SIZE(omap2430_mmc2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
 	&omap2430_l3_main__l4_core,
@@ -240,6 +278,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
 	&omap2430_l4_core__l4_wkup,
+	&omap2430_l4_core__mmc1,
+	&omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -1230,6 +1270,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
 
 
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+	.rev_offs	= 0x1fc,
+	.sysc_offs	= 0x10,
+	.syss_offs	= 0x14,
+	.sysc_flags	= (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+	.name = "mmc",
+	.sysc = &mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+	{ .irq = 83 },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+	{ .name = "tx",	.dma_req = 61 }, /* DMA_MMC1_TX */
+	{ .name = "rx",	.dma_req = 62 }, /* DMA_MMC1_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+	{ .role = "dbck", .clk = "mmchsdb_fck" },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+	&omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+	.name		= "mmc1",
+	.mpu_irqs	= mmc1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc1_mpu_irqs),
+	.sdma_reqs	= mmc1_sdma_reqs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(mmc1_sdma_reqs),
+	.opt_clks	= mmc1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc1_opt_clks),
+	.main_clk	= "mmchs1_fck",
+	.prcm		= {
+		.omap2 = {
+			.module_offs = CORE_MOD,
+			.prcm_reg_id = 2,
+			.module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+			.idlest_reg_id = 2,
+			.idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT,
+		},
+	},
+	.slaves		= omap2430_mmc1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc1_slaves),
+	.class		= &mmc_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* MMC/SD/SDIO2 */
+
+static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
+	{ .irq = 86 },
+};
+
+static struct omap_hwmod_dma_info mmc2_sdma_reqs[] = {
+	{ .name = "tx",	.dma_req = 47 }, /* DMA_MMC2_TX */
+	{ .name = "rx",	.dma_req = 48 }, /* DMA_MMC2_RX */
+};
+
+static struct omap_hwmod_opt_clk mmc2_opt_clks[] = {
+	{ .role = "dbck", .clk = "mmchsdb_fck" },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc2_slaves[] = {
+	&omap2430_l4_core__mmc2,
+};
+
+static struct omap_hwmod omap2430_mmc2_hwmod = {
+	.name		= "mmc2",
+	.mpu_irqs	= mmc2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc2_mpu_irqs),
+	.sdma_reqs	= mmc2_sdma_reqs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(mmc2_sdma_reqs),
+	.opt_clks	= mmc2_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc2_opt_clks),
+	.main_clk	= "mmchs2_fck",
+	.prcm		= {
+		.omap2 = {
+			.module_offs = CORE_MOD,
+			.prcm_reg_id = 2,
+			.module_bit  = OMAP2430_EN_MMCHS2_SHIFT,
+			.idlest_reg_id = 2,
+			.idlest_idle_bit = OMAP2430_ST_MMCHS2_SHIFT,
+		},
+	},
+	.slaves		= omap2430_mmc2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc2_slaves),
+	.class		= &mmc_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
 static __initdata struct omap_hwmod *omap2430_hwmods[] = {
 	&omap2430_l3_main_hwmod,
 	&omap2430_l4_core_hwmod,
@@ -1242,6 +1386,8 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = {
 	&omap2430_uart3_hwmod,
 	&omap2430_i2c1_hwmod,
 	&omap2430_i2c2_hwmod,
+	&omap2430_mmc1_hwmod,
+	&omap2430_mmc2_hwmod,
 
 	/* gpio class */
 	&omap2430_gpio1_hwmod,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/5] OMAP3: hwmod data: Add HSMMC
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC Kishore Kadiyala
@ 2011-02-23 17:47 ` Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC Kishore Kadiyala
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Rajendra Nayak,
	Kishore Kadiyala, Benoit Cousson

From: Paul Walmsley <paul@pwsan.com>

Update the omap3 hwmod data with the HSMMC info.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  209 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm-common.h          |    4 +
 2 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 879f55f..c8f2725 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -61,6 +61,9 @@ static struct omap_hwmod omap34xx_mcspi1;
 static struct omap_hwmod omap34xx_mcspi2;
 static struct omap_hwmod omap34xx_mcspi3;
 static struct omap_hwmod omap34xx_mcspi4;
+static struct omap_hwmod omap3xxx_mmc1_hwmod;
+static struct omap_hwmod omap3xxx_mmc2_hwmod;
+static struct omap_hwmod omap3xxx_mmc3_hwmod;
 static struct omap_hwmod am35xx_usbhsotg_hwmod;
 
 static struct omap_hwmod omap3xxx_dma_system_hwmod;
@@ -138,6 +141,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
 	.user	= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE -> MMC1 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = {
+	{
+		.pa_start	= 0x4809c000,
+		.pa_end		= 0x4809c1ff,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_mmc1_hwmod,
+	.clk		= "mmchs1_ick",
+	.addr		= omap3xxx_mmc1_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_mmc1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+	.flags		= OMAP_FIREWALL_L4
+};
+
+/* L4 CORE -> MMC2 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = {
+	{
+		.pa_start	= 0x480b4000,
+		.pa_end		= 0x480b41ff,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_mmc2_hwmod,
+	.clk		= "mmchs2_ick",
+	.addr		= omap3xxx_mmc2_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_mmc2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+	.flags		= OMAP_FIREWALL_L4
+};
+
+/* L4 CORE -> MMC3 interface */
+static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
+	{
+		.pa_start	= 0x480ad000,
+		.pa_end		= 0x480ad1ff,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_mmc3_hwmod,
+	.clk		= "mmchs3_ick",
+	.addr		= omap3xxx_mmc3_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_mmc3_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+	.flags		= OMAP_FIREWALL_L4
+};
+
 /* L4 CORE -> UART1 interface */
 static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
 	{
@@ -1788,11 +1848,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_class_sysconfig mmc_sysc = {
+	.rev_offs	= 0x1fc,
+	.sysc_offs	= 0x10,
+	.syss_offs	= 0x14,
+	.sysc_flags	= (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class mmc_class = {
+	.name = "mmc",
+	.sysc = &mmc_sysc,
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
+	{ .irq = 83, },
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = {
+	{ .name = "tx",	.dma_req = 61, },
+	{ .name = "rx",	.dma_req = 62, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+	{ .role = "dbck", .clk = "omap_32k_fck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
+	&omap3xxx_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+	.name		= "mmc1",
+	.mpu_irqs	= mmc1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc1_mpu_irqs),
+	.sdma_reqs	= mmc1_sdma_reqs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(mmc1_sdma_reqs),
+	.opt_clks	= mmc1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc1_opt_clks),
+	.main_clk	= "mmchs1_fck",
+	.prcm		= {
+		.omap2 = {
+			.module_offs = CORE_MOD,
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_MMC1_SHIFT,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_mmc1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc1_slaves),
+	.class		= &mmc_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* MMC/SD/SDIO2 */
+
+static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
+	{ .irq = INT_24XX_MMC2_IRQ, },
+};
+
+static struct omap_hwmod_dma_info mmc2_sdma_reqs[] = {
+	{ .name = "tx",	.dma_req = 47, },
+	{ .name = "rx",	.dma_req = 48, },
+};
+
+static struct omap_hwmod_opt_clk mmc2_opt_clks[] = {
+	{ .role = "dbck", .clk = "omap_32k_fck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc2_slaves[] = {
+	&omap3xxx_l4_core__mmc2,
+};
+
+static struct omap_hwmod omap3xxx_mmc2_hwmod = {
+	.name		= "mmc2",
+	.mpu_irqs	= mmc2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc2_mpu_irqs),
+	.sdma_reqs	= mmc2_sdma_reqs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(mmc2_sdma_reqs),
+	.opt_clks	= mmc2_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc2_opt_clks),
+	.main_clk	= "mmchs2_fck",
+	.prcm		= {
+		.omap2 = {
+			.module_offs = CORE_MOD,
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_MMC2_SHIFT,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430_ST_MMC2_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_mmc2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc2_slaves),
+	.class		= &mmc_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* MMC/SD/SDIO3 */
+
+static struct omap_hwmod_irq_info mmc3_mpu_irqs[] = {
+	{ .irq = 94, },
+};
+
+static struct omap_hwmod_dma_info mmc3_sdma_reqs[] = {
+	{ .name = "tx",	.dma_req = 77, },
+	{ .name = "rx",	.dma_req = 78, },
+};
+
+static struct omap_hwmod_opt_clk mmc3_opt_clks[] = {
+	{ .role = "dbck", .clk = "omap_32k_fck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_mmc3_slaves[] = {
+	&omap3xxx_l4_core__mmc3,
+};
+
+static struct omap_hwmod omap3xxx_mmc3_hwmod = {
+	.name		= "mmc3",
+	.mpu_irqs	= mmc3_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc3_mpu_irqs),
+	.sdma_reqs	= mmc3_sdma_reqs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(mmc3_sdma_reqs),
+	.opt_clks	= mmc3_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc3_opt_clks),
+	.main_clk	= "mmchs3_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_MMC3_SHIFT,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430_ST_MMC3_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_mmc3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc3_slaves),
+	.class		= &mmc_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l3_main_hwmod,
 	&omap3xxx_l4_core_hwmod,
 	&omap3xxx_l4_per_hwmod,
 	&omap3xxx_l4_wkup_hwmod,
+	&omap3xxx_mmc1_hwmod,
+	&omap3xxx_mmc2_hwmod,
+	&omap3xxx_mmc3_hwmod,
 	&omap3xxx_mpu_hwmod,
 	&omap3xxx_iva_hwmod,
 	&omap3xxx_wd_timer2_hwmod,
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 87486f5..098e659 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -191,6 +191,8 @@
 #define OMAP3430_AUTOIDLE_MASK				(1 << 0)
 
 /* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */
+#define OMAP3430_EN_MMC3_MASK				(1 << 30)
+#define OMAP3430_EN_MMC3_SHIFT				30
 #define OMAP3430_EN_MMC2_MASK				(1 << 25)
 #define OMAP3430_EN_MMC2_SHIFT				25
 #define OMAP3430_EN_MMC1_MASK				(1 << 24)
@@ -231,6 +233,8 @@
 #define OMAP3430_EN_HSOTGUSB_SHIFT			4
 
 /* PM_WKST1_CORE, CM_IDLEST1_CORE shared bits */
+#define OMAP3430_ST_MMC3_SHIFT				30
+#define OMAP3430_ST_MMC3_MASK				(1 << 30)
 #define OMAP3430_ST_MMC2_SHIFT				25
 #define OMAP3430_ST_MMC2_MASK				(1 << 25)
 #define OMAP3430_ST_MMC1_SHIFT				24
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC Kishore Kadiyala
  2011-02-23 17:47 ` [PATCH v3 2/5] OMAP3: " Kishore Kadiyala
@ 2011-02-23 17:47 ` Kishore Kadiyala
  2011-02-24 10:21   ` Cousson, Benoit
  2011-02-23 17:47 ` [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver Kishore Kadiyala
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Anand Gadiyar,
	Kishore Kadiyala, Benoit Cousson

From: Anand Gadiyar <gadiyar@ti.com>

Enabling hsmmc hwmod for OMAP4

Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..dd39e75 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	&omap44xx_mcspi4_hwmod,
 
 	/* mmc class */
-/*	&omap44xx_mmc1_hwmod, */
-/*	&omap44xx_mmc2_hwmod, */
-/*	&omap44xx_mmc3_hwmod, */
-/*	&omap44xx_mmc4_hwmod, */
-/*	&omap44xx_mmc5_hwmod, */
+	&omap44xx_mmc1_hwmod,
+	&omap44xx_mmc2_hwmod,
+	&omap44xx_mmc3_hwmod,
+	&omap44xx_mmc4_hwmod,
+	&omap44xx_mmc5_hwmod,
 
 	/* mpu class */
 	&omap44xx_mpu_hwmod,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
                   ` (2 preceding siblings ...)
  2011-02-23 17:47 ` [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC Kishore Kadiyala
@ 2011-02-23 17:47 ` Kishore Kadiyala
  2011-02-24  6:00   ` Varadarajan, Charulatha
  2011-02-24 10:59   ` Cousson, Benoit
  2011-02-23 17:47 ` [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework Kishore Kadiyala
  2011-02-24 10:19 ` [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Cousson, Benoit
  5 siblings, 2 replies; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Kishore Kadiyala, Benoit Cousson

Add a device attribute to hwmod data of omap2430, omap3, omap4.
Currently the device attribute holds information regarding dual volt MMC card
support by the controller which will be later passed to the host driver via
platform data.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |    9 +++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 ++++++++++++++++
 arch/arm/plat-omap/include/plat/mmc.h      |   10 ++++++++++
 drivers/mmc/host/omap_hsmmc.c              |    4 ++--
 5 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4d45b7d..e050355 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include <plat/i2c.h>
 #include <plat/gpio.h>
 #include <plat/mcspi.h>
+#include <plat/mmc.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -1290,6 +1291,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct mmc_dev_attr mmc1_dev_attr = {
+	.flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
 	{ .irq = 83 },
 };
@@ -1328,11 +1333,14 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
 	.slaves		= omap2430_mmc1_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc1_slaves),
 	.class		= &mmc_class,
+	.dev_attr	= &mmc1_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
 /* MMC/SD/SDIO2 */
 
+static struct mmc_dev_attr mmc2_dev_attr;
+
 static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
 	{ .irq = 86 },
 };
@@ -1371,6 +1379,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
 	.slaves		= omap2430_mmc2_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc2_slaves),
 	.class		= &mmc_class,
+	.dev_attr	= &mmc2_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index c8f2725..6afdf7f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -21,6 +21,7 @@
 #include <plat/l4_3xxx.h>
 #include <plat/i2c.h>
 #include <plat/gpio.h>
+#include <plat/mmc.h>
 #include <plat/smartreflex.h>
 #include <plat/mcspi.h>
 
@@ -1868,6 +1869,10 @@ static struct omap_hwmod_class mmc_class = {
 
 /* MMC/SD/SDIO1 */
 
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+	.flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
 	{ .irq = 83, },
 };
@@ -1906,11 +1911,14 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
 	.slaves		= omap3xxx_mmc1_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc1_slaves),
 	.class		= &mmc_class,
+	.dev_attr	= &omap_mmc1_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO2 */
 
+static struct mmc_dev_attr omap_mmc2_dev_attr;
+
 static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
 	{ .irq = INT_24XX_MMC2_IRQ, },
 };
@@ -1949,11 +1957,14 @@ static struct omap_hwmod omap3xxx_mmc2_hwmod = {
 	.slaves		= omap3xxx_mmc2_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc2_slaves),
 	.class		= &mmc_class,
+	.dev_attr	= &omap_mmc2_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
 /* MMC/SD/SDIO3 */
 
+static struct mmc_dev_attr omap_mmc3_dev_attr;
+
 static struct omap_hwmod_irq_info mmc3_mpu_irqs[] = {
 	{ .irq = 94, },
 };
@@ -1991,6 +2002,7 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
 	.slaves		= omap3xxx_mmc3_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mmc3_slaves),
 	.class		= &mmc_class,
+	.dev_attr	= &omap_mmc3_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index dd39e75..6c4ccfd 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -25,6 +25,7 @@
 #include <plat/gpio.h>
 #include <plat/dma.h>
 #include <plat/mcspi.h>
+#include <plat/mmc.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
 };
 
 /* mmc1 */
+static struct mmc_dev_attr omap_mmc1_dev_attr = {
+	.flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
 static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
 	{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3437,10 +3442,14 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc1_slaves),
 	.masters	= omap44xx_mmc1_masters,
 	.masters_cnt	= ARRAY_SIZE(omap44xx_mmc1_masters),
+	.dev_attr	= &omap_mmc1_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc2 */
+static struct omap_hwmod omap44xx_mmc2_hwmod;
+static struct mmc_dev_attr omap_mmc2_dev_attr;
+
 static struct omap_hwmod_irq_info omap44xx_mmc2_irqs[] = {
 	{ .irq = 86 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3495,11 +3504,13 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc2_slaves),
 	.masters	= omap44xx_mmc2_masters,
 	.masters_cnt	= ARRAY_SIZE(omap44xx_mmc2_masters),
+	.dev_attr	= &omap_mmc2_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc3 */
 static struct omap_hwmod omap44xx_mmc3_hwmod;
+static struct mmc_dev_attr omap_mmc3_dev_attr;
 static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = {
 	{ .irq = 94 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3547,11 +3558,13 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
 	},
 	.slaves		= omap44xx_mmc3_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc3_slaves),
+	.dev_attr	= &omap_mmc3_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc4 */
 static struct omap_hwmod omap44xx_mmc4_hwmod;
+static struct mmc_dev_attr omap_mmc4_dev_attr;
 static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = {
 	{ .irq = 96 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3599,11 +3612,13 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
 	},
 	.slaves		= omap44xx_mmc4_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc4_slaves),
+	.dev_attr	= &omap_mmc4_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
 /* mmc5 */
 static struct omap_hwmod omap44xx_mmc5_hwmod;
+static struct mmc_dev_attr omap_mmc5_dev_attr;
 static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = {
 	{ .irq = 59 + OMAP44XX_IRQ_GIC_START },
 };
@@ -3651,6 +3666,7 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
 	},
 	.slaves		= omap44xx_mmc5_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc5_slaves),
+	.dev_attr	= &omap_mmc5_dev_attr,
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index e5de5d4..7853130 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -43,6 +43,13 @@
 
 #define OMAP_MMC_MAX_SLOTS	2
 
+/* omap_hwmod integration data */
+#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT	BIT(1)
+
+struct mmc_dev_attr {
+	u8 flags;
+};
+
 struct omap_mmc_platform_data {
 	/* back-link to device */
 	struct device *dev;
@@ -71,6 +78,9 @@ struct omap_mmc_platform_data {
 
 	u64 dma_mask;
 
+	/* Integrating attributes from the omap_hwmod layer */
+	u8 controller_dev_attr;
+
 	/* Register offset deviation */
 	u16 reg_offset;
 
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 078fdf1..160cc95 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1555,7 +1555,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		break;
 	}
 
-	if (host->id == OMAP_MMC1_DEVID) {
+	if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
 		/* Only MMC1 can interface at 3V without some flavor
 		 * of external transceiver; but they all handle 1.8V.
 		 */
@@ -1647,7 +1647,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
 	u32 hctl, capa, value;
 
 	/* Only MMC1 supports 3.0V */
-	if (host->id == OMAP_MMC1_DEVID) {
+	if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
 		hctl = SDVS30;
 		capa = VS30 | VS18;
 	} else {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
                   ` (3 preceding siblings ...)
  2011-02-23 17:47 ` [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver Kishore Kadiyala
@ 2011-02-23 17:47 ` Kishore Kadiyala
  2011-02-24  6:28   ` Varadarajan, Charulatha
  2011-02-24 11:49   ` Cousson, Benoit
  2011-02-24 10:19 ` [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Cousson, Benoit
  5 siblings, 2 replies; 18+ messages in thread
From: Kishore Kadiyala @ 2011-02-23 17:47 UTC (permalink / raw)
  To: linux-mmc, linux-omap
  Cc: tony, cjb, madhu.cr, khilman, paul, Kishore Kadiyala, Benoit Cousson

Changes involves:
1) Remove controller reset in devices.c which is taken care of
   by hwmod framework.
2) Removing all base address macro defines except keeping one for OMAP2420.
3) Using omap-device layer to register device and utilizing data from
   hwmod data file for base address, dma channel number, Irq_number,
   device attribute.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/devices.c         |  251 ---------------------------------
 arch/arm/mach-omap2/hsmmc.c           |  153 ++++++++++++++++++--
 arch/arm/plat-omap/include/plat/mmc.h |   14 --
 3 files changed, 141 insertions(+), 277 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 7b35c87..2d2deb6 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -503,112 +503,6 @@ static inline void omap_init_aes(void) { }
 
 /*-------------------------------------------------------------------------*/
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-#define MMCHS_SYSCONFIG			0x0010
-#define MMCHS_SYSCONFIG_SWRESET		(1 << 1)
-#define MMCHS_SYSSTATUS			0x0014
-#define MMCHS_SYSSTATUS_RESETDONE	(1 << 0)
-
-static struct platform_device dummy_pdev = {
-	.dev = {
-		.bus = &platform_bus_type,
-	},
-};
-
-/**
- * omap_hsmmc_reset() - Full reset of each HS-MMC controller
- *
- * Ensure that each MMC controller is fully reset.  Controllers
- * left in an unknown state (by bootloader) may prevent retention
- * or OFF-mode.  This is especially important in cases where the
- * MMC driver is not enabled, _or_ built as a module.
- *
- * In order for reset to work, interface, functional and debounce
- * clocks must be enabled.  The debounce clock comes from func_32k_clk
- * and is not under SW control, so we only enable i- and f-clocks.
- **/
-static void __init omap_hsmmc_reset(void)
-{
-	u32 i, nr_controllers;
-	struct clk *iclk, *fclk;
-
-	if (cpu_is_omap242x())
-		return;
-
-	nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
-		(cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
-
-	for (i = 0; i < nr_controllers; i++) {
-		u32 v, base = 0;
-		struct device *dev = &dummy_pdev.dev;
-
-		switch (i) {
-		case 0:
-			base = OMAP2_MMC1_BASE;
-			break;
-		case 1:
-			base = OMAP2_MMC2_BASE;
-			break;
-		case 2:
-			base = OMAP3_MMC3_BASE;
-			break;
-		case 3:
-			if (!cpu_is_omap44xx())
-				return;
-			base = OMAP4_MMC4_BASE;
-			break;
-		case 4:
-			if (!cpu_is_omap44xx())
-				return;
-			base = OMAP4_MMC5_BASE;
-			break;
-		}
-
-		if (cpu_is_omap44xx())
-			base += OMAP4_MMC_REG_OFFSET;
-
-		dummy_pdev.id = i;
-		dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
-		iclk = clk_get(dev, "ick");
-		if (IS_ERR(iclk))
-			goto err1;
-		if (clk_enable(iclk))
-			goto err2;
-
-		fclk = clk_get(dev, "fck");
-		if (IS_ERR(fclk))
-			goto err3;
-		if (clk_enable(fclk))
-			goto err4;
-
-		omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
-		v = omap_readl(base + MMCHS_SYSSTATUS);
-		while (!(omap_readl(base + MMCHS_SYSSTATUS) &
-			 MMCHS_SYSSTATUS_RESETDONE))
-			cpu_relax();
-
-		clk_disable(fclk);
-		clk_put(fclk);
-		clk_disable(iclk);
-		clk_put(iclk);
-	}
-	return;
-
-err4:
-	clk_put(fclk);
-err3:
-	clk_disable(iclk);
-err2:
-	clk_put(iclk);
-err1:
-	printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
-			    "cannot reset.\n",  __func__, i);
-}
-#else
-static inline void omap_hsmmc_reset(void) {}
-#endif
-
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
 
 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
@@ -665,150 +559,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
 
 #endif
 
-#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
-
-static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
-			int controller_nr)
-{
-	if ((mmc_controller->slots[0].switch_pin > 0) && \
-		(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
-		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
-					OMAP_PIN_INPUT_PULLUP);
-	if ((mmc_controller->slots[0].gpio_wp > 0) && \
-		(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
-		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
-					OMAP_PIN_INPUT_PULLUP);
-	if (cpu_is_omap34xx()) {
-		if (controller_nr == 0) {
-			omap_mux_init_signal("sdmmc1_clk",
-				OMAP_PIN_INPUT_PULLUP);
-			omap_mux_init_signal("sdmmc1_cmd",
-				OMAP_PIN_INPUT_PULLUP);
-			omap_mux_init_signal("sdmmc1_dat0",
-				OMAP_PIN_INPUT_PULLUP);
-			if (mmc_controller->slots[0].caps &
-				(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-				omap_mux_init_signal("sdmmc1_dat1",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc1_dat2",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc1_dat3",
-					OMAP_PIN_INPUT_PULLUP);
-			}
-			if (mmc_controller->slots[0].caps &
-						MMC_CAP_8_BIT_DATA) {
-				omap_mux_init_signal("sdmmc1_dat4",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc1_dat5",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc1_dat6",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc1_dat7",
-					OMAP_PIN_INPUT_PULLUP);
-			}
-		}
-		if (controller_nr == 1) {
-			/* MMC2 */
-			omap_mux_init_signal("sdmmc2_clk",
-				OMAP_PIN_INPUT_PULLUP);
-			omap_mux_init_signal("sdmmc2_cmd",
-				OMAP_PIN_INPUT_PULLUP);
-			omap_mux_init_signal("sdmmc2_dat0",
-				OMAP_PIN_INPUT_PULLUP);
-
-			/*
-			 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
-			 * in the board-*.c files
-			 */
-			if (mmc_controller->slots[0].caps &
-				(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
-				omap_mux_init_signal("sdmmc2_dat1",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc2_dat2",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc2_dat3",
-					OMAP_PIN_INPUT_PULLUP);
-			}
-			if (mmc_controller->slots[0].caps &
-							MMC_CAP_8_BIT_DATA) {
-				omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
-					OMAP_PIN_INPUT_PULLUP);
-				omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
-					OMAP_PIN_INPUT_PULLUP);
-			}
-		}
-
-		/*
-		 * For MMC3 the pins need to be muxed in the board-*.c files
-		 */
-	}
-}
-
-void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
-			int nr_controllers)
-{
-	int i;
-	char *name;
-
-	for (i = 0; i < nr_controllers; i++) {
-		unsigned long base, size;
-		unsigned int irq = 0;
-
-		if (!mmc_data[i])
-			continue;
-
-		omap2_mmc_mux(mmc_data[i], i);
-
-		switch (i) {
-		case 0:
-			base = OMAP2_MMC1_BASE;
-			irq = INT_24XX_MMC_IRQ;
-			break;
-		case 1:
-			base = OMAP2_MMC2_BASE;
-			irq = INT_24XX_MMC2_IRQ;
-			break;
-		case 2:
-			if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
-				return;
-			base = OMAP3_MMC3_BASE;
-			irq = INT_34XX_MMC3_IRQ;
-			break;
-		case 3:
-			if (!cpu_is_omap44xx())
-				return;
-			base = OMAP4_MMC4_BASE;
-			irq = OMAP44XX_IRQ_MMC4;
-			break;
-		case 4:
-			if (!cpu_is_omap44xx())
-				return;
-			base = OMAP4_MMC5_BASE;
-			irq = OMAP44XX_IRQ_MMC5;
-			break;
-		default:
-			continue;
-		}
-
-		if (cpu_is_omap44xx()) {
-			if (i < 3)
-				irq += OMAP44XX_IRQ_GIC_START;
-			size = OMAP4_HSMMC_SIZE;
-			name = "mmci-omap-hs";
-		} else {
-			size = OMAP3_HSMMC_SIZE;
-			name = "mmci-omap-hs";
-		}
-		omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
-	};
-}
-
-#endif
-
 /*-------------------------------------------------------------------------*/
 
 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
@@ -878,7 +628,6 @@ static int __init omap2_init_devices(void)
 	 * please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
 	 */
-	omap_hsmmc_reset();
 	omap_init_audio();
 	omap_init_camera();
 	omap_init_mbox();
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 34272e4..b6e1eae 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -16,7 +16,11 @@
 #include <mach/hardware.h>
 #include <plat/mmc.h>
 #include <plat/omap-pm.h>
+#include <plat/mux.h>
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
 
+#include "mux.h"
 #include "hsmmc.h"
 #include "control.h"
 
@@ -30,7 +34,7 @@ static u16 control_mmc1;
 
 static struct hsmmc_controller {
 	char				name[HSMMC_NAME_LEN + 1];
-} hsmmc[OMAP34XX_NR_MMC];
+} hsmmc[OMAP44XX_NR_MMC];
 
 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
 
@@ -204,7 +208,141 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
 	return 0;
 }
 
-static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
+static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
+			int controller_nr)
+{
+	if ((mmc_controller->slots[0].switch_pin > 0) && \
+		(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
+		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
+					OMAP_PIN_INPUT_PULLUP);
+	if ((mmc_controller->slots[0].gpio_wp > 0) && \
+		(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
+		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
+					OMAP_PIN_INPUT_PULLUP);
+	if (cpu_is_omap34xx()) {
+		if (controller_nr == 0) {
+			omap_mux_init_signal("sdmmc1_clk",
+				OMAP_PIN_INPUT_PULLUP);
+			omap_mux_init_signal("sdmmc1_cmd",
+				OMAP_PIN_INPUT_PULLUP);
+			omap_mux_init_signal("sdmmc1_dat0",
+				OMAP_PIN_INPUT_PULLUP);
+			if (mmc_controller->slots[0].caps &
+				(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
+				omap_mux_init_signal("sdmmc1_dat1",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc1_dat2",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc1_dat3",
+					OMAP_PIN_INPUT_PULLUP);
+			}
+			if (mmc_controller->slots[0].caps &
+						MMC_CAP_8_BIT_DATA) {
+				omap_mux_init_signal("sdmmc1_dat4",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc1_dat5",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc1_dat6",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc1_dat7",
+					OMAP_PIN_INPUT_PULLUP);
+			}
+		}
+		if (controller_nr == 1) {
+			/* MMC2 */
+			omap_mux_init_signal("sdmmc2_clk",
+				OMAP_PIN_INPUT_PULLUP);
+			omap_mux_init_signal("sdmmc2_cmd",
+				OMAP_PIN_INPUT_PULLUP);
+			omap_mux_init_signal("sdmmc2_dat0",
+				OMAP_PIN_INPUT_PULLUP);
+
+			/*
+			 * For 8 wire configurations, Lines DAT4, 5, 6 and 7
+			 * need to be muxed in the board-*.c files
+			 */
+			if (mmc_controller->slots[0].caps &
+				(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
+				omap_mux_init_signal("sdmmc2_dat1",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc2_dat2",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc2_dat3",
+					OMAP_PIN_INPUT_PULLUP);
+			}
+			if (mmc_controller->slots[0].caps &
+							MMC_CAP_8_BIT_DATA) {
+				omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
+					OMAP_PIN_INPUT_PULLUP);
+				omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
+					OMAP_PIN_INPUT_PULLUP);
+			}
+		}
+
+		/*
+		 * For MMC3 the pins need to be muxed in the board-*.c files
+		 */
+	}
+}
+
+static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC] __initdata;
+
+static struct omap_device_pm_latency omap_hsmmc_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func	 = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+	/*
+	 * XXX There should also be an entry here to power off/on the
+	 * MMC regulators/PBIAS cells, etc.
+	 */
+};
+
+static int omap2_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
+{
+	struct omap_device *od;
+	struct omap_device_pm_latency *ohl;
+	char *name;
+	int ohl_cnt = 0;
+	struct mmc_dev_attr *mmc_dattr = oh->dev_attr;
+	struct omap2_hsmmc_info *c = (struct omap2_hsmmc_info *) hsmmcinfo;
+	int idx;
+	static int mmc_num;
+
+	/* Initialization of controllers which are not updated
+	 * in board file will be skipped here.
+	 */
+	c += mmc_num;
+	if (!c->mmc) {
+		pr_err("omap_hsmmc_info is not updated in board file\n");
+		return 0;
+	}
+	idx = c->mmc - 1 ;
+	name = "mmci-omap-hs";
+	ohl = omap_hsmmc_latency;
+	ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
+	omap2_mmc_mux(hsmmc_data[idx], idx);
+	hsmmc_data[idx]->controller_dev_attr = mmc_dattr->flags;
+	od = omap_device_build(name, idx, oh, hsmmc_data[idx],
+		sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
+	if (IS_ERR(od)) {
+		WARN(1, "Cant build omap_device for %s:%s.\n",
+					name, oh->name);
+		return PTR_ERR(od);
+	}
+	/*
+	 * return device handle to board setup code
+	 * required to populate for regulator framework structure
+	 */
+	c->dev = &od->pdev.dev;
+	mmc_num++;
+	return 0;
+}
 
 void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 {
@@ -358,16 +496,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 		hsmmc_data[c->mmc - 1] = mmc;
 	}
 
-	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
-
-	/* pass the device nodes back to board setup code */
-	for (c = controllers; c->mmc; c++) {
-		struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
-
-		if (!c->mmc || c->mmc > nr_hsmmc)
-			continue;
-		c->dev = mmc->dev;
-	}
+	omap_hwmod_for_each_by_class("mmc", omap2_mmc_init, controllers);
 
 done:
 	for (i = 0; i < nr_hsmmc; i++)
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index 7853130..6205984 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -24,20 +24,12 @@
 #define OMAP1_MMC2_BASE		0xfffb7c00	/* omap16xx only */
 
 #define OMAP24XX_NR_MMC		2
-#define OMAP34XX_NR_MMC		3
 #define OMAP44XX_NR_MMC		5
 #define OMAP2420_MMC_SIZE	OMAP1_MMC_SIZE
-#define OMAP3_HSMMC_SIZE	0x200
 #define OMAP4_HSMMC_SIZE	0x1000
 #define OMAP2_MMC1_BASE		0x4809c000
 #define OMAP2_MMC2_BASE		0x480b4000
-#define OMAP3_MMC3_BASE		0x480ad000
-#define OMAP4_MMC4_BASE		0x480d1000
-#define OMAP4_MMC5_BASE		0x480d5000
 #define OMAP4_MMC_REG_OFFSET	0x100
-#define HSMMC5			(1 << 4)
-#define HSMMC4			(1 << 3)
-#define HSMMC3			(1 << 2)
 #define HSMMC2			(1 << 1)
 #define HSMMC1			(1 << 0)
 
@@ -170,8 +162,6 @@ extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
 void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
 				int nr_controllers);
 void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
-void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
-				int nr_controllers);
 int omap_mmc_add(const char *name, int id, unsigned long base,
 				unsigned long size, unsigned int irq,
 				struct omap_mmc_platform_data *data);
@@ -183,10 +173,6 @@ static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
 static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
 {
 }
-static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
-				int nr_controllers)
-{
-}
 static inline int omap_mmc_add(const char *name, int id, unsigned long base,
 				unsigned long size, unsigned int irq,
 				struct omap_mmc_platform_data *data)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
  2011-02-23 17:47 ` [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver Kishore Kadiyala
@ 2011-02-24  6:00   ` Varadarajan, Charulatha
  2011-02-24 14:05     ` Kadiyala, Kishore
  2011-02-24 10:59   ` Cousson, Benoit
  1 sibling, 1 reply; 18+ messages in thread
From: Varadarajan, Charulatha @ 2011-02-24  6:00 UTC (permalink / raw)
  To: Kishore Kadiyala
  Cc: linux-mmc, linux-omap, tony, cjb, madhu.cr, khilman, paul,
	Benoit Cousson

Kishore,

On Wed, Feb 23, 2011 at 23:17, Kishore Kadiyala <kishore.kadiyala@ti.com> wrote:
> Add a device attribute to hwmod data of omap2430, omap3, omap4.
> Currently the device attribute holds information regarding dual volt MMC card
> support by the controller which will be later passed to the host driver via
> platform data.
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> ---
>  arch/arm/mach-omap2/omap_hwmod_2430_data.c |    9 +++++++++
>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 ++++++++++++++++
>  arch/arm/plat-omap/include/plat/mmc.h      |   10 ++++++++++
>  drivers/mmc/host/omap_hsmmc.c              |    4 ++--
>  5 files changed, 49 insertions(+), 2 deletions(-)
>

<<snip>>

>
> diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
> index e5de5d4..7853130 100644
> --- a/arch/arm/plat-omap/include/plat/mmc.h
> +++ b/arch/arm/plat-omap/include/plat/mmc.h
> @@ -43,6 +43,13 @@
>
>  #define OMAP_MMC_MAX_SLOTS     2
>
> +/* omap_hwmod integration data */

What is omap_hwmod integration data ? Pls clarify.

> +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
> +
> +struct mmc_dev_attr {
> +       u8 flags;
> +};
> +
>  struct omap_mmc_platform_data {
>        /* back-link to device */
>        struct device *dev;
> @@ -71,6 +78,9 @@ struct omap_mmc_platform_data {
>
>        u64 dma_mask;
>
> +       /* Integrating attributes from the omap_hwmod layer */
> +       u8 controller_dev_attr;
> +
>        /* Register offset deviation */
>        u16 reg_offset;
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 078fdf1..160cc95 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1555,7 +1555,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                break;
>        }
>
> -       if (host->id == OMAP_MMC1_DEVID) {
> +       if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {

Where is pdata->controller_dev_attr getting populated? I don't see the
dev_attr from the
hwmod database used anywhere in this patch.

>                /* Only MMC1 can interface at 3V without some flavor
>                 * of external transceiver; but they all handle 1.8V.
>                 */
> @@ -1647,7 +1647,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
>        u32 hctl, capa, value;
>
>        /* Only MMC1 supports 3.0V */
> -       if (host->id == OMAP_MMC1_DEVID) {
> +       if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {

Ditto.

>                hctl = SDVS30;
>                capa = VS30 | VS18;
>        } else {
> --
> 1.7.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-23 17:47 ` [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework Kishore Kadiyala
@ 2011-02-24  6:28   ` Varadarajan, Charulatha
  2011-02-24 14:02     ` Kadiyala, Kishore
  2011-02-24 11:49   ` Cousson, Benoit
  1 sibling, 1 reply; 18+ messages in thread
From: Varadarajan, Charulatha @ 2011-02-24  6:28 UTC (permalink / raw)
  To: Kishore Kadiyala
  Cc: linux-mmc, linux-omap, tony, cjb, madhu.cr, khilman, paul,
	Benoit Cousson

Kishore,

On Wed, Feb 23, 2011 at 23:17, Kishore Kadiyala <kishore.kadiyala@ti.com> wrote:
> Changes involves:
> 1) Remove controller reset in devices.c which is taken care of
>   by hwmod framework.
> 2) Removing all base address macro defines except keeping one for OMAP2420.

why?

> 3) Using omap-device layer to register device and utilizing data from
>   hwmod data file for base address, dma channel number, Irq_number,
>   device attribute.
>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> CC: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  arch/arm/mach-omap2/devices.c         |  251 ---------------------------------
>  arch/arm/mach-omap2/hsmmc.c           |  153 ++++++++++++++++++--
>  arch/arm/plat-omap/include/plat/mmc.h |   14 --
>  3 files changed, 141 insertions(+), 277 deletions(-)
>

<<snip>>

> diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
> index 34272e4..b6e1eae 100644
> --- a/arch/arm/mach-omap2/hsmmc.c
> +++ b/arch/arm/mach-omap2/hsmmc.c
> @@ -16,7 +16,11 @@
>  #include <mach/hardware.h>
>  #include <plat/mmc.h>
>  #include <plat/omap-pm.h>
> +#include <plat/mux.h>
> +#include <plat/omap_hwmod.h>
> +#include <plat/omap_device.h>
>
> +#include "mux.h"
>  #include "hsmmc.h"
>  #include "control.h"
>
> @@ -30,7 +34,7 @@ static u16 control_mmc1;
>
>  static struct hsmmc_controller {
>        char                            name[HSMMC_NAME_LEN + 1];
> -} hsmmc[OMAP34XX_NR_MMC];
> +} hsmmc[OMAP44XX_NR_MMC];

Why do you have a dependency on OMAP44XX_NR_MMC? You should get
this kind of information using number of iterations in *_hwmod_each_by_class.

>
>  #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
>
> @@ -204,7 +208,141 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
>        return 0;
>  }
>
> -static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
> +static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
> +                       int controller_nr)
> +{
> +       if ((mmc_controller->slots[0].switch_pin > 0) && \
> +               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
> +               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
> +                                       OMAP_PIN_INPUT_PULLUP);
> +       if ((mmc_controller->slots[0].gpio_wp > 0) && \
> +               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
> +               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
> +                                       OMAP_PIN_INPUT_PULLUP);
> +       if (cpu_is_omap34xx()) {
> +               if (controller_nr == 0) {
> +                       omap_mux_init_signal("sdmmc1_clk",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc1_cmd",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc1_dat0",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       if (mmc_controller->slots[0].caps &
> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> +                               omap_mux_init_signal("sdmmc1_dat1",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat2",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat3",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +                       if (mmc_controller->slots[0].caps &
> +                                               MMC_CAP_8_BIT_DATA) {
> +                               omap_mux_init_signal("sdmmc1_dat4",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat5",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat6",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat7",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +               }
> +               if (controller_nr == 1) {
> +                       /* MMC2 */
> +                       omap_mux_init_signal("sdmmc2_clk",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc2_cmd",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc2_dat0",
> +                               OMAP_PIN_INPUT_PULLUP);
> +
> +                       /*
> +                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7
> +                        * need to be muxed in the board-*.c files
> +                        */
> +                       if (mmc_controller->slots[0].caps &
> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> +                               omap_mux_init_signal("sdmmc2_dat1",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat2",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat3",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +                       if (mmc_controller->slots[0].caps &
> +                                                       MMC_CAP_8_BIT_DATA) {
> +                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +               }
> +
> +               /*
> +                * For MMC3 the pins need to be muxed in the board-*.c files
> +                */
> +       }
> +}
> +
> +static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC] __initdata;

Ditto

> +
> +static struct omap_device_pm_latency omap_hsmmc_latency[] = {
> +       [0] = {
> +               .deactivate_func = omap_device_idle_hwmods,
> +               .activate_func   = omap_device_enable_hwmods,
> +               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +       },
> +       /*
> +        * XXX There should also be an entry here to power off/on the
> +        * MMC regulators/PBIAS cells, etc.
> +        */
> +};
> +
> +static int omap2_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
> +{
> +       struct omap_device *od;
> +       struct omap_device_pm_latency *ohl;
> +       char *name;
> +       int ohl_cnt = 0;
> +       struct mmc_dev_attr *mmc_dattr = oh->dev_attr;
> +       struct omap2_hsmmc_info *c = (struct omap2_hsmmc_info *) hsmmcinfo;
> +       int idx;
> +       static int mmc_num;
> +
> +       /* Initialization of controllers which are not updated
> +        * in board file will be skipped here.
> +        */

Check multi-line comment style

> +       c += mmc_num;
> +       if (!c->mmc) {
> +               pr_err("omap_hsmmc_info is not updated in board file\n");
> +               return 0;
> +       }
> +       idx = c->mmc - 1 ;
> +       name = "mmci-omap-hs";
> +       ohl = omap_hsmmc_latency;
> +       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
> +       omap2_mmc_mux(hsmmc_data[idx], idx);
> +       hsmmc_data[idx]->controller_dev_attr = mmc_dattr->flags;

It would be good rename controller_dev_attr to controller_flag

> +       od = omap_device_build(name, idx, oh, hsmmc_data[idx],
> +               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
> +       if (IS_ERR(od)) {
> +               WARN(1, "Cant build omap_device for %s:%s.\n",
> +                                       name, oh->name);
> +               return PTR_ERR(od);
> +       }
> +       /*
> +        * return device handle to board setup code
> +        * required to populate for regulator framework structure
> +        */
> +       c->dev = &od->pdev.dev;
> +       mmc_num++;
> +       return 0;
> +}
>
>  void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
>  {
> @@ -358,16 +496,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
>                hsmmc_data[c->mmc - 1] = mmc;
>        }
>
> -       omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
> -
> -       /* pass the device nodes back to board setup code */
> -       for (c = controllers; c->mmc; c++) {
> -               struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
> -
> -               if (!c->mmc || c->mmc > nr_hsmmc)
> -                       continue;
> -               c->dev = mmc->dev;
> -       }
> +       omap_hwmod_for_each_by_class("mmc", omap2_mmc_init, controllers);
>
>  done:
>        for (i = 0; i < nr_hsmmc; i++)
> diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
> index 7853130..6205984 100644
> --- a/arch/arm/plat-omap/include/plat/mmc.h
> +++ b/arch/arm/plat-omap/include/plat/mmc.h
> @@ -24,20 +24,12 @@
>  #define OMAP1_MMC2_BASE                0xfffb7c00      /* omap16xx only */
>
>  #define OMAP24XX_NR_MMC                2
> -#define OMAP34XX_NR_MMC                3
>  #define OMAP44XX_NR_MMC                5

As mentioned above, OMAP44XX_NR_MMC & OMAP24XX_NR_MMC shall be
removed and instead get these info from hwmod.

I had provided the same comment in the previous patch version too. You may
reject the comment but mention the reasons for the same.

>  #define OMAP2420_MMC_SIZE      OMAP1_MMC_SIZE
> -#define OMAP3_HSMMC_SIZE       0x200
>  #define OMAP4_HSMMC_SIZE       0x1000

Can't this be removed?

>  #define OMAP2_MMC1_BASE                0x4809c000
>  #define OMAP2_MMC2_BASE                0x480b4000
> -#define OMAP3_MMC3_BASE                0x480ad000
> -#define OMAP4_MMC4_BASE                0x480d1000
> -#define OMAP4_MMC5_BASE                0x480d5000
>  #define OMAP4_MMC_REG_OFFSET   0x100

Remove OMAP4_MMC_REG_OFFSET too.

> -#define HSMMC5                 (1 << 4)
> -#define HSMMC4                 (1 << 3)
> -#define HSMMC3                 (1 << 2)
>  #define HSMMC2                 (1 << 1)
>  #define HSMMC1                 (1 << 0)

<<snip>>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation
  2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
                   ` (4 preceding siblings ...)
  2011-02-23 17:47 ` [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework Kishore Kadiyala
@ 2011-02-24 10:19 ` Cousson, Benoit
  2011-02-24 18:10   ` Kadiyala, Kishore
  5 siblings, 1 reply; 18+ messages in thread
From: Cousson, Benoit @ 2011-02-24 10:19 UTC (permalink / raw)
  To: Kadiyala, Kishore
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

Hi Kishore,

On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
> Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
> Adapting the omap_hsmmc driver to hwmod framework.
>
> The patch series is based on -rc6 and tested on OMAP2430, OMAP3430SDP
> &  OMAP4430SDP.

Could you rebase it on top of omap-for-linus, it does apply for the moment.

Thanks,
Benoit

>
> V3:
> ---
> Omap2420 platform consists of mmc block as in omap1 and not the
> hsmmc block as present in omap2430, omap3, omap4 platforms.
> The series takes care of hwmod adaptation of hsmmc drivers and
> thus excluding the omap2420 platforms.
>
> The patch series has dependency on :
>   1)https://patchwork.kernel.org/patch/585281/
>   2)https://patchwork.kernel.org/patch/538301/
>
> V2:
> ---
> http://www.spinics.net/lists/linux-omap/msg45443.html
>
> V1:
> ---
> http://www.spinics.net/lists/linux-mmc/msg05689.html
>
>
> Anand Gadiyar (1):
>    OMAP4: hwmod data: enable HSMMC
>
> Kishore Kadiyala (2):
>    OMAP: hwmod data: Add dev_attr and use in the host driver
>    OMAP: adapt hsmmc to hwmod framework
>
> Paul Walmsley (2):
>    OMAP2430: hwmod data: Add HSMMC
>    OMAP3: hwmod data: Add HSMMC
>
>   arch/arm/mach-omap2/devices.c              |  251 ----------------------------
>   arch/arm/mach-omap2/hsmmc.c                |  153 ++++++++++++++++--
>   arch/arm/mach-omap2/omap_hwmod_2430_data.c |  155 +++++++++++++++++
>   arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  221 ++++++++++++++++++++++++
>   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   26 +++-
>   arch/arm/mach-omap2/prcm-common.h          |    4 +
>   arch/arm/plat-omap/include/plat/mmc.h      |   24 +--
>   drivers/mmc/host/omap_hsmmc.c              |    4 +-
>   8 files changed, 554 insertions(+), 284 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC
  2011-02-23 17:47 ` [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC Kishore Kadiyala
@ 2011-02-24 10:21   ` Cousson, Benoit
  0 siblings, 0 replies; 18+ messages in thread
From: Cousson, Benoit @ 2011-02-24 10:21 UTC (permalink / raw)
  To: Kadiyala, Kishore
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul, Gadiyar, Anand

On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
> From: Anand Gadiyar<gadiyar@ti.com>
>
> Enabling hsmmc hwmod for OMAP4
>
> Signed-off-by: Anand Gadiyar<gadiyar@ti.com>
> Signed-off-by: Kishore Kadiyala<kishore.kadiyala@ti.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> Cc: Paul Walmsley<paul@pwsan.com>
> CC: Kevin Hilman<khilman@deeprootsystems.com>

Acked-by: Benoit Cousson<b-cousson@ti.com>

> ---
>   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   10 +++++-----
>   1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index 79a8601..dd39e75 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
>   	&omap44xx_mcspi4_hwmod,
>
>   	/* mmc class */
> -/*	&omap44xx_mmc1_hwmod, */
> -/*	&omap44xx_mmc2_hwmod, */
> -/*	&omap44xx_mmc3_hwmod, */
> -/*	&omap44xx_mmc4_hwmod, */
> -/*	&omap44xx_mmc5_hwmod, */
> +	&omap44xx_mmc1_hwmod,
> +	&omap44xx_mmc2_hwmod,
> +	&omap44xx_mmc3_hwmod,
> +	&omap44xx_mmc4_hwmod,
> +	&omap44xx_mmc5_hwmod,
>
>   	/* mpu class */
>   	&omap44xx_mpu_hwmod,


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
  2011-02-23 17:47 ` [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver Kishore Kadiyala
  2011-02-24  6:00   ` Varadarajan, Charulatha
@ 2011-02-24 10:59   ` Cousson, Benoit
  2011-02-24 13:58     ` Kadiyala, Kishore
  1 sibling, 1 reply; 18+ messages in thread
From: Cousson, Benoit @ 2011-02-24 10:59 UTC (permalink / raw)
  To: Kadiyala, Kishore
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
> Add a device attribute to hwmod data of omap2430, omap3, omap4.
> Currently the device attribute holds information regarding dual volt MMC card
> support by the controller which will be later passed to the host driver via
> platform data.
>
> Signed-off-by: Kevin Hilman<khilman@deeprootsystems.com>
> Signed-off-by: Kishore Kadiyala<kishore.kadiyala@ti.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> Cc: Paul Walmsley<paul@pwsan.com>

There are few minor comments to fix hence the:
Almost-Acked-by: Benoit Cousson<b-cousson@ti.com>


> ---
>   arch/arm/mach-omap2/omap_hwmod_2430_data.c |    9 +++++++++
>   arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
>   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 ++++++++++++++++
>   arch/arm/plat-omap/include/plat/mmc.h      |   10 ++++++++++
>   drivers/mmc/host/omap_hsmmc.c              |    4 ++--
>   5 files changed, 49 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> index 4d45b7d..e050355 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> @@ -19,6 +19,7 @@
>   #include<plat/i2c.h>
>   #include<plat/gpio.h>
>   #include<plat/mcspi.h>
> +#include<plat/mmc.h>
>
>   #include "omap_hwmod_common_data.h"
>
> @@ -1290,6 +1291,10 @@ static struct omap_hwmod_class mmc_class = {
>
>   /* MMC/SD/SDIO1 */
>
> +static struct mmc_dev_attr mmc1_dev_attr = {

Could you rename the struct omap_mmc_dev_attr to stick to the convention?

The dev_attr should be just above "static struct omap_hwmod". See the 
OMAP4 example below.

> +	.flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
> +};
> +
>   static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
>   	{ .irq = 83 },
>   };
> @@ -1328,11 +1333,14 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
>   	.slaves		= omap2430_mmc1_slaves,
>   	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc1_slaves),
>   	.class		=&mmc_class,
> +	.dev_attr	=&mmc1_dev_attr,

dev_attr should be above .slaves.

>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
>   };
>
>   /* MMC/SD/SDIO2 */
>
> +static struct mmc_dev_attr mmc2_dev_attr;

If you do not have any dev_attr for that instance, do not add it here 
and test for null pointer in your driver.
This comment applies for all instances in all OMAPs.

> +
>   static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
>   	{ .irq = 86 },
>   };
> @@ -1371,6 +1379,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
>   	.slaves		= omap2430_mmc2_slaves,
>   	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc2_slaves),
>   	.class		=&mmc_class,
> +	.dev_attr	=&mmc2_dev_attr,

Not needed if there is not data in the structure.

[...]

> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index dd39e75..6c4ccfd 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -25,6 +25,7 @@
>   #include<plat/gpio.h>
>   #include<plat/dma.h>
>   #include<plat/mcspi.h>
> +#include<plat/mmc.h>
>
>   #include "omap_hwmod_common_data.h"
>
> @@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
>   };
>
>   /* mmc1 */
> +static struct mmc_dev_attr omap_mmc1_dev_attr = {
> +	.flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
> +};
> +
>   static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
>   	{ .irq = 83 + OMAP44XX_IRQ_GIC_START },
>   };
> @@ -3437,10 +3442,14 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
>   	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc1_slaves),
>   	.masters	= omap44xx_mmc1_masters,
>   	.masters_cnt	= ARRAY_SIZE(omap44xx_mmc1_masters),
> +	.dev_attr	=&omap_mmc1_dev_attr,
>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>   };
>
>   /* mmc2 */
> +static struct omap_hwmod omap44xx_mmc2_hwmod;
> +static struct mmc_dev_attr omap_mmc2_dev_attr;
> +
>   static struct omap_hwmod_irq_info omap44xx_mmc2_irqs[] = {
>   	{ .irq = 86 + OMAP44XX_IRQ_GIC_START },
>   };
> @@ -3495,11 +3504,13 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
>   	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc2_slaves),
>   	.masters	= omap44xx_mmc2_masters,
>   	.masters_cnt	= ARRAY_SIZE(omap44xx_mmc2_masters),
> +	.dev_attr	=&omap_mmc2_dev_attr,
>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>   };
>
>   /* mmc3 */
>   static struct omap_hwmod omap44xx_mmc3_hwmod;
> +static struct mmc_dev_attr omap_mmc3_dev_attr;
>   static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = {
>   	{ .irq = 94 + OMAP44XX_IRQ_GIC_START },
>   };
> @@ -3547,11 +3558,13 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
>   	},
>   	.slaves		= omap44xx_mmc3_slaves,
>   	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc3_slaves),
> +	.dev_attr	=&omap_mmc3_dev_attr,
>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>   };
>
>   /* mmc4 */
>   static struct omap_hwmod omap44xx_mmc4_hwmod;
> +static struct mmc_dev_attr omap_mmc4_dev_attr;
>   static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = {
>   	{ .irq = 96 + OMAP44XX_IRQ_GIC_START },
>   };
> @@ -3599,11 +3612,13 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
>   	},
>   	.slaves		= omap44xx_mmc4_slaves,
>   	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc4_slaves),
> +	.dev_attr	=&omap_mmc4_dev_attr,
>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>   };
>
>   /* mmc5 */
>   static struct omap_hwmod omap44xx_mmc5_hwmod;
> +static struct mmc_dev_attr omap_mmc5_dev_attr;
>   static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = {
>   	{ .irq = 59 + OMAP44XX_IRQ_GIC_START },
>   };
> @@ -3651,6 +3666,7 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
>   	},
>   	.slaves		= omap44xx_mmc5_slaves,
>   	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc5_slaves),
> +	.dev_attr	=&omap_mmc5_dev_attr,
>   	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>   };
>

In order to be aligned with the generator, and assuming that only the 
mm1 needs dev_attr, the OMAP4 diff should be:

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 79a8601..958651c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -3420,6 +3420,11 @@ static struct omap_hwmod_ocp_if 
*omap44xx_mmc1_slaves[] = {
  	&omap44xx_l4_per__mmc1,
  };

+/* mmc1 dev_attr */
+static struct omap_mmc_dev_attr mmc1_dev_attr = {
+	.flags	= OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
+};
+
  static struct omap_hwmod omap44xx_mmc1_hwmod = {
  	.name		= "mmc1",
  	.class		= &omap44xx_mmc_hwmod_class,
@@ -3433,6 +3438,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
  			.clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
  		},
  	},
+	.dev_attr	= &mmc1_dev_attr,
  	.slaves		= omap44xx_mmc1_slaves,
  	.slaves_cnt	= ARRAY_SIZE(omap44xx_mmc1_slaves),
  	.masters	= omap44xx_mmc1_masters,
---

Regards,
Benoit

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-23 17:47 ` [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework Kishore Kadiyala
  2011-02-24  6:28   ` Varadarajan, Charulatha
@ 2011-02-24 11:49   ` Cousson, Benoit
  2011-02-24 13:55     ` Kadiyala, Kishore
  1 sibling, 1 reply; 18+ messages in thread
From: Cousson, Benoit @ 2011-02-24 11:49 UTC (permalink / raw)
  To: Kadiyala, Kishore
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
> Changes involves:
> 1) Remove controller reset in devices.c which is taken care of
>     by hwmod framework.
> 2) Removing all base address macro defines except keeping one for OMAP2420.
> 3) Using omap-device layer to register device and utilizing data from
>     hwmod data file for base address, dma channel number, Irq_number,
>     device attribute.
>
> Signed-off-by: Paul Walmsley<paul@pwsan.com>
> Signed-off-by: Kishore Kadiyala<kishore.kadiyala@ti.com>
> Cc: Benoit Cousson<b-cousson@ti.com>
> CC: Kevin Hilman<khilman@deeprootsystems.com>
> ---
>   arch/arm/mach-omap2/devices.c         |  251 ---------------------------------
>   arch/arm/mach-omap2/hsmmc.c           |  153 ++++++++++++++++++--
>   arch/arm/plat-omap/include/plat/mmc.h |   14 --
>   3 files changed, 141 insertions(+), 277 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> index 7b35c87..2d2deb6 100644
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -503,112 +503,6 @@ static inline void omap_init_aes(void) { }
>
>   /*-------------------------------------------------------------------------*/
>
> -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
> -
> -#define MMCHS_SYSCONFIG                        0x0010
> -#define MMCHS_SYSCONFIG_SWRESET                (1<<  1)
> -#define MMCHS_SYSSTATUS                        0x0014
> -#define MMCHS_SYSSTATUS_RESETDONE      (1<<  0)
> -
> -static struct platform_device dummy_pdev = {
> -       .dev = {
> -               .bus =&platform_bus_type,
> -       },
> -};
> -
> -/**
> - * omap_hsmmc_reset() - Full reset of each HS-MMC controller
> - *
> - * Ensure that each MMC controller is fully reset.  Controllers
> - * left in an unknown state (by bootloader) may prevent retention
> - * or OFF-mode.  This is especially important in cases where the
> - * MMC driver is not enabled, _or_ built as a module.
> - *
> - * In order for reset to work, interface, functional and debounce
> - * clocks must be enabled.  The debounce clock comes from func_32k_clk
> - * and is not under SW control, so we only enable i- and f-clocks.
> - **/
> -static void __init omap_hsmmc_reset(void)
> -{
> -       u32 i, nr_controllers;
> -       struct clk *iclk, *fclk;
> -
> -       if (cpu_is_omap242x())
> -               return;
> -
> -       nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
> -               (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
> -
> -       for (i = 0; i<  nr_controllers; i++) {
> -               u32 v, base = 0;
> -               struct device *dev =&dummy_pdev.dev;
> -
> -               switch (i) {
> -               case 0:
> -                       base = OMAP2_MMC1_BASE;
> -                       break;
> -               case 1:
> -                       base = OMAP2_MMC2_BASE;
> -                       break;
> -               case 2:
> -                       base = OMAP3_MMC3_BASE;
> -                       break;
> -               case 3:
> -                       if (!cpu_is_omap44xx())
> -                               return;
> -                       base = OMAP4_MMC4_BASE;
> -                       break;
> -               case 4:
> -                       if (!cpu_is_omap44xx())
> -                               return;
> -                       base = OMAP4_MMC5_BASE;
> -                       break;
> -               }
> -
> -               if (cpu_is_omap44xx())
> -                       base += OMAP4_MMC_REG_OFFSET;
> -
> -               dummy_pdev.id = i;
> -               dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
> -               iclk = clk_get(dev, "ick");
> -               if (IS_ERR(iclk))
> -                       goto err1;
> -               if (clk_enable(iclk))
> -                       goto err2;
> -
> -               fclk = clk_get(dev, "fck");
> -               if (IS_ERR(fclk))
> -                       goto err3;
> -               if (clk_enable(fclk))
> -                       goto err4;
> -
> -               omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
> -               v = omap_readl(base + MMCHS_SYSSTATUS);
> -               while (!(omap_readl(base + MMCHS_SYSSTATUS)&
> -                        MMCHS_SYSSTATUS_RESETDONE))
> -                       cpu_relax();
> -
> -               clk_disable(fclk);
> -               clk_put(fclk);
> -               clk_disable(iclk);
> -               clk_put(iclk);
> -       }
> -       return;
> -
> -err4:
> -       clk_put(fclk);
> -err3:
> -       clk_disable(iclk);
> -err2:
> -       clk_put(iclk);
> -err1:
> -       printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
> -                           "cannot reset.\n",  __func__, i);
> -}
> -#else
> -static inline void omap_hsmmc_reset(void) {}
> -#endif
> -
>   #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
>
>   static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
> @@ -665,150 +559,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
>
>   #endif
>
> -#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
> -
> -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
> -                       int controller_nr)
> -{
> -       if ((mmc_controller->slots[0].switch_pin>  0)&&  \
> -               (mmc_controller->slots[0].switch_pin<  OMAP_MAX_GPIO_LINES))
> -               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
> -                                       OMAP_PIN_INPUT_PULLUP);
> -       if ((mmc_controller->slots[0].gpio_wp>  0)&&  \
> -               (mmc_controller->slots[0].gpio_wp<  OMAP_MAX_GPIO_LINES))
> -               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
> -                                       OMAP_PIN_INPUT_PULLUP);
> -       if (cpu_is_omap34xx()) {
> -               if (controller_nr == 0) {
> -                       omap_mux_init_signal("sdmmc1_clk",
> -                               OMAP_PIN_INPUT_PULLUP);
> -                       omap_mux_init_signal("sdmmc1_cmd",
> -                               OMAP_PIN_INPUT_PULLUP);
> -                       omap_mux_init_signal("sdmmc1_dat0",
> -                               OMAP_PIN_INPUT_PULLUP);
> -                       if (mmc_controller->slots[0].caps&
> -                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> -                               omap_mux_init_signal("sdmmc1_dat1",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc1_dat2",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc1_dat3",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                       }
> -                       if (mmc_controller->slots[0].caps&
> -                                               MMC_CAP_8_BIT_DATA) {
> -                               omap_mux_init_signal("sdmmc1_dat4",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc1_dat5",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc1_dat6",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc1_dat7",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                       }
> -               }
> -               if (controller_nr == 1) {
> -                       /* MMC2 */
> -                       omap_mux_init_signal("sdmmc2_clk",
> -                               OMAP_PIN_INPUT_PULLUP);
> -                       omap_mux_init_signal("sdmmc2_cmd",
> -                               OMAP_PIN_INPUT_PULLUP);
> -                       omap_mux_init_signal("sdmmc2_dat0",
> -                               OMAP_PIN_INPUT_PULLUP);
> -
> -                       /*
> -                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
> -                        * in the board-*.c files
> -                        */
> -                       if (mmc_controller->slots[0].caps&
> -                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> -                               omap_mux_init_signal("sdmmc2_dat1",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc2_dat2",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc2_dat3",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                       }
> -                       if (mmc_controller->slots[0].caps&
> -                                                       MMC_CAP_8_BIT_DATA) {
> -                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
> -                                       OMAP_PIN_INPUT_PULLUP);
> -                       }
> -               }
> -
> -               /*
> -                * For MMC3 the pins need to be muxed in the board-*.c files
> -                */
> -       }
> -}
> -
> -void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
> -                       int nr_controllers)
> -{
> -       int i;
> -       char *name;
> -
> -       for (i = 0; i<  nr_controllers; i++) {
> -               unsigned long base, size;
> -               unsigned int irq = 0;
> -
> -               if (!mmc_data[i])
> -                       continue;
> -
> -               omap2_mmc_mux(mmc_data[i], i);
> -
> -               switch (i) {
> -               case 0:
> -                       base = OMAP2_MMC1_BASE;
> -                       irq = INT_24XX_MMC_IRQ;
> -                       break;
> -               case 1:
> -                       base = OMAP2_MMC2_BASE;
> -                       irq = INT_24XX_MMC2_IRQ;
> -                       break;
> -               case 2:
> -                       if (!cpu_is_omap44xx()&&  !cpu_is_omap34xx())
> -                               return;
> -                       base = OMAP3_MMC3_BASE;
> -                       irq = INT_34XX_MMC3_IRQ;
> -                       break;
> -               case 3:
> -                       if (!cpu_is_omap44xx())
> -                               return;
> -                       base = OMAP4_MMC4_BASE;
> -                       irq = OMAP44XX_IRQ_MMC4;
> -                       break;
> -               case 4:
> -                       if (!cpu_is_omap44xx())
> -                               return;
> -                       base = OMAP4_MMC5_BASE;
> -                       irq = OMAP44XX_IRQ_MMC5;
> -                       break;
> -               default:
> -                       continue;
> -               }
> -
> -               if (cpu_is_omap44xx()) {
> -                       if (i<  3)
> -                               irq += OMAP44XX_IRQ_GIC_START;
> -                       size = OMAP4_HSMMC_SIZE;
> -                       name = "mmci-omap-hs";
> -               } else {
> -                       size = OMAP3_HSMMC_SIZE;
> -                       name = "mmci-omap-hs";
> -               }
> -               omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
> -       };
> -}
> -
> -#endif
> -
>   /*-------------------------------------------------------------------------*/
>
>   #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
> @@ -878,7 +628,6 @@ static int __init omap2_init_devices(void)
>           * please keep these calls, and their implementations above,
>           * in alphabetical order so they're easier to sort through.
>           */
> -       omap_hsmmc_reset();
>          omap_init_audio();
>          omap_init_camera();
>          omap_init_mbox();
> diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
> index 34272e4..b6e1eae 100644
> --- a/arch/arm/mach-omap2/hsmmc.c
> +++ b/arch/arm/mach-omap2/hsmmc.c
> @@ -16,7 +16,11 @@
>   #include<mach/hardware.h>
>   #include<plat/mmc.h>
>   #include<plat/omap-pm.h>
> +#include<plat/mux.h>
> +#include<plat/omap_hwmod.h>
> +#include<plat/omap_device.h>
>
> +#include "mux.h"
>   #include "hsmmc.h"
>   #include "control.h"
>
> @@ -30,7 +34,7 @@ static u16 control_mmc1;
>
>   static struct hsmmc_controller {
>          char                            name[HSMMC_NAME_LEN + 1];
> -} hsmmc[OMAP34XX_NR_MMC];
> +} hsmmc[OMAP44XX_NR_MMC];

I do not know the details of that driver, so this comment might be 
completely irrelevant, but in theory, such static table should not be 
necessary since the driver core already maintain a list of all instances 
bound to it.
Because of that, you will have to modify this code for every new OMAP 
generation each time we add a new instance.

>
>   #if defined(CONFIG_ARCH_OMAP3)&&  defined(CONFIG_PM)
>
> @@ -204,7 +208,141 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
>          return 0;
>   }
>
> -static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
> +static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
> +                       int controller_nr)
> +{
> +       if ((mmc_controller->slots[0].switch_pin>  0)&&  \
> +               (mmc_controller->slots[0].switch_pin<  OMAP_MAX_GPIO_LINES))
> +               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
> +                                       OMAP_PIN_INPUT_PULLUP);
> +       if ((mmc_controller->slots[0].gpio_wp>  0)&&  \
> +               (mmc_controller->slots[0].gpio_wp<  OMAP_MAX_GPIO_LINES))
> +               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
> +                                       OMAP_PIN_INPUT_PULLUP);
> +       if (cpu_is_omap34xx()) {
> +               if (controller_nr == 0) {
> +                       omap_mux_init_signal("sdmmc1_clk",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc1_cmd",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc1_dat0",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       if (mmc_controller->slots[0].caps&
> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> +                               omap_mux_init_signal("sdmmc1_dat1",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat2",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat3",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +                       if (mmc_controller->slots[0].caps&
> +                                               MMC_CAP_8_BIT_DATA) {
> +                               omap_mux_init_signal("sdmmc1_dat4",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat5",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat6",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc1_dat7",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +               }
> +               if (controller_nr == 1) {
> +                       /* MMC2 */
> +                       omap_mux_init_signal("sdmmc2_clk",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc2_cmd",
> +                               OMAP_PIN_INPUT_PULLUP);
> +                       omap_mux_init_signal("sdmmc2_dat0",
> +                               OMAP_PIN_INPUT_PULLUP);
> +
> +                       /*
> +                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7
> +                        * need to be muxed in the board-*.c files
> +                        */
> +                       if (mmc_controller->slots[0].caps&
> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
> +                               omap_mux_init_signal("sdmmc2_dat1",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat2",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat3",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +                       if (mmc_controller->slots[0].caps&
> +                                                       MMC_CAP_8_BIT_DATA) {
> +                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
> +                                       OMAP_PIN_INPUT_PULLUP);
> +                       }
> +               }
> +
> +               /*
> +                * For MMC3 the pins need to be muxed in the board-*.c files
> +                */
> +       }
> +}
> +
> +static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC] __initdata;

Same concern than for hsmmc, why do you need static table here?
And why do you need another structure? The omap2_hsmmc_info should 
already be in a pdata kind of structure.
The board file should just populate a table of pdata that you will use 
during init.

> +
> +static struct omap_device_pm_latency omap_hsmmc_latency[] = {
> +       [0] = {
> +               .deactivate_func = omap_device_idle_hwmods,
> +               .activate_func   = omap_device_enable_hwmods,
> +               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +       },
> +       /*
> +        * XXX There should also be an entry here to power off/on the
> +        * MMC regulators/PBIAS cells, etc.
> +        */
> +};
> +
> +static int omap2_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
> +{
> +       struct omap_device *od;
> +       struct omap_device_pm_latency *ohl;
> +       char *name;
> +       int ohl_cnt = 0;
> +       struct mmc_dev_attr *mmc_dattr = oh->dev_attr;
> +       struct omap2_hsmmc_info *c = (struct omap2_hsmmc_info *) hsmmcinfo;
> +       int idx;
> +       static int mmc_num;
> +
> +       /* Initialization of controllers which are not updated
> +        * in board file will be skipped here.
> +        */
> +       c += mmc_num;
> +       if (!c->mmc) {
> +               pr_err("omap_hsmmc_info is not updated in board file\n");
> +               return 0;
> +       }
> +       idx = c->mmc - 1 ;
> +       name = "mmci-omap-hs";

Could you please rename the device to have something in the form: 
omap_XXXX? In that case "omap_mmc" should be good. The "hs" is just a 
indication of one of the mmc instance capability and does not have to be 
in the device name since there is no none-hs instance.

I know that this is not in your patch and was already there before, but 
that code is happily mixing MMC or HSMMC everywhere, so having a little 
bit of consistency will be good. I vote to stick to MMC only.
The "omap2_" prefix does not seems necessary too for my point of view. 
"omap_" is good enough.

> +       ohl = omap_hsmmc_latency;
> +       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
> +       omap2_mmc_mux(hsmmc_data[idx], idx);
> +       hsmmc_data[idx]->controller_dev_attr = mmc_dattr->flags;

You should copy the data and not keep a reference to internal hwmod 
structure. In your case, you should check if dev_attr is not null. It 
will avoid adding some empty dev_attr structure in the hwmod_data files.

> +       od = omap_device_build(name, idx, oh, hsmmc_data[idx],
> +               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
> +       if (IS_ERR(od)) {
> +               WARN(1, "Cant build omap_device for %s:%s.\n",
> +                                       name, oh->name);
> +               return PTR_ERR(od);
> +       }
> +       /*
> +        * return device handle to board setup code
> +        * required to populate for regulator framework structure
> +        */
> +       c->dev =&od->pdev.dev;
> +       mmc_num++;
> +       return 0;
> +}

Regards,
Benoit

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-24 11:49   ` Cousson, Benoit
@ 2011-02-24 13:55     ` Kadiyala, Kishore
  2011-02-24 14:33       ` Cousson, Benoit
  0 siblings, 1 reply; 18+ messages in thread
From: Kadiyala, Kishore @ 2011-02-24 13:55 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

On Thu, Feb 24, 2011 at 5:19 PM, Cousson, Benoit <b-cousson@ti.com> wrote:
> On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
>>
>> Changes involves:
>> 1) Remove controller reset in devices.c which is taken care of
>>    by hwmod framework.
>> 2) Removing all base address macro defines except keeping one for
>> OMAP2420.
>> 3) Using omap-device layer to register device and utilizing data from
>>    hwmod data file for base address, dma channel number, Irq_number,
>>    device attribute.
>>
>> Signed-off-by: Paul Walmsley<paul@pwsan.com>
>> Signed-off-by: Kishore Kadiyala<kishore.kadiyala@ti.com>
>> Cc: Benoit Cousson<b-cousson@ti.com>
>> CC: Kevin Hilman<khilman@deeprootsystems.com>
>> ---
>>  arch/arm/mach-omap2/devices.c         |  251
>> ---------------------------------
>>  arch/arm/mach-omap2/hsmmc.c           |  153 ++++++++++++++++++--
>>  arch/arm/plat-omap/include/plat/mmc.h |   14 --
>>  3 files changed, 141 insertions(+), 277 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
>> index 7b35c87..2d2deb6 100644
>> --- a/arch/arm/mach-omap2/devices.c
>> +++ b/arch/arm/mach-omap2/devices.c
>> @@ -503,112 +503,6 @@ static inline void omap_init_aes(void) { }
>>
>>
>>  /*-------------------------------------------------------------------------*/
>>
>> -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
>> -
>> -#define MMCHS_SYSCONFIG                        0x0010
>> -#define MMCHS_SYSCONFIG_SWRESET                (1<<  1)
>> -#define MMCHS_SYSSTATUS                        0x0014
>> -#define MMCHS_SYSSTATUS_RESETDONE      (1<<  0)
>> -
>> -static struct platform_device dummy_pdev = {
>> -       .dev = {
>> -               .bus =&platform_bus_type,
>> -       },
>> -};
>> -
>> -/**
>> - * omap_hsmmc_reset() - Full reset of each HS-MMC controller
>> - *
>> - * Ensure that each MMC controller is fully reset.  Controllers
>> - * left in an unknown state (by bootloader) may prevent retention
>> - * or OFF-mode.  This is especially important in cases where the
>> - * MMC driver is not enabled, _or_ built as a module.
>> - *
>> - * In order for reset to work, interface, functional and debounce
>> - * clocks must be enabled.  The debounce clock comes from func_32k_clk
>> - * and is not under SW control, so we only enable i- and f-clocks.
>> - **/
>> -static void __init omap_hsmmc_reset(void)
>> -{
>> -       u32 i, nr_controllers;
>> -       struct clk *iclk, *fclk;
>> -
>> -       if (cpu_is_omap242x())
>> -               return;
>> -
>> -       nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
>> -               (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
>> -
>> -       for (i = 0; i<  nr_controllers; i++) {
>> -               u32 v, base = 0;
>> -               struct device *dev =&dummy_pdev.dev;
>> -
>> -               switch (i) {
>> -               case 0:
>> -                       base = OMAP2_MMC1_BASE;
>> -                       break;
>> -               case 1:
>> -                       base = OMAP2_MMC2_BASE;
>> -                       break;
>> -               case 2:
>> -                       base = OMAP3_MMC3_BASE;
>> -                       break;
>> -               case 3:
>> -                       if (!cpu_is_omap44xx())
>> -                               return;
>> -                       base = OMAP4_MMC4_BASE;
>> -                       break;
>> -               case 4:
>> -                       if (!cpu_is_omap44xx())
>> -                               return;
>> -                       base = OMAP4_MMC5_BASE;
>> -                       break;
>> -               }
>> -
>> -               if (cpu_is_omap44xx())
>> -                       base += OMAP4_MMC_REG_OFFSET;
>> -
>> -               dummy_pdev.id = i;
>> -               dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
>> -               iclk = clk_get(dev, "ick");
>> -               if (IS_ERR(iclk))
>> -                       goto err1;
>> -               if (clk_enable(iclk))
>> -                       goto err2;
>> -
>> -               fclk = clk_get(dev, "fck");
>> -               if (IS_ERR(fclk))
>> -                       goto err3;
>> -               if (clk_enable(fclk))
>> -                       goto err4;
>> -
>> -               omap_writel(MMCHS_SYSCONFIG_SWRESET, base +
>> MMCHS_SYSCONFIG);
>> -               v = omap_readl(base + MMCHS_SYSSTATUS);
>> -               while (!(omap_readl(base + MMCHS_SYSSTATUS)&
>> -                        MMCHS_SYSSTATUS_RESETDONE))
>> -                       cpu_relax();
>> -
>> -               clk_disable(fclk);
>> -               clk_put(fclk);
>> -               clk_disable(iclk);
>> -               clk_put(iclk);
>> -       }
>> -       return;
>> -
>> -err4:
>> -       clk_put(fclk);
>> -err3:
>> -       clk_disable(iclk);
>> -err2:
>> -       clk_put(iclk);
>> -err1:
>> -       printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
>> -                           "cannot reset.\n",  __func__, i);
>> -}
>> -#else
>> -static inline void omap_hsmmc_reset(void) {}
>> -#endif
>> -
>>  #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
>>
>>  static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
>> @@ -665,150 +559,6 @@ void __init omap242x_init_mmc(struct
>> omap_mmc_platform_data **mmc_data)
>>
>>  #endif
>>
>> -#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
>> -
>> -static inline void omap2_mmc_mux(struct omap_mmc_platform_data
>> *mmc_controller,
>> -                       int controller_nr)
>> -{
>> -       if ((mmc_controller->slots[0].switch_pin>  0)&&  \
>> -               (mmc_controller->slots[0].switch_pin<
>>  OMAP_MAX_GPIO_LINES))
>> -               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -       if ((mmc_controller->slots[0].gpio_wp>  0)&&  \
>> -               (mmc_controller->slots[0].gpio_wp<  OMAP_MAX_GPIO_LINES))
>> -               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -       if (cpu_is_omap34xx()) {
>> -               if (controller_nr == 0) {
>> -                       omap_mux_init_signal("sdmmc1_clk",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -                       omap_mux_init_signal("sdmmc1_cmd",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -                       omap_mux_init_signal("sdmmc1_dat0",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -                       if (mmc_controller->slots[0].caps&
>> -                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))
>> {
>> -                               omap_mux_init_signal("sdmmc1_dat1",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc1_dat2",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc1_dat3",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                       }
>> -                       if (mmc_controller->slots[0].caps&
>> -                                               MMC_CAP_8_BIT_DATA) {
>> -                               omap_mux_init_signal("sdmmc1_dat4",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc1_dat5",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc1_dat6",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc1_dat7",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                       }
>> -               }
>> -               if (controller_nr == 1) {
>> -                       /* MMC2 */
>> -                       omap_mux_init_signal("sdmmc2_clk",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -                       omap_mux_init_signal("sdmmc2_cmd",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -                       omap_mux_init_signal("sdmmc2_dat0",
>> -                               OMAP_PIN_INPUT_PULLUP);
>> -
>> -                       /*
>> -                        * For 8 wire configurations, Lines DAT4, 5, 6 and
>> 7 need to be muxed
>> -                        * in the board-*.c files
>> -                        */
>> -                       if (mmc_controller->slots[0].caps&
>> -                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))
>> {
>> -                               omap_mux_init_signal("sdmmc2_dat1",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc2_dat2",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                               omap_mux_init_signal("sdmmc2_dat3",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                       }
>> -                       if (mmc_controller->slots[0].caps&
>> -
>> MMC_CAP_8_BIT_DATA) {
>> -
>> omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -
>> omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -
>> omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -
>> omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
>> -                                       OMAP_PIN_INPUT_PULLUP);
>> -                       }
>> -               }
>> -
>> -               /*
>> -                * For MMC3 the pins need to be muxed in the board-*.c
>> files
>> -                */
>> -       }
>> -}
>> -
>> -void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
>> -                       int nr_controllers)
>> -{
>> -       int i;
>> -       char *name;
>> -
>> -       for (i = 0; i<  nr_controllers; i++) {
>> -               unsigned long base, size;
>> -               unsigned int irq = 0;
>> -
>> -               if (!mmc_data[i])
>> -                       continue;
>> -
>> -               omap2_mmc_mux(mmc_data[i], i);
>> -
>> -               switch (i) {
>> -               case 0:
>> -                       base = OMAP2_MMC1_BASE;
>> -                       irq = INT_24XX_MMC_IRQ;
>> -                       break;
>> -               case 1:
>> -                       base = OMAP2_MMC2_BASE;
>> -                       irq = INT_24XX_MMC2_IRQ;
>> -                       break;
>> -               case 2:
>> -                       if (!cpu_is_omap44xx()&&  !cpu_is_omap34xx())
>> -                               return;
>> -                       base = OMAP3_MMC3_BASE;
>> -                       irq = INT_34XX_MMC3_IRQ;
>> -                       break;
>> -               case 3:
>> -                       if (!cpu_is_omap44xx())
>> -                               return;
>> -                       base = OMAP4_MMC4_BASE;
>> -                       irq = OMAP44XX_IRQ_MMC4;
>> -                       break;
>> -               case 4:
>> -                       if (!cpu_is_omap44xx())
>> -                               return;
>> -                       base = OMAP4_MMC5_BASE;
>> -                       irq = OMAP44XX_IRQ_MMC5;
>> -                       break;
>> -               default:
>> -                       continue;
>> -               }
>> -
>> -               if (cpu_is_omap44xx()) {
>> -                       if (i<  3)
>> -                               irq += OMAP44XX_IRQ_GIC_START;
>> -                       size = OMAP4_HSMMC_SIZE;
>> -                       name = "mmci-omap-hs";
>> -               } else {
>> -                       size = OMAP3_HSMMC_SIZE;
>> -                       name = "mmci-omap-hs";
>> -               }
>> -               omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
>> -       };
>> -}
>> -
>> -#endif
>> -
>>
>>  /*-------------------------------------------------------------------------*/
>>
>>  #if defined(CONFIG_HDQ_MASTER_OMAP) ||
>> defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
>> @@ -878,7 +628,6 @@ static int __init omap2_init_devices(void)
>>          * please keep these calls, and their implementations above,
>>          * in alphabetical order so they're easier to sort through.
>>          */
>> -       omap_hsmmc_reset();
>>         omap_init_audio();
>>         omap_init_camera();
>>         omap_init_mbox();
>> diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
>> index 34272e4..b6e1eae 100644
>> --- a/arch/arm/mach-omap2/hsmmc.c
>> +++ b/arch/arm/mach-omap2/hsmmc.c
>> @@ -16,7 +16,11 @@
>>  #include<mach/hardware.h>
>>  #include<plat/mmc.h>
>>  #include<plat/omap-pm.h>
>> +#include<plat/mux.h>
>> +#include<plat/omap_hwmod.h>
>> +#include<plat/omap_device.h>
>>
>> +#include "mux.h"
>>  #include "hsmmc.h"
>>  #include "control.h"
>>
>> @@ -30,7 +34,7 @@ static u16 control_mmc1;
>>
>>  static struct hsmmc_controller {
>>         char                            name[HSMMC_NAME_LEN + 1];
>> -} hsmmc[OMAP34XX_NR_MMC];
>> +} hsmmc[OMAP44XX_NR_MMC];
>
> I do not know the details of that driver, so this comment might be
> completely irrelevant, but in theory, such static table should not be
> necessary since the driver core already maintain a list of all instances
> bound to it.

I agree, but this is used in slot data for the controller and is used
in the driver
to create a /sys entry. I will try to avoid the "OMAP44XX_NR_MMC" dependency.


> Because of that, you will have to modify this code for every new OMAP
> generation each time we add a new instance.
>
>>
>>  #if defined(CONFIG_ARCH_OMAP3)&&  defined(CONFIG_PM)
>>
>> @@ -204,7 +208,141 @@ static int nop_mmc_set_power(struct device *dev, int
>> slot, int power_on,
>>         return 0;
>>  }
>>
>> -static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC]
>> __initdata;
>> +static inline void omap2_mmc_mux(struct omap_mmc_platform_data
>> *mmc_controller,
>> +                       int controller_nr)
>> +{
>> +       if ((mmc_controller->slots[0].switch_pin>  0)&&  \
>> +               (mmc_controller->slots[0].switch_pin<
>>  OMAP_MAX_GPIO_LINES))
>> +               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +       if ((mmc_controller->slots[0].gpio_wp>  0)&&  \
>> +               (mmc_controller->slots[0].gpio_wp<  OMAP_MAX_GPIO_LINES))
>> +               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +       if (cpu_is_omap34xx()) {
>> +               if (controller_nr == 0) {
>> +                       omap_mux_init_signal("sdmmc1_clk",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc1_cmd",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc1_dat0",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       if (mmc_controller->slots[0].caps&
>> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))
>> {
>> +                               omap_mux_init_signal("sdmmc1_dat1",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat2",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat3",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +                       if (mmc_controller->slots[0].caps&
>> +                                               MMC_CAP_8_BIT_DATA) {
>> +                               omap_mux_init_signal("sdmmc1_dat4",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat5",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat6",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat7",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +               }
>> +               if (controller_nr == 1) {
>> +                       /* MMC2 */
>> +                       omap_mux_init_signal("sdmmc2_clk",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc2_cmd",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc2_dat0",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +
>> +                       /*
>> +                        * For 8 wire configurations, Lines DAT4, 5, 6 and
>> 7
>> +                        * need to be muxed in the board-*.c files
>> +                        */
>> +                       if (mmc_controller->slots[0].caps&
>> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))
>> {
>> +                               omap_mux_init_signal("sdmmc2_dat1",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat2",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat3",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +                       if (mmc_controller->slots[0].caps&
>> +
>> MMC_CAP_8_BIT_DATA) {
>> +
>> omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +
>> omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +
>> omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +
>> omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +               }
>> +
>> +               /*
>> +                * For MMC3 the pins need to be muxed in the board-*.c
>> files
>> +                */
>> +       }
>> +}
>> +
>> +static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC]
>> __initdata;
>
> Same concern than for hsmmc, why do you need static table here?

Agree, will remove static declaration.

> And why do you need another structure? The omap2_hsmmc_info should already
> be in a pdata kind of structure.
> The board file should just populate a table of pdata that you will use
> during init.

No, omap2_hsmmc_info is intermediate structure used by the boards
files to update
some basic info of the controller, based on which the pdata is
populated in hsmmc.c.

>
>> +
>> +static struct omap_device_pm_latency omap_hsmmc_latency[] = {
>> +       [0] = {
>> +               .deactivate_func = omap_device_idle_hwmods,
>> +               .activate_func   = omap_device_enable_hwmods,
>> +               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
>> +       },
>> +       /*
>> +        * XXX There should also be an entry here to power off/on the
>> +        * MMC regulators/PBIAS cells, etc.
>> +        */
>> +};
>> +
>> +static int omap2_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
>> +{
>> +       struct omap_device *od;
>> +       struct omap_device_pm_latency *ohl;
>> +       char *name;
>> +       int ohl_cnt = 0;
>> +       struct mmc_dev_attr *mmc_dattr = oh->dev_attr;
>> +       struct omap2_hsmmc_info *c = (struct omap2_hsmmc_info *)
>> hsmmcinfo;
>> +       int idx;
>> +       static int mmc_num;
>> +
>> +       /* Initialization of controllers which are not updated
>> +        * in board file will be skipped here.
>> +        */
>> +       c += mmc_num;
>> +       if (!c->mmc) {
>> +               pr_err("omap_hsmmc_info is not updated in board file\n");
>> +               return 0;
>> +       }
>> +       idx = c->mmc - 1 ;
>> +       name = "mmci-omap-hs";
>
> Could you please rename the device to have something in the form: omap_XXXX?
> In that case "omap_mmc" should be good. The "hs" is just a indication of one
> of the mmc instance capability and does not have to be in the device name
> since there is no none-hs instance.

I understood your concern but omap1,omap2420 uses mmc driver while
omap2430, omap3 , omap4 has hsmmc driver.

omap1, omap2420 boards have device name as "mmci-omap" currently, but
if they undergo
the similar change as proposed above then it looks like "omap_mmc"

Therefore for hsmmc driver, I will be happy to have something like "omap_hsmmc"

please let me know if this is fine.

>
> I know that this is not in your patch and was already there before, but that
> code is happily mixing MMC or HSMMC everywhere, so having a little bit of
> consistency will be good. I vote to stick to MMC only.
> The "omap2_" prefix does not seems necessary too for my point of view.
> "omap_" is good enough.
>
>> +       ohl = omap_hsmmc_latency;
>> +       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
>> +       omap2_mmc_mux(hsmmc_data[idx], idx);
>> +       hsmmc_data[idx]->controller_dev_attr = mmc_dattr->flags;
>
> You should copy the data and not keep a reference to internal hwmod
> structure. In your case, you should check if dev_attr is not null. It will
> avoid adding some empty dev_attr structure in the hwmod_data files.

Ok, will make changes.

>
>> +       od = omap_device_build(name, idx, oh, hsmmc_data[idx],
>> +               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt,
>> false);
>> +       if (IS_ERR(od)) {
>> +               WARN(1, "Cant build omap_device for %s:%s.\n",
>> +                                       name, oh->name);
>> +               return PTR_ERR(od);
>> +       }
>> +       /*
>> +        * return device handle to board setup code
>> +        * required to populate for regulator framework structure
>> +        */
>> +       c->dev =&od->pdev.dev;
>> +       mmc_num++;
>> +       return 0;
>> +}
>
> Regards,
> Benoit
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
  2011-02-24 10:59   ` Cousson, Benoit
@ 2011-02-24 13:58     ` Kadiyala, Kishore
  0 siblings, 0 replies; 18+ messages in thread
From: Kadiyala, Kishore @ 2011-02-24 13:58 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

On Thu, Feb 24, 2011 at 4:29 PM, Cousson, Benoit <b-cousson@ti.com> wrote:
> On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
>>
>> Add a device attribute to hwmod data of omap2430, omap3, omap4.
>> Currently the device attribute holds information regarding dual volt MMC
>> card
>> support by the controller which will be later passed to the host driver
>> via
>> platform data.
>>
>> Signed-off-by: Kevin Hilman<khilman@deeprootsystems.com>
>> Signed-off-by: Kishore Kadiyala<kishore.kadiyala@ti.com>
>> Cc: Benoit Cousson<b-cousson@ti.com>
>> Cc: Paul Walmsley<paul@pwsan.com>
>
> There are few minor comments to fix hence the:
> Almost-Acked-by: Benoit Cousson<b-cousson@ti.com>
>
>
>> ---
>>  arch/arm/mach-omap2/omap_hwmod_2430_data.c |    9 +++++++++
>>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
>>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 ++++++++++++++++
>>  arch/arm/plat-omap/include/plat/mmc.h      |   10 ++++++++++
>>  drivers/mmc/host/omap_hsmmc.c              |    4 ++--
>>  5 files changed, 49 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> index 4d45b7d..e050355 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> @@ -19,6 +19,7 @@
>>  #include<plat/i2c.h>
>>  #include<plat/gpio.h>
>>  #include<plat/mcspi.h>
>> +#include<plat/mmc.h>
>>
>>  #include "omap_hwmod_common_data.h"
>>
>> @@ -1290,6 +1291,10 @@ static struct omap_hwmod_class mmc_class = {
>>
>>  /* MMC/SD/SDIO1 */
>>
>> +static struct mmc_dev_attr mmc1_dev_attr = {
>
> Could you rename the struct omap_mmc_dev_attr to stick to the convention?

Ok

>
> The dev_attr should be just above "static struct omap_hwmod". See the OMAP4
> example below.
>
>> +       .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
>> +};
>> +
>>  static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = {
>>        { .irq = 83 },
>>  };
>> @@ -1328,11 +1333,14 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
>>        .slaves         = omap2430_mmc1_slaves,
>>        .slaves_cnt     = ARRAY_SIZE(omap2430_mmc1_slaves),
>>        .class          =&mmc_class,
>> +       .dev_attr       =&mmc1_dev_attr,
>
> dev_attr should be above .slaves.
>
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
>>  };
>>
>>  /* MMC/SD/SDIO2 */
>>
>> +static struct mmc_dev_attr mmc2_dev_attr;
>
> If you do not have any dev_attr for that instance, do not add it here and
> test for null pointer in your driver.
> This comment applies for all instances in all OMAPs.

ok

>
>> +
>>  static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = {
>>        { .irq = 86 },
>>  };
>> @@ -1371,6 +1379,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
>>        .slaves         = omap2430_mmc2_slaves,
>>        .slaves_cnt     = ARRAY_SIZE(omap2430_mmc2_slaves),
>>        .class          =&mmc_class,
>> +       .dev_attr       =&mmc2_dev_attr,
>
> Not needed if there is not data in the structure.

ok

>
> [...]
>
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> index dd39e75..6c4ccfd 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> @@ -25,6 +25,7 @@
>>  #include<plat/gpio.h>
>>  #include<plat/dma.h>
>>  #include<plat/mcspi.h>
>> +#include<plat/mmc.h>
>>
>>  #include "omap_hwmod_common_data.h"
>>
>> @@ -3383,6 +3384,10 @@ static struct omap_hwmod_class
>> omap44xx_mmc_hwmod_class = {
>>  };
>>
>>  /* mmc1 */
>> +static struct mmc_dev_attr omap_mmc1_dev_attr = {
>> +       .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
>> +};
>> +
>>  static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
>>        { .irq = 83 + OMAP44XX_IRQ_GIC_START },
>>  };
>> @@ -3437,10 +3442,14 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
>>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc1_slaves),
>>        .masters        = omap44xx_mmc1_masters,
>>        .masters_cnt    = ARRAY_SIZE(omap44xx_mmc1_masters),
>> +       .dev_attr       =&omap_mmc1_dev_attr,
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>>  };
>>
>>  /* mmc2 */
>> +static struct omap_hwmod omap44xx_mmc2_hwmod;
>> +static struct mmc_dev_attr omap_mmc2_dev_attr;
>> +
>>  static struct omap_hwmod_irq_info omap44xx_mmc2_irqs[] = {
>>        { .irq = 86 + OMAP44XX_IRQ_GIC_START },
>>  };
>> @@ -3495,11 +3504,13 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
>>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc2_slaves),
>>        .masters        = omap44xx_mmc2_masters,
>>        .masters_cnt    = ARRAY_SIZE(omap44xx_mmc2_masters),
>> +       .dev_attr       =&omap_mmc2_dev_attr,
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>>  };
>>
>>  /* mmc3 */
>>  static struct omap_hwmod omap44xx_mmc3_hwmod;
>> +static struct mmc_dev_attr omap_mmc3_dev_attr;
>>  static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = {
>>        { .irq = 94 + OMAP44XX_IRQ_GIC_START },
>>  };
>> @@ -3547,11 +3558,13 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
>>        },
>>        .slaves         = omap44xx_mmc3_slaves,
>>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc3_slaves),
>> +       .dev_attr       =&omap_mmc3_dev_attr,
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>>  };
>>
>>  /* mmc4 */
>>  static struct omap_hwmod omap44xx_mmc4_hwmod;
>> +static struct mmc_dev_attr omap_mmc4_dev_attr;
>>  static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = {
>>        { .irq = 96 + OMAP44XX_IRQ_GIC_START },
>>  };
>> @@ -3599,11 +3612,13 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
>>        },
>>        .slaves         = omap44xx_mmc4_slaves,
>>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc4_slaves),
>> +       .dev_attr       =&omap_mmc4_dev_attr,
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>>  };
>>
>>  /* mmc5 */
>>  static struct omap_hwmod omap44xx_mmc5_hwmod;
>> +static struct mmc_dev_attr omap_mmc5_dev_attr;
>>  static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = {
>>        { .irq = 59 + OMAP44XX_IRQ_GIC_START },
>>  };
>> @@ -3651,6 +3666,7 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
>>        },
>>        .slaves         = omap44xx_mmc5_slaves,
>>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc5_slaves),
>> +       .dev_attr       =&omap_mmc5_dev_attr,
>>        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
>>  };
>>
>
> In order to be aligned with the generator, and assuming that only the mm1
> needs dev_attr, the OMAP4 diff should be:

ok, will have changes as below.

>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index 79a8601..958651c 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -3420,6 +3420,11 @@ static struct omap_hwmod_ocp_if
> *omap44xx_mmc1_slaves[] = {
>        &omap44xx_l4_per__mmc1,
>  };
>
> +/* mmc1 dev_attr */
> +static struct omap_mmc_dev_attr mmc1_dev_attr = {
> +       .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
> +};
> +
>  static struct omap_hwmod omap44xx_mmc1_hwmod = {
>        .name           = "mmc1",
>        .class          = &omap44xx_mmc_hwmod_class,
> @@ -3433,6 +3438,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
>                        .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
>                },
>        },
> +       .dev_attr       = &mmc1_dev_attr,
>        .slaves         = omap44xx_mmc1_slaves,
>        .slaves_cnt     = ARRAY_SIZE(omap44xx_mmc1_slaves),
>        .masters        = omap44xx_mmc1_masters,
> ---
>
> Regards,
> Benoit
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-24  6:28   ` Varadarajan, Charulatha
@ 2011-02-24 14:02     ` Kadiyala, Kishore
  0 siblings, 0 replies; 18+ messages in thread
From: Kadiyala, Kishore @ 2011-02-24 14:02 UTC (permalink / raw)
  To: Varadarajan, Charulatha
  Cc: linux-mmc, linux-omap, tony, cjb, madhu.cr, khilman, paul,
	Benoit Cousson

On Thu, Feb 24, 2011 at 11:58 AM, Varadarajan, Charulatha <charu@ti.com> wrote:
> Kishore,
>
> On Wed, Feb 23, 2011 at 23:17, Kishore Kadiyala <kishore.kadiyala@ti.com> wrote:
>> Changes involves:
>> 1) Remove controller reset in devices.c which is taken care of
>>   by hwmod framework.
>> 2) Removing all base address macro defines except keeping one for OMAP2420.
>
> why?

Will  mention the details in the log

>
>> 3) Using omap-device layer to register device and utilizing data from
>>   hwmod data file for base address, dma channel number, Irq_number,
>>   device attribute.
>>
>> Signed-off-by: Paul Walmsley <paul@pwsan.com>
>> Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
>> Cc: Benoit Cousson <b-cousson@ti.com>
>> CC: Kevin Hilman <khilman@deeprootsystems.com>
>> ---
>>  arch/arm/mach-omap2/devices.c         |  251 ---------------------------------
>>  arch/arm/mach-omap2/hsmmc.c           |  153 ++++++++++++++++++--
>>  arch/arm/plat-omap/include/plat/mmc.h |   14 --
>>  3 files changed, 141 insertions(+), 277 deletions(-)
>>
>
> <<snip>>
>
>> diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
>> index 34272e4..b6e1eae 100644
>> --- a/arch/arm/mach-omap2/hsmmc.c
>> +++ b/arch/arm/mach-omap2/hsmmc.c
>> @@ -16,7 +16,11 @@
>>  #include <mach/hardware.h>
>>  #include <plat/mmc.h>
>>  #include <plat/omap-pm.h>
>> +#include <plat/mux.h>
>> +#include <plat/omap_hwmod.h>
>> +#include <plat/omap_device.h>
>>
>> +#include "mux.h"
>>  #include "hsmmc.h"
>>  #include "control.h"
>>
>> @@ -30,7 +34,7 @@ static u16 control_mmc1;
>>
>>  static struct hsmmc_controller {
>>        char                            name[HSMMC_NAME_LEN + 1];
>> -} hsmmc[OMAP34XX_NR_MMC];
>> +} hsmmc[OMAP44XX_NR_MMC];
>
> Why do you have a dependency on OMAP44XX_NR_MMC? You should get
> this kind of information using number of iterations in *_hwmod_each_by_class.

Ok , will remove

>
>>
>>  #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
>>
>> @@ -204,7 +208,141 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
>>        return 0;
>>  }
>>
>> -static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
>> +static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
>> +                       int controller_nr)
>> +{
>> +       if ((mmc_controller->slots[0].switch_pin > 0) && \
>> +               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
>> +               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +       if ((mmc_controller->slots[0].gpio_wp > 0) && \
>> +               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
>> +               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +       if (cpu_is_omap34xx()) {
>> +               if (controller_nr == 0) {
>> +                       omap_mux_init_signal("sdmmc1_clk",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc1_cmd",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc1_dat0",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       if (mmc_controller->slots[0].caps &
>> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
>> +                               omap_mux_init_signal("sdmmc1_dat1",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat2",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat3",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +                       if (mmc_controller->slots[0].caps &
>> +                                               MMC_CAP_8_BIT_DATA) {
>> +                               omap_mux_init_signal("sdmmc1_dat4",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat5",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat6",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc1_dat7",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +               }
>> +               if (controller_nr == 1) {
>> +                       /* MMC2 */
>> +                       omap_mux_init_signal("sdmmc2_clk",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc2_cmd",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +                       omap_mux_init_signal("sdmmc2_dat0",
>> +                               OMAP_PIN_INPUT_PULLUP);
>> +
>> +                       /*
>> +                        * For 8 wire configurations, Lines DAT4, 5, 6 and 7
>> +                        * need to be muxed in the board-*.c files
>> +                        */
>> +                       if (mmc_controller->slots[0].caps &
>> +                               (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
>> +                               omap_mux_init_signal("sdmmc2_dat1",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat2",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat3",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +                       if (mmc_controller->slots[0].caps &
>> +                                                       MMC_CAP_8_BIT_DATA) {
>> +                               omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                               omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
>> +                                       OMAP_PIN_INPUT_PULLUP);
>> +                       }
>> +               }
>> +
>> +               /*
>> +                * For MMC3 the pins need to be muxed in the board-*.c files
>> +                */
>> +       }
>> +}
>> +
>> +static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC] __initdata;
>
> Ditto
>
>> +
>> +static struct omap_device_pm_latency omap_hsmmc_latency[] = {
>> +       [0] = {
>> +               .deactivate_func = omap_device_idle_hwmods,
>> +               .activate_func   = omap_device_enable_hwmods,
>> +               .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
>> +       },
>> +       /*
>> +        * XXX There should also be an entry here to power off/on the
>> +        * MMC regulators/PBIAS cells, etc.
>> +        */
>> +};
>> +
>> +static int omap2_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
>> +{
>> +       struct omap_device *od;
>> +       struct omap_device_pm_latency *ohl;
>> +       char *name;
>> +       int ohl_cnt = 0;
>> +       struct mmc_dev_attr *mmc_dattr = oh->dev_attr;
>> +       struct omap2_hsmmc_info *c = (struct omap2_hsmmc_info *) hsmmcinfo;
>> +       int idx;
>> +       static int mmc_num;
>> +
>> +       /* Initialization of controllers which are not updated
>> +        * in board file will be skipped here.
>> +        */
>
> Check multi-line comment style

Ok

>
>> +       c += mmc_num;
>> +       if (!c->mmc) {
>> +               pr_err("omap_hsmmc_info is not updated in board file\n");
>> +               return 0;
>> +       }
>> +       idx = c->mmc - 1 ;
>> +       name = "mmci-omap-hs";
>> +       ohl = omap_hsmmc_latency;
>> +       ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
>> +       omap2_mmc_mux(hsmmc_data[idx], idx);
>> +       hsmmc_data[idx]->controller_dev_attr = mmc_dattr->flags;
>
> It would be good rename controller_dev_attr to controller_flag

Ok

>
>> +       od = omap_device_build(name, idx, oh, hsmmc_data[idx],
>> +               sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
>> +       if (IS_ERR(od)) {
>> +               WARN(1, "Cant build omap_device for %s:%s.\n",
>> +                                       name, oh->name);
>> +               return PTR_ERR(od);
>> +       }
>> +       /*
>> +        * return device handle to board setup code
>> +        * required to populate for regulator framework structure
>> +        */
>> +       c->dev = &od->pdev.dev;
>> +       mmc_num++;
>> +       return 0;
>> +}
>>
>>  void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
>>  {
>> @@ -358,16 +496,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
>>                hsmmc_data[c->mmc - 1] = mmc;
>>        }
>>
>> -       omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
>> -
>> -       /* pass the device nodes back to board setup code */
>> -       for (c = controllers; c->mmc; c++) {
>> -               struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
>> -
>> -               if (!c->mmc || c->mmc > nr_hsmmc)
>> -                       continue;
>> -               c->dev = mmc->dev;
>> -       }
>> +       omap_hwmod_for_each_by_class("mmc", omap2_mmc_init, controllers);
>>
>>  done:
>>        for (i = 0; i < nr_hsmmc; i++)
>> diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
>> index 7853130..6205984 100644
>> --- a/arch/arm/plat-omap/include/plat/mmc.h
>> +++ b/arch/arm/plat-omap/include/plat/mmc.h
>> @@ -24,20 +24,12 @@
>>  #define OMAP1_MMC2_BASE                0xfffb7c00      /* omap16xx only */
>>
>>  #define OMAP24XX_NR_MMC                2
>> -#define OMAP34XX_NR_MMC                3
>>  #define OMAP44XX_NR_MMC                5
>
> As mentioned above, OMAP44XX_NR_MMC & OMAP24XX_NR_MMC shall be
> removed and instead get these info from hwmod.

Agree

>
> I had provided the same comment in the previous patch version too. You may
> reject the comment but mention the reasons for the same.
>
>>  #define OMAP2420_MMC_SIZE      OMAP1_MMC_SIZE
>> -#define OMAP3_HSMMC_SIZE       0x200
>>  #define OMAP4_HSMMC_SIZE       0x1000
>
> Can't this be removed?

will check

>
>>  #define OMAP2_MMC1_BASE                0x4809c000
>>  #define OMAP2_MMC2_BASE                0x480b4000
>> -#define OMAP3_MMC3_BASE                0x480ad000
>> -#define OMAP4_MMC4_BASE                0x480d1000
>> -#define OMAP4_MMC5_BASE                0x480d5000
>>  #define OMAP4_MMC_REG_OFFSET   0x100
>
> Remove OMAP4_MMC_REG_OFFSET too.

This is needed for the OMAP4 since the registers which
were accessed has offset deviation of 0x100 w.r.t to OMAP3

>
>> -#define HSMMC5                 (1 << 4)
>> -#define HSMMC4                 (1 << 3)
>> -#define HSMMC3                 (1 << 2)
>>  #define HSMMC2                 (1 << 1)
>>  #define HSMMC1                 (1 << 0)
>
> <<snip>>
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
  2011-02-24  6:00   ` Varadarajan, Charulatha
@ 2011-02-24 14:05     ` Kadiyala, Kishore
  0 siblings, 0 replies; 18+ messages in thread
From: Kadiyala, Kishore @ 2011-02-24 14:05 UTC (permalink / raw)
  To: Varadarajan, Charulatha
  Cc: linux-mmc, linux-omap, tony, cjb, madhu.cr, khilman, paul,
	Benoit Cousson

On Thu, Feb 24, 2011 at 11:30 AM, Varadarajan, Charulatha <charu@ti.com> wrote:
> Kishore,
>
> On Wed, Feb 23, 2011 at 23:17, Kishore Kadiyala <kishore.kadiyala@ti.com> wrote:
>> Add a device attribute to hwmod data of omap2430, omap3, omap4.
>> Currently the device attribute holds information regarding dual volt MMC card
>> support by the controller which will be later passed to the host driver via
>> platform data.
>>
>> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
>> Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
>> Cc: Benoit Cousson <b-cousson@ti.com>
>> Cc: Paul Walmsley <paul@pwsan.com>
>> ---
>>  arch/arm/mach-omap2/omap_hwmod_2430_data.c |    9 +++++++++
>>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
>>  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   16 ++++++++++++++++
>>  arch/arm/plat-omap/include/plat/mmc.h      |   10 ++++++++++
>>  drivers/mmc/host/omap_hsmmc.c              |    4 ++--
>>  5 files changed, 49 insertions(+), 2 deletions(-)
>>
>
> <<snip>>
>
>>
>> diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
>> index e5de5d4..7853130 100644
>> --- a/arch/arm/plat-omap/include/plat/mmc.h
>> +++ b/arch/arm/plat-omap/include/plat/mmc.h
>> @@ -43,6 +43,13 @@
>>
>>  #define OMAP_MMC_MAX_SLOTS     2
>>
>> +/* omap_hwmod integration data */
>
> What is omap_hwmod integration data ? Pls clarify.
>
>> +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT  BIT(1)
>> +
>> +struct mmc_dev_attr {
>> +       u8 flags;
>> +};
>> +
>>  struct omap_mmc_platform_data {
>>        /* back-link to device */
>>        struct device *dev;
>> @@ -71,6 +78,9 @@ struct omap_mmc_platform_data {
>>
>>        u64 dma_mask;
>>
>> +       /* Integrating attributes from the omap_hwmod layer */
>> +       u8 controller_dev_attr;
>> +
>>        /* Register offset deviation */
>>        u16 reg_offset;
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 078fdf1..160cc95 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1555,7 +1555,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>                break;
>>        }
>>
>> -       if (host->id == OMAP_MMC1_DEVID) {
>> +       if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
>
> Where is pdata->controller_dev_attr getting populated? I don't see the
> dev_attr from the
> hwmod database used anywhere in this patch.

good catch ,
the changes in the driver should be part of last patch.

>
>>                /* Only MMC1 can interface at 3V without some flavor
>>                 * of external transceiver; but they all handle 1.8V.
>>                 */
>> @@ -1647,7 +1647,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host)
>>        u32 hctl, capa, value;
>>
>>        /* Only MMC1 supports 3.0V */
>> -       if (host->id == OMAP_MMC1_DEVID) {
>> +       if (host->pdata->controller_dev_attr & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {
>
> Ditto.
>
>>                hctl = SDVS30;
>>                capa = VS30 | VS18;
>>        } else {
>> --
>> 1.7.1
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
  2011-02-24 13:55     ` Kadiyala, Kishore
@ 2011-02-24 14:33       ` Cousson, Benoit
  0 siblings, 0 replies; 18+ messages in thread
From: Cousson, Benoit @ 2011-02-24 14:33 UTC (permalink / raw)
  To: Kadiyala, Kishore
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

On 2/24/2011 2:55 PM, Kadiyala, Kishore wrote:
> On Thu, Feb 24, 2011 at 5:19 PM, Cousson, Benoit<b-cousson@ti.com>  wrote:
>> On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:

[...]

>>>   static struct hsmmc_controller {
>>>          char                            name[HSMMC_NAME_LEN + 1];
>>> -} hsmmc[OMAP34XX_NR_MMC];
>>> +} hsmmc[OMAP44XX_NR_MMC];
>>
>> I do not know the details of that driver, so this comment might be
>> completely irrelevant, but in theory, such static table should not be
>> necessary since the driver core already maintain a list of all instances
>> bound to it.
>
> I agree, but this is used in slot data for the controller and is used
> in the driver
> to create a /sys entry.

I guess the sysfs should be able to use only the device instance.

> I will try to avoid the "OMAP44XX_NR_MMC" dependency.

[...]

>>> +static struct omap_mmc_platform_data *hsmmc_data[OMAP44XX_NR_MMC]
>>> __initdata;
>>
>> Same concern than for hsmmc, why do you need static table here?
>
> Agree, will remove static declaration.
>
>> And why do you need another structure? The omap2_hsmmc_info should already
>> be in a pdata kind of structure.
>> The board file should just populate a table of pdata that you will use
>> during init.
>
> No, omap2_hsmmc_info is intermediate structure used by the boards
> files to update
> some basic info of the controller, based on which the pdata is
> populated in hsmmc.c.

This is the point, I guess you can potentially directly fill partially a 
pdata with controller information in the board file to avoid that 
intermediate structure.

[...]

>>> +       name = "mmci-omap-hs";
>>
>> Could you please rename the device to have something in the form: omap_XXXX?
>> In that case "omap_mmc" should be good. The "hs" is just a indication of one
>> of the mmc instance capability and does not have to be in the device name
>> since there is no none-hs instance.
>
> I understood your concern but omap1,omap2420 uses mmc driver while
> omap2430, omap3 , omap4 has hsmmc driver.

OK, it makes sense then.

> omap1, omap2420 boards have device name as "mmci-omap" currently, but
> if they undergo
> the similar change as proposed above then it looks like "omap_mmc"
>
> Therefore for hsmmc driver, I will be happy to have something like "omap_hsmmc"
>
> please let me know if this is fine.

Excellent, that's fine for me.

Thanks,
Benoit

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation
  2011-02-24 10:19 ` [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Cousson, Benoit
@ 2011-02-24 18:10   ` Kadiyala, Kishore
  0 siblings, 0 replies; 18+ messages in thread
From: Kadiyala, Kishore @ 2011-02-24 18:10 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: linux-mmc, linux-omap, tony, cjb, Chikkature Rajashekar,
	Madhusudhan, khilman, paul

Hi Benoit,

On Thu, Feb 24, 2011 at 3:49 PM, Cousson, Benoit <b-cousson@ti.com> wrote:
> Hi Kishore,
>
> On 2/23/2011 6:47 PM, Kadiyala, Kishore wrote:
>>
>> Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4.
>> Adapting the omap_hsmmc driver to hwmod framework.
>>
>> The patch series is based on -rc6 and tested on OMAP2430, OMAP3430SDP
>> &  OMAP4430SDP.
>
> Could you rebase it on top of omap-for-linus, it does apply for the moment.

Sure, I will repost new version based on omap-for-linus with comments fixed.

<snip>

Regards,
Kishore

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-02-24 18:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-23 17:47 [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Kishore Kadiyala
2011-02-23 17:47 ` [PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC Kishore Kadiyala
2011-02-23 17:47 ` [PATCH v3 2/5] OMAP3: " Kishore Kadiyala
2011-02-23 17:47 ` [PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC Kishore Kadiyala
2011-02-24 10:21   ` Cousson, Benoit
2011-02-23 17:47 ` [PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver Kishore Kadiyala
2011-02-24  6:00   ` Varadarajan, Charulatha
2011-02-24 14:05     ` Kadiyala, Kishore
2011-02-24 10:59   ` Cousson, Benoit
2011-02-24 13:58     ` Kadiyala, Kishore
2011-02-23 17:47 ` [PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework Kishore Kadiyala
2011-02-24  6:28   ` Varadarajan, Charulatha
2011-02-24 14:02     ` Kadiyala, Kishore
2011-02-24 11:49   ` Cousson, Benoit
2011-02-24 13:55     ` Kadiyala, Kishore
2011-02-24 14:33       ` Cousson, Benoit
2011-02-24 10:19 ` [PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation Cousson, Benoit
2011-02-24 18:10   ` Kadiyala, Kishore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.