omap4 hsmmc: Register offset handling
Subsystems (5)
PATCH v2 3/4 omap4 hsmmc: Register offset handling
The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver.
The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly.
--- arch/arm/mach-omap2/devices.c | 8 +++----- arch/arm/mach-omap2/hsmmc.c | 4 ++++ arch/arm/plat-omap/include/plat/mmc.h | 3 +++ drivers/mmc/host/omap_hsmmc.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/devices.c +3 -5
@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,case 3 :if (!cpu_is_omap44xx ())return ; - base =OMAP4_MMC4_BASE +OMAP4_MMC_REG_OFFSET ; + base =OMAP4_MMC4_BASE ; irq =OMAP44XX_IRQ_MMC4 ;break ;case 4 :if (!cpu_is_omap44xx ())return ; - base =OMAP4_MMC5_BASE +OMAP4_MMC_REG_OFFSET ; + base =OMAP4_MMC5_BASE ; irq =OMAP44XX_IRQ_MMC5 ;break ;default :
@@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size =OMAP2420_MMC_SIZE ; name ="mmci-omap" ; }else if (cpu_is_omap44xx ()) { -if (i <3 ) { - base +=OMAP4_MMC_REG_OFFSET ; +if (i <3 ) irq +=OMAP44XX_IRQ_GIC_START ; - } size =OMAP4_HSMMC_SIZE ; name ="mmci-omap-hs" ; }else {
arch/arm/mach-omap2/hsmmc.c +4 -0
@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc->slots[0 ].wires = c->wires; mmc->slots[0 ].internal_clock = !c->ext_clock; mmc->dma_mask =0xffffffff ; +if (cpu_is_omap44xx ()) + mmc->reg_offset =OMAP4_MMC_REG_OFFSET ; +else + mmc->reg_offset =0 ; mmc->get_context_loss_count = hsmmc_get_context_loss;
arch/arm/plat-omap/include/plat/mmc.h +3 -0
@@ -71,6 +71,9 @@ struct omap_mmc_platform_data {u64 dma_mask; +/* Register offset deviation */ +u16 reg_offset; +struct omap_mmc_slot_data {/* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC;
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -2034,7 +2034,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host->irq = irq; host->id = pdev->id; host->slot_id =0 ; - host->mapbase = res->start; + host->mapbase = res->start + pdata->reg_offset; host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ;
Signature · 1 line
1.7.0.4
PATCH v2 3/4 omap4 hsmmc: Register offset handling
Hi Kishore
Quoted 6 lines · Kishore
The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver.
That explanation does not sound very accurate to me.
The fact that the hwmods are auto-generated has nothing to do with your offset problem. The real cause is due to the update of the IP to support the new PM programming model.
Because of that, and to keep a certain level of compatibility, the legacy registers were all shifted by 0x100 and the new one were added from offset 0 to 0x10.
Regards,
Benoit
Quoted 85 lines
The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly.
Signed-off-by Kishore Kadiyala<[email protected]>--- arch/arm/mach-omap2/devices.c | 8 +++----- arch/arm/mach-omap2/hsmmc.c | 4 ++++ arch/arm/plat-omap/include/plat/mmc.h | 3 +++ drivers/mmc/host/omap_hsmmc.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-)arch/arm/mach-omap2/devices.c +3
-5@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,case 3 :if (!cpu_is_omap44xx ())return ; - base =OMAP4_MMC4_BASE +OMAP4_MMC_REG_OFFSET ; + base =OMAP4_MMC4_BASE ; irq =OMAP44XX_IRQ_MMC4 ;break ;case 4 :if (!cpu_is_omap44xx ())return ; - base =OMAP4_MMC5_BASE +OMAP4_MMC_REG_OFFSET ; + base =OMAP4_MMC5_BASE ; irq =OMAP44XX_IRQ_MMC5 ;break ;default :@@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size =OMAP2420_MMC_SIZE ; name ="mmci-omap" ; }else if (cpu_is_omap44xx ()) { -if (i<3 ) { - base +=OMAP4_MMC_REG_OFFSET ; +if (i<3 ) irq +=OMAP44XX_IRQ_GIC_START ; - } size =OMAP4_HSMMC_SIZE ; name ="mmci-omap-hs" ; }else {arch/arm/mach-omap2/hsmmc.c +4
-0@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc->slots[0 ].wires = c->wires; mmc->slots[0 ].internal_clock = !c->ext_clock; mmc->dma_mask =0xffffffff ; +if (cpu_is_omap44xx ()) + mmc->reg_offset =OMAP4_MMC_REG_OFFSET ; +else + mmc->reg_offset =0 ; mmc->get_context_loss_count = hsmmc_get_context_loss;arch/arm/plat-omap/include/plat/mmc.h +3
-0@@ -71,6 +71,9 @@ struct omap_mmc_platform_data {u64 dma_mask; +/* Register offset deviation */ +u16 reg_offset; +struct omap_mmc_slot_data {/* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC; drivers/mmc/host/omap_hsmmc.c +1
-1@@ -2034,7 +2034,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host->irq = irq; host->id = pdev->id; host->slot_id =0 ; - host->mapbase = res->start; + host->mapbase = res->start + pdata->reg_offset; host->base =ioremap (host->mapbase,SZ_4K ); host->power_mode =MMC_POWER_OFF ;
PATCH v2 3/4 omap4 hsmmc: Register offset handling
Hi Benoit,
Quoted 11 lines · Benoit
Hi Kishore
Quoted 7 lines · Kishore
The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver.
Quoted 3 lines
That explanation does not sound very accurate to me.
The fact that the hwmods are auto-generated has nothing to do with your offset problem.
Agree the change log needs to be updated as said but when coming to implementation this how it is:
With current mainline kernel, offset appending is already implemented in mach-omap2/devices.c and works fine [here bases are updated with 0x100 and then passed to driver which has same register offset's as OMAP3].
When hwmod modifications are done to the MMC driver, the base address are picked from omap_hwmod_44xx_data.c and omap_device is build. Coming to the driver it still has the same old register offset's as OMAP3 and there should be a way to add 0x100 some where.
The current patch moves the offset appending to the driver file which is updated in mach-omap2/hsmmc.c which will fit for current implementation and even hwmod adaptation.
Quoted 9 lines
The real cause is due to the update of the IP to support the
new PM programming model.
Because of that, and to keep a certain level of compatibility, the legacy registers were all shifted by0x100and the new one were added from offset 0 to0x10.Regards,
Benoit
<snip>
Regards,
Kishore
PATCH v2 3/4 omap4 hsmmc: Register offset handling
In reply to kishore kadiyalaQuoted 69 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Kadiyala, Kishore
Sent: Saturday, September 18, 2010 10:04 PM
To: linux-mmc at vger.kernel.org; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Cc: khilman at deeprootsystems.com; Cousson, Benoit
Subject: [PATCH v2 3/4] omap4 hsmmc: Register offset handlingThe offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver. The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly.Signed-off-by Kishore Kadiyala <[email protected]>--- arch/arm/mach-omap2/devices.c | 8 +++----- arch/arm/mach-omap2/hsmmc.c | 4 ++++ arch/arm/plat-omap/include/plat/mmc.h | 3 +++ drivers/mmc/host/omap_hsmmc.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-omap2/devices.cindex 2dbb265..bb7ec13 100644arch/arm/mach-omap2/devices.c +2
-2@@ -745,13 +745,13 @@ void __init omap2_init_mmc(structomap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq =OMAP44XX_IRQ_MMC4 ;break ;case 4 :if (!cpu_is_omap44xx ())return ; - base =OMAP4_MMC5_BASE +OMAP4_MMC_REG_OFFSET ; + base =OMAP4_MMC5_BASE ; irq =OMAP44XX_IRQ_MMC5 ;break ;arch/arm/mach-omap2/devices.c +1
-3default :@@ -762,10 +762,8 @@ void __init omap2_init_mmc(structomap_mmc_platform_data **mmc_data, size =OMAP2420_MMC_SIZE ; name ="mmci-omap" ; }else if (cpu_is_omap44xx ()) { -if (i <3 ) { - base +=OMAP4_MMC_REG_OFFSET ; +if (i <3 ) irq +=OMAP44XX_IRQ_GIC_START ; - } size =OMAP4_HSMMC_SIZE ; name ="mmci-omap-hs" ;arch/arm/mach-omap2/devices.c +0
-0}else {(quoted diff) +0
-0
b/arch/arm/mach-omap2/hsmmc.cindex c8f647b..49d76a7 100644
arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct · line 268
Quoted 8 lines
arch/arm/mach-omap2/hsmmc.c +4
-0@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc->slots[0].wires = c->wires; mmc->slots[0 ].internal_clock = !c->ext_clock; mmc->dma_mask =0xffffffff ; +if (cpu_is_omap44xx ()) + mmc->reg_offset =OMAP4_MMC_REG_OFFSET ; +else + mmc->reg_offset =0 ;
1. Since you mentioned that, this is useful for hwmod, the register offsets should use enum and static tables. You can refer to i2c-omap.c for more details and dma hwmod review comments for more details.
https://patchwork.kernel.org/patch/126251/
2. Replace macros with inline functions for low level read/write functions.
-Manjunath
PATCH v2 3/4 omap4 hsmmc: Register offset handling
Manju,
Quoted 75 lines · Manjunath Kondaiah
Quoted 75 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Kadiyala, Kishore
Sent: Saturday, September 18, 2010 10:04 PM
To: linux-mmc at vger.kernel.org; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Cc: khilman at deeprootsystems.com; Cousson, Benoit
Subject: [PATCH v2 3/4] omap4 hsmmc: Register offset handlingThe offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver.
Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver. The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly.Signed-off-by Kishore Kadiyala <[email protected]>---
?arch/arm/mach-omap2/devices.c ? ? ? ? | ? ?8 +++----- ?arch/arm/mach-omap2/hsmmc.c ? ? ? ? ? | ? ?4 ++++ ?arch/arm/plat-omap/include/plat/mmc.h | ? ?3 +++ ?drivers/mmc/host/omap_hsmmc.c ? ? ? ? | ? ?2 +-?4 files changed, 11 insertions(+), 6 deletions(-)
(quoted diff) +0
-0
b/arch/arm/mach-omap2/devices.cindex 2dbb265..bb7ec13 100644arch/arm/mach-omap2/devices.c +0
-0@@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,? ? ? ? ? ? ? case 3:
? ? ? ? ? ? ? ? ? ? ? if (!cpu_is_omap44xx())
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return;
- ? ? ? ? ? ? ? ? ? ? base =OMAP4_MMC4_BASE+OMAP4_MMC_REG_OFFSET;
+ ? ? ? ? ? ? ? ? ? ? base =OMAP4_MMC4_BASE;
? ? ? ? ? ? ? ? ? ? ? irq =OMAP44XX_IRQ_MMC4;
? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? case 4:
? ? ? ? ? ? ? ? ? ? ? if (!cpu_is_omap44xx())
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return;
- ? ? ? ? ? ? ? ? ? ? base =OMAP4_MMC5_BASE+OMAP4_MMC_REG_OFFSET;
+ ? ? ? ? ? ? ? ? ? ? base =OMAP4_MMC5_BASE;
? ? ? ? ? ? ? ? ? ? ? irq =OMAP44XX_IRQ_MMC5;
? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? default:arch/arm/mach-omap2/devices.c +1
-3@@ -762,10 +762,8 @@ void __init omap2_init_mmc(structomap_mmc_platform_data **mmc_data, ? ? ? ? ? ? ? ? ? ? ? size = OMAP2420_MMC_SIZE; ? ? ? ? ? ? ? ? ? ? ? name = "mmci-omap"; ? ? ? ? ? ? ? } else if (cpu_is_omap44xx()) { - ? ? ? ? ? ? ? ? ? ? if (i < 3) { - ? ? ? ? ? ? ? ? ? ? ? ? ? ? base += OMAP4_MMC_REG_OFFSET; + ? ? ? ? ? ? ? ? ? ? if (i < 3) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? irq += OMAP44XX_IRQ_GIC_START; - ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? size = OMAP4_HSMMC_SIZE; ? ? ? ? ? ? ? ? ? ? ? name = "mmci-omap-hs";? ? ? ? ? ? ? } else {
(quoted diff) +0
-0
b/arch/arm/mach-omap2/hsmmc.cindex c8f647b..49d76a7 100644arch/arm/mach-omap2/hsmmc.c +2
-0@@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) ? ? ? ? ? ? ? mmc->slots[0].wires = c->wires; ? ? ? ? ? ? ? mmc->slots[0].internal_clock = !c->ext_clock; ? ? ? ? ? ? ? mmc->dma_mask = 0xffffffff; + ? ? ? ? ? ? if (cpu_is_omap44xx()) + ? ? ? ? ? ? ? ? ? ? mmc->reg_offset = OMAP4_MMC_REG_OFFSET;
Quoted 8 lines
arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct · line 268
Quoted 2 lines
arch/arm/mach-omap2/hsmmc.c +2
-0+ ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? mmc->reg_offset = 0;1. Since you mentioned that, this is useful for hwmod, the register offsets should use enum and static tables. You can refer to
i2c-omap.cfor more details and dma hwmod review comments for more details.
https://patchwork.kernel.org/patch/126251/
I've avoided using static tables for register offset handling as suggested by Benoit for HSMMC driver.Instead had the offset updated in hsmmc.c and used in driver.
Could you check the latest version V4
http://www.spinics.net/lists/linux-omap/msg37226.html
Quoted 3 lines
2. Replace macros with inline functions for low level read/write functions.
Didn't touch this in the latest V4
Regards,
Kishore
Quoted 7 lines
?-Manjunath
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html