fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
PATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
From: Shengzhou Liu <[email protected]>
Add common function fdt_set_node_status() to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org).
fdt_set_status_by_alias() is based on fdt_set_node_status() but uses an alias string to identify the node to update.
We also add some shortcut functions to help the common cases of setting "okay" and "disabled":
fdt_status_okay()
fdt_status_disabled()
fdt_status_okay_by_alias()
fdt_status_disabled_by_alias()
Finally, we fixup the corenet_ds ethernet code which previously had a function by the same name that can be replaced with the new helpers.
--- board/freescale/corenet_ds/eth_hydra.c | 26 ++------------ board/freescale/corenet_ds/eth_p4080.c | 36 +++++-------------- common/fdt_support.c | 60 +++++++++++++++++++++++++++++++- include/fdt_support.h | 28 +++++++++++++++ 4 files changed, 101 insertions(+), 49 deletions(-)
board/freescale/corenet_ds/eth_hydra.c +4 -22
@@ -70,6 +70,7 @@#include <fm_eth.h> #include <fsl_mdio.h> #include <malloc.h> +#include <fdt_support.h> #include <asm/fsl_dtsec.h> #include "../common/ngpixis.h"
@@ -200,25 +201,6 @@ static int hydra_mdio_init(char *realbusname, char *fakebusname) }/* -* Given an alias or a path for a node, set the status of that node. -* -* If 'alias' is not a valid alias, then it is treated as a full path to the -* node. No error checking is performed. -* -* This function is normally called to set the status for a virtual MDIO node. -*/ -static void fdt_set_node_status (void *fdt,const char *alias, -const char *status) -{ -const char *path =fdt_get_alias (fdt, alias); - -if (!path) - path = alias; - -do_fixup_by_path (fdt, path,"status" , status,strlen (status) +1 ,1 ); -} - -/* * Given an alias or a path for a node, set the mux value of that node. * * If 'alias' is not a valid alias, then it is treated as a full path to the
@@ -372,14 +354,14 @@ void fdt_fixup_board_enet(void *fdt)case PHY_INTERFACE_MODE_SGMII : lane =serdes_get_first_lane (SGMII_FM1_DTSEC1 + idx);if (lane >=0 ) { -fdt_set_node_status (fdt,"emi1_sgmii" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi1_sgmii" );/* Also set the MUX value */ fdt_set_mdio_mux (fdt,"emi1_sgmii" , mdio_mux[i].val); }break ;case PHY_INTERFACE_MODE_RGMII : -fdt_set_node_status (fdt,"emi1_rgmii" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi1_rgmii" );break ;default :break ;
@@ -388,7 +370,7 @@ void fdt_fixup_board_enet(void *fdt) lane =serdes_get_first_lane (XAUI_FM1 );if (lane >=0 ) -fdt_set_node_status (fdt,"emi2_xgmii" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi2_xgmii" );#endif }
board/freescale/corenet_ds/eth_p4080.c +10 -26
@@ -199,22 +199,6 @@ static int p4080ds_mdio_init(char *realbusname, u32 muxval)return mdio_register (bus); } -/* -* Sets the specified node's status to the value contained in "status" -* If the first character of the specified path is "/" then we use -* alias as a path. Otherwise, we look for an alias of that name -*/ -static void fdt_set_node_status (void *fdt,const char *alias, -const char *status) -{ -const char *path =fdt_get_alias (fdt, alias); - -if (!path) - path = alias; - -do_fixup_by_path (fdt, path,"status" , status,strlen (status) +1 ,1 ); -} -void board_ft_fman_fixup_port (void *blob,char * prop,phys_addr_t pa,enum fm_port port,int offset) {
@@ -255,28 +239,28 @@ void fdt_fixup_board_enet(void *fdt)*/ /* We've got six MDIO nodes that may or may not need to exist */ -fdt_set_node_status (fdt,"emi1_slot3" ,"disabled" ); -fdt_set_node_status (fdt,"emi1_slot4" ,"disabled" ); -fdt_set_node_status (fdt,"emi1_slot5" ,"disabled" ); -fdt_set_node_status (fdt,"emi2_slot4" ,"disabled" ); -fdt_set_node_status (fdt,"emi2_slot5" ,"disabled" ); +fdt_status_disabled_by_alias (fdt,"emi1_slot3" ); +fdt_status_disabled_by_alias (fdt,"emi1_slot4" ); +fdt_status_disabled_by_alias (fdt,"emi1_slot5" ); +fdt_status_disabled_by_alias (fdt,"emi2_slot4" ); +fdt_status_disabled_by_alias (fdt,"emi2_slot5" );for (i =0 ; i <NUM_FM_PORTS ; i++) {switch (mdio_mux[i]) {case EMI1_SLOT3 : -fdt_set_node_status (fdt,"emi1_slot3" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi1_slot3" );break ;case EMI1_SLOT4 : -fdt_set_node_status (fdt,"emi1_slot4" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi1_slot4" );break ;case EMI1_SLOT5 : -fdt_set_node_status (fdt,"emi1_slot5" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi1_slot5" );break ;case EMI2_SLOT4 : -fdt_set_node_status (fdt,"emi2_slot4" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi2_slot4" );break ;case EMI2_SLOT5 : -fdt_set_node_status (fdt,"emi2_slot5" ,"okay" ); +fdt_status_okay_by_alias (fdt,"emi2_slot5" );break ; } }
common/fdt_support.c +59 -1
72 lines not on this page · raw message
include/fdt_support.h +28 -0
@@ -97,5 +97,33 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr);u64 fdt_get_base_address (void *fdt,int node); +enum fdt_status { +FDT_STATUS_OKAY , +FDT_STATUS_DISABLED , +FDT_STATUS_FAIL , +FDT_STATUS_FAIL_ERROR_CODE , +}; +int fdt_set_node_status (void *fdt,int nodeoffset, +enum fdt_status status,unsigned int error_code); +static inline int fdt_status_okay (void *fdt,int nodeoffset) +{ +return fdt_set_node_status (fdt, nodeoffset,FDT_STATUS_OKAY ,0 ); +} +static inline int fdt_status_disabled (void *fdt,int nodeoffset) +{ +return fdt_set_node_status (fdt, nodeoffset,FDT_STATUS_DISABLED ,0 ); +} + +int fdt_set_status_by_alias (void *fdt,const char * alias, +enum fdt_status status,unsigned int error_code); +static inline int fdt_status_okay_by_alias (void *fdt,const char * alias) +{ +return fdt_set_status_by_alias (fdt, alias,FDT_STATUS_OKAY ,0 ); +} +static inline int fdt_status_disabled_by_alias (void *fdt,const char * alias) +{ +return fdt_set_status_by_alias (fdt, alias,FDT_STATUS_DISABLED ,0 ); +} +#endif /* ifdef CONFIG_OF_LIBFDT */ #endif /* ifndef __FDT_SUPPORT_H */
Signature · 1 line
1.7.3.4
PATCH 2/2 powerpc/85xx: Update USB device tree status based on pin settings
From: Shengzhou Liu <[email protected]>
For P3060 and P4080, USB pins are multiplexed with other functions. Update the device tree status for USB ports based on setting of RCW[EC1] & RCW[EC2] which describe if pins are muxed to usb.
--- arch/powerpc/cpu/mpc85xx/fdt.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
arch/powerpc/cpu/mpc85xx/fdt.c +23 -0
@@ -538,6 +538,27 @@ void fdt_fixup_fman_firmware(void *blob)#define fdt_fixup_fman_firmware (x)#endif +#if defined(CONFIG_PPC_P4080 ) || defined(CONFIG_PPC_P3060 ) +static void fdt_fixup_usb (void *fdt) +{ +ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +u32 rcwsr11 =in_be32 (&gur->rcwsr[11 ]); +int off; + + off =fdt_node_offset_by_compatible (fdt,-1 ,"fsl,mpc85xx-usb2-mph" ); +if ((rcwsr11 &FSL_CORENET_RCWSR11_EC1 ) != +FSL_CORENET_RCWSR11_EC1_FM1_USB1 ) +fdt_status_disabled (fdt, off); + + off =fdt_node_offset_by_compatible (fdt,-1 ,"fsl,mpc85xx-usb2-dr" ); +if ((rcwsr11 &FSL_CORENET_RCWSR11_EC2 ) != +FSL_CORENET_RCWSR11_EC2_USB2 ) +fdt_status_disabled (fdt, off); +} +#else +#define fdt_fixup_usb (x) +#endif +void ft_cpu_setup (void *blob,bd_t *bd) {int off;
@@ -642,6 +663,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)do_fixup_by_compat_u32 (blob,"fsl,flexcan-v1.0" ,"clock_freq" , gd->bus_clk,1 ); + +fdt_fixup_usb (blob); }/*
Signature · 1 line
1.7.3.4
Kumar Gala
AppliedPATCH 2/2 powerpc/85xx: Update USB device tree status based on pin settings
Quoted 11 lines · Kumar Gala
From: Shengzhou Liu <[email protected]>
For P3060 and P4080, USB pins are multiplexed with other functions. Update the device tree status for USB ports based on setting of RCW[EC1] & RCW[EC2] which describe if pins are muxed to usb.
Signed-off-by Shengzhou Liu <[email protected]>Signed-off-by Kumar Gala <[email protected]>---
arch/powerpc/cpu/mpc85xx/fdt.c| 23 +++++++++++++++++++++++1 files changed, 23 insertions(+), 0 deletions(-)
applied to 85xx
- k
PATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
In reply to Kumar GalaHi Kumar, Shengzhou,
Quoted 20 lines · Kumar Gala
From: Shengzhou Liu<[email protected]>
Add common function
fdt_set_node_status()to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org).
fdt_set_status_by_alias()is based onfdt_set_node_status()but uses an alias string to identify the node to update.We also add some shortcut functions to help the common cases of setting "okay" and "disabled":
fdt_status_okay()
fdt_status_disabled()
fdt_status_okay_by_alias()
fdt_status_disabled_by_alias()Finally, we fixup the
corenet_dsethernet code which previously had a function by the same name that can be replaced with the new helpers.
Quoted 8 lines
Signed-off-by Shengzhou Liu<[email protected]>Signed-off-by Kumar Gala<[email protected]>--- board/freescale/corenet_ds/eth_hydra.c | 26 ++------------ board/freescale/corenet_ds/eth_p4080.c | 36 +++++-------------- common/fdt_support.c | 60 +++++++++++++++++++++++++++++++- include/fdt_support.h | 28 +++++++++++++++ 4 files changed, 101 insertions(+), 49 deletions(-)
While this touches fdt_support.[ch] which is nominally "mine", it is coupled with the Freescale support. I could make you break it into two, but then I would have to do more work and you (and wd) would have to make sure they went into u-boot in the right order. That sounds ugly, so I would prefer Kumar apply it to his subrepo to feed into u-boot.
Best regards,
gvb
[snip]
Kumar Gala
AppliedPATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
Quoted 32 lines · Jerry Van Baren
Hi Kumar, Shengzhou,
Quoted 20 lines · Kumar Gala
From: Shengzhou Liu<[email protected]>
Add common function
fdt_set_node_status()to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org).
fdt_set_status_by_alias()is based onfdt_set_node_status()but uses an alias string to identify the node to update.We also add some shortcut functions to help the common cases of setting "okay" and "disabled":
fdt_status_okay()
fdt_status_disabled()
fdt_status_okay_by_alias()
fdt_status_disabled_by_alias()Finally, we fixup the
corenet_dsethernet code which previously had a function by the same name that can be replaced with the new helpers.Quoted 8 lines
Signed-off-by Shengzhou Liu<[email protected]>Signed-off-by Kumar Gala<[email protected]>--- board/freescale/corenet_ds/eth_hydra.c | 26 ++------------ board/freescale/corenet_ds/eth_p4080.c | 36 +++++-------------- common/fdt_support.c | 60 +++++++++++++++++++++++++++++++- include/fdt_support.h | 28 +++++++++++++++ 4 files changed, 101 insertions(+), 49 deletions(-)
Quoted 6 lines
While this touches fdt_support.[ch] which is nominally "mine", it is coupled with the Freescale support. I could make you break it into two, but then I would have to do more work and you (and wd) would have to make sure they went into u-boot in the right order. That sounds ugly, so I would prefer Kumar apply it to his subrepo to feed into u-boot.
Acked-by Gerald Van Baren <[email protected]>Best regards,
gvb
applied to 85xx
- k
PATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
In reply to Kumar GalaDear Kumar Gala,
Quoted 17 lines · In message <[email protected]> you…
From: Shengzhou Liu <[email protected]>
Add common function
fdt_set_node_status()to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org).
fdt_set_status_by_alias()is based onfdt_set_node_status()but uses an alias string to identify the node to update.We also add some shortcut functions to help the common cases of setting "okay" and "disabled":
fdt_status_okay()
fdt_status_disabled()
fdt_status_okay_by_alias()
fdt_status_disabled_by_alias()
Quoted 5 lines
Finally, we fixup the
corenet_dsethernet code which previously had a function by the same name that can be replaced with the new helpers.Signed-off-by Shengzhou Liu <[email protected]>Signed-off-by Kumar Gala <[email protected]>
This patch breaks a number of boards by growing the code size even for boards which never make use of this new stuff.
Affected boards: TQM8555 TQM8541
[Building with ELDK 4.2]:
+ ./MAKEALL TQM8555
Configuring for TQM8555 - Board: TQM85xx, Options: MPC8555,TQM8555=y,HOSTNAME=tqm8555,BOARDNAME="TQM8555"
ppc_6xx-ld: warning: dot moved backwards before `.bss'
ppc_6xx-ld: warning: dot moved backwards before `.bss'
ppc_6xx-ld: u-boot: section .text lma 0xfffc0000 overlaps previous sections
ppc_6xx-ld: u-boot: section .rodata lma 0xfffef388 overlaps previous sections
ppc_6xx-ld: u-boot: section .reloc lma 0xffffa400 overlaps previous sections
ppc_6xx-ld: u-boot: section .data lma 0xffffcd3c overlaps previous sections
ppc_6xx-ld: u-boot: section .u_boot_cmd lma 0xffffea68 overlaps previous sections
ppc_6xx-ld: u-boot: section .bootpg lma 0xfffff0dc overlaps previous sections
Please fix.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Each honest calling, each walk of life, has its own elite, its own aristocracy based on excellence of performance. - James Bryant Conant
PATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
Quoted 33 lines · Wolfgang Denk
Dear Kumar Gala,
Quoted 17 lines · In message <[email protected]> you…
From: Shengzhou Liu <[email protected]>
Add common function
fdt_set_node_status()to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org).
fdt_set_status_by_alias()is based onfdt_set_node_status()but uses an alias string to identify the node to update.We also add some shortcut functions to help the common cases of setting "okay" and "disabled":
fdt_status_okay()
fdt_status_disabled()
fdt_status_okay_by_alias()
fdt_status_disabled_by_alias()Quoted 5 lines
Finally, we fixup the
corenet_dsethernet code which previously had a function by the same name that can be replaced with the new helpers.Signed-off-by Shengzhou Liu <[email protected]>Signed-off-by Kumar Gala <[email protected]>This patch breaks a number of boards by growing the code size even for boards which never make use of this new stuff.
Affected boards: TQM8555 TQM8541
[Building with ELDK 4.2]:
Quoted 10 lines
+ ./MAKEALL TQM8555
Configuring for TQM8555 - Board: TQM85xx, Options: MPC8555,TQM8555=y,HOSTNAME=tqm8555,BOARDNAME="TQM8555"
ppc_6xx-ld: warning: dot moved backwards before `.bss'
ppc_6xx-ld: warning: dot moved backwards before `.bss'
ppc_6xx-ld: u-boot: section .text lma0xfffc0000overlaps previous sections
ppc_6xx-ld: u-boot: section .rodata lma0xfffef388overlaps previous sections
ppc_6xx-ld: u-boot: section .reloc lma0xffffa400overlaps previous sections
ppc_6xx-ld: u-boot: section .data lma0xffffcd3coverlaps previous sections
ppc_6xx-ld: u-boot: section .u_boot_cmd lma0xffffea68overlaps previous sections
ppc_6xx-ld: u-boot: section .bootpg lma0xfffff0dcoverlaps previous sections
Is part of our issue with older gcc-4.2 toolchain that the linker doesn't garbage collect unused functions?
- k
PATCH 1/2 fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
Dear Kumar Gala,
Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
[Building with ELDK 4.2]:
...
Quoted 2 lines
Is part of our issue with older gcc-4.2 toolchain that the linker doesn't garbage collect unused functions?
Which binutils version is minimally needed? ElDK 4.2 uses GNU ld version 2.17.50.0.12 20070128 ...
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I am more bored than you could ever possibly be. Go back to work.