OMAP: omap_device: use pdev as parameter to get rt_va
Subsystems (2)
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Make the parameter received by omap_device_get_mpu_rt_va consistent with the functions meant to be called by drivers.
Also move its header declaration to appear in the set of functions to be used by drivers, as per the comment there.
--- arch/arm/plat-omap/include/plat/omap_device.h | 3 +-- arch/arm/plat-omap/omap_device.c | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/plat-omap/include/plat/omap_device.h +1 -2
@@ -80,6 +80,7 @@ struct omap_device {int omap_device_enable (struct platform_device *pdev);int omap_device_idle (struct platform_device *pdev);int omap_device_shutdown (struct platform_device *pdev); +void __iomem *omap_device_get_rt_va (struct platform_device *pdev);/* Core code interface */
@@ -101,8 +102,6 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,int omap_device_register (struct omap_device *od);int omap_early_device_register (struct omap_device *od); -void __iomem *omap_device_get_rt_va (struct omap_device *od); -/* OMAP PM interface */ int omap_device_align_pm_lat (struct platform_device *pdev,u32 new_wakeup_lat_limit);
arch/arm/plat-omap/omap_device.c +6 -2
@@ -681,7 +681,7 @@ struct powerdomain *omap_device_get_pwrdm(struct omap_device *od)/** * omap_device_get_mpu_rt_va - return the MPU's virtual addr for the hwmod base -* @od: struct omap_device * +* @pdev: struct platform_device * * * Return the MPU's virtual address for the base of the hwmod, from * the ioremap() that the hwmod code does. Only valid if there is one
@@ -690,8 +690,12 @@ struct powerdomain *omap_device_get_pwrdm(struct omap_device *od)* otherwise, passes along the return value from * omap_hwmod_get_mpu_rt_va(). */ -void __iomem *omap_device_get_rt_va (struct omap_device *od) +void __iomem *omap_device_get_rt_va (struct platform_device *pdev) { +struct omap_device *od; + + od =_find_by_pdev (pdev); +if (od->hwmods_cnt !=1 )return NULL ;
Signature · 1 line
1.7.1
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Hi Omar,
Quoted 5 lines · Omar
Make the parameter received by
omap_device_get_mpu_rt_vaconsistent with the functions meant to be called by drivers.Also move its header declaration to appear in the set of functions to be used by drivers, as per the comment there.
Please note that even if Paul submitted this API upon request from Santosh, we do not want driver to us it most of the time.
All drivers should us the generic Linux way to get physical mem resource and then ioremap it.
I assume that if you want to update this API, you are probably already using it.
Why cannot you use the generic way?
Regards,
Benoit
Quoted 56 lines
Signed-off-by Omar Ramirez Luna<[email protected]>Acked-by Kevin Hilman<[email protected]>--- arch/arm/plat-omap/include/plat/omap_device.h | 3 +-- arch/arm/plat-omap/omap_device.c | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-)arch/arm/plat-omap/include/plat/omap_device.h +1
-2@@ -80,6 +80,7 @@ struct omap_device {int omap_device_enable (struct platform_device *pdev);int omap_device_idle (struct platform_device *pdev);int omap_device_shutdown (struct platform_device *pdev); +void __iomem *omap_device_get_rt_va (struct platform_device *pdev);/* Core code interface */ @@ -101,8 +102,6 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,int omap_device_register (struct omap_device *od);int omap_early_device_register (struct omap_device *od); -void __iomem *omap_device_get_rt_va (struct omap_device *od); -/* OMAP PM interface */ int omap_device_align_pm_lat (struct platform_device *pdev,u32 new_wakeup_lat_limit);arch/arm/plat-omap/omap_device.c +6
-2@@ -681,7 +681,7 @@ struct powerdomain *omap_device_get_pwrdm(struct omap_device *od)/** * omap_device_get_mpu_rt_va - return the MPU's virtual addr for the hwmod base -* @od: struct omap_device * +* @pdev: struct platform_device * * * Return the MPU's virtual address for the base of the hwmod, from * the ioremap() that the hwmod code does. Only valid if there is one @@ -690,8 +690,12 @@ struct powerdomain *omap_device_get_pwrdm(struct omap_device *od)* otherwise, passes along the return value from * omap_hwmod_get_mpu_rt_va(). */ -void __iomem *omap_device_get_rt_va (struct omap_device *od) +void __iomem *omap_device_get_rt_va (struct platform_device *pdev) { +struct omap_device *od; + + od =_find_by_pdev (pdev); +if (od->hwmods_cnt !=1 )return NULL ;
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Hi Benoit,
Quoted 4 lines · Benoit
Hi Omar,
Quoted 1 line · Omar
Quoted 8 lines
Quoted 5 lines
Make the parameter received by
omap_device_get_mpu_rt_vaconsistent with the functions meant to be called by drivers.Also move its header declaration to appear in the set of functions to be used by drivers, as per the comment there.
Please note that even if Paul submitted this API upon request from Santosh, we do not want driver to us it most of the time.
Oh, ok. Yes, I was under the impression that this ioremap was internal to hwmod, and drivers should do their own one; but then I noticed that API and since it was under the "public functions through struct platform data", I thought it was easier to pass pdev than od.
Quoted 2 lines
All drivers should us the generic Linux way to get physical mem resource and then ioremap it.
Then I guess this function belongs to the "public for core code" and not for drivers along with the omap_device_get_pwrdm.
Quoted 3 lines
I assume that if you want to update this API, you are probably already using it.
Why cannot you use the generic way?
I can leave the generic way along with ioremap, the purpose was to use omap_device APIs as much as possible.
Thanks,
Omar
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Hello Omar
Quoted 23 lines · Omar
Quoted 10 lines · Benoit
Quoted 6 lines · Omar
Make the parameter received by
omap_device_get_mpu_rt_vaconsistent with the functions meant to be called by drivers.Also move its header declaration to appear in the set of functions to be used by drivers, as per the comment there.
Please note that even if Paul submitted this API upon request from Santosh, we do not want driver to us it most of the time.
Oh, ok. Yes, I was under the impression that this ioremap was internal to hwmod, and drivers should do their own one but then I noticed that API and since it was under the "public functions through struct platform data", I thought it was easier to pass pdev than od.
Quoted 2 lines
All drivers should us the generic Linux way to get physical mem resource and then ioremap it.
Then I guess this function belongs to the "public for core code" and not for drivers along with the
omap_device_get_pwrdm.
Quoted 6 lines
Quoted 3 lines
I assume that if you want to update this API, you are probably already using it.
Why cannot you use the generic way?I can leave the generic way along with ioremap, the purpose was to use
omap_deviceAPIs as much as possible.
The above isn't quite it. What I'd suggest you do in your code is this:
- In your driver-to-core-OMAP integration code in arch/arm/*omap*, call omap_hwmod_get_mpu_rt_va(), and pass that to the driver via an entry in the struct platform_data.
- In your driver code in drivers/*, test to see if that struct platform_data entry is NULL. If it is, only then should your driver ioremap(). Otherwise, it should use the address from the struct platform_data.
This is because it's not guaranteed that ioremap() on OMAP will continue to reuse the current static mapping in the future. We've heard from some mobile OS vendors that they are under significant address space constraints, so on those distributions it might make sense to only map devices that are actually in use, and take the additional TLB entry cost.
Does this make sense?
- Paul
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Hello Omar
Quoted 3 lines · Paul Walmsley
- In your driver-to-core-OMAP integration code in
arch/arm/*omap*, callomap_hwmod_get_mpu_rt_va(), and pass that to the driver via an entry in the structplatform_data.
One brief note here - this should have been more clear:
- In your driver-to-core-OMAP integration code in arch/arm/*omap*, call omap_hwmod_get_mpu_rt_va(), and pass the virtual address that it returns to the driver via an entry in the struct platform_data.
- Paul
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
In reply to Paul WalmsleyQuoted 45 lines · Paul Walmsley
Hello Omar
Quoted 23 lines · Omar
Quoted 10 lines · Benoit
Quoted 6 lines · Omar
Make the parameter received by
omap_device_get_mpu_rt_vaconsistent with the functions meant to be called by drivers.Also move its header declaration to appear in the set of functions to be used by drivers, as per the comment there.
Please note that even if Paul submitted this API upon request from Santosh, we do not want driver to us it most of the time.
Oh, ok. Yes, I was under the impression that this ioremap was internal to hwmod, and drivers should do their own one but then I noticed that API and since it was under the "public functions through struct platform data", I thought it was easier to pass pdev than od.
Quoted 2 lines
All drivers should us the generic Linux way to get physical mem resource and then ioremap it.
Then I guess this function belongs to the "public for core code" and not for drivers along with the
omap_device_get_pwrdm.Quoted 6 lines
Quoted 3 lines
I assume that if you want to update this API, you are probably already using it.
Why cannot you use the generic way?I can leave the generic way along with ioremap, the purpose was to use
omap_deviceAPIs as much as possible.The above isn't quite it. What I'd suggest you do in your code is this:
- In your driver-to-core-OMAP integration code in
arch/arm/*omap*, callomap_hwmod_get_mpu_rt_va(), and pass that to the driver via an entry in the structplatform_data.- In your driver code in
drivers/*, test to see if that structplatform_dataentry is NULL. If it is, only then should your driverioremap(). Otherwise, it should use the address from the structplatform_data.
Quoted 7 lines
This is because it's not guaranteed that
ioremap()on OMAP will continue to reuse the current static mapping in the future. We've heard from some mobile OS vendors that they are under significant address space constraints, so on those distributions it might make sense to only map devices that are actually in use, and take the additional TLB entry cost.Does this make sense?
No it doesn't - this is not a valid reason to bugger about with drivers to make them non-standard.
omap_ioremap() can be improved to retain its re-use of static mappings by having some kind of tree structure or something like that - ioremap is after all not a performance critical path. There's no need to start passing virtual addresses to drivers.
PATCH 1/1 OMAP: omap_device: use pdev as parameter to get rt_va
Quoted 7 lines · Russell King - ARM Linux
No it doesn't - this is not a valid reason to bugger about with drivers to make them non-standard.
omap_ioremap()can be improved to retain its re-use of static mappings by having some kind of tree structure or something like that - ioremap is after all not a performance critical path. There's no need to start passing virtual addresses to drivers.
OK, that's the approach we'll take then, when or if that needs to happen.
Omar, please ignore my earlier post and just call ioremap() directly from your driver code.
- Paul