diff options
author | Walter Lozano <walter.lozano@collabora.com> | 2020-06-25 01:10:06 -0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-07-09 18:57:22 -0600 |
commit | addf358bac1d2bd087b77be7d4d95a2a2e5dfcaf (patch) | |
tree | 8f235b174eb05d46eeb532a5caa90c7e2c00cf74 | |
parent | ace16e88d97d64a1c999a690f46123cf73fafa7c (diff) | |
download | u-boot-addf358bac1d2bd087b77be7d4d95a2a2e5dfcaf.zip u-boot-addf358bac1d2bd087b77be7d4d95a2a2e5dfcaf.tar.gz u-boot-addf358bac1d2bd087b77be7d4d95a2a2e5dfcaf.tar.bz2 |
core: add support for U_BOOT_DRIVER_ALIAS
Currently when using OF_PLATDATA the binding between devices and drivers
is done trying to match the compatible string in the node with a driver
name. However, usually a single driver supports multiple compatible strings
which causes that only devices which its compatible string matches a
driver name get bound.
To overcome this issue, this patch adds the U_BOOT_DRIVER_ALIAS macro,
which generates no code at all, but allows an easy way to declare driver
name aliases. Thanks to this, dtoc could be improve to look for the driver
name based on its alias when it populates the U_BOOT_DEVICE entry.
Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/clk/at91/pmc.c | 2 | ||||
-rw-r--r-- | drivers/gpio/mxs_gpio.c | 2 | ||||
-rw-r--r-- | drivers/gpio/sandbox.c | 2 | ||||
-rw-r--r-- | drivers/i2c/rk_i2c.c | 2 | ||||
-rw-r--r-- | drivers/mmc/mxsmmc.c | 1 | ||||
-rw-r--r-- | drivers/mmc/rockchip_dw_mmc.c | 3 | ||||
-rw-r--r-- | drivers/mtd/spi/sf_probe.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/nxp/pinctrl-mxs.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-at91.c | 2 | ||||
-rw-r--r-- | drivers/power/pmic/rk8xx.c | 2 | ||||
-rw-r--r-- | drivers/serial/ns16550.c | 4 | ||||
-rw-r--r-- | drivers/spi/mxs_spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/rk_spi.c | 2 | ||||
-rw-r--r-- | include/dm/device.h | 7 |
14 files changed, 35 insertions, 0 deletions
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index f6b9367..54ae0d2 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -31,6 +31,8 @@ U_BOOT_DRIVER(atmel_at91rm9200_pmc) = { .of_match = at91_pmc_match, }; +U_BOOT_DRIVER_ALIAS(atmel_at91rm9200_pmc, atmel_at91sam9260_pmc) + /*---------------------------------------------------------*/ int at91_pmc_core_probe(struct udevice *dev) diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index bc69743..cb79726 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -311,4 +311,6 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = { .ofdata_to_platdata = mxs_ofdata_to_platdata, #endif }; + +U_BOOT_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio) #endif /* DM_GPIO */ diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 1df2d8d..b9a1d65 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -254,6 +254,8 @@ U_BOOT_DRIVER(sandbox_gpio) = { .ops = &gpio_sandbox_ops, }; +U_BOOT_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias) + /* pincontrol: used only to check GPIO pin configuration (pinmux command) */ struct sb_pinctrl_priv { diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index cbe959b..6594610 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -494,3 +494,5 @@ U_BOOT_DRIVER(rockchip_rk3066_i2c) = { .priv_auto_alloc_size = sizeof(struct rk_i2c), .ops = &rockchip_i2c_ops, }; + +U_BOOT_DRIVER_ALIAS(rockchip_rk3066_i2c, rockchip_rk3288_i2c) diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 03a5077..c6a06b9 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -727,4 +727,5 @@ U_BOOT_DRIVER(fsl_imx23_mmc) = { .platdata_auto_alloc_size = sizeof(struct mxsmmc_platdata), }; +U_BOOT_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 c5aeffc..e8e4da2 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -180,6 +180,9 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { .platdata_auto_alloc_size = 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) + #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 3dcd57d..475f6c3 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -170,4 +170,6 @@ U_BOOT_DRIVER(jedec_spi_nor) = { .ops = &spi_flash_std_ops, }; +U_BOOT_DRIVER_ALIAS(jedec_spi_nor, spansion_m25p16) + #endif /* CONFIG_DM_SPI_FLASH */ diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c index 99a43a3..db463fc 100644 --- a/drivers/pinctrl/nxp/pinctrl-mxs.c +++ b/drivers/pinctrl/nxp/pinctrl-mxs.c @@ -191,3 +191,5 @@ U_BOOT_DRIVER(fsl_imx23_pinctrl) = { .priv_auto_alloc_size = sizeof(struct mxs_pinctrl_priv), .ops = &mxs_pinctrl_ops, }; + +U_BOOT_DRIVER_ALIAS(fsl_imx23_pinctrl, fsl_imx28_pinctrl) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index def7236..cd7b32c 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -527,3 +527,5 @@ U_BOOT_DRIVER(atmel_sama5d3_pinctrl) = { .priv_auto_alloc_size = sizeof(struct at91_pinctrl_priv), .ops = &at91_pinctrl_ops, }; + +U_BOOT_DRIVER_ALIAS(atmel_sama5d3_pinctrl, atmel_at91rm9200_pinctrl) diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 517c87e..148ee29 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -194,3 +194,5 @@ U_BOOT_DRIVER(rockchip_rk805) = { .probe = rk8xx_probe, .ops = &rk8xx_ops, }; + +U_BOOT_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index cca798d..702109b 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -620,6 +620,10 @@ U_BOOT_DRIVER(ns16550_serial) = { .flags = DM_FLAG_PRE_RELOC, #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) #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index 4b8e242..3c1af83 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -498,3 +498,5 @@ U_BOOT_DRIVER(fsl_imx23_spi) = { .priv_auto_alloc_size = sizeof(struct mxs_spi_priv), .probe = mxs_spi_probe, }; + +U_BOOT_DRIVER_ALIAS(fsl_imx23_spi, fsl_imx28_spi) diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 5c1828a..add3e49 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -563,3 +563,5 @@ U_BOOT_DRIVER(rockchip_rk3288_spi) = { .priv_auto_alloc_size = sizeof(struct rockchip_spi_priv), .probe = rockchip_spi_probe, }; + +U_BOOT_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3368_spi) diff --git a/include/dm/device.h b/include/dm/device.h index 975eec5..2cfe107 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -283,6 +283,13 @@ struct driver { ll_entry_get(struct driver, __name, driver) /** + * Declare a macro to state a alias for a driver name. This macro will + * produce no code but its information will be parsed by tools like + * dtoc + */ +#define U_BOOT_DRIVER_ALIAS(__name, __alias) + +/** * dev_get_platdata() - Get the platform data for a device * * This checks that dev is not NULL, but no other checks for now |