diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clk/imx/clk-imx8.c | 2 | ||||
-rw-r--r-- | drivers/gpio/stm32f7_gpio.c | 22 | ||||
-rw-r--r-- | drivers/misc/imx8/scu.c | 26 | ||||
-rw-r--r-- | drivers/misc/imx8/scu_api.c | 4 | ||||
-rw-r--r-- | drivers/mmc/mmc.c | 4 |
5 files changed, 38 insertions, 20 deletions
diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c index fcb8090d35..d03fcc2fdd 100644 --- a/drivers/clk/imx/clk-imx8.c +++ b/drivers/clk/imx/clk-imx8.c @@ -18,6 +18,7 @@ struct imx8_clks { const char *name; }; +#if CONFIG_IS_ENABLED(CMD_CLK) static struct imx8_clks imx8_clk_names[] = { { IMX8QXP_A35_DIV, "A35_DIV" }, { IMX8QXP_I2C0_CLK, "I2C0" }, @@ -39,6 +40,7 @@ static struct imx8_clks imx8_clk_names[] = { { IMX8QXP_ENET1_REF_DIV, "ENET1_REF" }, { IMX8QXP_ENET1_PTP_CLK, "ENET1_PTP" }, }; +#endif static ulong imx8_clk_get_rate(struct clk *clk) { diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c index f160b4e689..5c9f2fe64d 100644 --- a/drivers/gpio/stm32f7_gpio.c +++ b/drivers/gpio/stm32f7_gpio.c @@ -19,6 +19,7 @@ #define MODE_BITS_MASK 3 #define BSRR_BIT(gpio_pin, value) BIT(gpio_pin + (value ? 0 : 16)) +#ifndef CONFIG_SPL_BUILD /* * convert gpio offset to gpio index taking into account gpio holes * into gpio bank @@ -145,23 +146,27 @@ static const struct dm_gpio_ops gpio_stm32_ops = { .set_value = stm32_gpio_set_value, .get_function = stm32_gpio_get_function, }; +#endif static int gpio_stm32_probe(struct udevice *dev) { - struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct stm32_gpio_priv *priv = dev_get_priv(dev); - struct ofnode_phandle_args args; struct clk clk; fdt_addr_t addr; - const char *name; int ret; - int i; addr = dev_read_addr(dev); if (addr == FDT_ADDR_T_NONE) return -EINVAL; priv->regs = (struct stm32_gpio_regs *)addr; + +#ifndef CONFIG_SPL_BUILD + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct ofnode_phandle_args args; + const char *name; + int i; + name = dev_read_string(dev, "st,bank-name"); if (!name) return -EINVAL; @@ -171,6 +176,11 @@ static int gpio_stm32_probe(struct udevice *dev) ret = dev_read_phandle_with_args(dev, "gpio-ranges", NULL, 3, i, &args); + if (ret == -ENOENT) { + uc_priv->gpio_count = STM32_GPIOS_PER_BANK; + priv->gpio_range = GENMASK(STM32_GPIOS_PER_BANK - 1, 0); + } + while (ret != -ENOENT) { priv->gpio_range |= GENMASK(args.args[2] + args.args[0] - 1, args.args[0]); @@ -184,7 +194,7 @@ static int gpio_stm32_probe(struct udevice *dev) dev_dbg(dev, "addr = 0x%p bank_name = %s gpio_count = %d gpio_range = 0x%x\n", (u32 *)priv->regs, uc_priv->bank_name, uc_priv->gpio_count, priv->gpio_range); - +#endif ret = clk_get_by_index(dev, 0, &clk); if (ret < 0) return ret; @@ -210,7 +220,9 @@ U_BOOT_DRIVER(gpio_stm32) = { .id = UCLASS_GPIO, .of_match = stm32_gpio_ids, .probe = gpio_stm32_probe, +#ifndef CONFIG_SPL_BUILD .ops = &gpio_stm32_ops, +#endif .flags = DM_UC_FLAG_SEQ_ALIAS, .priv_auto_alloc_size = sizeof(struct stm32_gpio_priv), }; diff --git a/drivers/misc/imx8/scu.c b/drivers/misc/imx8/scu.c index b824ac79e6..15101b3e5f 100644 --- a/drivers/misc/imx8/scu.c +++ b/drivers/misc/imx8/scu.c @@ -158,7 +158,7 @@ static int sc_ipc_write(struct mu_type *base, void *data) static int imx8_scu_call(struct udevice *dev, int no_resp, void *tx_msg, int tx_size, void *rx_msg, int rx_size) { - struct imx8_scu *priv = dev_get_priv(dev); + struct imx8_scu *plat = dev_get_platdata(dev); sc_err_t result; int ret; @@ -166,11 +166,11 @@ static int imx8_scu_call(struct udevice *dev, int no_resp, void *tx_msg, if (rx_msg && tx_msg != rx_msg) printf("tx_msg %p, rx_msg %p\n", tx_msg, rx_msg); - ret = sc_ipc_write(priv->base, tx_msg); + ret = sc_ipc_write(plat->base, tx_msg); if (ret) return ret; if (!no_resp) { - ret = sc_ipc_read(priv->base, rx_msg); + ret = sc_ipc_read(plat->base, rx_msg); if (ret) return ret; } @@ -182,24 +182,24 @@ static int imx8_scu_call(struct udevice *dev, int no_resp, void *tx_msg, static int imx8_scu_probe(struct udevice *dev) { - struct imx8_scu *priv = dev_get_priv(dev); + struct imx8_scu *plat = dev_get_platdata(dev); fdt_addr_t addr; - debug("%s(dev=%p) (priv=%p)\n", __func__, dev, priv); + debug("%s(dev=%p) (plat=%p)\n", __func__, dev, plat); addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) return -EINVAL; - priv->base = (struct mu_type *)addr; + plat->base = (struct mu_type *)addr; /* U-Boot not enable interrupts, so need to enable RX interrupts */ - mu_hal_init(priv->base); + mu_hal_init(plat->base); gd->arch.scu_dev = dev; - device_probe(priv->clk); - device_probe(priv->pinclk); + device_probe(plat->clk); + device_probe(plat->pinclk); return 0; } @@ -211,7 +211,7 @@ static int imx8_scu_remove(struct udevice *dev) static int imx8_scu_bind(struct udevice *dev) { - struct imx8_scu *priv = dev_get_priv(dev); + struct imx8_scu *plat = dev_get_platdata(dev); int ret; struct udevice *child; int node; @@ -227,7 +227,7 @@ static int imx8_scu_bind(struct udevice *dev) if (ret) return ret; - priv->clk = child; + plat->clk = child; node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "fsl,imx8qxp-iomuxc"); @@ -238,7 +238,7 @@ static int imx8_scu_bind(struct udevice *dev) if (ret) return ret; - priv->pinclk = child; + plat->pinclk = child; return 0; } @@ -261,6 +261,6 @@ U_BOOT_DRIVER(imx8_scu) = { .bind = imx8_scu_bind, .remove = imx8_scu_remove, .ops = &imx8_scu_ops, - .priv_auto_alloc_size = sizeof(struct imx8_scu), + .platdata_auto_alloc_size = sizeof(struct imx8_scu), .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index 65080d7544..d9c4d5d784 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -169,7 +169,7 @@ int sc_misc_get_control(sc_ipc_t ipc, sc_rsrc_t resource, sc_ctrl_t ctrl, printf("%s: ctrl:%d resource:%d: res:%d\n", __func__, ctrl, resource, RPC_R8(&msg)); - if (!val) + if (val) *val = RPC_U32(&msg, 0U); return ret; @@ -194,7 +194,7 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev) if (ret) printf("%s: res:%d\n", __func__, RPC_R8(&msg)); - if (!boot_dev) + if (boot_dev) *boot_dev = RPC_U16(&msg, 0U); } diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index f5c821e308..d858127132 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2449,6 +2449,10 @@ static int mmc_startup(struct mmc *mmc) bdesc->revision[0] = 0; #endif +#if !defined(CONFIG_DM_MMC) && (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT)) + part_init(bdesc); +#endif + return 0; } |