Commit Graph

19993 Commits

Author SHA1 Message Date
d8af9dc4ae i2c: stm32f7: fix clearing the control register
Bits should be set to 0, not 1.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I067f23215acfa4d468e86806d959d68654289473
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/265893
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Alain VOLMAT <alain.volmat@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
acb3eaf035 i2c: stm32: fix usage of rise/fall device tree properties
These two device tree properties were not being applied.

Change-Id: Iab376954a5af8f9a6f9b81f81c45c2c3fe6aa3ab
Fixes: 0c63ec6bbf ("i2c: stm32f7: move driver data of each instance in a privdata")
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/265849
Tested-by: Alain VOLMAT <alain.volmat@foss.st.com>
Reviewed-by: Alain VOLMAT <alain.volmat@foss.st.com>
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
648aff43b8 i2c: stm32: do not set the STOP condition on error
Current function stm32_i2c_message_xfer is sending a STOP
whatever the result of the transaction is.  This can cause issues
such as making the bus busy since the controller itself is already
sending automatically a STOP when a NACK is generated.

Thanks to Jorge Ramirez-Ortiz for diagnosing and proposing a first
fix for this. [1]

[1] https://lore.kernel.org/u-boot/20220815145211.31342-2-jorge@foundries.io/

Change-Id: I157b95a3b8e411e8591d76e148930cf00f682fc4
Reported-by: Jorge Ramirez-Ortiz, Foundries <jorge@foundries.io>
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/264955
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
8fffa9e5cc i2c: stm32: remove unused stop parameter in start & reload handling
Functions stm32_i2c_message_start and stm32_i2c_handle_reload
both get a stop boolean indicating if the transfer should end with
a STOP or not.  However no specific handling is needed in those
functions hence remove the parameter.

Change-Id: I681def7666baa987116ee7391cfb7158ed768cb6
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/264954
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
5487d29128 i2c: stm32: fix comment and remove unused AUTOEND bit
Comment within stm32_i2c_message_start is misleading, indicating
that AUTOEND bit is setted while it is actually cleared.
Moreover, the bit is actually never setted so there is no need
to clear it hence get rid of this bit clear and the bit macro
as well.

Change-Id: Icbf734d98f127a9e2a52d0f3d138cc9e291cd579
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/264953
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
664b387431 video: theadorable: Use RGB565 for BMP blitting
At present this uses RGB555 format for blitting to a display. Sandbox uses
565 and that seems to be more normal for BMP as well. Update the code
accordingly and add a test.

Note that this likely breaks the theadorable board so we may need to
discuss supporting both formats.

[Backport of commit 4ea1548210 ("video: theadorable: Use RGB565 for
 BMP blitting")]

Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Ifae9f08166f4c7c3f8a1aa41f6fc0c898c3be5b5
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/265323
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
2022-10-17 10:48:26 +02:00
44ae5a1cef clk: stm32-core: introduce multi gate management
Majority of IPs have a peripheral clock and a Kernel clocks.
These clocks are gated with same bit register. Then we have to manage
a counter at gate level.

This patch introduce a new clock "clk_stm32_gate", it will replace
"clk_stm32_setclr_gate".

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Change-Id: I6bb988cb0f7eab5cc8374bc3fe65b37cbcd9a5e0
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/256638
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
5006f25ce4 clk: stm32-core: fix divider in stm32 composite clock
Divider ops is missing in composite clock.

Fixes: 58291d94e3 ("clk: stm32-core: introduce stm32-clk-core")
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Change-Id: I9f939e363d7d9e4024f5ae189ab6fcb6e8e0bde5
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/256637
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
55dc4842a6 clk: stm32-core: rename parameter name in clk_stm32_register_composite()
Rename "pcfg" parameter into "mcfg" ('m' for mux).

Fixes: 58291d94e3 ("clk: stm32-core: introduce stm32-clk-core")
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Change-Id: Ia5effceb54b5b8f776d106f01cd89e6c323d19e4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/256636
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:26 +02:00
20e17e74b6 pinctrl: pinctrl_stm32: Populate uc_priv->name[] with pinmux node's name
Populate uc_priv->name[] with pinmux node's name in order to indicate
the pinmuxing's label in case GPIO is configured in alternate.

For example, for STM32 SoC's based platform, "gpio status" command
output :

  before
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func
      GPIOZ5: func
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

  After
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func i2c4-0
      GPIOZ5: func i2c4-0
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: Ib7563ed0d20cece9516e5c5523103990852b4d0f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/255980
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
f5798061ec gpio: Fix pin's status display for pin with GPIOF_UNUSED function
Even pin's with GPIOF_UNUSED function can have label.
The criteria to add or not a space character is linked to label not to
the used/unused status.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: Ic9e92420a339490be694d3eee4daaa348344b5d0
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/255979
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
60371e490a gpio: Allow to print pin's label even for pin with GPIOF_FUNC function
Currently, if pin's function is GPIOF_FUNC, only "func" if displayed
without any other information. It would be interesting, if information is
available, to indicate which pin's label is used.

For example, for STM32 SoC's based platform, "gpio status" command
output :

   before
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func
      GPIOZ5: func
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

   After
    Bank GPIOZ:
      GPIOZ0: unused : 0 [ ]
      GPIOZ1: unused : 0 [ ]
      GPIOZ2: unused : 0 [ ]
      GPIOZ3: unused : 0 [ ]
      GPIOZ4: func i2c4-0
      GPIOZ5: func i2c4-0
      GPIOZ6: unused : 0 [ ]
      GPIOZ7: unused : 0 [ ]
      GPIOZ8: unknown
      GPIOZ9: unknown
      GPIOZ10: unknown
      GPIOZ11: unknown
      GPIOZ12: unknown
      GPIOZ13: unknown
      GPIOZ14: unknown
      GPIOZ15: unknown

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: Ia935ed2f340b6df1c439389a53e2c05489561983
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/255978
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
b941fcea8a gpio: stm32_gpio: flag secured pin as protected
When a GPIO is secure-protected, it can't be accessed from U-Boot.
In that case, set its 'function' to GPIOF_PROTECTED.
This makes the "gpio status" command returning the "protected" status.

Example with GPIOA6 pin secure-protected

> gpio status -a
Bank GPIOA:
GPIOA0: unused: 0 [ ]
GPIOA1: func
...
GPIOA6: protected
...

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: If3297d920741a6a1b915503650de1cfb69c726f9
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/252040
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
a33d8e2f83 dm: gpio: Add GPIOF_PROTECTED flag
Declare the GPIOF_PROTECTED flag, to identify a GPIO which can't be used
because it has a protected access.
This can be used to flag a GPIO that can be accessed only from the Secure
world.

Add a test and support in the gpio sandbox.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: Ic990ca6a02f9cc6f9e84bd94732ea62cfbafb301
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/252039
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
973461aa8d mmc: stm32_sdmmc2: protect against unsupported modes
The UHS modes for SD, HS200 and HS400 modes for eMMC are not supported
by the stm32_sdmmc2 driver.
Make it clear by removing the corresponding caps after parsing the DT.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I53c4e33906fa94a5cf3fafca2ce9e61e0ab65d0a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/257471
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
e2cf7fd677 mmc: stm32_sdmmc2: add dual data rate support
To support dual data rate with STM32 sdmmc2 driver, the dedicated bit
(DDR - BIT(18)) needs to be set in the CLKRC register. Clock bypass
(no divider) is not allowed in this case.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I7f7e6786c6ed43715d1147e5def412c9422910f4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/257470
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
8a46bc3005 mmc: stm32_sdmmc2: make reset property optional
Although not recommended, the reset property could be made optional.
This way the driver will probe even if no reset property is provided
in an sdmmc node in DT. This reset is already optional in Linux.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I39b69e8dc7b43b8e265e77388fb53f7c1fa2a007
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/250055
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
ab40d97399 usb: host: ehci-generic: Make usage of clock/reset bulk() API
Make usage of clock and reset bulk API in order to simplify the code

[Backport of ba96176ab7 ("usb: host: ehci-generic: Make usage of
 clock/reset bulk() API")]

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: Ia5711b14a17cf1d042bdab9d3f28437d5c53272c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/246747
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
7a250cc251 clk: scmi: fix invalid clock name references
Fixes clock name references in scmi_clk driver. SCMI clock names are
retrieved from the SCMI firmware by invoking SCMI commands using the
stack for SCMI response message hence clocks names located in the
stack must be duplicated before being registered in the clock framework.

Change-Id: I4795469625d44c319ed9ba5673a8cdf560b7de6b
Fixes: 7c33f78983 ("clk: scmi: register scmi clocks with CCF")
Reported-by: scan-admin@coverity.com
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/249343
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-10-17 10:48:25 +02:00
0af9d9c82c video: stm32: remove test on CONFIG_DM_REGULATOR
The tests on CONFIG_DM_REGULATOR, added to avoid compilation issues, can now
be removed, they are no more needed since the commit 16cc5ad0b4 ("power:
regulator: add dummy helper").

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I18e4ad5947e3b321573efe2085dd4c593cabbabe
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/250167
2022-10-17 10:48:25 +02:00
5dc7c456a1 spi: stm32_qspi: Remove SR_BUSY bit check before sending command
Waiting for SR_BUSY bit when receiving a new command is not needed.
SR_BUSY bit is already managed in the previous command treatment.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: If15940fb19e9d2f9b9d9e67b117b1460c284e927
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/250833
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:02 +02:00
65a6c3beaa spi: stm32_qspi: Always check SR_TCF flags in stm32_qspi_wait_cmd()
Currently, SR_TCF flag is checked in case there is data, this criteria
is not correct.

SR_TCF flags is set when programmed number of bytes have been transferred
to the memory device ("bytes" comprised command and data send to the
SPI device).
So even if there is no data, we must check SR_TCF flag.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: Id4e8f33e11a972d985f29b7a4363b1622f4128c2
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/250832
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:02 +02:00
ccb3a05989 video: add support of panel Rocktech HX8394
Support for Rocktech HX8394 720p dsi 2dl video mode panel.
This panel driver is based on the Linux Kernel driver from
drivers/gpu/drm/panel/panel-rocktech-hx8394.c.

Change-Id: I116af7c59e8e77217337b25d27beb45d08028500
Signed-off-by: Yannick FERTRE <yannick.fertre@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/236113
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:02 +02:00
3076f946b7 video: stm32: stm32_ltdc: fix data enable polarity
Wrong DISPLAY_FLAGS used to set the data enable polarity.

Signed-off-by: Yannick FERTRE <yannick.fertre@foss.st.com>
Change-Id: I767c723f7deb853ac09ee1f7e39c057bd37e1a46
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/240655
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:02 +02:00
e117c2ad32 pinctrl: pinctrl_stm32: Update pinmux_mode definition
pinmux_mode[] is linked to gpio_function[] defined in gpio-uclass.c
So reuse the same gpio_func_t enum value

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I284167e444a8b59066bff10ec2f92ac2b26a2d70
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/239115
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
(cherry picked from commit 312fccd8213bcdefe9d353e4b306748e7b49cd0c)
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/239880
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:02 +02:00
cd3d4a9d1f mmc: fix error message for unaligned erase request
Fix the end address in the message for unaligned erase request in
mmc_berase() when start + blkcnt is aligned to erase_grp_size.

for example:
  - start = 0x2000 - 26
  - count = 26
  - erase_grp_size = 0x400

  Caution! Your devices Erase group is 0x400
  The erase range would be change to 0x2000~0x27ff

But no issue when the end address is not aligned, for example
  - start = 0x2000 - 2 * 26
  - count = 26
  - erase_grp_size = 0x400

  Caution! Your devices Erase group is 0x400
  The erase range would be change to 0x2000~0x23ff

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I5f92544259c3d1dad2df30c9d7762ec7860f07cf
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/238835
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
2022-05-25 16:01:01 +02:00
de79e6949f pinctrl: pinctrl_stm32: Use GPIOF_UNKNOWN to indicate not mapped pins
GPIOF_UNKNOWN becomes a valid pin muxing information to indicate
that a pin is not mapped.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I659b45eae59374d82103ee15857c35b4f2bcdf75
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/239066
Reviewed-by: Fabien DESSENNE <fabien.dessenne@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
2022-05-25 16:01:01 +02:00
fba8d6b38c gpio: stm32_gpio: Rework GPIO hole management
On some STM32 SoC's package, GPIO bank may have hole in their GPIO bank
Example:
  If GPIO bank have 16 GPIO pins [0-15].
  In particular SoC's package case, some GPIO bank can have less GPIO pins:
    - [0-10] => 11 pins;
    - [2-7] => 6 pins.

Commit dbf928dd26 ("gpio: stm32f7: Add gpio bank holes management")
proposed a first implementation by not counting GPIO "inside" hole. GPIO
are not displaying correctly using gpio or pinmux command when GPIO holes
are located at the beginning of GPIO bank.

To simplify, consider that all GPIO have 16 GPIO and use the gpio_ranges
struct to indicate if a GPIO is mapped or not. GPIO uclass offers several
GPIO functions ("input", "output", "unused", "unknown" and "func"), use
"unknown" GPIO function to indicate that a GPIO is not mapped.

stm32_offset_to_index() is no more needed and removed.

This must be reflected using the "gpio" command to indicate to user
that a particular GPIO is not mapped (marked as "unknown") as shown below:

Example for a 16 pins GPIO bank with the [2-7] mapping (only 6 pins
mapped):
GPIOI0          : unknown
GPIOI1          : unknown
GPIOI2          : analog
GPIOI3          : analog
GPIOI4          : alt function 0 push-pull pull-down
GPIOI5          : alt function 0 push-pull pull-down
GPIOI6          : alt function 0 push-pull pull-down
GPIOI7          : analog
GPIOI8          : unknown
GPIOI9          : unknown
GPIOI10         : unknown
GPIOI11         : unknown
GPIOI12         : unknown
GPIOI13         : unknown
GPIOI14         : unknown
GPIOI15         : unknown

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I55c39a2707fa8dae108d90c4a72590f1a4520ca9
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/239065
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
0e3c42448a iio: adc: stm32-adc: add support of generic channels binding
Add support of generic IIO channel binding:
./devicetree/bindings/iio/adc/adc.yaml
Keep support of st,adc-channels for backward compatibility.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Change-Id: Ifb433baf31af3661271d98b7c155958aa5f7afdb
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/238839
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabrice GASNIER <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
423ebb16d2 stm32: adc: split channel init into several routines
Split stm32_adc_chan_of_init channel initialization function into
several routines to increase readability and prepare channel
generic binding handling.

Change-Id: Ifdbb454600c4e2d48e6dde70ff5354e4aaff9c17
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/238838
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Fabrice GASNIER <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
c189609d33 mmc: stm32_sdmmc2: introduce of_to_plat ops
Add the uclass ops of_to_plat to parse the device tree properties
to respect the expected sequence by the driver model.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: Ie868aca1e057629eb212dcc3c8f463c00d01ccb7
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/235573
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Yann GAUTIER <yann.gautier@foss.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
2022-05-25 16:01:01 +02:00
9bbe98426b mmc: stm32_sdmmc2: remove privdata
All the elements of privdata are static and build from device tree,
they are moved in platdata to prepare the support of ops
of_to_plat.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: Id78f6e3f0b5deebedc6e5f54dd99b855a163fd2c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/235572
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Yann GAUTIER <yann.gautier@foss.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
2022-05-25 16:01:01 +02:00
3e6ec74c43 mmc: stm32_sdmmc2: cosmetic: rename stm32_sdmmc_bind
Rename stm32_sdmmc_bind to stm32_sdmmc2_bind as all oter function
in SDMMCv2 driver

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: Idba00f2816d362a1675c8c74eac80400cb2e4de7
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/235571
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Yann GAUTIER <yann.gautier@foss.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
2022-05-25 16:01:01 +02:00
6ee1aad5b6 net: dwc_eth_qos: restore support of not cache-aligned descriptor
Solve a issue with AXI_WIDTH_32 on a the 64 bytes cache line platform;
in this case the requested descriptor padding length should be 12 but the
associated parameter EQOS_DMA_CH0_CONTROL.DSL is limited at 3bits = 7.

As the DMA descriptor can't be correctly aligned with the cache line,
the maintenance of each descriptor can't be guarantee by a simple cache
line operation: flush or invalid.

To avoid all the maintenance issues, these descripto need to be allocated
in a NOT CACHEABLE memory, allocated by noncached_alloc() when
CONFIG_SYS_NONCACHED_MEMORY is enable.

This patch don't change the current behavior when the descriptor
can be cache-aligned with the filed "Descriptor Skip Length" of
the DMA channel control register, when eqos->desc_pad = true.

Change-Id: Iada23492743e3af977e07c1f1b8c2f32550436f7
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/236650
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com>
2022-05-25 16:01:01 +02:00
7c0508bcc8 power: regulator: stm32-verfbuf: add support from mp13
Add support for stm32mp13 verfbuf with minimal voltage value
of 1650mV.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
Change-Id: I8fcea9fea3a379dad16816f38b75389f82c55bda
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/235947
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
b25fc67425 clk: manage CLK_SET_RATE_PARENT flags on clk_set_rate()
Add possibility to propagate rate change up one level

Change-Id: I866d25a89cd351ea75cf7e4605397ebe20a60661
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/235018
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
5186289e66 clk: update clk_clean_rate_cache to use private clk struct
In clk_clean_rate_cache, clk->rate should update the private clock
struct when CCF is activated to save the cached rate value.

When clk_get_parent_rate is called, the cached information
is read from pclk->rate, with pclk = clk_get_parent(clk)
which use dev_get_clk_ptr() to access to private data.

As the cached is read from private clk data, the update should
be done also on it.

Series-cc: Tero Kristo <t-kristo@ti.com>
Series-cc: Tero Kristo <kristo@kernel.org>
Fixes: 6b7fd3128f ("clk: fix set_rate to clean up cached rates for the hierarchy")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: Ifa06360115ffa3f3307372e6cdd98ec16759d6ba
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/236864
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
2022-05-25 16:01:01 +02:00
97402fc9a3 adc: manage pcsel on end of conversion
Some I/Os are connected to ADC input channels, when the corresponding bit
in PCSEL register are set on STM32H7 and STM32MP15.
PCSEL shouldn't be let enabled when VDDA supply is disabled, to avoid
current leakage. This may occur if the kernel disable the VDDA supply
of the ADC, while the PCSEL remains set, after leaving U-boot.
Clear PCSEL bits after each end of conversion, when relevant, to
prevent this case.

Change-Id: I147f128cd67392220a8924cf407bcdae0e1eb555
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/233126
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
5f2761e423 adc: stm32: add smart calibration support
Add smart calibration support for STM32MP1.
- STM32MP15x: both linear & offset calibration are supported
- STM32MP13x: Only offset calibration is supported

Linear calibration:
Linear calibration is SoC dependent and does not change over
time. As it is time consuming, do it only once.
Restore calibration data from environment variable to save time.
If no calibration data are found in u-boot environment variables
run a new calibration.

Offset calibration:
This calibration is fast and may vary over time.
Run offset single-ended and differential calibration on each boot.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Change-Id: If8739d96e019d42341901c5da6a83925cc78333a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/231628
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
f1ee2f5b66 usb: gadget: dwc2_udc_otg: Make usage of typec_get_driver_from_usb()
Before relying on u-boot,force-b-session-valid property presence to set
force_b_session_valid field, use typec_get_driver_from_usb() which check
if a Type-C connector is present. In this case invoke typec_get_data_role()
which indicates if current data role is DEVICE or HOST.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I3dc5da0c332c5b557a855564985317345d25458f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232354
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
d7cf053394 usb: typec: Add typec_get_driver_from_usb() API
The typec_get_driver_from_usb() allows to retrieve a Type-C device from
an USB device.
typec_get_driver_from_usb() checks in USB device node for port and endpoint
sub-node, if exist, retrieve the connector node, probe the associated
Type-C device and return it.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: If564cdf463f3915bec26f17a4717c9ab9d42f692
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232353
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
158eb2b33c usb: typec: ucsi: Add STM32G0 UCSI driver support
STM32GO provides an integrated USB Type-C interface.
It handles UCSI protocol over I2C and supports read and write
UCSI uclass ops.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I309b85859f94f284bb62bc3ce7174cf9f49a5e31
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232350
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
32a22b57c8 usb: typec: ucsi: Add UCSI uclass support
Implement a minimal UCSI uclass which allows to send request
to UCSI compatible chip. It provides the read() and write() ops.
It offers 3 services:
  - ucsi_is_attached() which informs if Type-C connector is attached
    or not.
  - ucsi_get_data_role() which informs if the Type-C controller acts
    as Device or host.
  - usci_get_nb_connector() which indicates how many connector are
    managed.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I319cf1f49b0980d33e2b47f1b14a513eb4466da5
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232349
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
bc1af77ffc usb: typec: Add support for STUSB160x Type-C controller family
Add STMicroelectronics STUSB160x Type-C controller driver
It supports both Type-C uclass ops (.is_attached and .get_data_role).

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I72077e70ff050e9bc463cb096408fd78bd66f318
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232345
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
3e36da694a usb: Add USB_TYPEC uclass
The USB TypeC uclass exposes 3 services:
  - is_attached() which indicates if connector is attached or not
  - get_data_role() which indicates the current controller role
    (Host or Device)
  - get_nb_connector() which indicates the connector number managed

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I296bc3cb8b180e0adb02171ede5db887fb1f5d6b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/232343
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
bd92d42f2b net: dwc_eth_qos: Support the phy-supply regulator binding
Configure the phy regulator if defined by the "phy-supply" DT phandle.

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Change-Id: I9febda03d173d1671b5961bccadefbb21b7a7a09
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/225075
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
62a78a33f7 pinctrl: pinctrl_stm32: prevent the use of the secure protected pins
The hardware denies any access from the U-Boot non-secure world to the
secure-protected pins. Hence, prevent any driver to configure such a pin.
Identify the secure pins with "NO ACCESS" through the 'pinmux status -a'
command.
Use a driver data structure to identify which hardware versions support
this feature.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: I7b56a959537b4f201b4ce49a5ee84432684ea0e3
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/215821
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
6f102bacfe gpio: stm32-gpio: prevent the use of the secure protected pins
The hardware denies any access from the U-Boot non-secure world to the
secure-protected pins. Hence, prevent any driver to request such a pin.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: Iabe8941fbad73d7125f0558e13b95dd67806094e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/215820
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
b8f032657d video: stm32: stm32_ltdc: support several hardware versions
Register mapping & pixel formats depend on version of ltdc
display controller.

Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
Change-Id: I4ecd3c23c3ac4fdc2734290b3d432fbc484c568a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/193320
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@foss.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00
13492aa128 pinctrl: Add MPC23017 support
Add support for Microchip MCP23017 which is a 16-Bit I/O
expander with I2c interface.

Datasheet is available here:
https://www.microchip.com/wwwproducts/en/MCP23017

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Change-Id: I18d0add0d30970a3f08859f2cf38261f699056fd
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/190046
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrice CHOTARD <patrice.chotard@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2022-05-25 16:01:01 +02:00