From 7b4add1789640d188d2c5d4c7885f942908846f6 Mon Sep 17 00:00:00 2001 From: Alexandre Bard Date: Tue, 11 Jan 2022 12:02:12 +0100 Subject: [PATCH] nm-boards: Replace all devicetree paths with aliases This is easier to maintain and should be compatible with any kernel version as long as the devicetree aliases are maintained. BugzID: 77112 --- board/nm/hw25/board.c | 14 +++++++------- board/nm/nmhw21/board.c | 8 ++++---- board/nm/nrhw20/board.c | 4 ++-- board/nm/nrhw24/board.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/board/nm/hw25/board.c b/board/nm/hw25/board.c index 09a104669d..9f35fdaf29 100644 --- a/board/nm/hw25/board.c +++ b/board/nm/hw25/board.c @@ -1304,13 +1304,13 @@ static void ft_dio(void *blob) ft_enable_node(blob, "/netbox_dio_2in_1out"); /* OEM Linux gpios -> remove IOs not present */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@7000/gpio@0", 27, ""); /* gpio0_27: IO_OUT1n */ - ft_set_gpio_name(blob, "/ocp/interconnect@48000000/segment@0/target-module@4c000/gpio@0", 14, ""); /* gpio1_14: IO_IN2 */ - ft_set_gpio_name(blob, "/ocp/interconnect@48000000/segment@0/target-module@4c000/gpio@0", 15, ""); /* gpio1_15: IO_IN3 */ + ft_set_gpio_name(blob, "gpio0", 27, ""); /* gpio0_27: IO_OUT1n */ + ft_set_gpio_name(blob, "gpio1", 14, ""); /* gpio1_14: IO_IN2 */ + ft_set_gpio_name(blob, "gpio1", 15, ""); /* gpio1_15: IO_IN3 */ /* pmic_gpios: 5: IO_IN2_WAKE3n, 6: IO_IN2_WAKE3n */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/da9063@58/gpio", 5, ""); - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/da9063@58/gpio", 6, ""); + ft_set_gpio_name(blob, "pmic_gpios", 5, ""); + ft_set_gpio_name(blob, "pmic_gpios", 6, ""); break; default: @@ -1325,8 +1325,8 @@ static void ft_tty(void *blob) } else { /* OEM Linux gpios -> remove IOs not present */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@7000/gpio@0", 22, ""); /* gpio0_22: SEL_RS232_RS485n */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@7000/gpio@0", 23, ""); /* gpio0_23: RS485_TERM_ENn */ + ft_set_gpio_name(blob, "gpio0", 22, ""); /* gpio0_22: SEL_RS232_RS485n */ + ft_set_gpio_name(blob, "gpio0", 23, ""); /* gpio0_23: RS485_TERM_ENn */ } } diff --git a/board/nm/nmhw21/board.c b/board/nm/nmhw21/board.c index 15da7f3b18..92ec727c10 100644 --- a/board/nm/nmhw21/board.c +++ b/board/nm/nmhw21/board.c @@ -2123,7 +2123,7 @@ static void ft_user_interface(void *blob) if (ui_hw_version == 1) { int node_offset; - node_offset = fdt_path_offset(blob, "/ocp/interconnect@48000000/segment@0/target-module@2a000/i2c@0/pca9539@74/"); + node_offset = fdt_path_offset(blob, "ui_v1"); if (node_offset != -1) { fdt_setprop_string(blob, node_offset, "status", "okay"); } @@ -2148,7 +2148,7 @@ static void ft_user_interface(void *blob) else if (ui_hw_version == 2) { int node_offset; - node_offset = fdt_path_offset(blob, "/ocp/interconnect@48000000/segment@0/target-module@2a000/i2c@0/pca9538@70/"); + node_offset = fdt_path_offset(blob, "ui_v2"); if (node_offset != -1) { fdt_setprop_string(blob, node_offset, "status", "okay"); } @@ -2206,13 +2206,13 @@ static void ft_eth(void *blob) if (hw_ver == 1) { int node_offset; - node_offset = fdt_path_offset(blob, "/ocp/interconnect@4a000000/segment@0/target-module@100000/ethernet@0/mdio@1000/ethernet-phy@2/"); + node_offset = fdt_path_offset(blob, "broadr1"); if (node_offset != -1) { fdt_setprop_u32(blob, node_offset, "", 7); fdt_setprop_u32(blob, node_offset, "reg", 7); } - node_offset = fdt_path_offset(blob, "/ocp/interconnect@4a000000/segment@0/target-module@100000/ethernet@0/mdio@1000/ethernet-phy@2/ethernet-phy@3/"); + node_offset = fdt_path_offset(blob, "broadr0"); if (node_offset != -1) { fdt_setprop_u32(blob, node_offset, "", 6); fdt_setprop_u32(blob, node_offset, "reg", 6); diff --git a/board/nm/nrhw20/board.c b/board/nm/nrhw20/board.c index 0a723bc95a..8839dd5ea7 100644 --- a/board/nm/nrhw20/board.c +++ b/board/nm/nrhw20/board.c @@ -1330,10 +1330,10 @@ end: ; static void ft_comio_gpios(void *blob) { /* gpio0_7: COM/IO relay output */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@7000/gpio@0", 7, "COMIO_OUT0"); + ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0"); /* gpio1_8: COM/IO digital input */ - ft_set_gpio_name(blob, "/ocp/interconnect@48000000/segment@0/target-module@4c000/gpio@0", 8, "COMIO_IN0"); + ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0"); } static void ft_shields(void* blob) diff --git a/board/nm/nrhw24/board.c b/board/nm/nrhw24/board.c index d9226d9c0b..84b914c843 100644 --- a/board/nm/nrhw24/board.c +++ b/board/nm/nrhw24/board.c @@ -1242,10 +1242,10 @@ end: ; static void ft_comio_gpios(void *blob) { /* gpio0_7: COM/IO relay output */ - ft_set_gpio_name(blob, "/ocp/interconnect@44c00000/segment@200000/target-module@7000/gpio@0", 7, "COMIO_OUT0"); + ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0"); /* gpio1_8: COM/IO digital input */ - ft_set_gpio_name(blob, "/ocp/interconnect@48000000/segment@0/target-module@4c000/gpio@0", 8, "COMIO_IN0"); + ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0"); } static void ft_shields(void* blob)