dm: Preparation for enhanced of-platdata (part C)
Subsystems (38)
cover dm: Preparation for enhanced of-platdata (part C)
At present various driver model data structures are accessed outside the core driver mode code. This makes it harder to adjust how certain values are stored, which is needed for of-platdata.
This series updates several a few more fields so that they are only accessed via functions.
This series also includes some changes to sandbox and x86 drivers to get them ready for the new of-platdata.
It is available at u-boot-dm/prepc-working
Simon Glass (26):
sandbox: serial: Move priv into a header file
sandbox: i2c: Move priv into a header file
sandbox: Add a compatible string for spltest
sandbox: Update dts files to reduce SPL size
x86: apl: Move priv/plat structs to headers
x86: Move priv/plat structs for intel_common to headers
x86: spl: Move priv/plat structs to headers
spi: Tidy up get/set of device node
spi: Tweak a few strange SPI NOR features for of-platdata
x86: apl: Use struct spi_nor instead of struct spi_flash
dm: core: Move priv/plat structs for simple_bus to headers
x86: sysreset: Move priv/plat structs to headers
x86: apl: Adjust how the UART gets its platform data
x86: coral: Remove unwanted nodes from SPL/TPL
x86: Drop rtc from SPL
dm: core: Split out alloc code into a new function
dm: core: Rename sqq to seq_
dm: core: Access device flags through functions
dm: core: Rename device flags to indicate it is private
dm: core: Rename dev_has_of_node() to dev_has_ofnode()
dm: core: Use dev_has_ofnode() instead of dev_of_valid()
dm: core: Access device ofnode through functions
dm: core: Rename device node to indicate it is private
dm: core: Split out scanning code to dm_scan()
dm: core: Allow the uclass list to move
dm: core: Add logging when lists_bind_fdt() fails
arch/arm/mach-stm32mp/pwr_regulator.c | 2 +- arch/sandbox/dts/sandbox.dts | 4 +- arch/sandbox/dts/sandbox.dtsi | 11 +- arch/sandbox/include/asm/i2c.h | 14 ++ arch/sandbox/include/asm/serial.h | 30 ++++ arch/x86/cpu/apollolake/hostbridge.c | 20 +-- arch/x86/cpu/apollolake/pmc.c | 8 +- arch/x86/cpu/apollolake/spl.c | 2 +- arch/x86/cpu/apollolake/uart.c | 43 +++--- arch/x86/cpu/intel_common/itss.c | 19 --- arch/x86/cpu/intel_common/p2sb.c | 9 +- arch/x86/dts/chromebook_coral.dts | 17 ++- arch/x86/dts/rtc.dtsi | 2 +- arch/x86/include/asm/arch-apollolake/gpio.h | 18 +++ .../include/asm/arch-apollolake/hostbridge.h | 28 ++++ arch/x86/include/asm/arch-apollolake/pmc.h | 16 +++ arch/x86/include/asm/arch-apollolake/uart.h | 19 ++- arch/x86/include/asm/itss.h | 21 +++ arch/x86/include/asm/p2sb.h | 18 +++ arch/x86/include/asm/sysreset.h | 18 +++ board/synopsys/hsdk/clk-lib.c | 2 +- cmd/remoteproc.c | 2 +- drivers/ata/mtk_ahci.c | 3 +- drivers/clk/clk-uclass.c | 2 +- drivers/clk/clk.c | 2 +- drivers/clk/meson/axg.c | 2 +- drivers/clk/meson/g12a.c | 2 +- drivers/clk/meson/gxbb.c | 2 +- drivers/core/device-remove.c | 18 +-- drivers/core/device.c | 135 ++++++++++-------- drivers/core/devres.c | 4 +- drivers/core/dump.c | 6 +- drivers/core/lists.c | 2 +- drivers/core/root.c | 58 +++++--- drivers/core/simple-bus.c | 7 +- drivers/core/uclass.c | 12 +- drivers/gpio/mpc8xxx_gpio.c | 4 +- drivers/gpio/octeon_gpio.c | 2 +- drivers/gpio/sandbox.c | 2 +- drivers/i2c/designware_i2c_pci.c | 4 +- drivers/i2c/i2c-uclass.c | 2 +- drivers/i2c/sandbox_i2c.c | 5 +- drivers/misc/spltest_sandbox.c | 6 + drivers/misc/swap_case.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 25 ++-- drivers/mmc/pci_mmc.c | 2 +- drivers/mtd/nand/raw/octeontx_nand.c | 4 +- drivers/mtd/nand/spi/core.c | 2 +- drivers/mtd/spi/sf-uclass.c | 2 +- drivers/mtd/spi/sf_probe.c | 2 +- drivers/net/fm/eth.c | 4 +- drivers/net/fsl_enetc.c | 8 +- drivers/net/fsl_enetc_mdio.c | 2 +- drivers/net/mdio-ipq4019.c | 4 +- drivers/net/mdio_mux_i2creg.c | 2 +- drivers/net/mvmdio.c | 4 +- drivers/net/octeontx/smi.c | 2 +- drivers/net/tsec.c | 3 +- drivers/pci/pci-uclass.c | 8 +- drivers/phy/phy-ti-am654.c | 2 +- drivers/pinctrl/intel/pinctrl_apl.c | 12 -- drivers/pinctrl/pinctrl-uclass.c | 4 +- drivers/power/domain/meson-ee-pwrc.c | 4 +- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 +- drivers/power/regulator/pbias_regulator.c | 3 +- drivers/pwm/pwm-meson.c | 9 +- drivers/remoteproc/rproc-uclass.c | 2 +- drivers/reset/reset-socfpga.c | 2 +- drivers/serial/sandbox.c | 16 +-- drivers/serial/serial-uclass.c | 2 +- drivers/spi/fsl_dspi.c | 6 +- drivers/spi/ich.c | 11 -- drivers/spi/ich.h | 11 ++ drivers/spi/spi-uclass.c | 2 +- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/sysreset/sysreset_x86.c | 5 +- drivers/tee/optee/core.c | 2 +- drivers/timer/timer-uclass.c | 2 +- drivers/usb/cdns3/core.c | 4 +- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/dwc3-generic.c | 6 +- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-meson-gxl.c | 2 +- drivers/usb/gadget/dwc2_udc_otg.c | 4 +- drivers/usb/host/dwc3-octeon-glue.c | 2 +- drivers/usb/host/dwc3-sti-glue.c | 5 +- drivers/usb/host/ehci-mx6.c | 2 +- drivers/usb/host/usb-uclass.c | 4 +- drivers/usb/host/xhci-dwc3.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_plat.c | 4 +- drivers/usb/musb-new/ti-musb.c | 2 +- drivers/video/nexell_display.c | 2 +- drivers/video/rockchip/rk_mipi.c | 2 +- include/asm-generic/global_data.h | 8 +- include/dm/device-internal.h | 1 + include/dm/device.h | 74 ++++++++-- include/dm/read.h | 18 +-- include/dm/simple_bus.h | 15 ++ include/linux/mtd/mtd.h | 9 +- include/linux/mtd/nand.h | 14 ++ include/linux/mtd/spi-nor.h | 6 +- include/linux/mtd/spinand.h | 15 ++ include/virtio.h | 2 +- net/mdio-mux-uclass.c | 2 +- net/mdio-uclass.c | 8 +- test/dm/bus.c | 10 +- test/dm/core.c | 26 ++-- test/dm/cpu.c | 2 +- test/dm/pci.c | 6 +- test/dm/test-fdt.c | 20 +-- test/dm/virtio.c | 2 +- 112 files changed, 655 insertions(+), 410 deletions(-) create mode 100644 arch/sandbox/include/asm/i2c.h create mode 100644 arch/sandbox/include/asm/serial.h create mode 100644 arch/x86/include/asm/arch-apollolake/hostbridge.h create mode 100644 arch/x86/include/asm/arch-apollolake/pmc.h create mode 100644 arch/x86/include/asm/p2sb.h create mode 100644 arch/x86/include/asm/sysreset.h create mode 100644 include/dm/simple_bus.h
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 1/26 sandbox: serial: Move priv into a header file
Move this struct into a header file so that dtoc can include it in its dt-platdata.c file.
---
arch/sandbox/include/asm/serial.h | 30 ++++++++++++++++++++++++++++++ drivers/serial/sandbox.c | 16 +--------------- 2 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 arch/sandbox/include/asm/serial.h
arch/sandbox/include/asm/serial.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#ifndef __asm_serial_h +#define __asm_serial_h + +#include <dt-structs.h> + +struct sandbox_serial_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_sandbox_serial dtplat; +#endif +int colour;/* Text colour to use for output, -1 for none */ +}; + +/** +* struct sandbox_serial_priv - Private data for this driver +* +* @buf: holds input characters available to be read by this driver +*/ +struct sandbox_serial_priv { +struct membuff buf; +char serial_buf[16 ]; +bool start_of_line; +}; + +#endif /* __asm_serial_h */
drivers/serial/sandbox.c +1 -15
@@ -17,25 +17,11 @@#include <serial.h> #include <video.h> #include <linux/compiler.h> +#include <asm/serial.h> #include <asm/state.h> DECLARE_GLOBAL_DATA_PTR ; -struct sandbox_serial_plat { -int colour;/* Text colour to use for output, -1 for none */ -}; - -/** -* struct sandbox_serial_priv - Private data for this driver -* -* @buf: holds input characters available to be read by this driver -*/ -struct sandbox_serial_priv { -struct membuff buf; -char serial_buf[16 ]; -bool start_of_line; -}; -/** * output_ansi_colour() - Output an ANSI colour code *
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 1/26 sandbox: serial: Move priv into a header file
Quoted 2 lines · Simon Glass
Move this struct into a header file so that dtoc can include it in its
dt-platdata.cfile.
Quoted 78 lines
Signed-off-by Simon Glass <[email protected]>---
arch/sandbox/include/asm/serial.h | 30 ++++++++++++++++++++++++++++++ drivers/serial/sandbox.c | 16 +--------------- 2 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 arch/sandbox/include/asm/serial.harch/sandbox/include/asm/serial.h new file +30
-0@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#ifndef __asm_serial_h +#define __asm_serial_h + +#include <dt-structs.h> + +struct sandbox_serial_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_sandbox_serial dtplat; +#endif +int colour;/* Text colour to use for output, -1 for none */ +}; + +/** +* struct sandbox_serial_priv - Private data for this driver +* +* @buf: holds input characters available to be read by this driver +*/ +struct sandbox_serial_priv { +struct membuff buf; +char serial_buf[16 ]; +bool start_of_line; +}; + +#endif /* __asm_serial_h */ drivers/serial/sandbox.c +1
-15@@ -17,25 +17,11 @@#include <serial.h> #include <video.h> #include <linux/compiler.h> +#include <asm/serial.h> #include <asm/state.h> DECLARE_GLOBAL_DATA_PTR ; -struct sandbox_serial_plat { -int colour;/* Text colour to use for output, -1 for none */ -}; - -/** -* struct sandbox_serial_priv - Private data for this driver -* -* @buf: holds input characters available to be read by this driver -*/ -struct sandbox_serial_priv { -struct membuff buf; -char serial_buf[16 ]; -bool start_of_line; -}; -/** * output_ansi_colour() - Output an ANSI colour code * Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/26 sandbox: serial: Move priv into a header file
Quoted 2 lines · Simon Glass
Move this struct into a header file so that dtoc can include it in its
dt-platdata.cfile.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
arch/sandbox/include/asm/serial.h | 30 ++++++++++++++++++++++++++++++ drivers/serial/sandbox.c | 16 +--------------- 2 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 arch/sandbox/include/asm/serial.h
Applied to u-boot-dm/next, thanks!
PATCH 2/26 sandbox: i2c: Move priv into a header file
In reply to Simon GlassMove this struct into a header file so that dtoc can include it in its dt-platdata.c file.
---
arch/sandbox/include/asm/i2c.h | 14 ++++++++++++++ drivers/i2c/sandbox_i2c.c | 5 +---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 arch/sandbox/include/asm/i2c.h
arch/sandbox/include/asm/i2c.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#ifndef __asn_i2c_h +#define __asn_i2c_h + +struct sandbox_i2c_priv { +bool test_mode; +}; + +#endif /* __asn_i2c_h */
drivers/i2c/sandbox_i2c.c +1 -4
@@ -10,15 +10,12 @@#include <errno.h> #include <i2c.h> #include <log.h> +#include <asm/i2c.h> #include <asm/test.h> #include <dm/acpi.h> #include <dm/lists.h> #include <dm/device-internal.h> -struct sandbox_i2c_priv { -bool test_mode; -}; -static int get_emul (struct udevice *dev,struct udevice **devp,struct dm_i2c_ops **opsp) {
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 2/26 sandbox: i2c: Move priv into a header file
Move this struct into a header file so that dtoc can include it in its dt-platdata.c file.
---
arch/sandbox/include/asm/i2c.h | 14 ++++++++++++++ drivers/i2c/sandbox_i2c.c | 5 +---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 arch/sandbox/include/asm/i2c.h
Applied to u-boot-dm/next, thanks!
PATCH 3/26 sandbox: Add a compatible string for spltest
In reply to Simon GlassAt present this driver does not have a compatible string. For it to be used with the coming of-platadata, it must have one. Update it accordingly.
---
drivers/misc/spltest_sandbox.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/misc/spltest_sandbox.c +6 -0
@@ -8,8 +8,14 @@#include <dm.h> #include <dt-structs.h> +static const struct udevice_id sandbox_spl_ids[] = { + { .compatible ="sandbox,spl-test" , }, + {}/* sentinel */ +}; +U_BOOT_DRIVER (sandbox_spl_test) = { .name ="sandbox_spl_test" , .id =UCLASS_MISC , + .of_match = sandbox_spl_ids, .flags =DM_FLAG_PRE_RELOC , };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 3/26 sandbox: Add a compatible string for spltest
At present this driver does not have a compatible string. For it to be used with the coming of-platadata, it must have one. Update it accordingly.
---
drivers/misc/spltest_sandbox.c | 6 ++++++ 1 file changed, 6 insertions(+)
Applied to u-boot-dm/next, thanks!
PATCH 4/26 sandbox: Update dts files to reduce SPL size
In reply to Simon GlassAt present there are require a few devices in the devicetree which are not actually used in SPL. This will cause problems with the new of-platdata, since it will try to instantiate devices which are not compiled into U-Boot.
Update the devicetree to remove these devices from SPL.
---
arch/sandbox/dts/sandbox.dts | 4 ++-- arch/sandbox/dts/sandbox.dtsi | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-)
arch/sandbox/dts/sandbox.dts +2 -2
@@ -41,7 +41,7 @@ cros_ec: cros-ec { reg = <0 0>; - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; compatible = "google,cros-ec-sandbox"; };
@@ -83,7 +83,7 @@ }; spi: spi at 0 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; #address-cells = <1>; #size-cells = <0>; reg = <0 0>;
arch/sandbox/dts/sandbox.dtsi +5 -6
@@ -56,7 +56,7 @@ }; gpio_a: gpios at 0 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; gpio-controller; compatible = "sandbox,gpio"; #gpio-cells = <1>;
@@ -65,7 +65,7 @@ }; gpio_b: gpios at 1 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; gpio-controller; compatible = "sandbox,gpio"; #gpio-cells = <2>;
@@ -120,7 +120,7 @@ }; lcd { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; compatible = "sandbox,lcd-sdl"; xres = <1366>; yres = <768>;
@@ -209,7 +209,7 @@ spi at 0 { firmware_storage_spi: flash at 0 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; reg = <0>; compatible = "spansion,m25p16", "jedec,spi-nor"; spi-max-frequency = <40000000>;
@@ -278,7 +278,6 @@ }; tpm { - u-boot,dm-pre-reloc; compatible = "google,sandbox-tpm"; };
@@ -415,6 +414,6 @@ }; keyboard-controller { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; }; };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 4/26 sandbox: Update dts files to reduce SPL size
At present there are require a few devices in the devicetree which are not actually used in SPL. This will cause problems with the new of-platdata, since it will try to instantiate devices which are not compiled into U-Boot.
Update the devicetree to remove these devices from SPL.
---
arch/sandbox/dts/sandbox.dts | 4 ++-- arch/sandbox/dts/sandbox.dtsi | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 5/26 x86: apl: Move priv/plat structs to headers
In reply to Simon GlassWith the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
arch/x86/cpu/apollolake/hostbridge.c | 20 +------------ arch/x86/cpu/apollolake/pmc.c | 8 +----- arch/x86/include/asm/arch-apollolake/gpio.h | 18 ++++++++++++ .../include/asm/arch-apollolake/hostbridge.h | 28 +++++++++++++++++++ arch/x86/include/asm/arch-apollolake/pmc.h | 16 +++++++++++ drivers/pinctrl/intel/pinctrl_apl.c | 12 -------- 6 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 arch/x86/include/asm/arch-apollolake/hostbridge.h create mode 100644 arch/x86/include/asm/arch-apollolake/pmc.h
arch/x86/cpu/apollolake/hostbridge.c +1 -19
@@ -24,6 +24,7 @@#include <asm/io.h> #include <asm/pci.h> #include <asm/arch/acpi.h> +#include <asm/arch/hostbridge.h> #include <asm/arch/systemagent.h> #include <dt-bindings/sound/nhlt.h> #include <dm/acpi.h>
@@ -41,25 +42,6 @@ enum { TOLUD = 0xbc, }; -/** -* struct apl_hostbridge_plat - platform data for hostbridge -* -* @dtplat: Platform data for of-platdata -* @early_pads: Early pad data to set up, each (pad, cfg0, cfg1) -* @early_pads_count: Number of pads to process -* @pciex_region_size: BAR length in bytes -* @bdf: Bus/device/function of hostbridge -*/ -struct apl_hostbridge_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -struct dtd_intel_apl_hostbridge dtplat; -#endif -u32 *early_pads; -int early_pads_count; -uint pciex_region_size; -pci_dev_t bdf; -}; -#if CONFIG_IS_ENABLED (GENERATE_ACPI_TABLE )static const struct nhlt_format_config dmic_1ch_formats[] = { /* 48 KHz 16-bits per sample. */
arch/x86/cpu/apollolake/pmc.c +1 -7
@@ -16,6 +16,7 @@#include <acpi/acpi_s3.h> #include <asm/io.h> #include <asm/pci.h> +#include <asm/arch/pmc.h> #include <linux/bitops.h> #include <power/acpi_pmc.h>
@@ -53,13 +54,6 @@ enum { CF9_GLB_RST = 1 << 20, }; -struct apl_pmc_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -struct dtd_intel_apl_pmc dtplat; -#endif -pci_dev_t bdf; -}; -static int apl_pmc_fill_power_state (struct udevice *dev) {struct acpi_pmc_upriv *upriv =dev_get_uclass_priv (dev);
arch/x86/include/asm/arch-apollolake/gpio.h +18 -0
@@ -485,4 +485,22 @@/* This is needed by ACPI */ #define GPIO_NUM_PAD_CFG_REGS 2/* DW0, DW1 */ +#ifndef __ASSEMBLY__ + +#include <dt-structs.h> + +/** +* struct apl_gpio_plat - platform data for each device +* +* @dtplat: of-platdata data from C struct +*/ +struct apl_gpio_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +/* Put this first since driver model will copy the data here */ +struct dtd_intel_apl_pinctrl dtplat; +#endif +}; + +#endif /* __ASSEMBLY__ */ +#endif /* _ASM_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-apollolake/hostbridge.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ + +#ifndef _ASM_ARCH_HOSTBRIDGE_H_ +#define _ASM_ARCH_HOSTBRIDGE_H_ + +/** +* struct apl_hostbridge_plat - platform data for hostbridge +* +* @dtplat: Platform data for of-platdata +* @early_pads: Early pad data to set up, each (pad, cfg0, cfg1) +* @early_pads_count: Number of pads to process +* @pciex_region_size: BAR length in bytes +* @bdf: Bus/device/function of hostbridge +*/ +struct apl_hostbridge_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_apl_hostbridge dtplat; +#endif +u32 *early_pads; +int early_pads_count; +uint pciex_region_size; +pci_dev_t bdf; +}; + +#endif /* _ASM_ARCH_HOSTBRIDGE_H_ */
arch/x86/include/asm/arch-apollolake/pmc.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ + +#ifndef ASM_ARCH_PMC_H +#define ASM_ARCH_PMC_H + +struct apl_pmc_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_apl_pmc dtplat; +#endif +pci_dev_t bdf; +}; + +#endif /* ASM_ARCH_PMC_H */
drivers/pinctrl/intel/pinctrl_apl.c +0 -12
@@ -17,18 +17,6 @@#include <asm-generic/gpio.h> #include <asm/intel_pinctrl_defs.h> -/** -* struct apl_gpio_plat - platform data for each device -* -* @dtplat: of-platdata data from C struct -*/ -struct apl_gpio_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -/* Put this first since driver model will copy the data here */ -struct dtd_intel_apl_pinctrl dtplat; -#endif -}; -static const struct reset_mapping rst_map[] = { { .logical =PAD_CFG0_LOGICAL_RESET_PWROK , .chipset =0U <<30 }, { .logical =PAD_CFG0_LOGICAL_RESET_DEEP , .chipset =1U <<30 },
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 5/26 x86: apl: Move priv/plat structs to headers
With the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
arch/x86/cpu/apollolake/hostbridge.c | 20 +------------ arch/x86/cpu/apollolake/pmc.c | 8 +----- arch/x86/include/asm/arch-apollolake/gpio.h | 18 ++++++++++++ .../include/asm/arch-apollolake/hostbridge.h | 28 +++++++++++++++++++ arch/x86/include/asm/arch-apollolake/pmc.h | 16 +++++++++++ drivers/pinctrl/intel/pinctrl_apl.c | 12 -------- 6 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 arch/x86/include/asm/arch-apollolake/hostbridge.h create mode 100644 arch/x86/include/asm/arch-apollolake/pmc.h
Applied to u-boot-dm/next, thanks!
PATCH 6/26 x86: Move priv/plat structs for intel_common to headers
In reply to Simon GlassWith the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
arch/x86/cpu/intel_common/itss.c | 19 ------------------- arch/x86/cpu/intel_common/p2sb.c | 9 +-------- arch/x86/include/asm/itss.h | 21 +++++++++++++++++++++ arch/x86/include/asm/p2sb.h | 18 ++++++++++++++++++ 4 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 arch/x86/include/asm/p2sb.h
arch/x86/cpu/intel_common/itss.c +0 -19
@@ -19,25 +19,6 @@#include <spl.h> #include <asm/itss.h> -struct itss_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -/* Put this first since driver model will copy the data here */ -struct dtd_intel_itss dtplat; -#endif -}; - -/* struct pmc_route - Routing for PMC to GPIO */ -struct pmc_route { -u32 pmc; -u32 gpio; -}; - -struct itss_priv { -struct pmc_route *route; -uint route_count; -u32 irq_snapshot[NUM_IPC_REGS ]; -}; -static int set_polarity (struct udevice *dev,uint irq,bool active_low) {u32 mask;
arch/x86/cpu/intel_common/p2sb.c +1 -8
@@ -13,20 +13,13 @@#include <log.h> #include <p2sb.h> #include <spl.h> +#include <asm/p2sb.h> #include <asm/pci.h> #include <linux/bitops.h> #define PCH_P2SB_E0 0xe0#define HIDE_BIT BIT(0) -struct p2sb_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -struct dtd_intel_p2sb dtplat; -#endif -ulong mmio_base; -pci_dev_t bdf; -}; -/* PCI config space registers */ #define HPTC_OFFSET 0x60#define HPTC_ADDR_ENABLE_BIT BIT(7)
arch/x86/include/asm/itss.h +21 -0
@@ -11,6 +11,8 @@#ifndef _ASM_ARCH_ITSS_H#define _ASM_ARCH_ITSS_H +#include <irq.h> +#define GPIO_IRQ_START 50#define GPIO_IRQ_END ITSS_MAX_IRQ
@@ -42,4 +44,23 @@/* ITSS Power reduction control */ #define PCR_ITSS_ITSSPRC 0x3300 +struct itss_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +/* Put this first since driver model will copy the data here */ +struct dtd_intel_itss dtplat; +#endif +}; + +/* struct pmc_route - Routing for PMC to GPIO */ +struct pmc_route { +u32 pmc; +u32 gpio; +}; + +struct itss_priv { +struct pmc_route *route; +uint route_count; +u32 irq_snapshot[NUM_IPC_REGS ]; +}; +#endif /* _ASM_ARCH_ITSS_H */
arch/x86/include/asm/p2sb.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ + +#ifndef ASM_P2SB_H +#define ASM_P2SB_H + +/* Platform data for the P2SB */ +struct p2sb_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_p2sb dtplat; +#endif +ulong mmio_base; +pci_dev_t bdf; +}; + +#endif /* ASM_P2SB_H */
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 6/26 x86: Move priv/plat structs for intel_common to headers
With the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
arch/x86/cpu/intel_common/itss.c | 19 ------------------- arch/x86/cpu/intel_common/p2sb.c | 9 +-------- arch/x86/include/asm/itss.h | 21 +++++++++++++++++++++ arch/x86/include/asm/p2sb.h | 18 ++++++++++++++++++ 4 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 arch/x86/include/asm/p2sb.h
Applied to u-boot-dm/next, thanks!
PATCH 7/26 x86: spl: Move priv/plat structs to headers
In reply to Simon GlassWith the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
drivers/spi/ich.c | 11 ----------- drivers/spi/ich.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/spi/ich.c +0 -11
@@ -38,17 +38,6 @@ #define debug_trace(x, args...)#endif -struct ich_spi_plat { -#if CONFIG_IS_ENABLED (OF_PLATDATA ) -struct dtd_intel_fast_spi dtplat; -#endif -enum ich_version ich_version;/* Controller version, 7 or 9 */ -bool lockdown;/* lock down controller settings? */ -ulong mmio_base;/* Base of MMIO registers */ -pci_dev_t bdf;/* PCI address used by of-platdata */ -bool hwseq;/* Use hardware sequencing (not s/w) */ -}; -static u8 ich_readb (struct ich_spi_priv *priv,int reg) {u8 value =readb (priv->base + reg);
drivers/spi/ich.h +11 -0
@@ -230,4 +230,15 @@ struct ich_spi_priv { struct udevice *pch; /* PCH, used to control SPI access */ }; +struct ich_spi_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_fast_spi dtplat; +#endif +enum ich_version ich_version;/* Controller version, 7 or 9 */ +bool lockdown;/* lock down controller settings? */ +ulong mmio_base;/* Base of MMIO registers */ +pci_dev_t bdf;/* PCI address used by of-platdata */ +bool hwseq;/* Use hardware sequencing (not s/w) */ +}; +#endif /* _ICH_H_ */
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 7/26 x86: spl: Move priv/plat structs to headers
With the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
drivers/spi/ich.c | 11 ----------- drivers/spi/ich.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 8/26 spi: Tidy up get/set of device node
In reply to Simon GlassThis code is a bit odd in that it only reads and updates the livetree version of the device ofnode. This means it won't work with flattree. Update the code to work as it was presumably intended.
---
drivers/mtd/nand/spi/core.c | 2 +- include/linux/mtd/mtd.h | 9 ++++----- include/linux/mtd/nand.h | 14 ++++++++++++++ include/linux/mtd/spi-nor.h | 2 ++ include/linux/mtd/spinand.h | 15 +++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-)
drivers/mtd/nand/spi/core.c +1 -1
@@ -1173,7 +1173,7 @@ static int spinand_probe(struct udevice *dev)return -ENOMEM ;sprintf (mtd->name,"spi-nand%d" , spi_nand_idx++); spinand->slave = slave; -spinand_set_of_node (spinand, dev->node.np); +spinand_set_ofnode (spinand, dev->node);#endif ret =spinand_init (spinand);
include/linux/mtd/mtd.h +4 -5
@@ -332,15 +332,14 @@ struct mtd_info { };#if IS_ENABLED (CONFIG_DM ) -static inline void mtd_set_of_node (struct mtd_info *mtd, -const struct device_node *np) +static inline void mtd_set_ofnode (struct mtd_info *mtd,ofnode node) { - mtd->dev->node.np = np; + mtd->dev->node = node; } -static inline const struct device_node *mtd_get_of_node (struct mtd_info *mtd) +static inline const ofnode mtd_get_ofnode (struct mtd_info *mtd) { -return mtd->dev->node.np; +return mtd->dev->node; }#else struct device_node ;
include/linux/mtd/nand.h +14 -0
@@ -389,6 +389,7 @@ static inline int nanddev_unregister(struct nand_device *nand)return mtd_device_unregister (nand->mtd); } +#ifndef __UBOOT__/** * nanddev_set_of_node() - Attach a DT node to a NAND device * @nand: NAND device
@@ -412,6 +413,19 @@ static inline const struct device_node *nanddev_get_of_node(struct nand_device * {return mtd_get_of_node (nand->mtd); } +#else +/** +* nanddev_set_of_node() - Attach a DT node to a NAND device +* @nand: NAND device +* @node: ofnode +* +* Attach a DT node to a NAND device. +*/ +static inline void nanddev_set_ofnode (struct nand_device *nand,ofnode node) +{ +mtd_set_ofnode (nand->mtd, node); +} +#endif /* __UBOOT__ */ /** * nanddev_offs_to_pos() - Convert an absolute NAND offset into a NAND position
include/linux/mtd/spi-nor.h +2 -0
@@ -352,6 +352,7 @@ struct spi_nor {u32 erase_size; }; +#ifndef __UBOOT__static inline void spi_nor_set_flash_node (struct spi_nor *nor,const struct device_node *np) {
@@ -363,6 +364,7 @@ device_node *spi_nor_get_flash_node(struct spi_nor *nor) {return mtd_get_of_node (&nor->mtd); } +#endif /* __UBOOT__ */ /** * struct spi_nor_hwcaps - Structure for describing the hardware capabilies
include/linux/mtd/spinand.h +15 -0
@@ -412,6 +412,7 @@ spinand_to_nand(struct spinand_device *spinand)return &spinand->base; } +#ifndef __UBOOT__/** * spinand_set_of_node - Attach a DT node to a SPI NAND device * @spinand: SPI NAND device
@@ -424,6 +425,20 @@ static inline void spinand_set_of_node(struct spinand_device *spinand, {nanddev_set_of_node (&spinand->base, np); } +#else +/** +* spinand_set_of_node - Attach a DT node to a SPI NAND device +* @spinand: SPI NAND device +* @node: ofnode +* +* Attach a DT node to a SPI NAND device. +*/ +static inline void spinand_set_ofnode (struct spinand_device *spinand, +ofnode node) +{ +nanddev_set_ofnode (&spinand->base, node); +} +#endif /* __UBOOT__ */ int spinand_match_and_init(struct spinand_device *dev, const struct spinand_info *table,
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 8/26 spi: Tidy up get/set of device node
This code is a bit odd in that it only reads and updates the livetree version of the device ofnode. This means it won't work with flattree. Update the code to work as it was presumably intended.
---
drivers/mtd/nand/spi/core.c | 2 +- include/linux/mtd/mtd.h | 9 ++++----- include/linux/mtd/nand.h | 14 ++++++++++++++ include/linux/mtd/spi-nor.h | 2 ++ include/linux/mtd/spinand.h | 15 +++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 9/26 spi: Tweak a few strange SPI NOR features for of-platdata
In reply to Simon GlassThe #define of one struct to another has been around for a while. It confuses dtoc and makes it think that struct spi_flash does not exist.
Make a few changes to improve things while we wait for migration to be completed:
- Move the 'struct spi_flash' to column 1 so dtoc scans it
- Remove the #define when compiling dt-platdata.c
- Update the strange mtd_get/set_of_node() functions
- Use struct spi_nor in the drivers, so dtoc sees the correct struct
---
drivers/mtd/spi/sf-uclass.c | 2 +- drivers/mtd/spi/sf_probe.c | 2 +- include/linux/mtd/spi-nor.h | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/spi/sf-uclass.c +1 -1
@@ -100,5 +100,5 @@ UCLASS_DRIVER(spi_flash) = { .id = UCLASS_SPI_FLASH, .name = "spi_flash", .post_bind = spi_flash_post_bind, - .per_device_auto = sizeof(struct spi_flash), + .per_device_auto = sizeof(struct spi_nor), };
drivers/mtd/spi/sf_probe.c +1 -1
@@ -166,7 +166,7 @@ U_BOOT_DRIVER(jedec_spi_nor) = { .of_match = spi_flash_std_ids, .probe = spi_flash_std_probe, .remove = spi_flash_std_remove, - .priv_auto = sizeof(struct spi_flash), + .priv_auto = sizeof(struct spi_nor), .ops = &spi_flash_std_ops, };
include/linux/mtd/spi-nor.h +3 -1
@@ -258,11 +258,13 @@ struct flash_info;/* * TODO: Remove, once all users of spi_flash interface are moved to MTD * -* struct spi_flash { +struct spi_flash { * Defined below (keep this text to enable searching for spi_flash decl) * } */ +#ifndef DT_PLATDATA_C #define spi_flash spi_nor +#endif /** * struct spi_nor - Structure for defining a the SPI NOR layer
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 9/26 spi: Tweak a few strange SPI NOR features for of-platdata
The #define of one struct to another has been around for a while. It confuses dtoc and makes it think that struct spi_flash does not exist.
Make a few changes to improve things while we wait for migration to be completed:
- Move the 'struct spi_flash' to column 1 so dtoc scans it
- Remove the #define when compiling dt-platdata.c
- Update the strange mtd_get/set_of_node() functions
- Use struct spi_nor in the drivers, so dtoc sees the correct struct
---
drivers/mtd/spi/sf-uclass.c | 2 +- drivers/mtd/spi/sf_probe.c | 2 +- include/linux/mtd/spi-nor.h | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 10/26 x86: apl: Use struct spi_nor instead of struct spi_flash
In reply to Simon GlassThis construct effectively uses struct spi_nor due to a #define in spi-nor.h so we may as well use that struct here. This allows dtoc to parse it correctly.
---
arch/x86/cpu/apollolake/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/apollolake/spl.c +1 -1
@@ -97,7 +97,7 @@ U_BOOT_DRIVER(winbond_w25q128fw) = { .id = UCLASS_SPI_FLASH, .of_match = apl_flash_ids, .probe = apl_flash_probe, - .priv_auto = sizeof(struct spi_flash), + .priv_auto = sizeof(struct spi_nor), .ops = &apl_flash_ops, };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 10/26 x86: apl: Use struct spi_nor instead of struct spi_flash
This construct effectively uses struct spi_nor due to a #define in spi-nor.h so we may as well use that struct here. This allows dtoc to parse it correctly.
---
arch/x86/cpu/apollolake/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm/next, thanks!
PATCH 11/26 dm: core: Move priv/plat structs for simple_bus to headers
In reply to Simon GlassWith the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
drivers/core/simple-bus.c | 7 +------ include/dm/simple_bus.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 include/dm/simple_bus.h
drivers/core/simple-bus.c +1 -6
@@ -5,12 +5,7 @@#include <common.h> #include <dm.h> - -struct simple_bus_plat { -u32 base; -u32 size; -u32 target; -}; +#include <dm/simple_bus.h> fdt_addr_t simple_bus_translate (struct udevice *dev,fdt_addr_t addr) {
include/dm/simple_bus.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ + +#ifndef __DM_SIMPLE_BUS_H +#define __DM_SIMPLE_BUS_H + +struct simple_bus_plat { +u32 base; +u32 size; +u32 target; +}; + +#endif
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 11/26 dm: core: Move priv/plat structs for simple_bus to headers
With the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them.
---
drivers/core/simple-bus.c | 7 +------ include/dm/simple_bus.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 include/dm/simple_bus.h
Applied to u-boot-dm/next, thanks!
PATCH 12/26 x86: sysreset: Move priv/plat structs to headers
In reply to Simon GlassWith the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them and add the dtd struct too.
---
arch/x86/include/asm/sysreset.h | 18 ++++++++++++++++++ drivers/sysreset/sysreset_x86.c | 5 +---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 arch/x86/include/asm/sysreset.h
arch/x86/include/asm/sysreset.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ +#ifndef _X86_ASM_SYSRESET_H_ +#define _X86_ASM_SYSRESET_H_ + +#include <dt-structs.h> + +struct x86_sysreset_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_x86_reset dtplat; +#endif + +struct udevice *pch; +}; + +#endif /* _X86_ASM_SYSRESET_H_ */
drivers/sysreset/sysreset_x86.c +1 -4
@@ -13,10 +13,7 @@#include <acpi/acpi_s3.h> #include <asm/io.h> #include <asm/processor.h> - -struct x86_sysreset_plat { -struct udevice *pch; -}; +#include <asm/sysreset.h> /* * Power down the machine by using the power management sleep control
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 12/26 x86: sysreset: Move priv/plat structs to headers
Quoted 2 lines · Simon Glass
With the new of-platdata, these need to be available to
dt_platdata.cso must be in header files. Move them and add the dtd struct too.
Quoted 51 lines
Signed-off-by Simon Glass <[email protected]>---
arch/x86/include/asm/sysreset.h | 18 ++++++++++++++++++ drivers/sysreset/sysreset_x86.c | 5 +---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 arch/x86/include/asm/sysreset.harch/x86/include/asm/sysreset.h new file +18
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Google LLC +*/ +#ifndef _X86_ASM_SYSRESET_H_ +#define _X86_ASM_SYSRESET_H_ + +#include <dt-structs.h> + +struct x86_sysreset_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_x86_reset dtplat; +#endif + +struct udevice *pch; +}; + +#endif /* _X86_ASM_SYSRESET_H_ */ drivers/sysreset/sysreset_x86.c +1
-4@@ -13,10 +13,7 @@#include <acpi/acpi_s3.h> #include <asm/io.h> #include <asm/processor.h> - -struct x86_sysreset_plat { -struct udevice *pch; -}; +#include <asm/sysreset.h> /* * Power down the machine by using the power management sleep control Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 12/26 x86: sysreset: Move priv/plat structs to headers
Quoted 2 lines · Simon Glass
With the new of-platdata, these need to be available to
dt_platdata.cso must be in header files. Move them and add the dtd struct too.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
arch/x86/include/asm/sysreset.h | 18 ++++++++++++++++++ drivers/sysreset/sysreset_x86.c | 5 +---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 arch/x86/include/asm/sysreset.h
Applied to u-boot-dm/next, thanks!
PATCH 13/26 x86: apl: Adjust how the UART gets its platform data
In reply to Simon GlassAt present this driver calls malloc() to start a new platform data structure, fills it in and tells driver model to use it.
We want to avoid malloc, particularly with the new version of of-platdata. Create a new struct which encompasses both the dtd struct and the ns16550 one, to avoid this. Unfortunately we must copy the data into the right place for the ns16550 driver. Add some comments about this.
---
arch/x86/cpu/apollolake/uart.c | 43 ++++++++++++--------- arch/x86/include/asm/arch-apollolake/uart.h | 19 ++++++++- 2 files changed, 42 insertions(+), 20 deletions(-)
arch/x86/cpu/apollolake/uart.c +24 -19
@@ -17,6 +17,7 @@#include <asm/pci.h> #include <asm/lpss.h> #include <dm/device-internal.h> +#include <asm/arch/uart.h> /* Low-power Subsystem (LPSS) clock register */ enum {
@@ -69,7 +70,7 @@ void apl_uart_init(pci_dev_t bdf, ulong base)* This driver uses its own compatible string but almost everything else from * the standard ns16550 driver. This allows us to provide an of-platdata * implementation, since the platdata produced by of-platdata does not match -* struct ns16550_plat. +* struct apl_ns16550_plat. * * When running with of-platdata (generally TPL), the platdata is converted to * something that ns16550 expects. When running withoutof-platdata (SPL, U-Boot
@@ -78,10 +79,10 @@ void apl_uart_init(pci_dev_t bdf, ulong base)static int apl_ns16550_probe (struct udevice *dev) { -struct ns16550_plat *plat =dev_get_plat (dev); +struct apl_ns16550_plat *plat =dev_get_plat (dev);if (!CONFIG_IS_ENABLED (PCI )) -apl_uart_init (plat->bdf, plat->base); +apl_uart_init (plat->ns16550.bdf, plat->ns16550.base);return ns16550_serial_probe (dev); }
@@ -89,24 +90,28 @@ static int apl_ns16550_probe(struct udevice *dev)static int apl_ns16550_of_to_plat (struct udevice *dev) {#if CONFIG_IS_ENABLED (OF_PLATDATA ) -struct dtd_intel_apl_ns16550 *dtplat =dev_get_plat (dev); -struct ns16550_plat *plat; +struct dtd_intel_apl_ns16550 *dtplat; +struct apl_ns16550_plat *plat =dev_get_plat (dev); +struct ns16550_plat ns;/* -* Convert our plat to the ns16550's plat, so we can just use -* that driver +* The device's plat uses struct apl_ns16550_plat which starts with the +* dtd struct, but the ns16550 driver expects it to be struct ns16550. +* Set up what that driver expects. Note that this means that the values +* cannot be read in this driver when using of-platdata. +* +* TODO(sjg at chromium.org): Consider having a separate plat pointer for +* of-platdata so that it is not necessary to overwrite this. */ - plat =malloc (sizeof (*plat)); -if (!plat) -return -ENOMEM ; - plat->base = dtplat->early_regs[0 ]; - plat->reg_width =1 ; - plat->reg_shift = dtplat->reg_shift; - plat->reg_offset =0 ; - plat->clock = dtplat->clock_frequency; - plat->fcr =UART_FCR_DEFVAL ; - plat->bdf =pci_ofplat_get_devfn (dtplat->reg[0 ]); -dev_set_plat (dev, plat); + dtplat = &plat->dtplat; + ns.base = dtplat->early_regs[0 ]; + ns.reg_width =1 ; + ns.reg_shift = dtplat->reg_shift; + ns.reg_offset =0 ; + ns.clock = dtplat->clock_frequency; + ns.fcr =UART_FCR_DEFVAL ; + ns.bdf =pci_ofplat_get_devfn (dtplat->reg[0 ]); +memcpy (plat, &ns,sizeof (ns));#else int ret;
@@ -129,7 +134,7 @@ U_BOOT_DRIVER(intel_apl_ns16550) = { .name = "intel_apl_ns16550", .id = UCLASS_SERIAL, .of_match = of_match_ptr(apl_ns16550_serial_ids), - .plat_auto = sizeof(struct ns16550_plat), + .plat_auto = sizeof(struct apl_ns16550_plat), .priv_auto = sizeof(struct ns16550), .ops = &ns16550_serial_ops, .of_to_plat = apl_ns16550_of_to_plat,
arch/x86/include/asm/arch-apollolake/uart.h +18 -1
@@ -6,6 +6,23 @@#ifndef _ASM_ARCH_UART_H#define _ASM_ARCH_UART_H +#include <ns16550.h> + +/** +* struct apl_ns16550_plat - platform data for the APL UART +* +* Note that when of-platdata is in use, apl_ns16550_of_to_plat() actually +* copies the ns16550_plat contents to the start of this struct, meaning that +* dtplat is no-longer valid. This is done so that the ns16550 driver can use +* dev_get_plat() without any offsets or adjustments. +*/ +struct apl_ns16550_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_intel_apl_ns16550 dtplat; +#endif +struct ns16550_plat ns16550; +}; +/** * apl_uart_init() - Set up the APL UART device and clock *
@@ -15,6 +32,6 @@* The UART won't actually work unless the GPIO settings are correct and the * signals actually exit the SoC. See board_debug_uart_init() for that. */ -int apl_uart_init (pci_dev_t bdf,ulong base); +void apl_uart_init (pci_dev_t bdf,ulong base);#endif
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 13/26 x86: apl: Adjust how the UART gets its platform data
At present this driver calls malloc() to start a new platform data structure, fills it in and tells driver model to use it.
We want to avoid malloc, particularly with the new version of of-platdata. Create a new struct which encompasses both the dtd struct and the ns16550 one, to avoid this. Unfortunately we must copy the data into the right place for the ns16550 driver. Add some comments about this.
---
arch/x86/cpu/apollolake/uart.c | 43 ++++++++++++--------- arch/x86/include/asm/arch-apollolake/uart.h | 19 ++++++++- 2 files changed, 42 insertions(+), 20 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 14/26 x86: coral: Remove unwanted nodes from SPL/TPL
In reply to Simon GlassSome devices are not needed in SPL/TPL. For TPL this causes the generation of unnecessary of-platadata structs. Make some adjustments to fix this.
---
arch/x86/dts/chromebook_coral.dts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
arch/x86/dts/chromebook_coral.dts +11 -6
@@ -102,12 +102,13 @@ }; cpus { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; #address-cells = <1>; #size-cells = <0>; cpu_0: cpu at 0 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; + u-boot,dm-spl; device_type = "cpu"; compatible = "intel,apl-cpu"; reg = <0>;
@@ -184,12 +185,14 @@ }; punit at 0,1 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; + u-boot,dm-spl; reg = <0x00000800 0 0 0 0>; compatible = "intel,apl-punit"; }; gma at 2,0 { + u-boot,dm-pre-proper; reg = <0x00001000 0 0 0 0>; compatible = "fsp-fb"; };
@@ -324,7 +327,8 @@ }; spi: fast-spi at d,2 { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; + u-boot,dm-spl; reg = <0x02006a10 0 0 0 0>; #address-cells = <1>; #size-cells = <0>;
@@ -335,7 +339,8 @@ fwstore_spi: spi-flash at 0 { #size-cells = <1>; #address-cells = <1>; - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; + u-boot,dm-spl; reg = <0>; compatible = "winbond,w25q128fw", "jedec,spi-nor";
@@ -577,7 +582,7 @@ #size-cells = <0>; u-boot,dm-pre-reloc; cros_ec: cros-ec { - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; compatible = "google,cros-ec-lpc"; reg = <0x204 1 0x200 1 0x880 0x80>;
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 14/26 x86: coral: Remove unwanted nodes from SPL/TPL
Some devices are not needed in SPL/TPL. For TPL this causes the generation of unnecessary of-platadata structs. Make some adjustments to fix this.
---
arch/x86/dts/chromebook_coral.dts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 15/26 x86: Drop rtc from SPL
In reply to Simon GlassThe RTC is not currently used in SPL. Drop it so that it does not take up space.
---
arch/x86/dts/rtc.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/dts/rtc.dtsi +1 -1
@@ -1,7 +1,7 @@ / { rtc: rtc { compatible = "motorola,mc146818"; - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; reg = <0x70 2>; }; };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 15/26 x86: Drop rtc from SPL
The RTC is not currently used in SPL. Drop it so that it does not take up space.
---
arch/x86/dts/rtc.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm/next, thanks!
PATCH 16/26 dm: core: Split out alloc code into a new function
In reply to Simon GlassAdd a new function to handle the allocation of private/platform data for a device. This will make it easier to skip this feature when using the new of-platdata.
---
drivers/core/device.c | 89 +++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 37 deletions(-)
drivers/core/device.c +52 -37
@@ -323,34 +323,17 @@ static void *alloc_priv(int size, uint flags)return priv; } -int device_of_to_plat (struct udevice *dev) +/** +* device_alloc_priv() - Allocate priv/plat data required by the device +* +* @dev: Device to process +* @return 0 if OK, -ENOMEM if out of memory +*/ +static int device_alloc_priv (struct udevice *dev) {const struct driver *drv; -int size =0 ;void *ptr; -int ret; - -if (!dev) -return -EINVAL ; - -if (dev->flags &DM_FLAG_PLATDATA_VALID ) -return 0 ; - -/* Ensure all parents have ofdata */ -if (dev->parent) { - ret =device_of_to_plat (dev->parent); -if (ret) - goto fail; - -/* -* The device might have already been probed during -* the call to device_probe() on its parent device -* (e.g. PCI bridge devices). Test the flags again -* so that we don't mess up the device. -*/ -if (dev->flags &DM_FLAG_PLATDATA_VALID ) -return 0 ; - } +int size; drv = dev->driver;assert (drv);
@@ -358,20 +341,17 @@ int device_of_to_plat(struct udevice *dev)/* Allocate private data if requested and not reentered */ if (drv->priv_auto && !dev_get_priv (dev)) { ptr =alloc_priv (drv->priv_auto, drv->flags); -if (!ptr) { - ret = -ENOMEM ; - goto fail; - } +if (!ptr) +return -ENOMEM ;dev_set_priv (dev, ptr); } +/* Allocate private data if requested and not reentered */ size = dev->uclass->uc_drv->per_device_auto;if (size && !dev_get_uclass_priv (dev)) { ptr =alloc_priv (size, dev->uclass->uc_drv->flags); -if (!ptr) { - ret = -ENOMEM ; - goto fail; - } +if (!ptr) +return -ENOMEM ;dev_set_uclass_priv (dev, ptr); }
@@ -382,14 +362,49 @@ int device_of_to_plat(struct udevice *dev) size = dev->parent->uclass->uc_drv->per_child_auto;if (size && !dev_get_parent_priv (dev)) { ptr =alloc_priv (size, drv->flags); -if (!ptr) { - ret = -ENOMEM ; - goto fail; - } +if (!ptr) +return -ENOMEM ;dev_set_parent_priv (dev, ptr); } } +return 0 ; +} + +int device_of_to_plat (struct udevice *dev) +{ +const struct driver *drv; +int ret; + +if (!dev) +return -EINVAL ; + +if (dev->flags &DM_FLAG_PLATDATA_VALID ) +return 0 ; + +/* Ensure all parents have ofdata */ +if (dev->parent) { + ret =device_of_to_plat (dev->parent); +if (ret) + goto fail; + +/* +* The device might have already been probed during +* the call to device_probe() on its parent device +* (e.g. PCI bridge devices). Test the flags again +* so that we don't mess up the device. +*/ +if (dev->flags &DM_FLAG_PLATDATA_VALID ) +return 0 ; + } + + ret =device_alloc_priv (dev); +if (ret) + goto fail; + + drv = dev->driver; +assert (drv); +if (drv->of_to_plat && (CONFIG_IS_ENABLED (OF_PLATDATA ) ||dev_has_of_node (dev))) { ret = drv->of_to_plat (dev);
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 16/26 dm: core: Split out alloc code into a new function
Add a new function to handle the allocation of private/platform data for a device. This will make it easier to skip this feature when using the new of-platdata.
---
drivers/core/device.c | 89 +++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 37 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 17/26 dm: core: Rename sqq to seq_
In reply to Simon GlassNow that the sequence-numbering migration is complete, rename this member back to seq_, adding an underscore to indicate it is internal to driver model.
---
drivers/core/device.c | 8 ++++---- drivers/core/dump.c | 2 +- drivers/core/uclass.c | 8 ++++---- drivers/pci/pci-uclass.c | 2 +- include/dm/device.h | 9 +++++---- test/dm/core.c | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-)
drivers/core/device.c +4 -4
@@ -73,7 +73,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, dev->driver = drv; dev->uclass = uc; - dev->sqq =-1 ; + dev->seq_ =-1 ;if (CONFIG_IS_ENABLED (DM_SEQ_ALIAS ) && (uc->uc_drv->flags &DM_UC_FLAG_SEQ_ALIAS )) {/*
@@ -83,13 +83,13 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) {if (uc->uc_drv->name &&ofnode_valid (node)) { -if (!dev_read_alias_seq (dev, &dev->sqq)) +if (!dev_read_alias_seq (dev, &dev->seq_)) auto_seq = false; } } }if (auto_seq && !(uc->uc_drv->flags &DM_UC_FLAG_NO_AUTO_SEQ )) - dev->sqq =uclass_find_next_free_seq (uc); + dev->seq_ =uclass_find_next_free_seq (uc);if (drv->plat_auto) {bool alloc = !plat;
@@ -658,7 +658,7 @@ int device_find_child_by_seq(const struct udevice *parent, int seq, *devp =NULL ;list_for_each_entry (dev, &parent->child_head, sibling_node) { -if (dev->sqq == seq) { +if (dev->seq_ == seq) { *devp = dev;return 0 ; }
drivers/core/dump.c +1 -1
@@ -69,7 +69,7 @@ static void dm_display_line(struct udevice *dev, int index)printf ("%-3i %c %s @ %08lx" , index, dev->flags &DM_FLAG_ACTIVATED ?'*' :' ' , dev->name, (ulong )map_to_sysmem (dev)); -if (dev->sqq !=-1 ) +if (dev->seq_ !=-1 )printf (", seq %d" ,dev_seq (dev));puts ("\n" ); }
drivers/core/uclass.c +4 -4
@@ -297,8 +297,8 @@ int uclass_find_next_free_seq(struct uclass *uc)/* Avoid conflict with existing devices */ list_for_each_entry (dev, &uc->dev_head, uclass_node) { -if (dev->sqq > max) - max = dev->sqq; +if (dev->seq_ > max) + max = dev->seq_; }/* * At this point, max will be -1 if there are no existing aliases or
@@ -323,8 +323,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)return ret; uclass_foreach_dev(dev, uc) { -log_debug (" - %d '%s'\n" , dev->sqq, dev->name); -if (dev->sqq == seq) { +log_debug (" - %d '%s'\n" , dev->seq_, dev->name); +if (dev->seq_ == seq) { *devp = dev;log_debug (" - found\n" );return 0 ;
drivers/pci/pci-uclass.c +1 -1
@@ -1019,7 +1019,7 @@ static int pci_uclass_pre_probe(struct udevice *bus) ret =uclass_get (UCLASS_PCI , &uc);if (ret)return ret; - bus->sqq =uclass_find_next_free_seq (uc); + bus->seq_ =uclass_find_next_free_seq (uc); }/* For bridges, use the top-level PCI controller */
include/dm/device.h +5 -4
@@ -136,11 +136,12 @@ enum {* @child_head: List of children of this device * @sibling_node: Next device in list of all devices * @flags: Flags for this device DM_FLAG_... -* @seq: Allocated sequence number for this device (-1 = none). This is set up +* @seq_: Allocated sequence number for this device (-1 = none). This is set up * when the device is bound and is unique within the device's uclass. If the * device has an alias in the devicetree then that is used to set the sequence * number. Otherwise, the next available number is used. Sequence numbers are -* used by certain commands that need device to be numbered (e.g. 'mmc dev') +* used by certain commands that need device to be numbered (e.g. 'mmc dev'). +* (do not access outside driver model) * @devres_head: List of memory allocations associated with this device. * When CONFIG_DEVRES is enabled, devm_kmalloc() and friends will * add to this list. Memory so-allocated will be freed
@@ -163,7 +164,7 @@ struct udevice {struct list_head child_head;struct list_head sibling_node;uint32_t flags; -int sqq; +int seq_;#ifdef CONFIG_DEVRES struct list_head devres_head;#endif
@@ -190,7 +191,7 @@ static inline bool dev_has_of_node(struct udevice *dev)static inline int dev_seq (const struct udevice *dev) { -return dev->sqq; +return dev->seq_; }/**
test/dm/core.c +3 -3
@@ -1075,10 +1075,10 @@ static int dm_test_all_have_seq(struct unit_test_state *uts)list_for_each_entry (uc, &gd->uclass_root, sibling_node) {list_for_each_entry (dev, &uc->dev_head, uclass_node) { -if (dev->sqq ==-1 ) +if (dev->seq_ ==-1 )printf ("Device '%s' has no seq (%d)\n" , - dev->name, dev->sqq); -ut_assert (dev->sqq !=-1 ); + dev->name, dev->seq_); +ut_assert (dev->seq_ !=-1 ); } }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 17/26 dm: core: Rename sqq to seq_
Quoted 3 lines · Simon Glass
Now that the sequence-numbering migration is complete, rename this member back to
seq_, adding an underscore to indicate it is internal to driver model.
Quoted 159 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/core/device.c | 8 ++++---- drivers/core/dump.c | 2 +- drivers/core/uclass.c | 8 ++++---- drivers/pci/pci-uclass.c | 2 +- include/dm/device.h | 9 +++++---- test/dm/core.c | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-)drivers/core/device.c +4
-4@@ -73,7 +73,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, dev->driver = drv; dev->uclass = uc; - dev->sqq =-1 ; + dev->seq_ =-1 ;if (CONFIG_IS_ENABLED (DM_SEQ_ALIAS ) && (uc->uc_drv->flags &DM_UC_FLAG_SEQ_ALIAS )) {/* @@ -83,13 +83,13 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) {if (uc->uc_drv->name &&ofnode_valid (node)) { -if (!dev_read_alias_seq (dev, &dev->sqq)) +if (!dev_read_alias_seq (dev, &dev->seq_)) auto_seq = false; } } }if (auto_seq && !(uc->uc_drv->flags &DM_UC_FLAG_NO_AUTO_SEQ )) - dev->sqq =uclass_find_next_free_seq (uc); + dev->seq_ =uclass_find_next_free_seq (uc);if (drv->plat_auto) {bool alloc = !plat;@@ -658,7 +658,7 @@ int device_find_child_by_seq(const struct udevice *parent, int seq, *devp =NULL ;list_for_each_entry (dev, &parent->child_head, sibling_node) { -if (dev->sqq == seq) { +if (dev->seq_ == seq) { *devp = dev;return 0 ; }drivers/core/dump.c +1
-1@@ -69,7 +69,7 @@ static void dm_display_line(struct udevice *dev, int index)printf ("%-3i %c %s @ %08lx" , index, dev->flags &DM_FLAG_ACTIVATED ?'*' :' ' , dev->name, (ulong )map_to_sysmem (dev)); -if (dev->sqq !=-1 ) +if (dev->seq_ !=-1 )printf (", seq %d" ,dev_seq (dev));puts ("\n" ); }drivers/core/uclass.c +4
-4@@ -297,8 +297,8 @@ int uclass_find_next_free_seq(struct uclass *uc)/* Avoid conflict with existing devices */ list_for_each_entry (dev, &uc->dev_head, uclass_node) { -if (dev->sqq > max) - max = dev->sqq; +if (dev->seq_ > max) + max = dev->seq_; }/* * At this point, max will be -1 if there are no existing aliases or @@ -323,8 +323,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)return ret; uclass_foreach_dev(dev, uc) { -log_debug (" - %d '%s'\n" , dev->sqq, dev->name); -if (dev->sqq == seq) { +log_debug (" - %d '%s'\n" , dev->seq_, dev->name); +if (dev->seq_ == seq) { *devp = dev;log_debug (" - found\n" );return 0 ;drivers/pci/pci-uclass.c +1
-1@@ -1019,7 +1019,7 @@ static int pci_uclass_pre_probe(struct udevice *bus) ret =uclass_get (UCLASS_PCI , &uc);if (ret)return ret; - bus->sqq =uclass_find_next_free_seq (uc); + bus->seq_ =uclass_find_next_free_seq (uc); }/* For bridges, use the top-level PCI controller */ include/dm/device.h +5
-4@@ -136,11 +136,12 @@ enum {* @child_head: List of children of this device * @sibling_node: Next device in list of all devices * @flags: Flags for this device DM_FLAG_... -* @seq: Allocated sequence number for this device (-1 = none). This is set up +* @seq_: Allocated sequence number for this device (-1 = none). This is set up * when the device is bound and is unique within the device's uclass. If the * device has an alias in the devicetree then that is used to set the sequence * number. Otherwise, the next available number is used. Sequence numbers are -* used by certain commands that need device to be numbered (e.g. 'mmc dev') +* used by certain commands that need device to be numbered (e.g. 'mmc dev'). +* (do not access outside driver model) * @devres_head: List of memory allocations associated with this device. * When CONFIG_DEVRES is enabled, devm_kmalloc() and friends will * add to this list. Memory so-allocated will be freed @@ -163,7 +164,7 @@ struct udevice {struct list_head child_head;struct list_head sibling_node;uint32_t flags; -int sqq; +int seq_;#ifdef CONFIG_DEVRES struct list_head devres_head;#endif @@ -190,7 +191,7 @@ static inline bool dev_has_of_node(struct udevice *dev)static inline int dev_seq (const struct udevice *dev) { -return dev->sqq; +return dev->seq_; }/** test/dm/core.c +3
-3@@ -1075,10 +1075,10 @@ static int dm_test_all_have_seq(struct unit_test_state *uts)list_for_each_entry (uc, &gd->uclass_root, sibling_node) {list_for_each_entry (dev, &uc->dev_head, uclass_node) { -if (dev->sqq ==-1 ) +if (dev->seq_ ==-1 )printf ("Device '%s' has no seq (%d)\n" , - dev->name, dev->sqq); -ut_assert (dev->sqq !=-1 ); + dev->name, dev->seq_); +ut_assert (dev->seq_ !=-1 ); } }Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 17/26 dm: core: Rename sqq to seq_
Quoted 3 lines · Simon Glass
Now that the sequence-numbering migration is complete, rename this member back to
seq_, adding an underscore to indicate it is internal to driver model.
Quoted 11 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/core/device.c | 8 ++++---- drivers/core/dump.c | 2 +- drivers/core/uclass.c | 8 ++++---- drivers/pci/pci-uclass.c | 2 +- include/dm/device.h | 9 +++++---- test/dm/core.c | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 18/26 dm: core: Access device flags through functions
In reply to Simon GlassAt present flags are stored as part of the device. In preparation for storing them separately, change the access to go through inline functions.
---
cmd/remoteproc.c | 2 +- drivers/clk/clk.c | 2 +- drivers/core/device-remove.c | 18 ++++++++-------- drivers/core/device.c | 32 ++++++++++++++-------------- drivers/core/devres.c | 4 ++-- drivers/core/dump.c | 4 ++-- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/remoteproc/rproc-uclass.c | 2 +- drivers/serial/serial-uclass.c | 2 +- include/dm/device.h | 15 +++++++++++++ include/virtio.h | 2 +- test/dm/bus.c | 10 ++++----- test/dm/core.c | 14 ++++++------ test/dm/cpu.c | 2 +- test/dm/test-fdt.c | 20 ++++++++--------- test/dm/virtio.c | 2 +- 16 files changed, 74 insertions(+), 59 deletions(-)
cmd/remoteproc.c +1 -1
@@ -35,7 +35,7 @@ static int print_remoteproc_list(void) uc_pdata =dev_get_uclass_plat (dev);/* Do not print if rproc is not probed */ -if (!(dev->flags &DM_FLAG_ACTIVATED )) +if (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ))continue ;switch (uc_pdata->mem_type) {
drivers/clk/clk.c +1 -1
@@ -67,7 +67,7 @@ const char *clk_hw_get_name(const struct clk *hw)bool clk_dev_binded (struct clk *clk) { -if (clk->dev && (clk->dev->flags &DM_FLAG_BOUND )) +if (clk->dev && (dev_get_flags (clk->dev) &DM_FLAG_BOUND ))return true;return false;
drivers/core/device-remove.c +9 -9
@@ -69,10 +69,10 @@ int device_unbind(struct udevice *dev)if (!dev)return log_msg_ret ("dev" , -EINVAL ); -if (dev->flags &DM_FLAG_ACTIVATED ) +if (dev_get_flags (dev) &DM_FLAG_ACTIVATED )return log_msg_ret ("active" , -EINVAL ); -if (!(dev->flags &DM_FLAG_BOUND )) +if (!(dev_get_flags (dev) &DM_FLAG_BOUND ))return log_msg_ret ("not-bound" , -EINVAL ); drv = dev->driver;
@@ -88,15 +88,15 @@ int device_unbind(struct udevice *dev)if (ret)return log_msg_ret ("child unbind" , ret); -if (dev->flags &DM_FLAG_ALLOC_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_PDATA ) {free (dev_get_plat (dev));dev_set_plat (dev,NULL ); } -if (dev->flags &DM_FLAG_ALLOC_UCLASS_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_UCLASS_PDATA ) {free (dev_get_uclass_plat (dev));dev_set_uclass_plat (dev,NULL ); } -if (dev->flags &DM_FLAG_ALLOC_PARENT_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_PARENT_PDATA ) {free (dev_get_parent_plat (dev));dev_set_parent_plat (dev,NULL ); }
@@ -109,7 +109,7 @@ int device_unbind(struct udevice *dev)devres_release_all (dev); -if (dev->flags &DM_FLAG_NAME_ALLOCED ) +if (dev_get_flags (dev) &DM_FLAG_NAME_ALLOCED )free ((char *)dev->name);free (dev);
@@ -144,7 +144,7 @@ void device_free(struct udevice *dev)dev_set_parent_priv (dev,NULL ); } } - dev->flags &= ~DM_FLAG_PLATDATA_VALID ; +dev_bic_flags (dev,DM_FLAG_PLATDATA_VALID );devres_release_probe (dev); }
@@ -166,7 +166,7 @@ int device_remove(struct udevice *dev, uint flags)if (!dev)return -EINVAL ; -if (!(dev->flags &DM_FLAG_ACTIVATED )) +if (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ))return 0 ; drv = dev->driver;
@@ -207,7 +207,7 @@ int device_remove(struct udevice *dev, uint flags)if (flags_remove (flags, drv->flags)) {device_free (dev); - dev->flags &= ~DM_FLAG_ACTIVATED ; +dev_bic_flags (dev,DM_FLAG_ACTIVATED ); }return ret;
drivers/core/device.c +16 -16
@@ -96,13 +96,13 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,if (CONFIG_IS_ENABLED (OF_PLATDATA )) {if (of_plat_size) { - dev->flags |=DM_FLAG_OF_PLATDATA ; +dev_or_flags (dev,DM_FLAG_OF_PLATDATA );if (of_plat_size < drv->plat_auto) alloc = true; } }if (alloc) { - dev->flags |=DM_FLAG_ALLOC_PDATA ; +dev_or_flags (dev,DM_FLAG_ALLOC_PDATA ); ptr =calloc (1 , drv->plat_auto);if (!ptr) { ret = -ENOMEM ;
@@ -116,7 +116,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, size = uc->uc_drv->per_device_plat_auto;if (size) { - dev->flags |=DM_FLAG_ALLOC_UCLASS_PDATA ; +dev_or_flags (dev,DM_FLAG_ALLOC_UCLASS_PDATA ); ptr =calloc (1 , size);if (!ptr) { ret = -ENOMEM ;
@@ -131,7 +131,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, size = parent->uclass->uc_drv->per_child_plat_auto; }if (size) { - dev->flags |=DM_FLAG_ALLOC_PARENT_PDATA ; +dev_or_flags (dev,DM_FLAG_ALLOC_PARENT_PDATA ); ptr =calloc (1 , size);if (!ptr) { ret = -ENOMEM ;
@@ -169,7 +169,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,if (devp) *devp = dev; - dev->flags |=DM_FLAG_BOUND ; +dev_or_flags (dev,DM_FLAG_BOUND );return 0 ;
@@ -193,18 +193,18 @@ fail_bind: fail_uclass_bind:if (CONFIG_IS_ENABLED (DM_DEVICE_REMOVE )) {list_del (&dev->sibling_node); -if (dev->flags &DM_FLAG_ALLOC_PARENT_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_PARENT_PDATA ) {free (dev_get_parent_plat (dev));dev_set_parent_plat (dev,NULL ); } } fail_alloc3: -if (dev->flags &DM_FLAG_ALLOC_UCLASS_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_UCLASS_PDATA ) {free (dev_get_uclass_plat (dev));dev_set_uclass_plat (dev,NULL ); } fail_alloc2: -if (dev->flags &DM_FLAG_ALLOC_PDATA ) { +if (dev_get_flags (dev) &DM_FLAG_ALLOC_PDATA ) {free (dev_get_plat (dev));dev_set_plat (dev,NULL ); }
@@ -379,7 +379,7 @@ int device_of_to_plat(struct udevice *dev)if (!dev)return -EINVAL ; -if (dev->flags &DM_FLAG_PLATDATA_VALID ) +if (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID )return 0 ;/* Ensure all parents have ofdata */
@@ -394,7 +394,7 @@ int device_of_to_plat(struct udevice *dev)* (e.g. PCI bridge devices). Test the flags again * so that we don't mess up the device. */ -if (dev->flags &DM_FLAG_PLATDATA_VALID ) +if (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID )return 0 ; }
@@ -412,7 +412,7 @@ int device_of_to_plat(struct udevice *dev) goto fail; } - dev->flags |=DM_FLAG_PLATDATA_VALID ; +dev_or_flags (dev,DM_FLAG_PLATDATA_VALID );return 0 ; fail:
@@ -429,7 +429,7 @@ int device_probe(struct udevice *dev)if (!dev)return -EINVAL ; -if (dev->flags &DM_FLAG_ACTIVATED ) +if (dev_get_flags (dev) &DM_FLAG_ACTIVATED )return 0 ; drv = dev->driver;
@@ -451,11 +451,11 @@ int device_probe(struct udevice *dev)* (e.g. PCI bridge devices). Test the flags again * so that we don't mess up the device. */ -if (dev->flags &DM_FLAG_ACTIVATED ) +if (dev_get_flags (dev) &DM_FLAG_ACTIVATED )return 0 ; } - dev->flags |=DM_FLAG_ACTIVATED ; +dev_or_flags (dev,DM_FLAG_ACTIVATED );/* * Process pinctrl for everything except the root device, and
@@ -515,7 +515,7 @@ fail_uclass: __func__, dev->name); } fail: - dev->flags &= ~DM_FLAG_ACTIVATED ; +dev_bic_flags (dev,DM_FLAG_ACTIVATED );device_free (dev);
@@ -965,7 +965,7 @@ bool device_is_last_sibling(const struct udevice *dev)void device_set_name_alloced (struct udevice *dev) { - dev->flags |=DM_FLAG_NAME_ALLOCED ; +dev_or_flags (dev,DM_FLAG_NAME_ALLOCED ); }int device_set_name (struct udevice *dev,const char *name)
drivers/core/devres.c +2 -2
@@ -107,9 +107,9 @@ void devres_add(struct udevice *dev, void *res)devres_log (dev, dr,"ADD" );assert_noisy (list_empty (&dr->entry)); -if (dev->flags &DM_FLAG_PLATDATA_VALID ) +if (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID ) dr->phase =DEVRES_PHASE_PROBE ; -else if (dev->flags &DM_FLAG_BOUND ) +else if (dev_get_flags (dev) &DM_FLAG_BOUND ) dr->phase =DEVRES_PHASE_OFDATA ;else dr->phase =DEVRES_PHASE_BIND ;
drivers/core/dump.c +2 -2
@@ -14,7 +14,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag) {int i, is_last;struct udevice *child; -u32 flags = dev->flags; +u32 flags =dev_get_flags (dev);/* print the first 20 characters to not break the tree-format. */ printf(IS_ENABLED(CONFIG_SPL_BUILD) ? " %s %d [ %c ] %s " :
@@ -67,7 +67,7 @@ void dm_dump_all(void)static void dm_display_line (struct udevice *dev,int index) {printf ("%-3i %c %s @ %08lx" , index, - dev->flags &DM_FLAG_ACTIVATED ?'*' :' ' , +dev_get_flags (dev) &DM_FLAG_ACTIVATED ?'*' :' ' , dev->name, (ulong )map_to_sysmem (dev));if (dev->seq_ !=-1 )printf (", seq %d" ,dev_seq (dev));
drivers/mtd/nand/raw/octeontx_nand.c +1 -1
@@ -2187,7 +2187,7 @@ int octeontx_pci_nand_deferred_probe(void)debug ("%s: Performing deferred probing\n" , __func__);list_for_each_entry (pdev, &octeontx_pci_nand_deferred_devices, list) {debug ("%s: Probing %s\n" , __func__, pdev->dev->name); - pdev->dev->flags &= ~DM_FLAG_ACTIVATED ; +dev_get_flags (pdev->dev) &= ~DM_FLAG_ACTIVATED ; rc =device_probe (pdev->dev);if (rc && rc != -ENODEV ) { printf("%s: Error %d with deferred probe of %s\n",
drivers/remoteproc/rproc-uclass.c +1 -1
@@ -247,7 +247,7 @@ static int _rproc_dev_is_probed(struct udevice *dev, struct dm_rproc_uclass_pdata *uc_pdata, const void *data) { -if (dev->flags &DM_FLAG_ACTIVATED ) + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) return 0;return -EAGAIN ;
drivers/serial/serial-uclass.c +1 -1
@@ -123,7 +123,7 @@ static void serial_find_console_or_panic(void)#ifdef CONFIG_SERIAL_SEARCH_ALL if (!uclass_get_device_by_seq (UCLASS_SERIAL ,INDEX , &dev) || !uclass_get_device (UCLASS_SERIAL ,INDEX , &dev)) { -if (dev->flags &DM_FLAG_ACTIVATED ) { +if (dev_get_flags (dev) &DM_FLAG_ACTIVATED ) { gd->cur_serial_dev = dev;return ; }
include/dm/device.h +15 -0
@@ -179,6 +179,21 @@ struct udevice {/* Returns non-zero if the device is active (probed and not removed) */ #define device_active (dev) ((dev)->flags & DM_FLAG_ACTIVATED) +static inline u32 dev_get_flags (const struct udevice *dev) +{ +return dev->flags; +} + +static inline void dev_or_flags (struct udevice *dev,u32 or) +{ + dev->flags |= or; +} + +static inline void dev_bic_flags (struct udevice *dev,u32 bic) +{ + dev->flags &= ~bic; +} +static inline int dev_of_offset (const struct udevice *dev) {return ofnode_to_offset (dev->node);
include/virtio.h +1 -1
@@ -492,7 +492,7 @@ static inline void __virtio_clear_bit(struct udevice *udev, unsigned int fbit)*/ static inline bool virtio_has_feature (struct udevice *vdev,unsigned int fbit) { -if (!(vdev->flags &DM_FLAG_BOUND )) +if (!(dev_get_flags (vdev) &DM_FLAG_BOUND ))WARN_ON (true);return __virtio_test_bit (vdev->parent, fbit);
test/dm/bus.c +5 -5
@@ -55,16 +55,16 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts)ut_assertok (device_get_child (bus,0 , &dev));ut_asserteq (-ENODEV ,device_get_child (bus,4 , &dev));ut_assertok (device_get_child_by_seq (bus,5 , &dev)); -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED );ut_asserteq_str ("c-test at 5" , dev->name);/* Device with sequence number 0 should be accessible */ ut_asserteq (-ENODEV ,device_find_child_by_seq (bus,-1 , &dev));ut_assertok (device_find_child_by_seq (bus,0 , &dev)); -ut_assert (!(dev->flags &DM_FLAG_ACTIVATED )); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ));ut_asserteq (0 ,device_find_child_by_seq (bus,0 , &dev));ut_assertok (device_get_child_by_seq (bus,0 , &dev)); -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED );ut_asserteq (0 ,device_find_child_by_seq (bus,0 , &dev));/* There is no device with sequence number 2 */
@@ -96,10 +96,10 @@ static int dm_test_bus_children_of_offset(struct unit_test_state *uts)ut_assert (node >0 );ut_assertok (device_find_child_by_of_offset (bus, node, &dev));ut_assertnonnull (dev); -ut_assert (!(dev->flags &DM_FLAG_ACTIVATED )); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ));ut_assertok (device_get_child_by_of_offset (bus, node, &dev));ut_assertnonnull (dev); -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED );return 0 ; }
test/dm/core.c +7 -7
@@ -131,7 +131,7 @@ static int dm_test_autobind(struct unit_test_state *uts)/* No devices should be probed */ list_for_each_entry (dev, &gd->dm_root->child_head, sibling_node) -ut_assert (!(dev->flags &DM_FLAG_ACTIVATED )); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ));/* Our test driver should have been bound 3 times */ ut_assert (dm_testdrv_op_count[DM_TEST_OP_BIND ] ==3 );
@@ -212,7 +212,7 @@ static int dm_test_autoprobe(struct unit_test_state *uts)ut_asserteq (0 , dm_testdrv_op_count[DM_TEST_OP_POST_PROBE ]);/* The root device should not be activated until needed */ -ut_assert (dms->root->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dms->root) &DM_FLAG_ACTIVATED );/* * We should be able to find the three test devices, and they should
@@ -222,17 +222,17 @@ static int dm_test_autoprobe(struct unit_test_state *uts)for (i =0 ; i <3 ; i++) {ut_assertok (uclass_find_device (UCLASS_TEST , i, &dev));ut_assert (dev); -ut_assertf (!(dev->flags &DM_FLAG_ACTIVATED ), +ut_assertf (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ),"Driver %d/%s already activated" , i, dev->name);/* This should activate it */ ut_assertok (uclass_get_device (UCLASS_TEST , i, &dev));ut_assert (dev); -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED );/* Activating a device should activate the root device */ if (!i) -ut_assert (dms->root->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dms->root) &DM_FLAG_ACTIVATED ); }/*
@@ -460,10 +460,10 @@ static int dm_test_remove(struct unit_test_state *uts)for (i =0 ; i <3 ; i++) {ut_assertok (uclass_find_device (UCLASS_TEST , i, &dev));ut_assert (dev); -ut_assertf (dev->flags &DM_FLAG_ACTIVATED , +ut_assertf (dev_get_flags (dev) &DM_FLAG_ACTIVATED ,"Driver %d/%s not activated" , i, dev->name);ut_assertok (device_remove (dev,DM_REMOVE_NORMAL )); -ut_assertf (!(dev->flags &DM_FLAG_ACTIVATED ), +ut_assertf (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED ),"Driver %d/%s should have deactivated" , i, dev->name);ut_assert (!dev_get_priv (dev));
test/dm/cpu.c +1 -1
@@ -25,7 +25,7 @@ static int dm_test_cpu(struct unit_test_state *uts)for (uclass_find_first_device (UCLASS_CPU , &dev); dev;uclass_find_next_device (&dev)) -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED );ut_assertok (uclass_get_device_by_name (UCLASS_CPU ,"cpu-test1" , &dev));ut_asserteq_ptr (cpu_get_current_dev (), dev);
test/dm/test-fdt.c +10 -10
@@ -1031,8 +1031,8 @@ static int dm_test_child_ofdata(struct unit_test_state *uts)ut_assertok (uclass_first_device_err (UCLASS_TEST_BUS , &bus)); count =0 ; device_foreach_child_of_to_plat(dev, bus) { -ut_assert (dev->flags &DM_FLAG_PLATDATA_VALID ); -ut_assert (!(dev->flags &DM_FLAG_ACTIVATED )); +ut_assert (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID ); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED )); count++; }ut_asserteq (3 , count);
@@ -1050,8 +1050,8 @@ static int dm_test_first_child_probe(struct unit_test_state *uts)ut_assertok (uclass_first_device_err (UCLASS_TEST_BUS , &bus)); count =0 ; device_foreach_child_probe(dev, bus) { -ut_assert (dev->flags &DM_FLAG_PLATDATA_VALID ); -ut_assert (dev->flags &DM_FLAG_ACTIVATED ); +ut_assert (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID ); +ut_assert (dev_get_flags (dev) &DM_FLAG_ACTIVATED ); count++; }ut_asserteq (3 , count);
@@ -1067,19 +1067,19 @@ static int dm_test_ofdata_order(struct unit_test_state *uts)ut_assertok (uclass_find_first_device (UCLASS_I2C , &bus));ut_assertnonnull (bus); -ut_assert (!(bus->flags &DM_FLAG_PLATDATA_VALID )); +ut_assert (!(dev_get_flags (bus) &DM_FLAG_PLATDATA_VALID ));ut_assertok (device_find_first_child (bus, &dev));ut_assertnonnull (dev); -ut_assert (!(dev->flags &DM_FLAG_PLATDATA_VALID )); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID ));/* read the child's ofdata which should cause the parent's to be read */ ut_assertok (device_of_to_plat (dev)); -ut_assert (dev->flags &DM_FLAG_PLATDATA_VALID ); -ut_assert (bus->flags &DM_FLAG_PLATDATA_VALID ); +ut_assert (dev_get_flags (dev) &DM_FLAG_PLATDATA_VALID ); +ut_assert (dev_get_flags (bus) &DM_FLAG_PLATDATA_VALID ); -ut_assert (!(dev->flags &DM_FLAG_ACTIVATED )); -ut_assert (!(bus->flags &DM_FLAG_ACTIVATED )); +ut_assert (!(dev_get_flags (dev) &DM_FLAG_ACTIVATED )); +ut_assert (!(dev_get_flags (bus) &DM_FLAG_ACTIVATED ));return 0 ; }
test/dm/virtio.c +1 -1
@@ -122,7 +122,7 @@ static int dm_test_virtio_remove(struct unit_test_state *uts)ut_assertok (virtio_set_status (dev,VIRTIO_CONFIG_S_DRIVER_OK ));/* check the device can be successfully removed */ - dev->flags |=DM_FLAG_ACTIVATED ; +dev_or_flags (dev,DM_FLAG_ACTIVATED );ut_assertok (device_remove (bus,DM_REMOVE_ACTIVE_ALL ));return 0 ;
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 18/26 dm: core: Access device flags through functions
At present flags are stored as part of the device. In preparation for storing them separately, change the access to go through inline functions.
---
cmd/remoteproc.c | 2 +- drivers/clk/clk.c | 2 +- drivers/core/device-remove.c | 18 ++++++++-------- drivers/core/device.c | 32 ++++++++++++++-------------- drivers/core/devres.c | 4 ++-- drivers/core/dump.c | 4 ++-- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/remoteproc/rproc-uclass.c | 2 +- drivers/serial/serial-uclass.c | 2 +- include/dm/device.h | 15 +++++++++++++ include/virtio.h | 2 +- test/dm/bus.c | 10 ++++----- test/dm/core.c | 14 ++++++------ test/dm/cpu.c | 2 +- test/dm/test-fdt.c | 20 ++++++++--------- test/dm/virtio.c | 2 +- 16 files changed, 74 insertions(+), 59 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 19/26 dm: core: Rename device flags to indicate it is private
In reply to Simon GlassTo avoid having people accidentally access this member, add a trailing underscore.
---
include/dm/device.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
include/dm/device.h +9 -8
@@ -135,7 +135,8 @@ enum {* @uclass_node: Used by uclass to link its devices * @child_head: List of children of this device * @sibling_node: Next device in list of all devices -* @flags: Flags for this device DM_FLAG_... +* @flags_: Flags for this device DM_FLAG_... (do not access outside driver +* model) * @seq_: Allocated sequence number for this device (-1 = none). This is set up * when the device is bound and is unique within the device's uclass. If the * device has an alias in the devicetree then that is used to set the sequence
@@ -163,7 +164,7 @@ struct udevice {struct list_head uclass_node;struct list_head child_head;struct list_head sibling_node; -uint32_t flags; +u32 flags_;int seq_;#ifdef CONFIG_DEVRES struct list_head devres_head;
@@ -176,24 +177,24 @@ struct udevice {/* Returns the operations for a device */ #define device_get_ops (dev) (dev->driver->ops) -/* Returns non-zero if the device is active (probed and not removed) */ -#define device_active (dev) ((dev)->flags & DM_FLAG_ACTIVATED) -static inline u32 dev_get_flags (const struct udevice *dev) { -return dev->flags; +return dev->flags_; }static inline void dev_or_flags (struct udevice *dev,u32 or) { - dev->flags |= or; + dev->flags_ |= or; }static inline void dev_bic_flags (struct udevice *dev,u32 bic) { - dev->flags &= ~bic; + dev->flags_ &= ~bic; } +/* Returns non-zero if the device is active (probed and not removed) */ +#define device_active (dev) (dev_get_flags(dev) & DM_FLAG_ACTIVATED) +static inline int dev_of_offset (const struct udevice *dev) {return ofnode_to_offset (dev->node);
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 19/26 dm: core: Rename device flags to indicate it is private
To avoid having people accidentally access this member, add a trailing underscore.
---
include/dm/device.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 20/26 dm: core: Rename dev_has_of_node() to dev_has_ofnode()
In reply to Simon GlassWe use 'ofnode' rather than 'of_node' in U-Boot. Rename this function to fit.
---
drivers/core/device.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/core/device.c +1 -1
@@ -406,7 +406,7 @@ int device_of_to_plat(struct udevice *dev)assert (drv);if (drv->of_to_plat && - (CONFIG_IS_ENABLED (OF_PLATDATA ) ||dev_has_of_node (dev))) { + (CONFIG_IS_ENABLED (OF_PLATDATA ) ||dev_has_ofnode (dev))) { ret = drv->of_to_plat (dev);if (ret) goto fail;
drivers/mmc/octeontx_hsmmc.c +1 -1
@@ -3752,7 +3752,7 @@ static int octeontx_mmc_host_probe(struct udevice *dev) host->dev = dev;debug ("%s(%s): Base address: %p\n" , __func__, dev->name, host->base_addr); -if (!dev_has_of_node (dev)) { +if (!dev_has_ofnode (dev)) {pr_err ("%s: No device tree information found\n" , __func__);return -1 ; }
drivers/pinctrl/pinctrl-uclass.c +1 -1
@@ -305,7 +305,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename)* Some device which is logical like mmc.blk, do not have * a valid ofnode. */ -if (!dev_has_of_node (dev)) +if (!dev_has_ofnode (dev))return 0 ;/* * Try full-implemented pinctrl first.
drivers/usb/host/usb-uclass.c +1 -1
@@ -517,7 +517,7 @@ static ofnode usb_get_ofnode(struct udevice *hub, int port)ofnode node;u32 reg; -if (!dev_has_of_node (hub)) +if (!dev_has_ofnode (hub))return ofnode_null ();/*
include/dm/device.h +1 -1
@@ -200,7 +200,7 @@ static inline int dev_of_offset(const struct udevice *dev)return ofnode_to_offset (dev->node); } -static inline bool dev_has_of_node (struct udevice *dev) +static inline bool dev_has_ofnode (struct udevice *dev) {return ofnode_valid (dev->node); }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 20/26 dm: core: Rename dev_has_of_node() to dev_has_ofnode()
We use 'ofnode' rather than 'of_node' in U-Boot. Rename this function to fit.
---
drivers/core/device.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 21/26 dm: core: Use dev_has_ofnode() instead of dev_of_valid()
In reply to Simon GlassWe have two functions which do the same thing. Standardise on dev_has_ofnode() since there is no such thing as an 'invalid' ofnode in normal operation: it is either null or missing.
Also move the functions into one place.
---
drivers/clk/clk-uclass.c | 2 +- drivers/core/device.c | 2 +- drivers/gpio/sandbox.c | 2 +- drivers/i2c/designware_i2c_pci.c | 4 ++-- drivers/i2c/i2c-uclass.c | 2 +- drivers/mmc/pci_mmc.c | 2 +- drivers/pci/pci-uclass.c | 6 +++--- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/spi/spi-uclass.c | 2 +- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/timer/timer-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 13 ++++++++++++- include/dm/read.h | 16 ---------------- test/dm/pci.c | 6 +++--- 15 files changed, 30 insertions(+), 35 deletions(-)
drivers/clk/clk-uclass.c +1 -1
@@ -345,7 +345,7 @@ int clk_set_defaults(struct udevice *dev, int stage) {int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;/* If this not in SPL and pre-reloc state, don't take any action. */
drivers/core/device.c +1 -1
@@ -485,7 +485,7 @@ int device_probe(struct udevice *dev) }/* Only handle devices that have a valid ofnode */ -if (dev_of_valid (dev)) { +if (dev_has_ofnode (dev)) {/* * Process 'assigned-{clocks/clock-parents/clock-rates}' * properties
drivers/gpio/sandbox.c +1 -1
@@ -294,7 +294,7 @@ static int gpio_sandbox_probe(struct udevice *dev) {struct gpio_dev_priv *uc_priv =dev_get_uclass_priv (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))/* Tell the uclass how many GPIOs we have */ uc_priv->gpio_count =CONFIG_SANDBOX_GPIO_COUNT ;
drivers/i2c/designware_i2c_pci.c +2 -2
@@ -92,7 +92,7 @@ static int designware_i2c_pci_bind(struct udevice *dev) {char name[20 ]; -if (dev_of_valid (dev)) +if (dev_has_ofnode (dev))return 0 ;sprintf (name,"i2c_designware#%u" ,dev_seq (dev));
@@ -152,7 +152,7 @@ static int dw_i2c_acpi_fill_ssdt(const struct udevice *dev,int ret;/* If no device-tree node, ignore this since we assume it isn't used */ -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; ret =acpi_device_path (dev, path,sizeof (path));
drivers/i2c/i2c-uclass.c +1 -1
@@ -678,7 +678,7 @@ static int i2c_child_post_bind(struct udevice *dev)#if CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )struct dm_i2c_chip *plat =dev_get_parent_plat (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;return i2c_chip_of_to_plat (dev, plat);#else
drivers/mmc/pci_mmc.c +1 -1
@@ -75,7 +75,7 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,struct acpi_dp *dp;int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; ret =gpio_get_acpi (&priv->cd_gpio, &gpio);
drivers/pci/pci-uclass.c +3 -3
@@ -540,7 +540,7 @@ int pci_auto_config_devices(struct udevice *bus)int ret;debug ("%s: device %s\n" , __func__, dev->name); -if (dev_of_valid (dev) && +if (dev_has_ofnode (dev) &&dev_read_bool (dev,"pci,no-autoconfig" ))continue ; ret =dm_pciauto_config_device (dev);
@@ -1036,7 +1036,7 @@ static int pci_uclass_pre_probe(struct udevice *bus) hose->bus = bus; hose->first_busno =dev_seq (bus); hose->last_busno =dev_seq (bus); -if (dev_of_valid (bus)) { +if (dev_has_ofnode (bus)) { hose->skip_auto_config_until_reloc =dev_read_bool (bus,"u-boot,skip-auto-config-until-reloc" );
@@ -1091,7 +1091,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev) {struct pci_child_plat *pplat; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; pplat =dev_get_parent_plat (dev);
drivers/pinctrl/pinctrl-uclass.c +1 -1
@@ -112,7 +112,7 @@ static int pinconfig_post_bind(struct udevice *dev)ofnode node;int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;dev_for_each_subnode (node, dev) {
drivers/spi/spi-uclass.c +1 -1
@@ -155,7 +155,7 @@ static int spi_child_post_bind(struct udevice *dev) {struct dm_spi_slave_plat *plat =dev_get_parent_plat (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;return spi_slave_of_to_plat (dev, plat);
drivers/sysreset/sysreset_sandbox.c +1 -1
@@ -50,7 +50,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)* (see the U_BOOT_DEVICE() declaration below) should not do anything. * If we are that device, return an error. */ -if (state->fdt_fname && !dev_of_valid (dev)) +if (state->fdt_fname && !dev_has_ofnode (dev))return -ENODEV ;switch (type) {
drivers/timer/timer-uclass.c +1 -1
@@ -54,7 +54,7 @@ static int timer_pre_probe(struct udevice *dev)ulong ret;/* It is possible that a timer device has a null ofnode */ -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; err =clk_get_by_index (dev,0 , &timer_clk);
drivers/usb/host/usb-uclass.c +1 -1
@@ -773,7 +773,7 @@ static int usb_child_post_bind(struct udevice *dev)struct usb_dev_plat *plat =dev_get_parent_plat (dev);int val; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;/* We only support matching a few things */
include/dm/device.h +12 -1
@@ -192,6 +192,17 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic) dev->flags_ &= ~bic; } +/** +* dev_ofnode() - get the DT node reference associated with a udevice +* +* @dev: device to check +* @return reference of the the device's DT node +*/ +static inline ofnode dev_ofnode (const struct udevice *dev) +{ +return dev->node; +} +/* Returns non-zero if the device is active (probed and not removed) */ #define device_active (dev) (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
@@ -200,7 +211,7 @@ static inline int dev_of_offset(const struct udevice *dev)return ofnode_to_offset (dev->node); } -static inline bool dev_has_ofnode (struct udevice *dev) +static inline bool dev_has_ofnode (const struct udevice *dev) {return ofnode_valid (dev->node); }
include/dm/read.h +0 -16
@@ -30,22 +30,6 @@ static inline const struct device_node *dev_np(const struct udevice *dev) }#endif -/** -* dev_ofnode() - get the DT node reference associated with a udevice -* -* @dev: device to check -* @return reference of the the device's DT node -*/ -static inline ofnode dev_ofnode (const struct udevice *dev) -{ -return dev->node; -} - -static inline bool dev_of_valid (const struct udevice *dev) -{ -return ofnode_valid (dev_ofnode (dev)); -} -#ifndef CONFIG_DM_DEV_READ_INLINE /**
test/dm/pci.c +3 -3
@@ -120,13 +120,13 @@ static int dm_test_pci_drvdata(struct unit_test_state *uts)ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x08 ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (dev_of_valid (swap)); +ut_assertok (dev_has_ofnode (swap));ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x0c ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (dev_of_valid (swap)); +ut_assertok (dev_has_ofnode (swap));ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x10 ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (!dev_of_valid (swap)); +ut_assertok (!dev_has_ofnode (swap));return 0 ; }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 21/26 dm: core: Use dev_has_ofnode() instead of dev_of_valid()
Quoted 5 lines · Simon Glass
We have two functions which do the same thing. Standardise on
dev_has_ofnode()since there is no such thing as an 'invalid' ofnode in normal operation: it is either null or missing.Also move the functions into one place.
Quoted 285 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/clk/clk-uclass.c | 2 +- drivers/core/device.c | 2 +- drivers/gpio/sandbox.c | 2 +- drivers/i2c/designware_i2c_pci.c | 4 ++-- drivers/i2c/i2c-uclass.c | 2 +- drivers/mmc/pci_mmc.c | 2 +- drivers/pci/pci-uclass.c | 6 +++--- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/spi/spi-uclass.c | 2 +- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/timer/timer-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 13 ++++++++++++- include/dm/read.h | 16 ---------------- test/dm/pci.c | 6 +++--- 15 files changed, 30 insertions(+), 35 deletions(-)drivers/clk/clk-uclass.c +1
-1@@ -345,7 +345,7 @@ int clk_set_defaults(struct udevice *dev, int stage) {int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;/* If this not in SPL and pre-reloc state, don't take any action. */ drivers/core/device.c +1
-1@@ -485,7 +485,7 @@ int device_probe(struct udevice *dev) }/* Only handle devices that have a valid ofnode */ -if (dev_of_valid (dev)) { +if (dev_has_ofnode (dev)) {/* * Process 'assigned-{clocks/clock-parents/clock-rates}' * properties drivers/gpio/sandbox.c +1
-1@@ -294,7 +294,7 @@ static int gpio_sandbox_probe(struct udevice *dev) {struct gpio_dev_priv *uc_priv =dev_get_uclass_priv (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))/* Tell the uclass how many GPIOs we have */ uc_priv->gpio_count =CONFIG_SANDBOX_GPIO_COUNT ;drivers/i2c/designware_i2c_pci.c +2
-2@@ -92,7 +92,7 @@ static int designware_i2c_pci_bind(struct udevice *dev) {char name[20 ]; -if (dev_of_valid (dev)) +if (dev_has_ofnode (dev))return 0 ;sprintf (name,"i2c_designware#%u" ,dev_seq (dev));@@ -152,7 +152,7 @@ static int dw_i2c_acpi_fill_ssdt(const struct udevice *dev,int ret;/* If no device-tree node, ignore this since we assume it isn't used */ -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; ret =acpi_device_path (dev, path,sizeof (path));drivers/i2c/i2c-uclass.c +1
-1@@ -678,7 +678,7 @@ static int i2c_child_post_bind(struct udevice *dev)#if CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )struct dm_i2c_chip *plat =dev_get_parent_plat (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;return i2c_chip_of_to_plat (dev, plat);#else drivers/mmc/pci_mmc.c +1
-1@@ -75,7 +75,7 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,struct acpi_dp *dp;int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; ret =gpio_get_acpi (&priv->cd_gpio, &gpio);drivers/pci/pci-uclass.c +3
-3@@ -540,7 +540,7 @@ int pci_auto_config_devices(struct udevice *bus)int ret;debug ("%s: device %s\n" , __func__, dev->name); -if (dev_of_valid (dev) && +if (dev_has_ofnode (dev) &&dev_read_bool (dev,"pci,no-autoconfig" ))continue ; ret =dm_pciauto_config_device (dev);@@ -1036,7 +1036,7 @@ static int pci_uclass_pre_probe(struct udevice *bus) hose->bus = bus; hose->first_busno =dev_seq (bus); hose->last_busno =dev_seq (bus); -if (dev_of_valid (bus)) { +if (dev_has_ofnode (bus)) { hose->skip_auto_config_until_reloc =dev_read_bool (bus,"u-boot,skip-auto-config-until-reloc" );@@ -1091,7 +1091,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev) {struct pci_child_plat *pplat; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; pplat =dev_get_parent_plat (dev);drivers/pinctrl/pinctrl-uclass.c +1
-1@@ -112,7 +112,7 @@ static int pinconfig_post_bind(struct udevice *dev)ofnode node;int ret; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;dev_for_each_subnode (node, dev) {drivers/spi/spi-uclass.c +1
-1@@ -155,7 +155,7 @@ static int spi_child_post_bind(struct udevice *dev) {struct dm_spi_slave_plat *plat =dev_get_parent_plat (dev); -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;return spi_slave_of_to_plat (dev, plat);drivers/sysreset/sysreset_sandbox.c +1
-1@@ -50,7 +50,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)* (see the U_BOOT_DEVICE() declaration below) should not do anything. * If we are that device, return an error. */ -if (state->fdt_fname && !dev_of_valid (dev)) +if (state->fdt_fname && !dev_has_ofnode (dev))return -ENODEV ;switch (type) {drivers/timer/timer-uclass.c +1
-1@@ -54,7 +54,7 @@ static int timer_pre_probe(struct udevice *dev)ulong ret;/* It is possible that a timer device has a null ofnode */ -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ; err =clk_get_by_index (dev,0 , &timer_clk);drivers/usb/host/usb-uclass.c +1
-1@@ -773,7 +773,7 @@ static int usb_child_post_bind(struct udevice *dev)struct usb_dev_plat *plat =dev_get_parent_plat (dev);int val; -if (!dev_of_valid (dev)) +if (!dev_has_ofnode (dev))return 0 ;/* We only support matching a few things */ include/dm/device.h +12
-1@@ -192,6 +192,17 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic) dev->flags_ &= ~bic; } +/** +* dev_ofnode() - get the DT node reference associated with a udevice +* +* @dev: device to check +* @return reference of the the device's DT node +*/ +static inline ofnode dev_ofnode (const struct udevice *dev) +{ +return dev->node; +} +/* Returns non-zero if the device is active (probed and not removed) */ #define device_active (dev) (dev_get_flags(dev) & DM_FLAG_ACTIVATED)@@ -200,7 +211,7 @@ static inline int dev_of_offset(const struct udevice *dev)return ofnode_to_offset (dev->node); } -static inline bool dev_has_ofnode (struct udevice *dev) +static inline bool dev_has_ofnode (const struct udevice *dev) {return ofnode_valid (dev->node); }include/dm/read.h +0
-16@@ -30,22 +30,6 @@ static inline const struct device_node *dev_np(const struct udevice *dev) }#endif -/** -* dev_ofnode() - get the DT node reference associated with a udevice -* -* @dev: device to check -* @return reference of the the device's DT node -*/ -static inline ofnode dev_ofnode (const struct udevice *dev) -{ -return dev->node; -} - -static inline bool dev_of_valid (const struct udevice *dev) -{ -return ofnode_valid (dev_ofnode (dev)); -} -#ifndef CONFIG_DM_DEV_READ_INLINE /** test/dm/pci.c +3
-3@@ -120,13 +120,13 @@ static int dm_test_pci_drvdata(struct unit_test_state *uts)ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x08 ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (dev_of_valid (swap)); +ut_assertok (dev_has_ofnode (swap));ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x0c ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (dev_of_valid (swap)); +ut_assertok (dev_has_ofnode (swap));ut_assertok (dm_pci_bus_find_bdf (PCI_BDF (1 ,0x10 ,0 ), &swap));ut_asserteq (SWAP_CASE_DRV_DATA , swap->driver_data); -ut_assertok (!dev_of_valid (swap)); +ut_assertok (!dev_has_ofnode (swap));return 0 ; }Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 21/26 dm: core: Use dev_has_ofnode() instead of dev_of_valid()
Quoted 5 lines · Simon Glass
We have two functions which do the same thing. Standardise on
dev_has_ofnode()since there is no such thing as an 'invalid' ofnode in normal operation: it is either null or missing.Also move the functions into one place.
Quoted 20 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/clk/clk-uclass.c | 2 +- drivers/core/device.c | 2 +- drivers/gpio/sandbox.c | 2 +- drivers/i2c/designware_i2c_pci.c | 4 ++-- drivers/i2c/i2c-uclass.c | 2 +- drivers/mmc/pci_mmc.c | 2 +- drivers/pci/pci-uclass.c | 6 +++--- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/spi/spi-uclass.c | 2 +- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/timer/timer-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 13 ++++++++++++- include/dm/read.h | 16 ---------------- test/dm/pci.c | 6 +++--- 15 files changed, 30 insertions(+), 35 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 21/26 dm: core: Use dev_has_ofnode() instead of dev_of_valid()
In reply to Simon GlassHi Simon,
Quoted 9 lines · Simon Glass
We have two functions which do the same thing. Standardise on
dev_has_ofnode()since there is no such thing as an 'invalid' ofnode in normal operation: it is either null or missing.Also move the functions into one place.
Signed-off-by Simon Glass <[email protected]>---
Quoted 17 lines
drivers/clk/clk-uclass.c | 2 +- drivers/core/device.c | 2 +- drivers/gpio/sandbox.c | 2 +- drivers/i2c/designware_i2c_pci.c | 4 ++-- drivers/i2c/i2c-uclass.c | 2 +- drivers/mmc/pci_mmc.c | 2 +- drivers/pci/pci-uclass.c | 6 +++--- drivers/pinctrl/pinctrl-uclass.c | 2 +- drivers/spi/spi-uclass.c | 2 +- drivers/sysreset/sysreset_sandbox.c | 2 +- drivers/timer/timer-uclass.c | 2 +- drivers/usb/host/usb-uclass.c | 2 +- include/dm/device.h | 13 ++++++++++++- include/dm/read.h | 16 ---------------- test/dm/pci.c | 6 +++--- 15 files changed, 30 insertions(+), 35 deletions(-)
Thanks
Patrick
PATCH 22/26 dm: core: Access device ofnode through functions
In reply to Simon GlassAt present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions.
---
arch/arm/mach-stm32mp/pwr_regulator.c | 2 +- board/synopsys/hsdk/clk-lib.c | 2 +- drivers/ata/mtk_ahci.c | 3 ++- drivers/clk/meson/axg.c | 2 +- drivers/clk/meson/g12a.c | 2 +- drivers/clk/meson/gxbb.c | 2 +- drivers/core/device.c | 2 +- drivers/core/root.c | 2 +- drivers/gpio/mpc8xxx_gpio.c | 4 ++-- drivers/gpio/octeon_gpio.c | 2 +- drivers/misc/swap_case.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 23 +++++++++++++---------- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/mtd/nand/spi/core.c | 2 +- drivers/net/fm/eth.c | 4 ++-- drivers/net/fsl_enetc.c | 8 ++++---- drivers/net/fsl_enetc_mdio.c | 2 +- drivers/net/mdio-ipq4019.c | 4 ++-- drivers/net/mdio_mux_i2creg.c | 2 +- drivers/net/mvmdio.c | 4 ++-- drivers/net/octeontx/smi.c | 2 +- drivers/net/tsec.c | 3 ++- drivers/phy/phy-ti-am654.c | 2 +- drivers/power/domain/meson-ee-pwrc.c | 4 ++-- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 ++-- drivers/power/regulator/pbias_regulator.c | 3 ++- drivers/pwm/pwm-meson.c | 9 ++++++--- drivers/reset/reset-socfpga.c | 2 +- drivers/spi/fsl_dspi.c | 6 ++++-- drivers/tee/optee/core.c | 2 +- drivers/usb/cdns3/core.c | 4 ++-- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/dwc3-generic.c | 6 +++--- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-meson-gxl.c | 2 +- drivers/usb/gadget/dwc2_udc_otg.c | 4 ++-- drivers/usb/host/dwc3-octeon-glue.c | 2 +- drivers/usb/host/dwc3-sti-glue.c | 5 +++-- drivers/usb/host/ehci-mx6.c | 2 +- drivers/usb/host/xhci-dwc3.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_plat.c | 4 ++-- drivers/usb/musb-new/ti-musb.c | 2 +- drivers/video/nexell_display.c | 2 +- drivers/video/rockchip/rk_mipi.c | 2 +- include/dm/device.h | 23 +++++++++++++++++++++-- include/dm/read.h | 2 +- include/linux/mtd/mtd.h | 4 ++-- net/mdio-mux-uclass.c | 2 +- net/mdio-uclass.c | 8 ++++---- 50 files changed, 113 insertions(+), 82 deletions(-)
arch/arm/mach-stm32mp/pwr_regulator.c +1 -1
@@ -81,7 +81,7 @@ static int stm32mp_pwr_bind(struct udevice *dev) {int children; - children =pmic_bind_children (dev, dev->node, pwr_children_info); + children =pmic_bind_children (dev,dev_ofnode (dev), pwr_children_info);if (!children)dev_dbg (dev,"no child found\n" );
board/synopsys/hsdk/clk-lib.c +1 -1
@@ -23,8 +23,8 @@ int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl)/* Dummy fmeas device, just to be able to use standard clk_* api */ struct udevice fmeas = { .name ="clk-fmeas" , - .node =ofnode_path ("/clk-fmeas" ), }; +dev_set_ofnode (&fmeas,ofnode_path ("/clk-fmeas" )); ret =clk_get_by_name (&fmeas, name, &clk);if (ret) {
drivers/ata/mtk_ahci.c +2 -1
@@ -68,7 +68,8 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv, SYS_CFG_SATA_MSK, SYS_CFG_SATA_EN); } -ofnode_read_u32 (dev->node,"ports-implemented" , &hpriv->port_map); +ofnode_read_u32 (dev_ofnode (dev),"ports-implemented" , + &hpriv->port_map);return 0 ; }
drivers/clk/meson/axg.c +1 -1
@@ -289,7 +289,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);
drivers/clk/meson/g12a.c +1 -1
@@ -979,7 +979,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);
drivers/clk/meson/gxbb.c +1 -1
@@ -885,7 +885,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);
drivers/core/device.c +1 -1
@@ -68,7 +68,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,dev_set_plat (dev, plat); dev->driver_data = driver_data; dev->name = name; - dev->node = node; +dev_set_ofnode (dev, node); dev->parent = parent; dev->driver = drv; dev->uclass = uc;
drivers/core/root.c +1 -1
@@ -148,7 +148,7 @@ int dm_init(bool of_live)if (ret)return ret;if (CONFIG_IS_ENABLED (OF_CONTROL )) -DM_ROOT_NON_CONST ->node =ofnode_root (); +dev_set_ofnode (DM_ROOT_NON_CONST ,ofnode_root ()); ret =device_probe (DM_ROOT_NON_CONST );if (ret)return ret;
drivers/gpio/mpc8xxx_gpio.c +2 -2
@@ -191,7 +191,7 @@ static int mpc8xxx_gpio_of_to_plat(struct udevice *dev)u32 i;u32 reg[4 ]; -if (ofnode_read_bool (dev->node,"little-endian" )) +if (ofnode_read_bool (dev_ofnode (dev),"little-endian" )) data->little_endian = true;if (data->little_endian)
@@ -257,7 +257,7 @@ static int mpc8xxx_gpio_probe(struct udevice *dev)if (!str)return -ENOMEM ; -if (ofnode_device_is_compatible (dev->node,"fsl,qoriq-gpio" )) { +if (ofnode_device_is_compatible (dev_ofnode (dev),"fsl,qoriq-gpio" )) {unsigned long gpibe = data->addr +sizeof (struct ccsr_gpio ) -sizeof (u32);
drivers/gpio/octeon_gpio.c +1 -1
@@ -190,7 +190,7 @@ static int octeon_gpio_probe(struct udevice *dev)GPIO_CONST_GPIOS_MASK ; }else { priv->base =dev_remap_addr (dev); - uc_priv->gpio_count =ofnode_read_u32_default (dev->node, + uc_priv->gpio_count =ofnode_read_u32_default (dev_ofnode (dev),"nr-gpios" ,32 ); }
drivers/misc/swap_case.c +1 -1
@@ -54,7 +54,7 @@ struct swap_case_priv {static int sandbox_swap_case_use_ea (const struct udevice *dev) { -return !!ofnode_get_property (dev->node,"use-ea" ,NULL ); +return !!ofnode_get_property (dev_ofnode (dev),"use-ea" ,NULL ); }/* Please keep these macros in sync with ea_regs below */
drivers/mmc/octeontx_hsmmc.c +13 -10
@@ -3439,7 +3439,7 @@ static u32 xlate_voltage(u32 voltage)*/ static bool octeontx_mmc_get_valid (struct udevice *dev) { -const char *stat =ofnode_read_string (dev->node,"status" ); +const char *stat =ofnode_read_string (dev_ofnode (dev),"status" );if (!stat || !strncmp (stat,"ok" ,2 ))return true;
@@ -3461,14 +3461,15 @@ static int octeontx_mmc_get_config(struct udevice *dev)uint low, high;char env_name[32 ];int err; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);int bus_width =1 ;ulong new_max_freq;debug ("%s(%s)" , __func__, dev->name); slot->cfg.name = dev->name; - slot->cfg.f_max =ofnode_read_s32_default (dev->node,"max-frequency" , + slot->cfg.f_max =ofnode_read_s32_default (dev_ofnode (dev), +"max-frequency" ,26000000 );snprintf (env_name,sizeof (env_name),"mmc_max_frequency%d" , slot->bus_id);
@@ -3486,25 +3487,26 @@ static int octeontx_mmc_get_config(struct udevice *dev)if (IS_ENABLED (CONFIG_ARCH_OCTEONTX2 )) { slot->hs400_tuning_block = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs400-tuning-block" ,-1 );debug ("%s(%s): mmc HS400 tuning block: %d\n" , __func__, dev->name, slot->hs400_tuning_block); slot->hs200_tap_adj = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs200-tap-adjust" ,0 );debug ("%s(%s): hs200-tap-adjust: %d\n" , __func__, dev->name, slot->hs200_tap_adj); slot->hs400_tap_adj = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs400-tap-adjust" ,0 );debug ("%s(%s): hs400-tap-adjust: %d\n" , __func__, dev->name, slot->hs400_tap_adj); } - err =ofnode_read_u32_array (dev->node,"voltage-ranges" , voltages,2 ); + err =ofnode_read_u32_array (dev_ofnode (dev),"voltage-ranges" , + voltages,2 );if (err) { slot->cfg.voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ; }else {
@@ -3756,14 +3758,15 @@ static int octeontx_mmc_host_probe(struct udevice *dev)pr_err ("%s: No device tree information found\n" , __func__);return -1 ; } - host->node = dev->node; + host->node =dev_ofnode (dev); host->last_slotid =-1 ;if (otx_is_platform (PLATFORM_ASIM )) host->is_asim = true;if (otx_is_platform (PLATFORM_EMULATOR )) host->is_emul = true; host->dma_wait_delay = -ofnode_read_u32_default (dev->node,"marvell,dma-wait-delay" ,1 ); +ofnode_read_u32_default (dev_ofnode (dev), +"marvell,dma-wait-delay" ,1 );/* Force reset of eMMC */ writeq (0 , host->base_addr +MIO_EMM_CFG ());debug ("%s: Clearing MIO_EMM_CFG\n" , __func__);
@@ -3824,7 +3827,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev)struct octeontx_mmc_host *host =dev_get_priv (dev_get_parent (dev));struct octeontx_mmc_slot *slot;struct mmc_uclass_priv *upriv; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);u32 bus_id;char name[16 ];int err;
drivers/mtd/nand/raw/octeontx_nand.c +1 -1
@@ -1999,7 +1999,7 @@ static int octeontx_nfc_chip_init(struct octeontx_nfc *tn, struct udevice *dev,static int octeontx_nfc_chips_init (struct octeontx_nfc *tn) {struct udevice *dev = tn->dev; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);ofnode nand_node;int nr_chips =of_get_child_count (node);int ret;
drivers/mtd/nand/spi/core.c +1 -1
@@ -1173,7 +1173,7 @@ static int spinand_probe(struct udevice *dev)return -ENOMEM ;sprintf (mtd->name,"spi-nand%d" , spi_nand_idx++); spinand->slave = slave; -spinand_set_ofnode (spinand, dev->node); +spinand_set_ofnode (spinand,dev_ofnode (dev));#endif ret =spinand_init (spinand);
drivers/net/fm/eth.c +2 -2
@@ -957,7 +957,7 @@ phy_interface_t fman_read_sys_if(struct udevice *dev) {const char *if_str; - if_str =ofnode_read_string (dev->node,"phy-connection-type" ); + if_str =ofnode_read_string (dev_ofnode (dev),"phy-connection-type" );debug ("MAC system interface mode %s\n" , if_str);return phy_get_interface_by_name (if_str);
@@ -969,7 +969,7 @@ static int fm_eth_bind(struct udevice *dev)char mac_name[11 ];u32 fm, num; -if (ofnode_read_u32 (ofnode_get_parent (dev->node),"cell-index" , &fm)) { +if (ofnode_read_u32 (ofnode_get_parent (dev_ofnode (dev)),"cell-index" , &fm)) {printf ("FMan node property cell-index missing\n" );return -EINVAL ; }
drivers/net/fsl_enetc.c +4 -4
@@ -99,7 +99,7 @@ static int enetc_bind(struct udevice *dev)* and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ -if (ofnode_valid (dev->node)) +if (ofnode_valid (dev_ofnode (dev)))sprintf (name,"enetc-%u" ,PCI_FUNC (pci_get_devfn (dev)));else sprintf (name,"enetc#%u" , eth_num_devices++);
@@ -253,12 +253,12 @@ static void enetc_start_pcs(struct udevice *dev)mdio_register (&priv->imdio); } -if (!ofnode_valid (dev->node)) { +if (!ofnode_valid (dev_ofnode (dev))) {enetc_dbg (dev,"no enetc ofnode found, skipping PCS set-up\n" );return ; } - if_str =ofnode_read_string (dev->node,"phy-mode" ); + if_str =ofnode_read_string (dev_ofnode (dev),"phy-mode" );if (if_str) priv->if_type =phy_get_interface_by_name (if_str);else
@@ -306,7 +306,7 @@ static int enetc_probe(struct udevice *dev) {struct enetc_priv *priv =dev_get_priv (dev); -if (ofnode_valid (dev->node) && !ofnode_is_available (dev->node)) { +if (ofnode_valid (dev_ofnode (dev)) && !ofnode_is_available (dev_ofnode (dev))) {enetc_dbg (dev,"interface disabled\n" );return -ENODEV ; }
drivers/net/fsl_enetc_mdio.c +1 -1
@@ -112,7 +112,7 @@ static int enetc_mdio_bind(struct udevice *dev)* and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ -if (ofnode_valid (dev->node)) +if (ofnode_valid (dev_ofnode (dev)))sprintf (name,"emdio-%u" ,PCI_FUNC (pci_get_devfn (dev)));else sprintf (name,"emdio#%u" , eth_num_devices++);
drivers/net/mdio-ipq4019.c +2 -2
@@ -107,8 +107,8 @@ static const struct mdio_ops ipq4019_mdio_ops = {static int ipq4019_mdio_bind (struct udevice *dev) { -if (ofnode_valid (dev->node)) -device_set_name (dev,ofnode_get_name (dev->node)); +if (ofnode_valid (dev_ofnode (dev))) +device_set_name (dev,ofnode_get_name (dev_ofnode (dev)));return 0 ; }
drivers/net/mdio_mux_i2creg.c +1 -1
@@ -61,7 +61,7 @@ static int mdio_mux_i2creg_probe(struct udevice *dev) }/* parent should be an I2C chip, grandparent should be an I2C bus */ - chip_node =ofnode_get_parent (dev->node); + chip_node =ofnode_get_parent (dev_ofnode (dev)); bus_node =ofnode_get_parent (chip_node); err =uclass_get_device_by_ofnode (UCLASS_I2C , bus_node, &i2c_bus);
drivers/net/mvmdio.c +2 -2
@@ -197,8 +197,8 @@ static int mvmdio_write(struct udevice *dev, int addr, int devad, int reg,*/ static int mvmdio_bind (struct udevice *dev) { -if (ofnode_valid (dev->node)) -device_set_name (dev,ofnode_get_name (dev->node)); +if (ofnode_valid (dev_ofnode (dev))) +device_set_name (dev,ofnode_get_name (dev_ofnode (dev)));return 0 ; }
drivers/net/octeontx/smi.c +1 -1
@@ -313,7 +313,7 @@ read_error:int octeontx_smi_probe (struct udevice *dev) { -int ret, subnode, cnt =0 , node = dev->node.of_offset; +int ret, subnode, cnt =0 , node =dev_ofnode (dev).of_offset;struct mii_dev *bus;struct octeontx_smi_priv *priv;pci_dev_t bdf =dm_pci_get_bdf (dev);
drivers/net/tsec.c +2 -1
@@ -707,7 +707,8 @@ static int init_phy(struct tsec_private *priv)tsec_configure_serdes (priv);#if defined(CONFIG_DM_ETH ) && defined(CONFIG_DM_MDIO ) -if (ofnode_valid (ofnode_find_subnode (priv->dev->node,"fixed-link" ))) +if (ofnode_valid (ofnode_find_subnode (dev_ofnode (priv->dev), +"fixed-link" ))) phydev =phy_connect (NULL ,0 , priv->dev, priv->interface);else phydev =dm_eth_phy_connect (priv->dev);
drivers/phy/phy-ti-am654.c +1 -1
@@ -344,7 +344,7 @@ static int serdes_am654_bind(struct udevice *dev) ret =device_bind_driver_to_node (dev->parent,"ti-serdes-am654-mux-clk" , -dev_read_name (dev), dev->node, +dev_read_name (dev),dev_ofnode (dev),NULL );if (ret) {dev_err (dev,"%s: not able to bind clock driver\n" , __func__);
drivers/power/domain/meson-ee-pwrc.c +2 -2
@@ -397,11 +397,11 @@ static int meson_ee_pwrc_probe(struct udevice *dev)if (!priv->data)return -EINVAL ; - priv->regmap_hhi =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->regmap_hhi =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->regmap_hhi))return PTR_ERR (priv->regmap_hhi); - ret =ofnode_read_u32 (dev->node,"amlogic,ao-sysctrl" , + ret =ofnode_read_u32 (dev_ofnode (dev),"amlogic,ao-sysctrl" , &ao_phandle);if (ret)return ret;
drivers/power/domain/meson-gx-pwrc-vpu.c +2 -2
@@ -300,11 +300,11 @@ static int meson_gx_pwrc_vpu_probe(struct udevice *dev)ofnode hhi_node;int ret; - priv->regmap_ao =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->regmap_ao =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->regmap_ao))return PTR_ERR (priv->regmap_ao); - ret =ofnode_read_u32 (dev->node,"amlogic,hhi-sysctrl" , + ret =ofnode_read_u32 (dev_ofnode (dev),"amlogic,hhi-sysctrl" , &hhi_phandle);if (ret)return ret;
drivers/power/regulator/pbias_regulator.c +2 -1
@@ -103,7 +103,8 @@ static int pbias_bind(struct udevice *dev) {int children; - children =pmic_bind_children (dev, dev->node, pmic_children_info); + children =pmic_bind_children (dev,dev_ofnode (dev), + pmic_children_info);if (!children)debug ("%s: %s - no child found\n" , __func__, dev->name);
drivers/pwm/pwm-meson.c +6 -3
@@ -304,13 +304,14 @@ static int meson_pwm_probe(struct udevice *dev)if (strcmp (cdev->driver->name,"fixed_rate_clock" ))continue ; - str =ofnode_read_string (cdev->node,"clock-output-names" ); + str =ofnode_read_string (dev_ofnode (cdev), +"clock-output-names" );if (!str)continue ;if (!strcmp (str,"xtal" )) { err =uclass_get_device_by_ofnode (UCLASS_CLK , - cdev->node, +dev_ofnode (cdev), &cdev);if (err) {printf ("%s%d: Failed to get xtal clk\n" , __func__, i);
@@ -345,7 +346,9 @@ static int meson_pwm_probe(struct udevice *dev)return -EINVAL ; } - err =uclass_get_device_by_ofnode (UCLASS_CLK , cdev->node, &cdev); + err =uclass_get_device_by_ofnode (UCLASS_CLK , +dev_ofnode (cdev), + &cdev);if (err) {printf ("%s%d: Failed to get clk controller\n" , __func__, i);return err;
drivers/reset/reset-socfpga.c +1 -1
@@ -148,7 +148,7 @@ static int socfpga_reset_bind(struct udevice *dev)* Bind it to the node, too, so that it can get its base address. */ ret =device_bind_driver_to_node (dev,"socfpga_sysreset" ,"sysreset" , - dev->node, &sys_child); +dev_ofnode (dev), &sys_child);if (ret)debug ("Warning: No sysreset driver: ret=%d\n" , ret);
drivers/spi/fsl_dspi.c +4 -2
@@ -460,8 +460,10 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev)return -EINVAL ; } -ofnode_read_u32 (dev->node,"fsl,spi-cs-sck-delay" , &cs_sck_delay); -ofnode_read_u32 (dev->node,"fsl,spi-sck-cs-delay" , &sck_cs_delay); +ofnode_read_u32 (dev_ofnode (dev),"fsl,spi-cs-sck-delay" , + &cs_sck_delay); +ofnode_read_u32 (dev_ofnode (dev),"fsl,spi-sck-cs-delay" , + &sck_cs_delay);/* Set PCS to SCK delay scale values */ ns_delay_scale (&pcssck, &cssck, cs_sck_delay, priv->bus_clk);
drivers/tee/optee/core.c +1 -1
@@ -592,7 +592,7 @@ static optee_invoke_fn *get_invoke_func(struct udevice *dev)const char *method;debug ("optee: looking for conduit method in DT.\n" ); - method =ofnode_get_property (dev->node,"method" ,NULL ); + method =ofnode_get_property (dev_ofnode (dev),"method" ,NULL );if (!method) {debug ("optee: missing \"method\" property\n" );return ERR_PTR (-ENXIO );
drivers/usb/cdns3/core.c +2 -2
@@ -110,7 +110,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)enum usb_dr_mode dr_mode;int ret =0 ; - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev)); cdns->role =USB_ROLE_NONE ;/*
@@ -393,7 +393,7 @@ int cdns3_bind(struct udevice *parent)ofnode node;int ret; - node =ofnode_by_compatible (parent->node,"cdns,usb3" ); + node =ofnode_by_compatible (dev_ofnode (parent),"cdns,usb3" );if (!ofnode_valid (node)) { ret = -ENODEV ; goto fail;
drivers/usb/dwc3/core.c +1 -1
@@ -905,7 +905,7 @@ void dwc3_of_parse(struct dwc3 *dwc)*/ hird_threshold =12 ; - dwc->hsphy_mode =usb_get_phy_mode (dev->node); + dwc->hsphy_mode =usb_get_phy_mode (dev_ofnode (dev)); dwc->has_lpm_erratum =dev_read_bool (dev,"snps,has-lpm-erratum" );
drivers/usb/dwc3/dwc3-generic.c +3 -3
@@ -108,7 +108,7 @@ static int dwc3_generic_remove(struct udevice *dev,static int dwc3_generic_of_to_plat (struct udevice *dev) {struct dwc3_generic_plat *plat =dev_get_plat (dev); -ofnode node = dev->node; +ofnode node =dev_ofnode (dev); plat->base =dev_read_addr (dev);
@@ -301,7 +301,7 @@ static int dwc3_glue_bind(struct udevice *parent)ofnode node;int ret; -ofnode_for_each_subnode (node, parent->node) { +ofnode_for_each_subnode (node,dev_ofnode (parent)) {const char *name =ofnode_get_name (node);enum usb_dr_mode dr_mode;struct udevice *dev;
@@ -418,7 +418,7 @@ static int dwc3_glue_probe(struct udevice *dev)while (child) {enum usb_dr_mode dr_mode; - dr_mode =usb_get_dr_mode (child->node); + dr_mode =usb_get_dr_mode (dev_ofnode (child));device_find_next_child (&child);if (ops && ops->select_dr_mode) ops->select_dr_mode (dev, index, dr_mode);
drivers/usb/dwc3/dwc3-meson-g12a.c +1 -1
@@ -395,7 +395,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) }#endif - priv->otg_mode =usb_get_dr_mode (dev->node); + priv->otg_mode =usb_get_dr_mode (dev_ofnode (dev)); ret =dwc3_meson_g12a_usb_init (priv);if (ret)
drivers/usb/dwc3/dwc3-meson-gxl.c +1 -1
@@ -338,7 +338,7 @@ static int dwc3_meson_gxl_probe(struct udevice *dev)if (ret)return ret; - priv->otg_mode =usb_get_dr_mode (dev->node); + priv->otg_mode =usb_get_dr_mode (dev_ofnode (dev));if (priv->otg_mode ==USB_DR_MODE_PERIPHERAL ) priv->otg_phy_mode =USB_DR_MODE_PERIPHERAL ;
drivers/usb/gadget/dwc2_udc_otg.c +2 -2
@@ -987,8 +987,8 @@ static int dwc2_udc_otg_of_to_plat(struct udevice *dev)void (*set_params)(struct dwc2_plat_otg_data *data);int ret; -if (usb_get_dr_mode (dev->node) !=USB_DR_MODE_PERIPHERAL && -usb_get_dr_mode (dev->node) !=USB_DR_MODE_OTG ) { +if (usb_get_dr_mode (dev_ofnode (dev)) !=USB_DR_MODE_PERIPHERAL && +usb_get_dr_mode (dev_ofnode (dev)) !=USB_DR_MODE_OTG ) {dev_dbg (dev,"Invalid mode\n" );return -ENODEV ; }
drivers/usb/host/dwc3-octeon-glue.c +1 -1
@@ -366,7 +366,7 @@ static int octeon_dwc3_glue_bind(struct udevice *dev)/* Find snps,dwc3 node from subnode */ dwc3_node =ofnode_null (); -ofnode_for_each_subnode (node, dev->node) { +ofnode_for_each_subnode (node,dev_ofnode (dev)) {if (ofnode_device_is_compatible (node,"snps,dwc3" )) dwc3_node = node; }
drivers/usb/host/dwc3-sti-glue.c +3 -2
@@ -108,7 +108,8 @@ static int sti_dwc3_glue_of_to_plat(struct udevice *dev)int ret;u32 reg[4 ]; - ret =ofnode_read_u32_array (dev->node,"reg" , reg,ARRAY_SIZE (reg)); + ret =ofnode_read_u32_array (dev_ofnode (dev),"reg" , reg, +ARRAY_SIZE (reg));if (ret) {pr_err ("unable to find st,stih407-dwc3 reg property(%d)\n" , ret);return ret;
@@ -154,7 +155,7 @@ static int sti_dwc3_glue_bind(struct udevice *dev)ofnode node, dwc3_node;/* Find snps,dwc3 node from subnode */ -ofnode_for_each_subnode (node, dev->node) { +ofnode_for_each_subnode (node,dev_ofnode (dev)) {if (ofnode_device_is_compatible (node,"snps,dwc3" )) dwc3_node = node; }
drivers/usb/host/ehci-mx6.c +1 -1
@@ -523,7 +523,7 @@ static int ehci_usb_of_to_plat(struct udevice *dev)struct usb_plat *plat =dev_get_plat (dev);enum usb_dr_mode dr_mode; - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev));switch (dr_mode) {case USB_DR_MODE_HOST :
drivers/usb/host/xhci-dwc3.c +1 -1
@@ -155,7 +155,7 @@ static int xhci_dwc3_probe(struct udevice *dev)writel (reg, &dwc3_reg->g_usb2phycfg[0 ]); - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev));if (dr_mode ==USB_DR_MODE_UNKNOWN )/* by default set dual role mode to HOST */ dr_mode =USB_DR_MODE_HOST ;
drivers/usb/mtu3/mtu3_core.c +1 -1
@@ -802,7 +802,7 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) mtu->ippc_base = ssusb->ippc_base; mtu->mac_base = ssusb->mac_base; mtu->ssusb = ssusb; - mtu->max_speed =usb_get_maximum_speed (dev->node); + mtu->max_speed =usb_get_maximum_speed (dev_ofnode (dev)); mtu->force_vbus =dev_read_bool (dev,"mediatek,force-vbus" ); ret =mtu3_hw_init (mtu);
drivers/usb/mtu3/mtu3_plat.c +2 -2
@@ -173,7 +173,7 @@ static int get_ssusb_rscs(struct udevice *dev, struct ssusb_mtk *ssusb)return -ENODEV ; } - ssusb->dr_mode =usb_get_dr_mode (child->node); + ssusb->dr_mode =usb_get_dr_mode (dev_ofnode (child));if (ssusb->dr_mode ==USB_DR_MODE_UNKNOWN || ssusb->dr_mode ==USB_DR_MODE_OTG )
@@ -313,7 +313,7 @@ static int mtu3_glue_bind(struct udevice *parent)ofnode node;int ret; - node =ofnode_by_compatible (parent->node,"mediatek,ssusb" ); + node =ofnode_by_compatible (dev_ofnode (parent),"mediatek,ssusb" );if (!ofnode_valid (node))return -ENODEV ;
drivers/usb/musb-new/ti-musb.c +1 -1
@@ -289,7 +289,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)ofnode node;int ret; -ofnode_for_each_subnode (node, parent->node) { +ofnode_for_each_subnode (node,dev_ofnode (parent)) {struct udevice *dev;const char *name =ofnode_get_name (node);enum usb_dr_mode dr_mode;
drivers/video/nexell_display.c +1 -1
@@ -416,7 +416,7 @@ static struct nx_display_dev *nx_display_setup(void) __func__);return NULL ; } - node = dev->node.of_offset; + node =dev_ofnode (dev).of_offset;if (CONFIG_IS_ENABLED (OF_CONTROL )) { ret =nx_display_parse_dt (dev, dp, plat);
drivers/video/rockchip/rk_mipi.c +1 -1
@@ -119,7 +119,7 @@ int rk_mipi_dsi_enable(struct udevice *dev,rk_mipi_dsi_write (regs,VID_PKT_SIZE ,0x4b0 );/* Set dpi color coding depth 24 bit */ - timing_node =ofnode_find_subnode (dev->node,"display-timings" ); + timing_node =ofnode_find_subnode (dev_ofnode (dev),"display-timings" ); node =ofnode_first_subnode (timing_node); val =ofnode_read_u32_default (node,"bits-per-pixel" ,-1 );
include/dm/device.h +21 -2
@@ -200,7 +200,11 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic)*/ static inline ofnode dev_ofnode (const struct udevice *dev) { +#if !CONFIG_IS_ENABLED (OF_PLATDATA )return dev->node; +#else +return ofnode_null (); +#endif }/* Returns non-zero if the device is active (probed and not removed) */
@@ -208,12 +212,27 @@ static inline ofnode dev_ofnode(const struct udevice *dev)static inline int dev_of_offset (const struct udevice *dev) { -return ofnode_to_offset (dev->node); +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +return ofnode_to_offset (dev_ofnode (dev)); +#else +return -1 ; +#endif }static inline bool dev_has_ofnode (const struct udevice *dev) { -return ofnode_valid (dev->node); +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +return ofnode_valid (dev_ofnode (dev)); +#else +return false; +#endif +} + +static inline void dev_set_ofnode (struct udevice *dev,ofnode node) +{ +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) + dev->node = node; +#endif }static inline int dev_seq (const struct udevice *dev)
include/dm/read.h +1 -1
@@ -21,7 +21,7 @@ struct resource;#if CONFIG_IS_ENABLED (OF_LIVE )static inline const struct device_node *dev_np (const struct udevice *dev) { -return ofnode_to_np (dev->node); +return ofnode_to_np (dev_ofnode (dev)); }#else static inline const struct device_node *dev_np (const struct udevice *dev)
include/linux/mtd/mtd.h +2 -2
@@ -334,12 +334,12 @@ struct mtd_info {#if IS_ENABLED (CONFIG_DM )static inline void mtd_set_ofnode (struct mtd_info *mtd,ofnode node) { - mtd->dev->node = node; +dev_set_ofnode (mtd->dev, node); }static inline const ofnode mtd_get_ofnode (struct mtd_info *mtd) { -return mtd->dev->node; +return dev_ofnode (mtd->dev); }#else struct device_node ;
net/mdio-mux-uclass.c +1 -1
@@ -163,7 +163,7 @@ static int dm_mdio_mux_post_bind(struct udevice *mux)ofnode ch_node;int err, first_err =0 ; -if (!ofnode_valid (mux->node)) { +if (!dev_has_ofnode (mux)) {debug ("%s: no mux node found, no child MDIO busses set up\n" , __func__);return 0 ;
net/mdio-uclass.c +4 -4
@@ -40,8 +40,8 @@ static int dm_mdio_post_bind(struct udevice *dev)const char *dt_name;/* set a custom name for the MDIO device, if present in DT */ -if (ofnode_valid (dev->node)) { - dt_name =ofnode_read_string (dev->node,"device-name" ); +if (dev_has_ofnode (dev)) { + dt_name =dev_read_string (dev,"device-name" );if (dt_name) {debug ("renaming dev %s to %s\n" , dev->name, dt_name);device_set_name (dev, dt_name);
@@ -182,14 +182,14 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev)struct phy_device *phy;int i; -if (!ofnode_valid (ethdev->node)) { +if (!dev_has_ofnode (ethdev)) {debug ("%s: supplied eth dev has no DT node!\n" , ethdev->name);return NULL ; } interface =PHY_INTERFACE_MODE_NONE ;for (i =0 ; i <PHY_MODE_STR_CNT ; i++) { - if_str =ofnode_read_string (ethdev->node, phy_mode_str[i]); + if_str =dev_read_string (ethdev, phy_mode_str[i]);if (if_str) { interface =phy_get_interface_by_name (if_str);break ;
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 22/26 dm: core: Access device ofnode through functions
At present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions.
---
arch/arm/mach-stm32mp/pwr_regulator.c | 2 +- board/synopsys/hsdk/clk-lib.c | 2 +- drivers/ata/mtk_ahci.c | 3 ++- drivers/clk/meson/axg.c | 2 +- drivers/clk/meson/g12a.c | 2 +- drivers/clk/meson/gxbb.c | 2 +- drivers/core/device.c | 2 +- drivers/core/root.c | 2 +- drivers/gpio/mpc8xxx_gpio.c | 4 ++-- drivers/gpio/octeon_gpio.c | 2 +- drivers/misc/swap_case.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 23 +++++++++++++---------- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/mtd/nand/spi/core.c | 2 +- drivers/net/fm/eth.c | 4 ++-- drivers/net/fsl_enetc.c | 8 ++++---- drivers/net/fsl_enetc_mdio.c | 2 +- drivers/net/mdio-ipq4019.c | 4 ++-- drivers/net/mdio_mux_i2creg.c | 2 +- drivers/net/mvmdio.c | 4 ++-- drivers/net/octeontx/smi.c | 2 +- drivers/net/tsec.c | 3 ++- drivers/phy/phy-ti-am654.c | 2 +- drivers/power/domain/meson-ee-pwrc.c | 4 ++-- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 ++-- drivers/power/regulator/pbias_regulator.c | 3 ++- drivers/pwm/pwm-meson.c | 9 ++++++--- drivers/reset/reset-socfpga.c | 2 +- drivers/spi/fsl_dspi.c | 6 ++++-- drivers/tee/optee/core.c | 2 +- drivers/usb/cdns3/core.c | 4 ++-- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/dwc3-generic.c | 6 +++--- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-meson-gxl.c | 2 +- drivers/usb/gadget/dwc2_udc_otg.c | 4 ++-- drivers/usb/host/dwc3-octeon-glue.c | 2 +- drivers/usb/host/dwc3-sti-glue.c | 5 +++-- drivers/usb/host/ehci-mx6.c | 2 +- drivers/usb/host/xhci-dwc3.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_plat.c | 4 ++-- drivers/usb/musb-new/ti-musb.c | 2 +- drivers/video/nexell_display.c | 2 +- drivers/video/rockchip/rk_mipi.c | 2 +- include/dm/device.h | 23 +++++++++++++++++++++-- include/dm/read.h | 2 +- include/linux/mtd/mtd.h | 4 ++-- net/mdio-mux-uclass.c | 2 +- net/mdio-uclass.c | 8 ++++---- 50 files changed, 113 insertions(+), 82 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 22/26 dm: core: Access device ofnode through functions
In reply to Simon GlassHi Simon,
Quoted 50 lines · Simon Glass
At present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions.
Signed-off-by Simon Glass <[email protected]>---
arch/arm/mach-stm32mp/pwr_regulator.c | 2 +- board/synopsys/hsdk/clk-lib.c | 2 +- drivers/ata/mtk_ahci.c | 3 ++- drivers/clk/meson/axg.c | 2 +- drivers/clk/meson/g12a.c | 2 +- drivers/clk/meson/gxbb.c | 2 +- drivers/core/device.c | 2 +- drivers/core/root.c | 2 +- drivers/gpio/mpc8xxx_gpio.c | 4 ++-- drivers/gpio/octeon_gpio.c | 2 +- drivers/misc/swap_case.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 23 +++++++++++++---------- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/mtd/nand/spi/core.c | 2 +- drivers/net/fm/eth.c | 4 ++-- drivers/net/fsl_enetc.c | 8 ++++---- drivers/net/fsl_enetc_mdio.c | 2 +- drivers/net/mdio-ipq4019.c | 4 ++-- drivers/net/mdio_mux_i2creg.c | 2 +- drivers/net/mvmdio.c | 4 ++-- drivers/net/octeontx/smi.c | 2 +- drivers/net/tsec.c | 3 ++- drivers/phy/phy-ti-am654.c | 2 +- drivers/power/domain/meson-ee-pwrc.c | 4 ++-- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 ++-- drivers/power/regulator/pbias_regulator.c | 3 ++- drivers/pwm/pwm-meson.c | 9 ++++++--- drivers/reset/reset-socfpga.c | 2 +- drivers/spi/fsl_dspi.c | 6 ++++-- drivers/tee/optee/core.c | 2 +- drivers/usb/cdns3/core.c | 4 ++-- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/dwc3-generic.c | 6 +++--- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-meson-gxl.c | 2 +- drivers/usb/gadget/dwc2_udc_otg.c | 4 ++-- drivers/usb/host/dwc3-octeon-glue.c | 2 +- drivers/usb/host/dwc3-sti-glue.c | 5 +++-- drivers/usb/host/ehci-mx6.c | 2 +- drivers/usb/host/xhci-dwc3.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_plat.c | 4 ++-- drivers/usb/musb-new/ti-musb.c | 2 +-
Quoted 8 lines
drivers/video/nexell_display.c | 2 +- drivers/video/rockchip/rk_mipi.c | 2 +- include/dm/device.h | 23 +++++++++++++++++++++-- include/dm/read.h | 2 +- include/linux/mtd/mtd.h | 4 ++-- net/mdio-mux-uclass.c | 2 +- net/mdio-uclass.c | 8 ++++---- 50 files changed, 113 insertions(+), 82 deletions(-)
in all the modified drivers,
for the functions ofnode_XXXX(dev->node,...) modified to ofnode_XXXX(dev_ofnode(dev), they can also modified to dev_XXX function :
ofnode_read_u32(dev_ofnode(dev), ...) => dev_read_u32(dev,....) ofnode_read_string(dev_ofnode(dev), ...) => dev_read_string(dev,....) ofnode_valid(dev_ofnode(dev)) => dev_has_ofnode(dev)
but you prefer perhaps minizes the modifications in this patchset and if it is the case :
You can found some other examples below.
Quoted 33 lines
arch/arm/mach-stm32mp/pwr_regulator.c +1
-1@@ -81,7 +81,7 @@ static int stm32mp_pwr_bind(struct udevice *dev) {int children; - children =pmic_bind_children (dev, dev->node, pwr_children_info); + children =pmic_bind_children (dev,dev_ofnode (dev), pwr_children_info);if (!children)dev_dbg (dev,"no child found\n" );board/synopsys/hsdk/clk-lib.c +1
-1@@ -23,8 +23,8 @@ int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl)/* Dummy fmeas device, just to be able to use standard clk_* api */ struct udevice fmeas = { .name ="clk-fmeas" , - .node =ofnode_path ("/clk-fmeas" ), }; +dev_set_ofnode (&fmeas,ofnode_path ("/clk-fmeas" )); ret =clk_get_by_name (&fmeas, name, &clk);if (ret) {drivers/ata/mtk_ahci.c +0
-0
drivers/ata/mtk_ahci.c static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv, · line 72
Quoted 6 lines
drivers/ata/mtk_ahci.c +2
-1@@ -68,7 +68,8 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv, SYS_CFG_SATA_MSK, SYS_CFG_SATA_EN); } -ofnode_read_u32 (dev->node,"ports-implemented" , &hpriv->port_map); +ofnode_read_u32 (dev_ofnode (dev),"ports-implemented" , + &hpriv->port_map);
dev_read_u32(dev, "ports-implemented", &hpriv->port_map);
Quoted 73 lines
drivers/ata/mtk_ahci.c +0
-0return 0 ; }drivers/clk/meson/axg.c +1
-1@@ -289,7 +289,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);drivers/clk/meson/g12a.c +1
-1@@ -979,7 +979,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);drivers/clk/meson/gxbb.c +1
-1@@ -885,7 +885,7 @@ static int meson_clk_probe(struct udevice *dev) {struct meson_clk *priv =dev_get_priv (dev); - priv->map =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->map =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->map))return PTR_ERR (priv->map);drivers/core/device.c +1
-1@@ -68,7 +68,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,dev_set_plat (dev, plat); dev->driver_data = driver_data; dev->name = name; - dev->node = node; +dev_set_ofnode (dev, node); dev->parent = parent; dev->driver = drv; dev->uclass = uc;drivers/core/root.c +1
-1@@ -148,7 +148,7 @@ int dm_init(bool of_live)if (ret)return ret;if (CONFIG_IS_ENABLED (OF_CONTROL )) -DM_ROOT_NON_CONST ->node =ofnode_root (); +dev_set_ofnode (DM_ROOT_NON_CONST ,ofnode_root ()); ret =device_probe (DM_ROOT_NON_CONST );if (ret)return ret;drivers/gpio/mpc8xxx_gpio.c +0
-0
drivers/gpio/mpc8xxx_gpio.c static int mpc8xxx_gpio_of_to_plat(struct udevice *dev) · line 194
Quoted 5 lines
drivers/gpio/mpc8xxx_gpio.c +1
-1@@ -191,7 +191,7 @@ static int mpc8xxx_gpio_of_to_plat(struct udevice *dev)u32 i;u32 reg[4 ]; -if (ofnode_read_bool (dev->node,"little-endian" )) +if (ofnode_read_bool (dev_ofnode (dev),"little-endian" ))
if (dev_read_bool(dev, "little-endian"))
Quoted 17 lines
drivers/gpio/mpc8xxx_gpio.c +1
-1data->little_endian = true;if (data->little_endian)@@ -257,7 +257,7 @@ static int mpc8xxx_gpio_probe(struct udevice *dev)if (!str)return -ENOMEM ; -if (ofnode_device_is_compatible (dev->node,"fsl,qoriq-gpio" )) { +if (ofnode_device_is_compatible (dev_ofnode (dev),"fsl,qoriq-gpio" )) {unsigned long gpibe = data->addr +sizeof (struct ccsr_gpio ) -sizeof (u32);drivers/gpio/octeon_gpio.c +0
-0
drivers/gpio/octeon_gpio.c static int octeon_gpio_probe(struct udevice *dev) · line 194
Quoted 6 lines
drivers/gpio/octeon_gpio.c +1
-1@@ -190,7 +190,7 @@ static int octeon_gpio_probe(struct udevice *dev)GPIO_CONST_GPIOS_MASK ; }else { priv->base =dev_remap_addr (dev); - uc_priv->gpio_count =ofnode_read_u32_default (dev->node, + uc_priv->gpio_count =ofnode_read_u32_default (dev_ofnode (dev),"nr-gpios" ,32 );
uc_priv->gpio_count = dev_read_u32_default(dev, "nr-gpios", 32);
drivers/misc/swap_case.c struct swap_case_priv { · line 57
Quoted 12 lines
drivers/gpio/octeon_gpio.c +0
-0}drivers/misc/swap_case.c +1
-1@@ -54,7 +54,7 @@ struct swap_case_priv {static int sandbox_swap_case_use_ea (const struct udevice *dev) { -return !!ofnode_get_property (dev->node,"use-ea" ,NULL ); +return !!ofnode_get_property (dev_ofnode (dev),"use-ea" ,NULL );
return !!dev_read_prop(dev, "use-ea", NULL);
Quoted 8 lines
drivers/misc/swap_case.c +0
-0}/* Please keep these macros in sync with ea_regs below */ drivers/mmc/octeontx_hsmmc.c +0
-0
drivers/mmc/octeontx_hsmmc.c static u32 xlate_voltage(u32 voltage) · line 3443
Quoted 6 lines
drivers/mmc/octeontx_hsmmc.c +1
-1@@ -3439,7 +3439,7 @@ static u32 xlate_voltage(u32 voltage)*/ static bool octeontx_mmc_get_valid (struct udevice *dev) { -const char *stat =ofnode_read_string (dev->node,"status" ); +const char *stat =ofnode_read_string (dev_ofnode (dev),"status" );
const char *stat = dev_read_string(dev, "status");
Quoted 8 lines
drivers/mmc/octeontx_hsmmc.c +1
-1if (!stat || !strncmp (stat,"ok" ,2 ))return true;@@ -3461,14 +3461,15 @@ static int octeontx_mmc_get_config(struct udevice *dev)uint low, high;char env_name[32 ];int err; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_get_config(struct udevice *dev) · line 3473
Quoted 10 lines
drivers/mmc/octeontx_hsmmc.c +2
-1int bus_width =1 ;ulong new_max_freq;debug ("%s(%s)" , __func__, dev->name); slot->cfg.name = dev->name; - slot->cfg.f_max =ofnode_read_s32_default (dev->node,"max-frequency" , + slot->cfg.f_max =ofnode_read_s32_default (dev_ofnode (dev), +"max-frequency" ,26000000 );
slot->cfg.f_max = dev_read_s32_default(dev, "max-frequency", 26000000);
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_get_config(struct udevice *dev) · line 3492
Quoted 10 lines
drivers/mmc/octeontx_hsmmc.c +1
-1snprintf (env_name,sizeof (env_name),"mmc_max_frequency%d" , slot->bus_id);@@ -3486,25 +3487,26 @@ static int octeontx_mmc_get_config(struct udevice *dev)if (IS_ENABLED (CONFIG_ARCH_OCTEONTX2 )) { slot->hs400_tuning_block = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs400-tuning-block" ,-1 );
idem
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_get_config(struct udevice *dev) · line 3498
Quoted 7 lines
drivers/mmc/octeontx_hsmmc.c +1
-1debug ("%s(%s): mmc HS400 tuning block: %d\n" , __func__, dev->name, slot->hs400_tuning_block); slot->hs200_tap_adj = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs200-tap-adjust" ,0 );
idem
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_get_config(struct udevice *dev) · line 3503
Quoted 6 lines
drivers/mmc/octeontx_hsmmc.c +1
-1debug ("%s(%s): hs200-tap-adjust: %d\n" , __func__, dev->name, slot->hs200_tap_adj); slot->hs400_tap_adj = -ofnode_read_s32_default (dev->node, +ofnode_read_s32_default (dev_ofnode (dev),"marvell,hs400-tap-adjust" ,0 );
idem
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_get_config(struct udevice *dev) · line 3509
Quoted 7 lines
drivers/mmc/octeontx_hsmmc.c +2
-1debug ("%s(%s): hs400-tap-adjust: %d\n" , __func__, dev->name, slot->hs400_tap_adj); } - err =ofnode_read_u32_array (dev->node,"voltage-ranges" , voltages,2 ); + err =ofnode_read_u32_array (dev_ofnode (dev),"voltage-ranges" , + voltages,2 );
idem
Quoted 8 lines
drivers/mmc/octeontx_hsmmc.c +0
-1if (err) { slot->cfg.voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ; }else {@@ -3756,14 +3758,15 @@ static int octeontx_mmc_host_probe(struct udevice *dev)pr_err ("%s: No device tree information found\n" , __func__);return -1 ; } - host->node = dev->node;
drivers/mmc/octeontx_hsmmc.c static int octeontx_mmc_host_probe(struct udevice *dev) · line 3769
Quoted 10 lines
drivers/mmc/octeontx_hsmmc.c +3
-1+ host->node =dev_ofnode (dev); host->last_slotid =-1 ;if (otx_is_platform (PLATFORM_ASIM )) host->is_asim = true;if (otx_is_platform (PLATFORM_EMULATOR )) host->is_emul = true; host->dma_wait_delay = -ofnode_read_u32_default (dev->node,"marvell,dma-wait-delay" ,1 ); +ofnode_read_u32_default (dev_ofnode (dev), +"marvell,dma-wait-delay" ,1 );
idem
Quoted 43 lines
drivers/mmc/octeontx_hsmmc.c +1
-1/* Force reset of eMMC */ writeq (0 , host->base_addr +MIO_EMM_CFG ());debug ("%s: Clearing MIO_EMM_CFG\n" , __func__);@@ -3824,7 +3827,7 @@ static int octeontx_mmc_host_child_pre_probe(struct udevice *dev)struct octeontx_mmc_host *host =dev_get_priv (dev_get_parent (dev));struct octeontx_mmc_slot *slot;struct mmc_uclass_priv *upriv; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);u32 bus_id;char name[16 ];int err;drivers/mtd/nand/raw/octeontx_nand.c +1
-1@@ -1999,7 +1999,7 @@ static int octeontx_nfc_chip_init(struct octeontx_nfc *tn, struct udevice *dev,static int octeontx_nfc_chips_init (struct octeontx_nfc *tn) {struct udevice *dev = tn->dev; -ofnode node = dev->node; +ofnode node =dev_ofnode (dev);ofnode nand_node;int nr_chips =of_get_child_count (node);int ret;drivers/mtd/nand/spi/core.c +1
-1@@ -1173,7 +1173,7 @@ static int spinand_probe(struct udevice *dev)return -ENOMEM ;sprintf (mtd->name,"spi-nand%d" , spi_nand_idx++); spinand->slave = slave; -spinand_set_ofnode (spinand, dev->node); +spinand_set_ofnode (spinand,dev_ofnode (dev));#endif ret =spinand_init (spinand);drivers/net/fm/eth.c +0
-0
drivers/net/fm/eth.c phy_interface_t fman_read_sys_if(struct udevice *dev) · line 960
Quoted 5 lines
drivers/net/fm/eth.c +1
-1@@ -957,7 +957,7 @@ phy_interface_t fman_read_sys_if(struct udevice *dev) {const char *if_str; - if_str =ofnode_read_string (dev->node,"phy-connection-type" ); + if_str =ofnode_read_string (dev_ofnode (dev),"phy-connection-type" );
dev_read_string
drivers/net/fm/eth.c static int fm_eth_bind(struct udevice *dev) · line 972
Quoted 9 lines
drivers/net/fm/eth.c +1
-1debug ("MAC system interface mode %s\n" , if_str);return phy_get_interface_by_name (if_str);@@ -969,7 +969,7 @@ static int fm_eth_bind(struct udevice *dev)char mac_name[11 ];u32 fm, num; -if (ofnode_read_u32 (ofnode_get_parent (dev->node),"cell-index" , &fm)) { +if (ofnode_read_u32 (ofnode_get_parent (dev_ofnode (dev)),"cell-index" , &fm)) {
dev_read_u32
drivers/net/fsl_enetc.c static int enetc_bind(struct udevice *dev) · line 102
Quoted 13 lines
drivers/net/fm/eth.c +0
-0printf ("FMan node property cell-index missing\n" );return -EINVAL ; }drivers/net/fsl_enetc.c +1
-1@@ -99,7 +99,7 @@ static int enetc_bind(struct udevice *dev)* and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ -if (ofnode_valid (dev->node)) +if (ofnode_valid (dev_ofnode (dev)))
if (dev_has_ofnode(dev))
drivers/net/fsl_enetc.c static void enetc_start_pcs(struct udevice *dev) · line 256
Quoted 9 lines
drivers/net/fsl_enetc.c +1
-1sprintf (name,"enetc-%u" ,PCI_FUNC (pci_get_devfn (dev))); else sprintf(name, "enetc#%u", eth_num_devices++);@@ -253,12 +253,12 @@ static void enetc_start_pcs(struct udevice *dev)mdio_register (&priv->imdio); } -if (!ofnode_valid (dev->node)) { +if (!ofnode_valid (dev_ofnode (dev))) {
if (!dev_has_ofnode(dev))
drivers/net/fsl_enetc.c static void enetc_start_pcs(struct udevice *dev) · line 261
Quoted 6 lines
drivers/net/fsl_enetc.c +1
-1enetc_dbg (dev,"no enetc ofnode found, skipping PCS set-up\n" );return ; } - if_str =ofnode_read_string (dev->node,"phy-mode" ); + if_str =ofnode_read_string (dev_ofnode (dev),"phy-mode" );
dev_read_string
drivers/net/fsl_enetc.c static int enetc_probe(struct udevice *dev) · line 309
Quoted 9 lines
drivers/net/fsl_enetc.c +1
-1if (if_str) priv->if_type =phy_get_interface_by_name (if_str);else @@ -306,7 +306,7 @@ static int enetc_probe(struct udevice *dev) {struct enetc_priv *priv =dev_get_priv (dev); -if (ofnode_valid (dev->node) && !ofnode_is_available (dev->node)) { +if (ofnode_valid (dev_ofnode (dev)) && !ofnode_is_available (dev_ofnode (dev))) {
if (dev_has_ofnode(dev) && !dev_read_enabled(dev)) {
drivers/net/fsl_enetc_mdio.c static int enetc_mdio_bind(struct udevice *dev) · line 115
Quoted 13 lines
drivers/net/fsl_enetc.c +0
-0enetc_dbg (dev,"interface disabled\n" );return -ENODEV ; }drivers/net/fsl_enetc_mdio.c +1
-1@@ -112,7 +112,7 @@ static int enetc_mdio_bind(struct udevice *dev)* and some are not, use different naming scheme - enetc-N based on * PCI function # and enetc#N based on interface count */ -if (ofnode_valid (dev->node)) +if (ofnode_valid (dev_ofnode (dev)))
if (dev_has_ofnode(dev))
Quoted 8 lines
drivers/net/fsl_enetc_mdio.c +0
-0sprintf (name,"emdio-%u" ,PCI_FUNC (pci_get_devfn (dev))); else sprintf(name, "emdio#%u", eth_num_devices++);drivers/net/mdio-ipq4019.c +0
-0
drivers/net/mdio-ipq4019.c static const struct mdio_ops ipq4019_mdio_ops = { · line 111
Quoted 7 lines
drivers/net/mdio-ipq4019.c +2
-2@@ -107,8 +107,8 @@ static const struct mdio_ops ipq4019_mdio_ops = {static int ipq4019_mdio_bind (struct udevice *dev) { -if (ofnode_valid (dev->node)) -device_set_name (dev,ofnode_get_name (dev->node)); +if (ofnode_valid (dev_ofnode (dev))) +device_set_name (dev,ofnode_get_name (dev_ofnode (dev)));
if (dev_has_ofnode(dev)
??? device_set_name(dev, dev_read_name(dev));
Quoted 21 lines
drivers/net/mdio-ipq4019.c +0
-0return 0 ; }drivers/net/mdio_mux_i2creg.c +1
-1@@ -61,7 +61,7 @@ static int mdio_mux_i2creg_probe(struct udevice *dev) }/* parent should be an I2C chip, grandparent should be an I2C bus */ - chip_node =ofnode_get_parent (dev->node); + chip_node =ofnode_get_parent (dev_ofnode (dev)); bus_node =ofnode_get_parent (chip_node); err =uclass_get_device_by_ofnode (UCLASS_I2C , bus_node, &i2c_bus);drivers/net/mvmdio.c +0
-0
drivers/net/mvmdio.c static int mvmdio_write(struct udevice *dev, int addr, int devad, int reg, · line 201
Quoted 7 lines
drivers/net/mvmdio.c +2
-2@@ -197,8 +197,8 @@ static int mvmdio_write(struct udevice *dev, int addr, int devad, int reg,*/ static int mvmdio_bind (struct udevice *dev) { -if (ofnode_valid (dev->node)) -device_set_name (dev,ofnode_get_name (dev->node)); +if (ofnode_valid (dev_ofnode (dev))) +device_set_name (dev,ofnode_get_name (dev_ofnode (dev)));
if (dev_has_ofnode(dev)
??? device_set_name(dev, dev_read_name(dev));
Quoted 20 lines
drivers/net/mvmdio.c +0
-0return 0 ; }drivers/net/octeontx/smi.c +1
-1@@ -313,7 +313,7 @@ read_error:int octeontx_smi_probe (struct udevice *dev) { -int ret, subnode, cnt =0 , node = dev->node.of_offset; +int ret, subnode, cnt =0 , node =dev_ofnode (dev).of_offset;struct mii_dev *bus;struct octeontx_smi_priv *priv;pci_dev_t bdf =dm_pci_get_bdf (dev);drivers/net/tsec.c +0
-0
drivers/net/tsec.c static int init_phy(struct tsec_private *priv) · line 711
Quoted 6 lines
drivers/net/tsec.c +2
-1@@ -707,7 +707,8 @@ static int init_phy(struct tsec_private *priv)tsec_configure_serdes (priv);#if defined(CONFIG_DM_ETH ) && defined(CONFIG_DM_MDIO ) -if (ofnode_valid (ofnode_find_subnode (priv->dev->node,"fixed-link" ))) +if (ofnode_valid (ofnode_find_subnode (dev_ofnode (priv->dev), +"fixed-link" )))
if (ofnode_valid(dev_read_subnode(priv->dev, "fixed-link")))
Quoted 22 lines
drivers/net/tsec.c +0
-0phydev =phy_connect (NULL ,0 , priv->dev, priv->interface); else phydev =dm_eth_phy_connect (priv->dev);drivers/phy/phy-ti-am654.c +1
-1@@ -344,7 +344,7 @@ static int serdes_am654_bind(struct udevice *dev) ret =device_bind_driver_to_node (dev->parent,"ti-serdes-am654-mux-clk" , -dev_read_name (dev), dev->node, +dev_read_name (dev),dev_ofnode (dev),NULL );if (ret) {dev_err (dev,"%s: not able to bind clock driver\n" , __func__);drivers/power/domain/meson-ee-pwrc.c +0
-0@@ -397,11 +397,11 @@ static int meson_ee_pwrc_probe(struct udevice *dev)if (!priv->data)
drivers/power/domain/meson-ee-pwrc.c static int meson_ee_pwrc_probe(struct udevice *dev) · line 405
Quoted 10 lines
drivers/power/domain/meson-ee-pwrc.c +2
-2return -EINVAL ; - priv->regmap_hhi =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->regmap_hhi =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->regmap_hhi))return PTR_ERR (priv->regmap_hhi); - ret =ofnode_read_u32 (dev->node,"amlogic,ao-sysctrl" , + ret =ofnode_read_u32 (dev_ofnode (dev),"amlogic,ao-sysctrl" , &ao_phandle);
dev_read_u32
Quoted 8 lines
drivers/power/domain/meson-ee-pwrc.c +0
-0if (ret)return ret;drivers/power/domain/meson-gx-pwrc-vpu.c +0
-0@@ -300,11 +300,11 @@ static int meson_gx_pwrc_vpu_probe(struct udevice *dev)ofnode hhi_node;
drivers/power/domain/meson-gx-pwrc-vpu.c static int meson_gx_pwrc_vpu_probe(struct udevice *dev) · line 308
Quoted 10 lines
drivers/power/domain/meson-gx-pwrc-vpu.c +2
-2int ret; - priv->regmap_ao =syscon_node_to_regmap (dev_get_parent (dev)->node); + priv->regmap_ao =syscon_node_to_regmap (dev_ofnode (dev_get_parent (dev)));if (IS_ERR (priv->regmap_ao))return PTR_ERR (priv->regmap_ao); - ret =ofnode_read_u32 (dev->node,"amlogic,hhi-sysctrl" , + ret =ofnode_read_u32 (dev_ofnode (dev),"amlogic,hhi-sysctrl" , &hhi_phandle);
dev_read_u32
Quoted 21 lines
drivers/power/domain/meson-gx-pwrc-vpu.c +0
-0if (ret)return ret;drivers/power/regulator/pbias_regulator.c +2
-1@@ -103,7 +103,8 @@ static int pbias_bind(struct udevice *dev) {int children; - children =pmic_bind_children (dev, dev->node, pmic_children_info); + children =pmic_bind_children (dev,dev_ofnode (dev), + pmic_children_info);if (!children)debug ("%s: %s - no child found\n" , __func__, dev->name);drivers/pwm/pwm-meson.c +0
-0
drivers/pwm/pwm-meson.c static int meson_pwm_probe(struct udevice *dev) · line 308
Quoted 6 lines
drivers/pwm/pwm-meson.c +2
-1@@ -304,13 +304,14 @@ static int meson_pwm_probe(struct udevice *dev)if (strcmp (cdev->driver->name,"fixed_rate_clock" ))continue ; - str =ofnode_read_string (cdev->node,"clock-output-names" ); + str =ofnode_read_string (dev_ofnode (cdev), +"clock-output-names" );
dev_read_string
Quoted 39 lines
drivers/pwm/pwm-meson.c +4
-2if (!str)continue ;if (!strcmp (str,"xtal" )) { err =uclass_get_device_by_ofnode (UCLASS_CLK , - cdev->node, +dev_ofnode (cdev), &cdev);if (err) {printf ("%s%d: Failed to get xtal clk\n" , __func__, i);@@ -345,7 +346,9 @@ static int meson_pwm_probe(struct udevice *dev)return -EINVAL ; } - err =uclass_get_device_by_ofnode (UCLASS_CLK , cdev->node, &cdev); + err =uclass_get_device_by_ofnode (UCLASS_CLK , +dev_ofnode (cdev), + &cdev);if (err) {printf ("%s%d: Failed to get clk controller\n" , __func__, i);return err;drivers/reset/reset-socfpga.c +1
-1@@ -148,7 +148,7 @@ static int socfpga_reset_bind(struct udevice *dev)* Bind it to the node, too, so that it can get its base address. */ ret =device_bind_driver_to_node (dev,"socfpga_sysreset" ,"sysreset" , - dev->node, &sys_child); +dev_ofnode (dev), &sys_child);if (ret)debug ("Warning: No sysreset driver: ret=%d\n" , ret);drivers/spi/fsl_dspi.c +0
-0
drivers/spi/fsl_dspi.c static int fsl_dspi_child_pre_probe(struct udevice *dev) · line 467
Quoted 10 lines
drivers/spi/fsl_dspi.c +4
-2@@ -460,8 +460,10 @@ static int fsl_dspi_child_pre_probe(struct udevice *dev)return -EINVAL ; } -ofnode_read_u32 (dev->node,"fsl,spi-cs-sck-delay" , &cs_sck_delay); -ofnode_read_u32 (dev->node,"fsl,spi-sck-cs-delay" , &sck_cs_delay); +ofnode_read_u32 (dev_ofnode (dev),"fsl,spi-cs-sck-delay" , + &cs_sck_delay); +ofnode_read_u32 (dev_ofnode (dev),"fsl,spi-sck-cs-delay" , + &sck_cs_delay);
dev_read_u32
drivers/tee/optee/core.c static optee_invoke_fn *get_invoke_func(struct udevice *dev) · line 595
Quoted 12 lines
drivers/spi/fsl_dspi.c +0
-0/* Set PCS to SCK delay scale values */ ns_delay_scale (&pcssck, &cssck, cs_sck_delay, priv->bus_clk);drivers/tee/optee/core.c +1
-1@@ -592,7 +592,7 @@ static optee_invoke_fn *get_invoke_func(struct udevice *dev)const char *method;debug ("optee: looking for conduit method in DT.\n" ); - method =ofnode_get_property (dev->node,"method" ,NULL ); + method =ofnode_get_property (dev_ofnode (dev),"method" ,NULL );
dev_read_prop
Quoted 52 lines
drivers/tee/optee/core.c +0
-0if (!method) {debug ("optee: missing \"method\" property\n" );return ERR_PTR (-ENXIO );drivers/usb/cdns3/core.c +2
-2@@ -110,7 +110,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)enum usb_dr_mode dr_mode;int ret =0 ; - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev)); cdns->role =USB_ROLE_NONE ;/* @@ -393,7 +393,7 @@ int cdns3_bind(struct udevice *parent)ofnode node;int ret; - node =ofnode_by_compatible (parent->node,"cdns,usb3" ); + node =ofnode_by_compatible (dev_ofnode (parent),"cdns,usb3" );if (!ofnode_valid (node)) { ret = -ENODEV ; goto fail;drivers/usb/dwc3/core.c +1
-1@@ -905,7 +905,7 @@ void dwc3_of_parse(struct dwc3 *dwc)*/ hird_threshold =12 ; - dwc->hsphy_mode =usb_get_phy_mode (dev->node); + dwc->hsphy_mode =usb_get_phy_mode (dev_ofnode (dev)); dwc->has_lpm_erratum =dev_read_bool (dev,"snps,has-lpm-erratum" );drivers/usb/dwc3/dwc3-generic.c +1
-1@@ -108,7 +108,7 @@ static int dwc3_generic_remove(struct udevice *dev,static int dwc3_generic_of_to_plat (struct udevice *dev) {struct dwc3_generic_plat *plat =dev_get_plat (dev); -ofnode node = dev->node; +ofnode node =dev_ofnode (dev); plat->base =dev_read_addr (dev);
drivers/usb/dwc3/dwc3-generic.c static int dwc3_glue_bind(struct udevice *parent) · line 304
Quoted 5 lines
drivers/usb/dwc3/dwc3-generic.c +1
-1@@ -301,7 +301,7 @@ static int dwc3_glue_bind(struct udevice *parent)ofnode node;int ret; -ofnode_for_each_subnode (node, parent->node) { +ofnode_for_each_subnode (node,dev_ofnode (parent)) {
??? dev_for_each_subnode(node, parent) {
Quoted 58 lines
drivers/usb/dwc3/dwc3-generic.c +1
-1const char *name =ofnode_get_name (node);enum usb_dr_mode dr_mode;struct udevice *dev;@@ -418,7 +418,7 @@ static int dwc3_glue_probe(struct udevice *dev)while (child) {enum usb_dr_mode dr_mode; - dr_mode =usb_get_dr_mode (child->node); + dr_mode =usb_get_dr_mode (dev_ofnode (child));device_find_next_child (&child);if (ops && ops->select_dr_mode) ops->select_dr_mode (dev, index, dr_mode);drivers/usb/dwc3/dwc3-meson-g12a.c +1
-1@@ -395,7 +395,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev) }#endif - priv->otg_mode =usb_get_dr_mode (dev->node); + priv->otg_mode =usb_get_dr_mode (dev_ofnode (dev)); ret =dwc3_meson_g12a_usb_init (priv);if (ret)drivers/usb/dwc3/dwc3-meson-gxl.c +1
-1@@ -338,7 +338,7 @@ static int dwc3_meson_gxl_probe(struct udevice *dev)if (ret)return ret; - priv->otg_mode =usb_get_dr_mode (dev->node); + priv->otg_mode =usb_get_dr_mode (dev_ofnode (dev));if (priv->otg_mode ==USB_DR_MODE_PERIPHERAL ) priv->otg_phy_mode =USB_DR_MODE_PERIPHERAL ;drivers/usb/gadget/dwc2_udc_otg.c +2
-2@@ -987,8 +987,8 @@ static int dwc2_udc_otg_of_to_plat(struct udevice *dev)void (*set_params)(struct dwc2_plat_otg_data *data);int ret; -if (usb_get_dr_mode (dev->node) !=USB_DR_MODE_PERIPHERAL && -usb_get_dr_mode (dev->node) !=USB_DR_MODE_OTG ) { +if (usb_get_dr_mode (dev_ofnode (dev)) !=USB_DR_MODE_PERIPHERAL && +usb_get_dr_mode (dev_ofnode (dev)) !=USB_DR_MODE_OTG ) {dev_dbg (dev,"Invalid mode\n" );return -ENODEV ; }drivers/usb/host/dwc3-octeon-glue.c +0
-0
drivers/usb/host/dwc3-octeon-glue.c static int octeon_dwc3_glue_bind(struct udevice *dev) · line 369
Quoted 5 lines
drivers/usb/host/dwc3-octeon-glue.c +1
-1@@ -366,7 +366,7 @@ static int octeon_dwc3_glue_bind(struct udevice *dev)/* Find snps,dwc3 node from subnode */ dwc3_node =ofnode_null (); -ofnode_for_each_subnode (node, dev->node) { +ofnode_for_each_subnode (node,dev_ofnode (dev)) {
dev_for_each_subnode(node, dev) {
Quoted 8 lines
drivers/usb/host/dwc3-octeon-glue.c +0
-0if (ofnode_device_is_compatible (node,"snps,dwc3" )) dwc3_node = node; }drivers/usb/host/dwc3-sti-glue.c +0
-0
drivers/usb/host/dwc3-sti-glue.c static int sti_dwc3_glue_of_to_plat(struct udevice *dev) · line 112
Quoted 6 lines
drivers/usb/host/dwc3-sti-glue.c +2
-1@@ -108,7 +108,8 @@ static int sti_dwc3_glue_of_to_plat(struct udevice *dev)int ret;u32 reg[4 ]; - ret =ofnode_read_u32_array (dev->node,"reg" , reg,ARRAY_SIZE (reg)); + ret =ofnode_read_u32_array (dev_ofnode (dev),"reg" , reg, +ARRAY_SIZE (reg));
dev_read_u32
drivers/usb/host/dwc3-sti-glue.c static int sti_dwc3_glue_bind(struct udevice *dev) · line 158
Quoted 9 lines
drivers/usb/host/dwc3-sti-glue.c +1
-1if (ret) {pr_err ("unable to find st,stih407-dwc3 reg property(%d)\n" , ret);return ret;@@ -154,7 +155,7 @@ static int sti_dwc3_glue_bind(struct udevice *dev)ofnode node, dwc3_node;/* Find snps,dwc3 node from subnode */ -ofnode_for_each_subnode (node, dev->node) { +ofnode_for_each_subnode (node,dev_ofnode (dev)) {
dev_for_each_subnode(node, dev) {
Quoted 95 lines
drivers/usb/host/dwc3-sti-glue.c +0
-0if (ofnode_device_is_compatible (node,"snps,dwc3" )) dwc3_node = node; }drivers/usb/host/ehci-mx6.c +1
-1@@ -523,7 +523,7 @@ static int ehci_usb_of_to_plat(struct udevice *dev)struct usb_plat *plat =dev_get_plat (dev);enum usb_dr_mode dr_mode; - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev));switch (dr_mode) {case USB_DR_MODE_HOST :drivers/usb/host/xhci-dwc3.c +1
-1@@ -155,7 +155,7 @@ static int xhci_dwc3_probe(struct udevice *dev)writel (reg, &dwc3_reg->g_usb2phycfg[0 ]); - dr_mode =usb_get_dr_mode (dev->node); + dr_mode =usb_get_dr_mode (dev_ofnode (dev));if (dr_mode ==USB_DR_MODE_UNKNOWN )/* by default set dual role mode to HOST */ dr_mode =USB_DR_MODE_HOST ;drivers/usb/mtu3/mtu3_core.c +1
-1@@ -802,7 +802,7 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) mtu->ippc_base = ssusb->ippc_base; mtu->mac_base = ssusb->mac_base; mtu->ssusb = ssusb; - mtu->max_speed =usb_get_maximum_speed (dev->node); + mtu->max_speed =usb_get_maximum_speed (dev_ofnode (dev)); mtu->force_vbus =dev_read_bool (dev,"mediatek,force-vbus" ); ret =mtu3_hw_init (mtu);drivers/usb/mtu3/mtu3_plat.c +2
-2@@ -173,7 +173,7 @@ static int get_ssusb_rscs(struct udevice *dev, struct ssusb_mtk *ssusb)return -ENODEV ; } - ssusb->dr_mode =usb_get_dr_mode (child->node); + ssusb->dr_mode =usb_get_dr_mode (dev_ofnode (child));if (ssusb->dr_mode ==USB_DR_MODE_UNKNOWN || ssusb->dr_mode ==USB_DR_MODE_OTG )@@ -313,7 +313,7 @@ static int mtu3_glue_bind(struct udevice *parent)ofnode node;int ret; - node =ofnode_by_compatible (parent->node,"mediatek,ssusb" ); + node =ofnode_by_compatible (dev_ofnode (parent),"mediatek,ssusb" );if (!ofnode_valid (node))return -ENODEV ;drivers/usb/musb-new/ti-musb.c +1
-1@@ -289,7 +289,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)ofnode node;int ret; -ofnode_for_each_subnode (node, parent->node) { +ofnode_for_each_subnode (node,dev_ofnode (parent)) {struct udevice *dev;const char *name =ofnode_get_name (node);enum usb_dr_mode dr_mode;drivers/video/nexell_display.c +1
-1@@ -416,7 +416,7 @@ static struct nx_display_dev *nx_display_setup(void) __func__);return NULL ; } - node = dev->node.of_offset; + node =dev_ofnode (dev).of_offset;if (CONFIG_IS_ENABLED (OF_CONTROL )) { ret =nx_display_parse_dt (dev, dp, plat);drivers/video/rockchip/rk_mipi.c +0
-0
drivers/video/rockchip/rk_mipi.c int rk_mipi_dsi_enable(struct udevice *dev, · line 122
Quoted 5 lines
drivers/video/rockchip/rk_mipi.c +1
-1@@ -119,7 +119,7 @@ int rk_mipi_dsi_enable(struct udevice *dev,rk_mipi_dsi_write (regs,VID_PKT_SIZE ,0x4b0 );/* Set dpi color coding depth 24 bit */ - timing_node =ofnode_find_subnode (dev->node,"display-timings" ); + timing_node =ofnode_find_subnode (dev_ofnode (dev),"display-timings" );
timing_node = dev_read_subnode(dev, "display-timings");
Quoted 116 lines
drivers/video/rockchip/rk_mipi.c +0
-0node =ofnode_first_subnode (timing_node); val =ofnode_read_u32_default (node,"bits-per-pixel" ,-1 );include/dm/device.h +21
-2@@ -200,7 +200,11 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic)*/ static inline ofnode dev_ofnode (const struct udevice *dev) { +#if !CONFIG_IS_ENABLED (OF_PLATDATA )return dev->node; +#else +return ofnode_null (); +#endif }/* Returns non-zero if the device is active (probed and not removed) */ @@ -208,12 +212,27 @@ static inline ofnode dev_ofnode(const struct udevice *dev)static inline int dev_of_offset (const struct udevice *dev) { -return ofnode_to_offset (dev->node); +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +return ofnode_to_offset (dev_ofnode (dev)); +#else +return -1 ; +#endif }static inline bool dev_has_ofnode (const struct udevice *dev) { -return ofnode_valid (dev->node); +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +return ofnode_valid (dev_ofnode (dev)); +#else +return false; +#endif +} + +static inline void dev_set_ofnode (struct udevice *dev,ofnode node) +{ +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) + dev->node = node; +#endif }static inline int dev_seq (const struct udevice *dev)include/dm/read.h +1
-1@@ -21,7 +21,7 @@ struct resource;#if CONFIG_IS_ENABLED (OF_LIVE )static inline const struct device_node *dev_np (const struct udevice *dev) { -return ofnode_to_np (dev->node); +return ofnode_to_np (dev_ofnode (dev)); }#else static inline const struct device_node *dev_np (const struct udevice *dev)include/linux/mtd/mtd.h +2
-2@@ -334,12 +334,12 @@ struct mtd_info {#if IS_ENABLED (CONFIG_DM )static inline void mtd_set_ofnode (struct mtd_info *mtd,ofnode node) { - mtd->dev->node = node; +dev_set_ofnode (mtd->dev, node); }static inline const ofnode mtd_get_ofnode (struct mtd_info *mtd) { -return mtd->dev->node; +return dev_ofnode (mtd->dev); }#else struct device_node ;net/mdio-mux-uclass.c +1
-1@@ -163,7 +163,7 @@ static int dm_mdio_mux_post_bind(struct udevice *mux)ofnode ch_node;int err, first_err =0 ; -if (!ofnode_valid (mux->node)) { +if (!dev_has_ofnode (mux)) {debug ("%s: no mux node found, no child MDIO busses set up\n" , __func__);return 0 ;net/mdio-uclass.c +3
-3@@ -40,8 +40,8 @@ static int dm_mdio_post_bind(struct udevice *dev)const char *dt_name;/* set a custom name for the MDIO device, if present in DT */ -if (ofnode_valid (dev->node)) { - dt_name =ofnode_read_string (dev->node,"device-name" ); +if (dev_has_ofnode (dev)) { + dt_name =dev_read_string (dev,"device-name" );if (dt_name) {debug ("renaming dev %s to %s\n" , dev->name, dt_name);device_set_name (dev, dt_name);@@ -182,14 +182,14 @@ struct phy_device *dm_eth_phy_connect(struct udevice *ethdev)struct phy_device *phy;int i; -if (!ofnode_valid (ethdev->node)) { +if (!dev_has_ofnode (ethdev)) {debug ("%s: supplied eth dev has no DT node!\n" , ethdev->name);
net/mdio-uclass.c struct phy_device *dm_eth_phy_connect(struct udevice *ethdev) · line 195
Quoted 10 lines
net/mdio-uclass.c +1
-1return NULL ; } interface =PHY_INTERFACE_MODE_NONE ;for (i =0 ; i <PHY_MODE_STR_CNT ; i++) { - if_str =ofnode_read_string (ethdev->node, phy_mode_str[i]); + if_str =dev_read_string (ethdev, phy_mode_str[i]);if (if_str) { interface =phy_get_interface_by_name (if_str);break ;
Patrick
PATCH 22/26 dm: core: Access device ofnode through functions
Hi Patrick,
Quoted 72 lines · Patrick DELAUNAY
Hi Simon,
Quoted 50 lines · Simon Glass
At present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions.
Signed-off-by Simon Glass <[email protected]>---
arch/arm/mach-stm32mp/pwr_regulator.c | 2 +- board/synopsys/hsdk/clk-lib.c | 2 +- drivers/ata/mtk_ahci.c | 3 ++- drivers/clk/meson/axg.c | 2 +- drivers/clk/meson/g12a.c | 2 +- drivers/clk/meson/gxbb.c | 2 +- drivers/core/device.c | 2 +- drivers/core/root.c | 2 +- drivers/gpio/mpc8xxx_gpio.c | 4 ++-- drivers/gpio/octeon_gpio.c | 2 +- drivers/misc/swap_case.c | 2 +- drivers/mmc/octeontx_hsmmc.c | 23 +++++++++++++---------- drivers/mtd/nand/raw/octeontx_nand.c | 2 +- drivers/mtd/nand/spi/core.c | 2 +- drivers/net/fm/eth.c | 4 ++-- drivers/net/fsl_enetc.c | 8 ++++---- drivers/net/fsl_enetc_mdio.c | 2 +- drivers/net/mdio-ipq4019.c | 4 ++-- drivers/net/mdio_mux_i2creg.c | 2 +- drivers/net/mvmdio.c | 4 ++-- drivers/net/octeontx/smi.c | 2 +- drivers/net/tsec.c | 3 ++- drivers/phy/phy-ti-am654.c | 2 +- drivers/power/domain/meson-ee-pwrc.c | 4 ++-- drivers/power/domain/meson-gx-pwrc-vpu.c | 4 ++-- drivers/power/regulator/pbias_regulator.c | 3 ++- drivers/pwm/pwm-meson.c | 9 ++++++--- drivers/reset/reset-socfpga.c | 2 +- drivers/spi/fsl_dspi.c | 6 ++++-- drivers/tee/optee/core.c | 2 +- drivers/usb/cdns3/core.c | 4 ++-- drivers/usb/dwc3/core.c | 2 +- drivers/usb/dwc3/dwc3-generic.c | 6 +++--- drivers/usb/dwc3/dwc3-meson-g12a.c | 2 +- drivers/usb/dwc3/dwc3-meson-gxl.c | 2 +- drivers/usb/gadget/dwc2_udc_otg.c | 4 ++-- drivers/usb/host/dwc3-octeon-glue.c | 2 +- drivers/usb/host/dwc3-sti-glue.c | 5 +++-- drivers/usb/host/ehci-mx6.c | 2 +- drivers/usb/host/xhci-dwc3.c | 2 +- drivers/usb/mtu3/mtu3_core.c | 2 +- drivers/usb/mtu3/mtu3_plat.c | 4 ++-- drivers/usb/musb-new/ti-musb.c | 2 +-Quoted 8 lines
drivers/video/nexell_display.c | 2 +- drivers/video/rockchip/rk_mipi.c | 2 +- include/dm/device.h | 23 +++++++++++++++++++++-- include/dm/read.h | 2 +- include/linux/mtd/mtd.h | 4 ++-- net/mdio-mux-uclass.c | 2 +- net/mdio-uclass.c | 8 ++++---- 50 files changed, 113 insertions(+), 82 deletions(-)in all the modified drivers,
for the functionsofnode_XXXX(dev->node,...)modified to ofnode_XXXX(dev_ofnode(dev), they can also modified todev_XXXfunction :
ofnode_read_u32(dev_ofnode(dev), ...)=>dev_read_u32(dev,....)ofnode_read_string(dev_ofnode(dev), ...)=>dev_read_string(dev,....)ofnode_valid(dev_ofnode(dev)) =>dev_has_ofnode(dev)
Quoted 7 lines
but you prefer perhaps minizes the modifications in this patchset and if it is the case :
Reviewed-by Patrick DelaunayYou can found some other examples below.
Thanks for that.
I wonder if we can press coccinelle into service here. I think the dev_read() API came later so people didn't know about it?
Regards,
Simon
PATCH 23/26 dm: core: Rename device node to indicate it is private
In reply to Simon GlassTo avoid having people accidentally access this member, add a trailing underscore. Also remove it when of-platdata is enabled, since it is not used.
---
include/dm/device.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/dm/device.h +7 -4
@@ -122,7 +122,6 @@ enum {* access outside driver model) * @uclass_plat_: The uclass's configuration data for this device (do not access * outside driver model) -* @node: Reference to device tree node for this device * @driver_data: Driver data word for the entry that matched this device with * its driver * @parent: Parent of this device, or NULL for the top level device
@@ -143,6 +142,8 @@ enum {* number. Otherwise, the next available number is used. Sequence numbers are * used by certain commands that need device to be numbered (e.g. 'mmc dev'). * (do not access outside driver model) +* @node_: Reference to device tree node for this device (do not access outside +* driver model) * @devres_head: List of memory allocations associated with this device. * When CONFIG_DEVRES is enabled, devm_kmalloc() and friends will * add to this list. Memory so-allocated will be freed
@@ -154,7 +155,6 @@ struct udevice {void *plat_;void *parent_plat_;void *uclass_plat_; -ofnode node;ulong driver_data;struct udevice *parent;void *priv_;
@@ -166,6 +166,9 @@ struct udevice {struct list_head sibling_node;u32 flags_;int seq_; +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +ofnode node_; +#endif #ifdef CONFIG_DEVRES struct list_head devres_head;#endif
@@ -201,7 +204,7 @@ static inline void dev_bic_flags(struct udevice *dev, u32 bic)static inline ofnode dev_ofnode (const struct udevice *dev) {#if !CONFIG_IS_ENABLED (OF_PLATDATA ) -return dev->node; +return dev->node_;#else return ofnode_null ();#endif
@@ -231,7 +234,7 @@ static inline bool dev_has_ofnode(const struct udevice *dev)static inline void dev_set_ofnode (struct udevice *dev,ofnode node) {#if !CONFIG_IS_ENABLED (OF_PLATDATA ) - dev->node = node; + dev->node_ = node;#endif }
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 23/26 dm: core: Rename device node to indicate it is private
To avoid having people accidentally access this member, add a trailing underscore. Also remove it when of-platdata is enabled, since it is not used.
---
include/dm/device.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 24/26 dm: core: Split out scanning code to dm_scan()
In reply to Simon GlassMove the code related to scanning for devices to bind, into a new function. This will make it easier to skip this step with the new of-platdata improvements.
---
drivers/core/root.c | 49 ++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 14 deletions(-)
drivers/core/root.c +35 -14
@@ -296,39 +296,60 @@ __weak int dm_scan_other(bool pre_reloc_only)return 0 ; } -int dm_init_and_scan (bool pre_reloc_only) +/** +* dm_scan() - Scan tables to bind devices +* +* Runs through the driver_info tables and binds the devices it finds. Then runs +* through the devicetree nodes. Finally calls dm_scan_other() to add any +* special devices +* +* @pre_reloc_only: If true, bind only nodes with special devicetree properties, +* or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers. +*/ +static int dm_scan (bool pre_reloc_only) {int ret; -if (CONFIG_IS_ENABLED (OF_PLATDATA )) -dm_populate_phandle_data (); - - ret =dm_init (CONFIG_IS_ENABLED (OF_LIVE )); -if (ret) { -debug ("dm_init() failed: %d\n" , ret); -return ret; - } ret =dm_scan_plat (pre_reloc_only);if (ret) {debug ("dm_scan_plat() failed: %d\n" , ret); - goto fail; +return ret; }if (CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA )) { ret =dm_extended_scan (pre_reloc_only);if (ret) {debug ("dm_extended_scan() failed: %d\n" , ret); - goto fail; +return ret; } } ret =dm_scan_other (pre_reloc_only);if (ret) - goto fail; +return ret; + +return 0 ; +} + +int dm_init_and_scan (bool pre_reloc_only) +{ +int ret; + +if (CONFIG_IS_ENABLED (OF_PLATDATA )) +dm_populate_phandle_data (); + + ret =dm_init (CONFIG_IS_ENABLED (OF_LIVE )); +if (ret) { +debug ("dm_init() failed: %d\n" , ret); +return ret; + } + ret =dm_scan (pre_reloc_only); +if (ret) { +log_debug ("dm_scan() failed: %d\n" , ret); +return ret; + }return 0 ; -fail: -return ret; }#ifdef CONFIG_ACPIGEN
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 24/26 dm: core: Split out scanning code to dm_scan()
Move the code related to scanning for devices to bind, into a new function. This will make it easier to skip this step with the new of-platdata improvements.
---
drivers/core/root.c | 49 ++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 14 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 25/26 dm: core: Allow the uclass list to move
In reply to Simon GlassAt present the uclass list head is in global_data. This is convenient but with the new of-platdata we need the list head to be declared by the generated code.
Change this over to be a pointer. Provide a 'static' version in global_data to retain the current behaviour.
---
drivers/core/device.c | 4 ++-- drivers/core/root.c | 7 ++++--- drivers/core/uclass.c | 4 ++-- include/asm-generic/global_data.h | 8 +++++++- include/dm/device-internal.h | 1 + test/dm/core.c | 6 +++--- 6 files changed, 19 insertions(+), 11 deletions(-)
drivers/core/device.c +2 -2
@@ -613,7 +613,7 @@ static int device_find_by_ofnode(ofnode node, struct udevice **devp)struct udevice *dev;int ret; -list_for_each_entry (uc, &gd->uclass_root, sibling_node) { +list_for_each_entry (uc, gd->uclass_root, sibling_node) { ret =uclass_find_device_by_ofnode (uc->uc_drv->id, node, &dev);if (!ret || dev) {
@@ -1032,7 +1032,7 @@ int dev_disable_by_path(const char *path)if (!of_live_active ())return -ENOSYS ; -list_for_each_entry (uc, &gd->uclass_root, sibling_node) { +list_for_each_entry (uc, gd->uclass_root, sibling_node) { ret =uclass_find_device_by_ofnode (uc->uc_drv->id, node, &dev);if (!ret)break ;
drivers/core/root.c +4 -3
@@ -45,8 +45,8 @@ void dm_fixup_for_gd_move(struct global_data *new_gd) {/* The sentinel node has moved, so update things that point to it */ if (gd->dm_root) { - new_gd->uclass_root.next->prev = &new_gd->uclass_root; - new_gd->uclass_root.prev->next = &new_gd->uclass_root; + new_gd->uclass_root->next->prev = new_gd->uclass_root; + new_gd->uclass_root->prev->next = new_gd->uclass_root; } }
@@ -136,7 +136,8 @@ int dm_init(bool of_live)dm_warn ("Virtual root driver already exists!\n" );return -EINVAL ; } -INIT_LIST_HEAD (&DM_UCLASS_ROOT_NON_CONST ); + gd->uclass_root = &DM_UCLASS_ROOT_S_NON_CONST ; +INIT_LIST_HEAD (DM_UCLASS_ROOT_NON_CONST );if (IS_ENABLED (CONFIG_NEEDS_MANUAL_RELOC )) {fix_drivers ();
drivers/core/uclass.c +2 -2
@@ -33,7 +33,7 @@ struct uclass *uclass_find(enum uclass_id key)* node to the start of the list, or creating a linear array mapping * id to node. */ -list_for_each_entry (uc, &gd->uclass_root, sibling_node) { +list_for_each_entry (uc, gd->uclass_root, sibling_node) {if (uc->uc_drv->id == key)return uc; }
@@ -84,7 +84,7 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp) uc->uc_drv = uc_drv;INIT_LIST_HEAD (&uc->sibling_node);INIT_LIST_HEAD (&uc->dev_head); -list_add (&uc->sibling_node, &DM_UCLASS_ROOT_NON_CONST ); +list_add (&uc->sibling_node,DM_UCLASS_ROOT_NON_CONST );if (uc_drv->init) { ret = uc_drv->init (uc);
include/asm-generic/global_data.h +7 -1
@@ -194,7 +194,13 @@ struct global_data {/** * @uclass_root: head of core tree */ -struct list_head uclass_root; +struct list_head uclass_root_s; +/** +* @uclass_root: pointer to head of core tree, if uclasses are in +* read-only memory and cannot be adjusted to use @uclass_root as a +* list head. +*/ +struct list_head *uclass_root;# if CONFIG_IS_ENABLED (OF_PLATDATA )/** Dynamic info about the driver */ struct driver_rt *dm_driver_rt;
include/dm/device-internal.h +1 -0
@@ -288,6 +288,7 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr);/* Cast away any volatile pointer */ #define DM_ROOT_NON_CONST (((gd_t *)gd)->dm_root)#define DM_UCLASS_ROOT_NON_CONST (((gd_t *)gd)->uclass_root) +#define DM_UCLASS_ROOT_S_NON_CONST (((gd_t *)gd)->uclass_root_s)/* device resource management */ #ifdef CONFIG_DEVRES
test/dm/core.c +3 -3
@@ -116,14 +116,14 @@ static int dm_test_autobind(struct unit_test_state *uts)* device with no children. */ ut_assert (dms->root); -ut_asserteq (1 ,list_count_items (&gd->uclass_root)); +ut_asserteq (1 ,list_count_items (gd->uclass_root));ut_asserteq (0 ,list_count_items (&gd->dm_root->child_head));ut_asserteq (0 , dm_testdrv_op_count[DM_TEST_OP_POST_BIND ]);ut_assertok (dm_scan_plat (false));/* We should have our test class now at least, plus more children */ -ut_assert (1 <list_count_items (&gd->uclass_root)); +ut_assert (1 <list_count_items (gd->uclass_root));ut_assert (0 <list_count_items (&gd->dm_root->child_head));/* Our 3 dm_test_infox children should be bound to the test uclass */
@@ -1073,7 +1073,7 @@ static int dm_test_all_have_seq(struct unit_test_state *uts)struct udevice *dev;struct uclass *uc; -list_for_each_entry (uc, &gd->uclass_root, sibling_node) { +list_for_each_entry (uc, gd->uclass_root, sibling_node) {list_for_each_entry (dev, &uc->dev_head, uclass_node) {if (dev->seq_ ==-1 ) printf("Device '%s' has no seq (%d)\n",
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 25/26 dm: core: Allow the uclass list to move
At present the uclass list head is in global_data. This is convenient but with the new of-platdata we need the list head to be declared by the generated code.
Change this over to be a pointer. Provide a 'static' version in global_data to retain the current behaviour.
---
drivers/core/device.c | 4 ++-- drivers/core/root.c | 7 ++++--- drivers/core/uclass.c | 4 ++-- include/asm-generic/global_data.h | 8 +++++++- include/dm/device-internal.h | 1 + test/dm/core.c | 6 +++--- 6 files changed, 19 insertions(+), 11 deletions(-)
Applied to u-boot-dm/next, thanks!
PATCH 26/26 dm: core: Add logging when lists_bind_fdt() fails
In reply to Simon GlassIt is useful to see the error code when this fails. Add logging for this function.
---
drivers/core/lists.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/lists.c +1 -1
@@ -251,7 +251,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,if (ret) {dm_warn ("Error binding driver '%s': %d\n" , entry->name, ret); -return ret; +return log_msg_ret ("bind" , ret); }else { found = true;if (devp)
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 26/26 dm: core: Add logging when lists_bind_fdt() fails
It is useful to see the error code when this fails. Add logging for this function.
---
drivers/core/lists.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm/next, thanks!