mips: ralink: introduce commonly used remap node function
Subsystems (3)
PATCH 1/1 mips: ralink: introduce commonly used remap node function
The ralink_of_remap() function is repeated several times on SoC specific source files. They have the same structure, but just differ in compatible strings. In order to make commonly use of these codes, this patch introduces a newly designed mtmips_of_remap_node() function to match and remap all supported system controller and memory controller nodes.
Build and run tested on MT7620 and MT7628.
--- arch/mips/ralink/common.h | 2 -- arch/mips/ralink/mt7620.c | 9 --------- arch/mips/ralink/mt7621.c | 9 --------- arch/mips/ralink/of.c | 42 ++++++++++++++++++++++++++++++++------- arch/mips/ralink/rt288x.c | 9 --------- arch/mips/ralink/rt305x.c | 9 --------- arch/mips/ralink/rt3883.c | 9 --------- 7 files changed, 35 insertions(+), 54 deletions(-)
arch/mips/ralink/common.h +0 -2
@@ -30,6 +30,4 @@ extern void ralink_rst_init(void);extern void __init prom_soc_init (struct ralink_soc_info *soc_info); -__iomem void *plat_of_remap_node (const char *node); -#endif /* _RALINK_COMMON_H__ */
arch/mips/ralink/mt7620.c +0 -9
@@ -273,15 +273,6 @@ void __init ralink_clk_init(void) } } -void __init ralink_of_remap (void ) -{ - rt_sysc_membase =plat_of_remap_node ("ralink,mt7620a-sysc" ); - rt_memc_membase =plat_of_remap_node ("ralink,mt7620a-memc" ); - -if (!rt_sysc_membase || !rt_memc_membase) -panic ("Failed to remap core resources" ); -} -static __init void mt7620_dram_init (struct ralink_soc_info *soc_info) {
arch/mips/ralink/mt7621.c +0 -9
@@ -89,15 +89,6 @@ static void __init mt7621_memory_detect(void)memblock_add (MT7621_HIGHMEM_BASE ,MT7621_HIGHMEM_SIZE ); } -void __init ralink_of_remap (void ) -{ - rt_sysc_membase =plat_of_remap_node ("mediatek,mt7621-sysc" ); - rt_memc_membase =plat_of_remap_node ("mediatek,mt7621-memc" ); - -if (!rt_sysc_membase || !rt_memc_membase) -panic ("Failed to remap core resources" ); -} -static unsigned int __init mt7621_get_soc_name0 (void ) {return __raw_readl (MT7621_SYSC_BASE +SYSC_REG_CHIP_NAME0 );
arch/mips/ralink/of.c +35 -7
63 lines not on this page · raw message
arch/mips/ralink/rt288x.c +0 -9
@@ -52,15 +52,6 @@ void __init ralink_clk_init(void)ralink_clk_add ("480000.wmac" , wmac_rate); } -void __init ralink_of_remap (void ) -{ - rt_sysc_membase =plat_of_remap_node ("ralink,rt2880-sysc" ); - rt_memc_membase =plat_of_remap_node ("ralink,rt2880-memc" ); - -if (!rt_sysc_membase || !rt_memc_membase) -panic ("Failed to remap core resources" ); -} -static unsigned int __init rt2880_get_soc_name0 (void ) {return __raw_readl (RT2880_SYSC_BASE +SYSC_REG_CHIP_NAME0 );
arch/mips/ralink/rt305x.c +0 -9
@@ -134,15 +134,6 @@ void __init ralink_clk_init(void)ralink_clk_add ("10180000.wmac" , wmac_rate); } -void __init ralink_of_remap (void ) -{ - rt_sysc_membase =plat_of_remap_node ("ralink,rt3050-sysc" ); - rt_memc_membase =plat_of_remap_node ("ralink,rt3050-memc" ); - -if (!rt_sysc_membase || !rt_memc_membase) -panic ("Failed to remap core resources" ); -} -static unsigned int __init rt305x_get_soc_name0 (void ) {return __raw_readl (RT305X_SYSC_BASE +SYSC_REG_CHIP_NAME0 );
arch/mips/ralink/rt3883.c +0 -9
@@ -65,15 +65,6 @@ void __init ralink_clk_init(void)ralink_clk_add ("10180000.wmac" ,40000000 ); } -void __init ralink_of_remap (void ) -{ - rt_sysc_membase =plat_of_remap_node ("ralink,rt3883-sysc" ); - rt_memc_membase =plat_of_remap_node ("ralink,rt3883-memc" ); - -if (!rt_sysc_membase || !rt_memc_membase) -panic ("Failed to remap core resources" ); -} -static unsigned int __init rt3883_get_soc_name0 (void ) {return __raw_readl (RT3883_SYSC_BASE +RT3883_SYSC_REG_CHIPID0_3 );
Signature · 1 line
2.30.2
Quoted 10 lines · Shiji Yang
The
ralink_of_remap()function is repeated several times on SoC specific source files. They have the same structure, but just differ in compatible strings. In order to make commonly use of these codes, this patch introduces a newly designedmtmips_of_remap_node()function to match and remap all supported system controller and memory controller nodes.Build and run tested on MT7620 and MT7628.
Signed-off-by Shiji Yang <[email protected]>
Quoted 9 lines
--- arch/mips/ralink/common.h | 2 -- arch/mips/ralink/mt7620.c | 9 --------- arch/mips/ralink/mt7621.c | 9 --------- arch/mips/ralink/of.c | 42 ++++++++++++++++++++++++++++++++------- arch/mips/ralink/rt288x.c | 9 --------- arch/mips/ralink/rt305x.c | 9 --------- arch/mips/ralink/rt3883.c | 9 --------- 7 files changed, 35 insertions(+), 54 deletions(-)
Awesome! More deletions than additions in arch folders is always a good thing :-).
Changes look good to me. Thanks for doing this!
Best regards,
Sergio Paracuellos
Quoted 24 lines · Shiji Yang
Quoted 10 lines
The
ralink_of_remap()function is repeated several times on SoC specific source files. They have the same structure, but just differ in compatible strings. In order to make commonly use of these codes, this patch introduces a newly designedmtmips_of_remap_node()function to match and remap all supported system controller and memory controller nodes.Build and run tested on MT7620 and MT7628.
Signed-off-by Shiji Yang <[email protected]>Quoted 9 lines
--- arch/mips/ralink/common.h | 2 -- arch/mips/ralink/mt7620.c | 9 --------- arch/mips/ralink/mt7621.c | 9 --------- arch/mips/ralink/of.c | 42 ++++++++++++++++++++++++++++++++------- arch/mips/ralink/rt288x.c | 9 --------- arch/mips/ralink/rt305x.c | 9 --------- arch/mips/ralink/rt3883.c | 9 --------- 7 files changed, 35 insertions(+), 54 deletions(-)Awesome! More deletions than additions in arch folders is always a good thing :-).
Quoted 6 lines
Changes look good to me. Thanks for doing this!
Reviewed-by Sergio Paracuellos <[email protected]>Best regards,
Sergio Paracuellos
Thank you for your review. After your new system control driver[1] is merged, with this patch, we can add more compatible IDs to the list.
[1] https://lore.kernel.org/all/[email protected]/
Best regards,
Shiji Yang
Quoted 9 lines · Shiji Yang
The
ralink_of_remap()function is repeated several times on SoC specific source files. They have the same structure, but just differ in compatible strings. In order to make commonly use of these codes, this patch introduces a newly designedmtmips_of_remap_node()function to match and remap all supported system controller and memory controller nodes.Build and run tested on MT7620 and MT7628.
Signed-off-by Shiji Yang <[email protected]>
Quoted 9 lines
--- arch/mips/ralink/common.h | 2 -- arch/mips/ralink/mt7620.c | 9 --------- arch/mips/ralink/mt7621.c | 9 --------- arch/mips/ralink/of.c | 42 ++++++++++++++++++++++++++++++++------- arch/mips/ralink/rt288x.c | 9 --------- arch/mips/ralink/rt305x.c | 9 --------- arch/mips/ralink/rt3883.c | 9 --------- 7 files changed, 35 insertions(+), 54 deletions(-)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]