From: Simon Glass Date: Tue, 29 Dec 2020 03:34:57 +0000 (-0700) Subject: dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIAS X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-logo.png?a=commitdiff_plain;h=bdf8fd76c0184373bbd31e6ee9a3a9430dcfc485;p=u-boot.git dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIAS We use the U_BOOT_ prefix (i.e. U_BOOT_DRIVER) to declare a driver but in every other case we just use DM_. Update the alias macros to use the DM_ prefix. We could perhaps rename U_BOOT_DRIVER() to DM_DRIVER(), but this macro is widely used and there is at least some benefit to indicating it us a U-Boot driver, particularly for code ported from Linux. So for now, let's keep that name. Signed-off-by: Simon Glass --- diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst index 21b45f6a7e..78afbdbcc9 100644 --- a/doc/driver-model/of-plat.rst +++ b/doc/driver-model/of-plat.rst @@ -184,7 +184,7 @@ via U_BOOT_DRIVER(). This effectively means that a U_BOOT_DRIVER() with a it to a valid name for C) is needed, so a dedicated driver is required for each 'compatible' string. -In order to make this a bit more flexible U_BOOT_DRIVER_ALIAS macro can be +In order to make this a bit more flexible DM_DRIVER_ALIAS macro can be used to declare an alias for a driver name, typically a 'compatible' string. This macro produces no code, but it is by dtoc tool. @@ -195,7 +195,7 @@ fix-ups required by dtoc. It is not currently used. The values in 'clocks' are the index of the driver_info for the target device followed by any phandle arguments. This is used to support device_get_by_driver_info_idx(). -During the build process dtoc parses both U_BOOT_DRIVER and U_BOOT_DRIVER_ALIAS +During the build process dtoc parses both U_BOOT_DRIVER and DM_DRIVER_ALIAS to build a list of valid driver names and driver aliases. If the 'compatible' string used for a device does not not match a valid driver name, it will be checked against the list of driver aliases in order to get the right driver @@ -297,7 +297,7 @@ For example: .plat_auto = sizeof(struct mmc_plat), }; - U_BOOT_DRIVER_ALIAS(mmc_drv, vendor_mmc) /* matches compatible string */ + DM_DRIVER_ALIAS(mmc_drv, vendor_mmc) /* matches compatible string */ Note that struct mmc_plat is defined in the C file, not in a header. This is to avoid needing to include dt-structs.h in a header file. The idea is to diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index 6280fb5984..06e6b2279f 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -345,7 +345,7 @@ U_BOOT_DRIVER(gpio_mxc) = { .bind = mxc_gpio_bind, }; -U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio) +DM_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio) #if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct mxc_gpio_plat mxc_plat[] = { diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index fd5e0ea5c2..4b2b18fdb5 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -306,5 +306,5 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = { #endif }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio) +DM_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio) #endif /* DM_GPIO */ diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index f8fa4baa2c..dc8d506e8d 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -327,7 +327,7 @@ U_BOOT_DRIVER(sandbox_gpio) = { ACPI_OPS_PTR(&gpio_sandbox_acpi_ops) }; -U_BOOT_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) +DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) /* pincontrol: used only to check GPIO pin configuration (pinmux command) */ diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index 704bafe238..f8fac45b6c 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -495,4 +495,4 @@ U_BOOT_DRIVER(rockchip_rk3066_i2c) = { .ops = &rockchip_i2c_ops, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3066_i2c, rockchip_rk3288_i2c) +DM_DRIVER_ALIAS(rockchip_rk3066_i2c, rockchip_rk3288_i2c) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 34c2dceb18..c528d345cd 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1711,5 +1711,5 @@ U_BOOT_DRIVER(fsl_esdhc) = { .priv_auto = sizeof(struct fsl_esdhc_priv), }; -U_BOOT_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc) +DM_DRIVER_ALIAS(fsl_esdhc, fsl_imx6q_usdhc) #endif diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index b3fb559a67..8fd4176415 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -722,5 +722,5 @@ U_BOOT_DRIVER(fsl_imx23_mmc) = { .plat_auto = sizeof(struct mxsmmc_plat), }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc) +DM_DRIVER_ALIAS(fsl_imx23_mmc, fsl_imx28_mmc) #endif /* CONFIG_DM_MMC */ diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 75db81ba4c..1be3c1741f 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -180,8 +180,8 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { .plat_auto = sizeof(struct rockchip_mmc_plat), }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc) +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc) #ifdef CONFIG_PWRSEQ static int rockchip_dwmmc_pwrseq_set_power(struct udevice *dev, bool enable) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 630787df1b..6c87434867 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -170,6 +170,6 @@ U_BOOT_DRIVER(jedec_spi_nor) = { .ops = &spi_flash_std_ops, }; -U_BOOT_DRIVER_ALIAS(jedec_spi_nor, spansion_m25p16) +DM_DRIVER_ALIAS(jedec_spi_nor, spansion_m25p16) #endif /* CONFIG_DM_SPI_FLASH */ diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c index 3cb0bf3b5a..6994dbb61a 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx6.c +++ b/drivers/pinctrl/nxp/pinctrl-imx6.c @@ -52,4 +52,4 @@ U_BOOT_DRIVER(fsl_imx6q_iomuxc) = { .flags = DM_FLAG_PRE_RELOC, }; -U_BOOT_DRIVER_ALIAS(fsl_imx6q_iomuxc, fsl_imx6dl_iomuxc) +DM_DRIVER_ALIAS(fsl_imx6q_iomuxc, fsl_imx6dl_iomuxc) diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c index 5ada2ac405..449a0aa8b5 100644 --- a/drivers/pinctrl/nxp/pinctrl-mxs.c +++ b/drivers/pinctrl/nxp/pinctrl-mxs.c @@ -192,4 +192,4 @@ U_BOOT_DRIVER(fsl_imx23_pinctrl) = { .ops = &mxs_pinctrl_ops, }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_pinctrl, fsl_imx28_pinctrl) +DM_DRIVER_ALIAS(fsl_imx23_pinctrl, fsl_imx28_pinctrl) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 74bfd3c3dc..ddaad55ddc 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -528,4 +528,4 @@ U_BOOT_DRIVER(atmel_sama5d3_pinctrl) = { .ops = &at91_pinctrl_ops, }; -U_BOOT_DRIVER_ALIAS(atmel_sama5d3_pinctrl, atmel_at91rm9200_pinctrl) +DM_DRIVER_ALIAS(atmel_sama5d3_pinctrl, atmel_at91rm9200_pinctrl) diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 2f547a314d..5f442fea68 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -195,4 +195,4 @@ U_BOOT_DRIVER(rockchip_rk805) = { .ops = &rk8xx_ops, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) +DM_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 508c134b94..65c6db073e 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -621,9 +621,9 @@ U_BOOT_DRIVER(ns16550_serial) = { #endif }; -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) +DM_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index 7f632d98bb..d41352a0bb 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -493,4 +493,4 @@ U_BOOT_DRIVER(fsl_imx23_spi) = { .probe = mxs_spi_probe, }; -U_BOOT_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi) +DM_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi) diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 51abebb947..40bd8851b7 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -565,4 +565,4 @@ U_BOOT_DRIVER(rockchip_rk3288_spi) = { .probe = rockchip_spi_probe, }; -U_BOOT_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi) +DM_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi) diff --git a/include/dm/device.h b/include/dm/device.h index 6899030105..f5b4cd6876 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -343,7 +343,7 @@ struct driver { * produce no code but its information will be parsed by tools like * dtoc */ -#define U_BOOT_DRIVER_ALIAS(__name, __alias) +#define DM_DRIVER_ALIAS(__name, __alias) /** * dev_get_plat() - Get the platform data for a device diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 1a6a511b01..e12aaa5399 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -187,7 +187,7 @@ class DtbPlatdata(): value: Driver for that driver _driver_aliases: Dict that holds aliases for driver names key: Driver alias declared with - U_BOOT_DRIVER_ALIAS(driver_alias, driver_name) + DM_DRIVER_ALIAS(driver_alias, driver_name) value: Driver name declared with U_BOOT_DRIVER(driver_name) _drivers_additional: List of additional drivers to use during scanning _dirname: Directory to hold output files, or None for none (all files @@ -416,9 +416,9 @@ class DtbPlatdata(): self._drivers[driver] = Driver(driver) # The following re will search for driver aliases declared as - # U_BOOT_DRIVER_ALIAS(alias, driver_name) + # DM_DRIVER_ALIAS(alias, driver_name) driver_aliases = re.findall( - r'U_BOOT_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)', + r'DM_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)', buff) for alias in driver_aliases: # pragma: no cover diff --git a/tools/dtoc/dtoc_test_scan_drivers.cxx b/tools/dtoc/dtoc_test_scan_drivers.cxx index 557c692ba2..f448767670 100644 --- a/tools/dtoc/dtoc_test_scan_drivers.cxx +++ b/tools/dtoc/dtoc_test_scan_drivers.cxx @@ -1 +1 @@ -U_BOOT_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2) +DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2)