ARM: OMAP2+: Optimize soc_is calls
Subsystems (4)
v2 cover ARM: OMAP2+: Optimize soc_is calls
The series implements optimizing soc_is calls for DRA7 and AM43XX family of SoCs. Originally the soc_is calls for DRA7 involved parsing device tree nodes and some repetitive string comparisons. Optimizing to store the result and use the result in the subsequent calls.
The series is boot tested on am437x-gp-evm, am335x-beaglebone, dra7-evm, dra72-evm, omap3 beagle-xm.
Compile Testing:
** Compile tested individual: OMAP2, OMAP3, OMAP4, OMAP5, DRA7XX, AM437x,
AM33XX defconfig.
** Ran Randconfig and found no errors under arch/arm/mach-omap2
overnight testing.
Source: https://github.com/felipebalbi/omap-seeds
The series is on top of:
https://patchwork.kernel.org/patch/7390351/
Keerthy (3):
ARM: OMAP2: DRA7: Modify optimize string comparisons in soc_is calls
ARM: dts: AM43x-epos-evm: Add AM438x compatible string for epos
ARM: OMAP2: AM43XX: Modify optimize string comparisons in soc_is calls
.../devicetree/bindings/arm/omap/omap.txt | 5 +++- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- arch/arm/mach-omap2/id.c | 28 ++++++++++++++++++++++ arch/arm/mach-omap2/soc.h | 25 +++++++++++++++---- 4 files changed, 53 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/3 ARM: OMAP2: DRA7: Modify optimize string comparisons in soc_is calls
Currently everytime soc_is calls are made, firstly device tree nodes are parsed and then string comparisons are made to determine the soc version. Optimizing it to be done one time and store the result. Use the stored value in all the subsequent checks for soc_is calls.
---
Changes in v2:
* Rebased to latest 4.3-rc5
arch/arm/mach-omap2/id.c | 17 +++++++++++++++++ arch/arm/mach-omap2/soc.h | 15 ++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/id.c +17 -0
@@ -40,6 +40,7 @@#define OMAP_SOC_MAX_NAME_LENGTH 16static unsigned int omap_revision; +static unsigned long soc_ids;static char soc_name[OMAP_SOC_MAX_NAME_LENGTH ];static char soc_rev[OMAP_SOC_MAX_NAME_LENGTH ];u32 omap_features;
@@ -50,6 +51,21 @@ unsigned int omap_rev(void) }EXPORT_SYMBOL (omap_rev); +void init_dra_soc_id (void ) +{ +if (of_machine_is_compatible ("ti,dra7" )) + soc_ids |=DRA7XX ; +if (of_machine_is_compatible ("ti,dra74" )) + soc_ids |=DRA74X ; +if (of_machine_is_compatible ("ti,dra72" )) + soc_ids |=DRA72X ; +} + +int check_soc_version (unsigned long id) +{ +return soc_ids & id; +} +int omap_type (void ) {static u32 val =OMAP2_DEVICETYPE_MASK ;
@@ -643,6 +659,7 @@ void __init dra7xxx_check_revision(void)u16 hawkeye;u8 rev; +init_dra_soc_id (); idcode =read_tap_reg (OMAP_TAP_IDCODE ); hawkeye = (idcode >>12 ) &0xffff ; rev = (idcode >>28 ) &0xff ;
arch/arm/mach-omap2/soc.h +12 -3
@@ -125,6 +125,15 @@#define OMAP2_DEVICE_TYPE_GP 3#define OMAP2_DEVICE_TYPE_BAD 4 +/* +* SoC types +*/ + +#define DRA7XX BIT(0) +#define DRA74X BIT(1) +#define DRA72X BIT(2) + +int check_soc_version (unsigned long id);int omap_type (void );/*
@@ -466,9 +475,9 @@ IS_OMAP_TYPE(3430, 0x3430)#undef soc_is_dra7xx#undef soc_is_dra74x#undef soc_is_dra72x -#define soc_is_dra7xx () (of_machine_is_compatible("ti,dra7")) -#define soc_is_dra74x () (of_machine_is_compatible("ti,dra74")) -#define soc_is_dra72x () (of_machine_is_compatible("ti,dra72")) +#define soc_is_dra7xx () check_soc_version(DRA7XX) +#define soc_is_dra74x () check_soc_version(DRA74X) +#define soc_is_dra72x () check_soc_version(DRA72X)#endif /* Various silicon revisions for omap2 */
Signature · 1 line
1.9.1
Tony Lindgren
maintainerPATCH v2 1/3 ARM: OMAP2: DRA7: Modify optimize string comparisons in soc_is calls
Quoted 4 lines · Keerthy
Currently everytime
soc_iscalls are made, firstly device tree nodes are parsed and then string comparisons are made to determine the soc version. Optimizing it to be done one time and store the result. Use the stored value in all the subsequent checks forsoc_iscalls.
Let's just get rid of the of_machine_is_compatible() checks here.
When dra7xxx_check_revision we already know it's dra7, no point for any of the string parsing with of_machine_is_compatible(). We just risk things going wrong.
And we already have omap_revision that gets populated based on the hawkeye register, so let's use that instead. Can you please update this patch just to use is_dra7xx() macros like the other use?
Regards,
Tony
PATCH v2 2/3 ARM: dts: AM43x-epos-evm: Add AM438x compatible string for epos
In reply to KeerthyAdd AM438x compatible property to identify the SoCs on epos evms.
---
Changes in v2:
* Rebased to latest 4.3-rc5
Documentation/devicetree/bindings/arm/omap/omap.txt | 5 ++++- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/omap/omap.txt +4 -1
@@ -100,6 +100,9 @@ SoCs: - AM4372 compatible = "ti,am4372", "ti,am43" +- AM438x + compatible = "ti,am438x", "ti,am43" + Boards: - OMAP3 BeagleBoard : Low cost community board
@@ -142,7 +145,7 @@ Boards: compatible = "ti,omap5-evm", "ti,omap5" - AM43x EPOS EVM - compatible = "ti,am43x-epos-evm", "ti,am4372", "ti,am43" + compatible = "ti,am43x-epos-evm", "ti,am438x", "ti,am43" - AM437x GP EVM compatible = "ti,am437x-gp-evm", "ti,am4372", "ti,am43"
arch/arm/boot/dts/am43x-epos-evm.dts +1 -1
@@ -18,7 +18,7 @@ / { model = "TI AM43x EPOS EVM"; - compatible = "ti,am43x-epos-evm","ti,am4372","ti,am43"; + compatible = "ti,am43x-epos-evm", "ti,am438x", "ti,am43"; aliases { display0 = &lcd0;
Signature · 1 line
1.9.1
Tony Lindgren
maintainerPATCH v2 2/3 ARM: dts: AM43x-epos-evm: Add AM438x compatible string for epos
Quoted 18 lines · Keerthy
Add AM438x compatible property to identify the SoCs on epos evms.
Signed-off-by Keerthy <[email protected]>---
Changes in v2:
* Rebased to latest 4.3-rc5
Documentation/devicetree/bindings/arm/omap/omap.txt | 5 ++++- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/arm/omap/omap.txt +0
-0
Documentation/devicetree/bindings/arm/omap/omap.txt SoCs: · line 105
Quoted 6 lines
Documentation/devicetree/bindings/arm/omap/omap.txt +3
-0@@ -100,6 +100,9 @@ SoCs: - AM4372 compatible = "ti,am4372", "ti,am43" +- AM438x + compatible = "ti,am438x", "ti,am43" +
The compatible strings should not have x, this should be "ti,am438" instead. But my guess is that we are better off adding proper SoC detection to avoid needing a separate dts file for each SoC revision. Ideally booting with "ti,am43" should be enough and we can initialize the rest during runtime.
Regards,
Tony
PATCH v2 3/3 ARM: OMAP2: AM43XX: Modify optimize string comparisons in soc_is calls
In reply to KeerthyCurrently everytime soc_is calls are made, firstly device tree nodes are parsed and then string comparisons are made to determine the soc version. Optimizing it to be done one time and store the result. Use the stored value in all the subsequent checks for soc_is calls.
---
Changes in v2:
* Rebased to latest 4.3-rc5
arch/arm/mach-omap2/id.c | 11 +++++++++++ arch/arm/mach-omap2/soc.h | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/id.c +11 -0
@@ -61,6 +61,16 @@ void init_dra_soc_id(void) soc_ids |=DRA72X ; } +void init_am43_soc_id (void ) +{ +if (of_machine_is_compatible ("ti,am43" )) + soc_ids |=AM43XX ; +if (of_machine_is_compatible ("ti,am4372" )) + soc_ids |=AM437X ; +if (of_machine_is_compatible ("ti,am438x" )) + soc_ids |=AM438X ; +} +int check_soc_version (unsigned long id) {return soc_ids & id;
@@ -357,6 +367,7 @@ void __init omap3xxx_check_revision(void)u16 hawkeye;u8 rev; +init_am43_soc_id ();/* * We cannot access revision registers on ES1.0. * If the processor type is Cortex-A8 and the revision is 0x0
arch/arm/mach-omap2/soc.h +8 -2
@@ -132,6 +132,9 @@#define DRA7XX BIT(0)#define DRA74X BIT(1)#define DRA72X BIT(2) +#define AM43XX BIT(3) +#define AM437X BIT(4) +#define AM438X BIT(5)int check_soc_version (unsigned long id);int omap_type (void );
@@ -266,6 +269,7 @@ IS_AM_SUBCLASS(437x, 0x437)#define soc_is_am335x () 0#define soc_is_am43xx () 0#define soc_is_am437x () 0 +#define soc_is_am438x () 0#define cpu_is_omap44xx () 0#define cpu_is_omap443x () 0#define cpu_is_omap446x () 0
@@ -441,8 +445,10 @@ IS_OMAP_TYPE(3430, 0x3430)#ifdef CONFIG_SOC_AM43XX # undef soc_is_am43xx# undef soc_is_am437x -# define soc_is_am43xx () is_am43xx() -# define soc_is_am437x () is_am437x() +# undef soc_is_am438x +# define soc_is_am43xx () check_soc_version(AM43XX) +# define soc_is_am437x () check_soc_version(AM437X) +# define soc_is_am438x () check_soc_version(AM438X)#endif # if defined(CONFIG_ARCH_OMAP4 )
Signature · 1 line
1.9.1
Tony Lindgren
maintainerPATCH v2 3/3 ARM: OMAP2: AM43XX: Modify optimize string comparisons in soc_is calls
Quoted 4 lines · Keerthy
Currently everytime
soc_iscalls are made, firstly device tree nodes are parsed and then string comparisons are made to determine the soc version. Optimizing it to be done one time and store the result. Use the stored value in all the subsequent checks forsoc_iscalls.
Here too we should rely on the hawkeye register or similar.
Regards,
Tony