diff options
| author | Tom Rini <[email protected]> | 2021-03-15 08:43:19 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2021-03-15 08:43:19 -0400 |
| commit | e8a10a02bd9ce6988942c393373d89dee5704c59 (patch) | |
| tree | 34ea975ab67f9b7d337fc0fc931f0ae069e5d6aa /drivers | |
| parent | ad7e1c7c6e2bde2b369f10984d41d6b1833453fb (diff) | |
| parent | b076cbe8aa2b3c29a3acc89fbea9fb7676f15fa7 (diff) | |
Merge tag 'u-boot-stm32-20210312' of https://source.denx.de/u-boot/custodians/u-boot-stm
- Add WATCHDOG_RESET() in MTD framework and STM32 QSPI driver
- stm32mp1_trusted_defconfig rely on SCMI support
- Remove the nand MTD configuration for NOR boot in stm32mp1 board
- STM32programmer update
- Bsec: manage clock when present in device tree
- stm32mp15: move bootdelay configuration in defconfig
- Update for stm32 dsi and dw_mipi_dsi
- STM32 MCU's cleanup
- Fix compilation issue depending on SYS_DCACHE_OFF and SYS_ICACHE_OFF flags
- Update stm32mp1 doc
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/clk/clk_stm32mp1.c | 62 | ||||
| -rw-r--r-- | drivers/firmware/scmi/mailbox_agent.c | 4 | ||||
| -rw-r--r-- | drivers/firmware/scmi/sandbox-scmi_agent.c | 2 | ||||
| -rw-r--r-- | drivers/firmware/scmi/sandbox-scmi_devices.c | 2 | ||||
| -rw-r--r-- | drivers/firmware/scmi/scmi_agent-uclass.c | 5 | ||||
| -rw-r--r-- | drivers/firmware/scmi/smccc_agent.c | 3 | ||||
| -rw-r--r-- | drivers/firmware/scmi/smt.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/core.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/spi/core.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/spi/spi-nor-core.c | 3 | ||||
| -rw-r--r-- | drivers/spi/stm32_qspi.c | 2 | ||||
| -rw-r--r-- | drivers/video/dw_mipi_dsi.c | 9 | ||||
| -rw-r--r-- | drivers/video/stm32/stm32_dsi.c | 3 |
13 files changed, 56 insertions, 46 deletions
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c index 848e33f4e82..0c0ef366a19 100644 --- a/drivers/clk/clk_stm32mp1.c +++ b/drivers/clk/clk_stm32mp1.c @@ -250,7 +250,7 @@ DECLARE_GLOBAL_DATA_PTR; enum stm32mp1_parent_id { /* * _HSI, _HSE, _CSI, _LSI, _LSE should not be moved - * they are used as index in osc[] as entry point + * they are used as index in osc_clk[] as clock reference */ _HSI, _HSE, @@ -430,8 +430,7 @@ struct stm32mp1_clk_data { struct stm32mp1_clk_priv { fdt_addr_t base; const struct stm32mp1_clk_data *data; - ulong osc[NB_OSC]; - struct udevice *osc_dev[NB_OSC]; + struct clk osc_clk[NB_OSC]; }; #define STM32MP1_CLK(off, b, idx, s) \ @@ -790,7 +789,7 @@ static ulong stm32mp1_clk_get_fixed(struct stm32mp1_clk_priv *priv, int idx) return 0; } - return priv->osc[idx]; + return clk_get_rate(&priv->osc_clk[idx]); } static int stm32mp1_clk_get_id(struct stm32mp1_clk_priv *priv, unsigned long id) @@ -1545,7 +1544,7 @@ static int stm32mp1_hsidiv(fdt_addr_t rcc, ulong hsifreq) break; if (hsidiv == 4) { - log_err("clk-hsi frequency invalid"); + log_err("hsi frequency invalid"); return -1; } @@ -1952,13 +1951,13 @@ static int stm32mp1_clktree(struct udevice *dev) * switch ON oscillator found in device-tree, * HSI already ON after bootrom */ - if (priv->osc[_LSI]) + if (clk_valid(&priv->osc_clk[_LSI])) stm32mp1_lsi_set(rcc, 1); - if (priv->osc[_LSE]) { + if (clk_valid(&priv->osc_clk[_LSE])) { int bypass, digbyp; u32 lsedrv; - struct udevice *dev = priv->osc_dev[_LSE]; + struct udevice *dev = priv->osc_clk[_LSE].dev; bypass = dev_read_bool(dev, "st,bypass"); digbyp = dev_read_bool(dev, "st,digbypass"); @@ -1969,9 +1968,9 @@ static int stm32mp1_clktree(struct udevice *dev) stm32mp1_lse_enable(rcc, bypass, digbyp, lsedrv); } - if (priv->osc[_HSE]) { + if (clk_valid(&priv->osc_clk[_HSE])) { int bypass, digbyp, css; - struct udevice *dev = priv->osc_dev[_HSE]; + struct udevice *dev = priv->osc_clk[_HSE].dev; bypass = dev_read_bool(dev, "st,bypass"); digbyp = dev_read_bool(dev, "st,digbypass"); @@ -1996,8 +1995,8 @@ static int stm32mp1_clktree(struct udevice *dev) /* configure HSIDIV */ dev_dbg(dev, "configure HSIDIV\n"); - if (priv->osc[_HSI]) { - stm32mp1_hsidiv(rcc, priv->osc[_HSI]); + if (clk_valid(&priv->osc_clk[_HSI])) { + stm32mp1_hsidiv(rcc, clk_get_rate(&priv->osc_clk[_HSI])); stgen_config(priv); } @@ -2043,7 +2042,7 @@ static int stm32mp1_clktree(struct udevice *dev) } /* wait LSE ready before to use it */ - if (priv->osc[_LSE]) + if (clk_valid(&priv->osc_clk[_LSE])) stm32mp1_lse_wait(rcc); /* configure with expected clock source */ @@ -2082,7 +2081,7 @@ static int stm32mp1_clktree(struct udevice *dev) dev_dbg(dev, "oscillator off\n"); /* switch OFF HSI if not found in device-tree */ - if (!priv->osc[_HSI]) + if (!clk_valid(&priv->osc_clk[_HSI])) stm32mp1_hsi_set(rcc, 0); /* Software Self-Refresh mode (SSR) during DDR initilialization */ @@ -2178,40 +2177,25 @@ static ulong stm32mp1_clk_set_rate(struct clk *clk, unsigned long clk_rate) return -EINVAL; } -static void stm32mp1_osc_clk_init(const char *name, - struct stm32mp1_clk_priv *priv, - int index) -{ - struct clk clk; - struct udevice *dev = NULL; - - priv->osc[index] = 0; - clk.id = 0; - if (!uclass_get_device_by_name(UCLASS_CLK, name, &dev)) { - if (clk_request(dev, &clk)) - log_err("%s request", name); - else - priv->osc[index] = clk_get_rate(&clk); - } - priv->osc_dev[index] = dev; -} - static void stm32mp1_osc_init(struct udevice *dev) { struct stm32mp1_clk_priv *priv = dev_get_priv(dev); int i; const char *name[NB_OSC] = { - [_LSI] = "clk-lsi", - [_LSE] = "clk-lse", - [_HSI] = "clk-hsi", - [_HSE] = "clk-hse", - [_CSI] = "clk-csi", + [_LSI] = "lsi", + [_LSE] = "lse", + [_HSI] = "hsi", + [_HSE] = "hse", + [_CSI] = "csi", [_I2S_CKIN] = "i2s_ckin", }; for (i = 0; i < NB_OSC; i++) { - stm32mp1_osc_clk_init(name[i], priv, i); - dev_dbg(dev, "%d: %s => %x\n", i, name[i], (u32)priv->osc[i]); + if (clk_get_by_name(dev, name[i], &priv->osc_clk[i])) + dev_dbg(dev, "No source clock \"%s\"", name[i]); + else + dev_dbg(dev, "%s clock rate: %luHz\n", + name[i], clk_get_rate(&priv->osc_clk[i])); } } diff --git a/drivers/firmware/scmi/mailbox_agent.c b/drivers/firmware/scmi/mailbox_agent.c index 3f4b04a4ae4..ea35e7e09ed 100644 --- a/drivers/firmware/scmi/mailbox_agent.c +++ b/drivers/firmware/scmi/mailbox_agent.c @@ -3,13 +3,15 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include <common.h> #include <dm.h> -#include <dm/device_compat.h> #include <errno.h> #include <mailbox.h> #include <scmi_agent.h> #include <scmi_agent-uclass.h> +#include <dm/device_compat.h> #include <dm/devres.h> #include <linux/compat.h> diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c index 35de68c75d3..97a5dace15f 100644 --- a/drivers/firmware/scmi/sandbox-scmi_agent.c +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c @@ -3,6 +3,8 @@ * Copyright (C) 2020, Linaro Limited */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include <common.h> #include <dm.h> #include <malloc.h> diff --git a/drivers/firmware/scmi/sandbox-scmi_devices.c b/drivers/firmware/scmi/sandbox-scmi_devices.c index 1a6fafbf531..69239a198f0 100644 --- a/drivers/firmware/scmi/sandbox-scmi_devices.c +++ b/drivers/firmware/scmi/sandbox-scmi_devices.c @@ -3,6 +3,8 @@ * Copyright (C) 2020, Linaro Limited */ +#define LOG_CATEGORY UCLASS_MISC + #include <common.h> #include <clk.h> #include <dm.h> diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c index 516e690ac2d..527163b5ce3 100644 --- a/drivers/firmware/scmi/scmi_agent-uclass.c +++ b/drivers/firmware/scmi/scmi_agent-uclass.c @@ -3,13 +3,14 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include <common.h> #include <dm.h> -#include <dm/device_compat.h> #include <errno.h> #include <scmi_agent-uclass.h> #include <scmi_protocols.h> - +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <linux/compat.h> diff --git a/drivers/firmware/scmi/smccc_agent.c b/drivers/firmware/scmi/smccc_agent.c index 64d0929f69c..f185891e8fd 100644 --- a/drivers/firmware/scmi/smccc_agent.c +++ b/drivers/firmware/scmi/smccc_agent.c @@ -3,12 +3,15 @@ * Copyright (C) 2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include <common.h> #include <dm.h> #include <errno.h> #include <scmi_agent.h> #include <scmi_agent-uclass.h> #include <dm/devres.h> +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <linux/arm-smccc.h> #include <linux/compat.h> diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index d25478796aa..60b9d499b79 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -4,6 +4,8 @@ * Copyright (C) 2019-2020 Linaro Limited. */ +#define LOG_CATEGORY UCLASS_SCMI_AGENT + #include <common.h> #include <cpu_func.h> #include <dm.h> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 219efdc8959..090834a495f 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) "nand: " fmt #include <common.h> +#include <watchdog.h> #ifndef __UBOOT__ #include <linux/compat.h> #include <linux/module.h> @@ -172,6 +173,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) nanddev_offs_to_pos(nand, einfo->addr, &pos); nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last); while (nanddev_pos_cmp(&pos, &last) <= 0) { + WATCHDOG_RESET(); ret = nanddev_erase(nand, &pos); if (ret) { einfo->fail_addr = nanddev_pos_to_offs(nand, &pos); diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 68ef5d1af8d..e5330958c7e 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -22,6 +22,7 @@ #else #include <common.h> #include <errno.h> +#include <watchdog.h> #include <spi.h> #include <spi-mem.h> #include <dm/device_compat.h> @@ -578,6 +579,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, #endif nanddev_io_for_each_page(nand, from, ops, &iter) { + WATCHDOG_RESET(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; @@ -629,6 +631,7 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, #endif nanddev_io_for_each_page(nand, to, ops, &iter) { + WATCHDOG_RESET(); ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) break; diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index ef426dac02b..e0efebc3555 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -11,6 +11,7 @@ #include <common.h> #include <log.h> +#include <watchdog.h> #include <dm.h> #include <dm/device_compat.h> #include <dm/devres.h> @@ -566,6 +567,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) len = instr->len; while (len) { + WATCHDOG_RESET(); #ifdef CONFIG_SPI_FLASH_BAR ret = write_bar(nor, addr); if (ret < 0) @@ -1250,6 +1252,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; + WATCHDOG_RESET(); /* * If page_size is a power of two, the offset can be quickly diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index 75e5e840edb..4acc9047b9e 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -16,6 +16,7 @@ #include <reset.h> #include <spi.h> #include <spi-mem.h> +#include <watchdog.h> #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/delay.h> @@ -171,6 +172,7 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv, static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr) { *val = readb(addr); + WATCHDOG_RESET(); } static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr) diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 4dde6488144..9ae09eec12b 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -721,15 +721,15 @@ static void dw_mipi_dsi_dphy_enable(struct dw_mipi_dsi *dsi) ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, val, val & PHY_LOCK, PHY_STATUS_TIMEOUT_US); if (ret) - dev_warn(dsi->dsi_host.dev, - "failed to wait phy lock state\n"); + dev_dbg(dsi->dsi_host.dev, + "failed to wait phy lock state\n"); ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS, val, val & PHY_STOP_STATE_CLK_LANE, PHY_STATUS_TIMEOUT_US); if (ret) - dev_warn(dsi->dsi_host.dev, - "failed to wait phy clk lane stop state\n"); + dev_dbg(dsi->dsi_host.dev, + "failed to wait phy clk lane stop state\n"); } static void dw_mipi_dsi_clear_err(struct dw_mipi_dsi *dsi) @@ -797,6 +797,7 @@ static int dw_mipi_dsi_init(struct udevice *dev, dsi->phy_ops = phy_ops; dsi->max_data_lanes = max_data_lanes; dsi->device = device; + dsi->dsi_host.dev = (struct device *)dev; dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; device->host = &dsi->dsi_host; diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index 8891ca4b784..4027e978c83 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -483,6 +483,9 @@ static int stm32_dsi_probe(struct udevice *dev) if (priv->hw_version != HWVER_130 && priv->hw_version != HWVER_131) { dev_err(dev, "DSI version 0x%x not supported\n", priv->hw_version); + dev_dbg(dev, "remove and unbind all DSI child\n"); + device_chld_remove(dev, NULL, DM_REMOVE_NORMAL); + device_chld_unbind(dev, NULL); ret = -ENODEV; goto err_clk; } |
