Message ID | 1496155669-1677-5-git-send-email-t-kristo@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, * Tero Kristo <t-kristo@ti.com> [170530 07:51]: > This function gets the physical base address of a clockdomain. .. > +static u32 omap4_clkdm_xlate_address(struct clockdomain *clkdm) > +{ > + u32 addr = (u32)_cm_bases[clkdm->prcm_partition] - OMAP2_L4_IO_OFFSET + > + clkdm->cm_inst + clkdm->clkdm_offs; > + > + return addr; > +} > + Hmm this will be flakey as it assumes fixed mappings for all these which we do not have on all SoCs. It would be best to pass the domain bases around as struct resource then just ioremap locally. It might be enough if we changed _cm_bases[] locally to be an array of: struct omap_domain_base { struct resource res; void __iomem *va; }; Or do you have better ideas? Regards, Tony
On 30/05/17 21:10, Tony Lindgren wrote: > Hi, > > * Tero Kristo <t-kristo@ti.com> [170530 07:51]: >> This function gets the physical base address of a clockdomain. > .. >> +static u32 omap4_clkdm_xlate_address(struct clockdomain *clkdm) >> +{ >> + u32 addr = (u32)_cm_bases[clkdm->prcm_partition] - OMAP2_L4_IO_OFFSET + >> + clkdm->cm_inst + clkdm->clkdm_offs; >> + >> + return addr; >> +} >> + > > Hmm this will be flakey as it assumes fixed mappings > for all these which we do not have on all SoCs. > > It would be best to pass the domain bases around as > struct resource then just ioremap locally. > > It might be enough if we changed _cm_bases[] locally > to be an array of: > > struct omap_domain_base { > struct resource res; > void __iomem *va; > }; > > Or do you have better ideas? > > Regards, > > Tony > Ok, I have a patch available that saves the physical addresses during probe and uses this info during the xlate phase. Will post in a bit. -Tero
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c index 2ab27ad..3df268e 100644 --- a/arch/arm/mach-omap2/cminst44xx.c +++ b/arch/arm/mach-omap2/cminst44xx.c @@ -31,6 +31,7 @@ #include "prm44xx.h" #include "prcm_mpu44xx.h" #include "prcm-common.h" +#include "iomap.h" #define OMAP4430_IDLEST_SHIFT 16 #define OMAP4430_IDLEST_MASK (0x3 << 16) @@ -475,6 +476,14 @@ static int omap4_clkdm_clk_disable(struct clockdomain *clkdm) return 0; } +static u32 omap4_clkdm_xlate_address(struct clockdomain *clkdm) +{ + u32 addr = (u32)_cm_bases[clkdm->prcm_partition] - OMAP2_L4_IO_OFFSET + + clkdm->cm_inst + clkdm->clkdm_offs; + + return addr; +} + struct clkdm_ops omap4_clkdm_operations = { .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep, .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep, @@ -490,6 +499,7 @@ struct clkdm_ops omap4_clkdm_operations = { .clkdm_deny_idle = omap4_clkdm_deny_idle, .clkdm_clk_enable = omap4_clkdm_clk_enable, .clkdm_clk_disable = omap4_clkdm_clk_disable, + .clkdm_xlate_address = omap4_clkdm_xlate_address, }; struct clkdm_ops am43xx_clkdm_operations = { @@ -499,6 +509,7 @@ struct clkdm_ops am43xx_clkdm_operations = { .clkdm_deny_idle = omap4_clkdm_deny_idle, .clkdm_clk_enable = omap4_clkdm_clk_enable, .clkdm_clk_disable = omap4_clkdm_clk_disable, + .clkdm_xlate_address = omap4_clkdm_xlate_address, }; static struct cm_ll_data omap4xxx_cm_ll_data = {
This function gets the physical base address of a clockdomain. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/cminst44xx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)