From e3e2470fdd57567e8df04e76203cd4e580a93975 Mon Sep 17 00:00:00 2001 From: Walter Lozano Date: Thu, 25 Jun 2020 01:10:04 -0300 Subject: drivers: rename drivers to match compatible string When using OF_PLATDATA, the bind process between devices and drivers is performed trying to match compatible string with driver names. However driver names are not strictly defined, and also there are different names used when declaring a driver with U_BOOT_DRIVER, the name of the symbol used in the linker list and the used in the struct driver_info. In order to make things a bit more clear, rename the drivers names. This will also help for further OF_PLATDATA improvements, such as checking for valid driver names. Signed-off-by: Walter Lozano Reviewed-by: Simon Glass Add a fix for sandbox of-platdata to avoid using an invalid ANSI colour: Signed-off-by: Simon Glass --- drivers/spi/rk_spi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/spi/rk_spi.c') diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 833cb04922e..5c1828aedac 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -553,12 +553,8 @@ static const struct udevice_id rockchip_spi_ids[] = { { } }; -U_BOOT_DRIVER(rockchip_spi) = { -#if CONFIG_IS_ENABLED(OF_PLATDATA) +U_BOOT_DRIVER(rockchip_rk3288_spi) = { .name = "rockchip_rk3288_spi", -#else - .name = "rockchip_spi", -#endif .id = UCLASS_SPI, .of_match = rockchip_spi_ids, .ops = &rockchip_spi_ops, -- cgit v1.2.3 From addf358bac1d2bd087b77be7d4d95a2a2e5dfcaf Mon Sep 17 00:00:00 2001 From: Walter Lozano Date: Thu, 25 Jun 2020 01:10:06 -0300 Subject: 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 Reviewed-by: Simon Glass --- drivers/spi/rk_spi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/spi/rk_spi.c') diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index 5c1828aedac..add3e49c306 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) -- cgit v1.2.3 From 51f1263d8933fcae877b7698c0cb06d3ab495439 Mon Sep 17 00:00:00 2001 From: Walter Lozano Date: Thu, 25 Jun 2020 01:10:13 -0300 Subject: dtoc: extend dtoc to use struct driver_info when linking nodes In the current implementation, when dtoc parses a dtb to generate a struct platdata it converts the information related to linked nodes as pointers to struct platdata of destination nodes. By doing this, it makes difficult to get pointer to udevices created based on these information. This patch extends dtoc to use struct driver_info when populating information about linked nodes, which makes it easier to later get the devices created. In this context, reimplement functions like clk_get_by_index_platdata() which made use of the previous approach. Signed-off-by: Walter Lozano Reviewed-by: Simon Glass --- drivers/spi/rk_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/spi/rk_spi.c') diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c index add3e49c306..b6f95fa9a47 100644 --- a/drivers/spi/rk_spi.c +++ b/drivers/spi/rk_spi.c @@ -183,7 +183,7 @@ static int conv_of_platdata(struct udevice *dev) plat->base = dtplat->reg[0]; plat->frequency = 20000000; - ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks, &priv->clk); + ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk); if (ret < 0) return ret; dev->req_seq = 0; -- cgit v1.2.3