Commit Graph

1348 Commits

Author SHA1 Message Date
Yann Gautier 6481a8f1e0 feat(st-sdmmc2): allow compatible to be defined in platform code
Put DT_SDMMC2_COMPAT under #ifndef. Keep the default value if it is not
defined in platform code.

Change-Id: I611baaf1fc622d33e655ee2c78d9c287baaa6a67
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-03-22 09:09:23 +01:00
Yann Gautier 5278ec3faf feat(st-pmic): add pmic_voltages_init() function
This new function pmic_voltages_init() is used to set the minimum value
for STM32MP13 VDDCPU and VDDCORE regulators. This value is retrieved
from device tree.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ibbe237cb5dccc1fddf92e07ffd3955048ff82075
2022-03-22 09:09:23 +01:00
Gabriel Fernandez 9be88e75c1 feat(st-clock): add clock driver for STM32MP13
Add new clock driver for STM32MP13. Split the include file to manage
either STM32MP13 or STM32MP15.

Change-Id: Ia568cd12b1d5538809204f0fd2224d51e5d1e985
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
2022-03-22 09:09:23 +01:00
Yann Gautier 111a384c90 feat(stm32mp1): remove unsupported features on STM32MP13
* GPIO: On STM32MP13, there are no banks GPIOJ, GPIOK and GPIOZ.
* STM32MP13 is a single Cortex-A7 CPU: remove reset from MPU1
  and reset from MCU traces
* There is no MCU on STM32MP13. Put MCU security management
  under STM32MP15 flag.
* The authentication feature is not supported yet on STM32MP13,
  put the code under SPM32MP15 flag.
* On STM32MP13, the monotonic counter is managed in ROM code, keep
  the monotonic counter update just for STM32MP15.
* SYSCFG: put registers not present on STM32MP13 under STM32MP15
  flag, as the code that manages them.
* PMIC: use ldo3 during DDR configuration only for STM32MP15
* Reset UART pins on USB boot is no more required.

Change-Id: Iceba59484a9bb02828fe7e99f3ecafe69c837bc7
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
2022-03-21 10:53:55 +01:00
Yann Gautier 57e6018305 fix(st-pmic): add static const to pmic_ops
The static was found by sparse tool:
drivers/st/pmic/stm32mp_pmic.c:456:18: warning: symbol 'pmic_ops'
 was not declared. Should it be static?
The const was also missing.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ibb5cfaf67ac980bf0af27712a95dbef05b617c25
2022-03-08 13:18:09 +01:00
Bipin Ravi af68314ddc Merge "refactor(mbedtls): allow platform to specify their config file" into integration 2022-03-07 21:40:26 +01:00
Madhukar Pappireddy c507b06007 Merge "fix(st-clock): initialize pllcfg table" into integration 2022-03-06 01:24:17 +01:00
Yann Gautier 1f60d1bd33 feat(st-uart): manage oversampling by 8
UART oversampling by 8 allows higher baud rates for UART. This is
required when (UART freq / baudrate) <= 16. In this case the OVER8 bit
needs to be enabled in CR1 register. And the BRR register management is
different:
USARTDIV = (2 * UART freq / baudrate) (with div round nearest)
BRR[15:4] = USARTDIV[15:4]
BRR[3] = 0
BRR[2:0] = USARTDIV[3:0] >> 1

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Ia3fbeeb73a36a4dc485c7ba428c531e65b6f6c09
2022-03-04 14:55:18 +01:00
Yann Gautier af7775ab53 fix(st-uart): correctly fill BRR register
To get the nearest divisor for BRR register, we use:
Divisor =  (Uart clock + (baudrate / 2)) / baudrate
But lsl was wrongly used instead of lsr to have the division by 2.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Iedcc3ccdb4cf8268012e82a66df2a9ec48fc1d79
2022-03-04 14:55:18 +01:00
Yann Gautier 175758b277 fix(st-clock): initialize pllcfg table
The issue was found by Coverity:
CID 376582:    (UNINIT)
    Using uninitialized value "*pllcfg[_PLL4]" when calling
    "stm32mp1_check_pll_conf".
CID 376582:    (UNINIT)
    Using uninitialized value "*pllcfg[_PLL3]" when calling
    "stm32mp1_check_pll_conf".

Check PLL configs are valid before using pllcfg.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I49de849eaf451d0c165a8eb8555112a0a4140bbc
2022-03-04 13:48:53 +01:00
Manish V Badarkhe 033f61370a refactor(mbedtls): allow platform to specify their config file
Common mbedTLS implementation include the fixed configuration
file of mbedTLS and that does not gives flexilibility to the
platform to include their own mbedTLS configuration.
Hence changes are done so that platform can include their own
mbedTLS configuration file.

Signed-off-by: Lucian Paul-Trifu <lucian.paul-trifu@arm.com>
Signed-off-by: Manish V Badarkhe <manish.badarkhe@arm.com>
Change-Id: I04546589f67299e26b0a6a6e151cdf1fdb302607
2022-03-01 19:08:11 +01:00
Channa Kadabi 2ef6b8d378 fix(ufs): don't zero out buf before ufs read
ufs_read_blocks always zeros out the buffer before passing
to UFS for DMA. We don't need to zero out buf before reading
from UFS storage, this change remove the memset in ufs_read_blocks.

Signed-off-by: Channa Kadabi <kadabi@google.com>
Change-Id: I8029a7ea07fbd8cce29b383c80a3cfc782c5b7ec
2022-03-01 08:28:30 -08:00
Yann Gautier 9fa9a0c55c fix(st-clock): print enums as unsigned
With gcc-11, the -Wformat-signedness warning complains about enum values
that should be printed as unsigned values. Change %d to %u for several
lines in the clock driver.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ia2d24e6feef5e852e0a6bfaa1286fe605f9a16b7
2022-02-28 11:36:00 +01:00
Madhukar Pappireddy 176717989f Merge changes from topic "bug-fix" into integration
* changes:
  fix(nxp-crypto): refine code to avoid hang issue for some of toolchain
  build(changelog): add new scope for nxp crypto
  fix(lx2): drop erratum A-009810
2022-02-23 15:34:57 +01:00
Thierry Bultel a29f6e76cb feat(allwinner): apx803: add aldo1 regulator
Notice that aldo1 is typically useful for the Olimex A64 board, where
it powers the PE bank through the vcc-pe line.
Without it, it is not possible to light the user led on PE17, for
instance.

Change-Id: I70588bc977b884b22df87f1b075549cb8925925a
Signed-off-by: Thierry Bultel <thierry.bultel@linatsea.fr>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-02-21 16:26:54 +01:00
Jiafei Pan fa7fdfabf0 fix(nxp-crypto): refine code to avoid hang issue for some of toolchain
bitfield structure maybe has strict-aliasing issue for some compiler,
for example the old code has hang issue for yocto 3.4 toolchain, so
refine the code to avoid to use bitfield structure.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I6b6d7597311240dd6d6b8ca4ce508c69332f9c68
2022-02-18 12:03:16 +08:00
Madhukar Pappireddy 1b33b58b66 Merge changes from topic "ls1046a" into integration
* changes:
  docs(layerscape): add ls1046a soc and board support
  feat(ls1046aqds): add board ls1046aqds support
  feat(ls1046afrwy): add ls1046afrwy board support
  feat(ls1046ardb): add ls1046ardb board support
  feat(ls1046a): add new SoC platform ls1046a
  fix(nxp-tools): fix tool location path for byte_swape
  fix(nxp-qspi): fix include path for QSPI driver
  build(changelog): add new scopes for NXP layerscape platforms
2022-02-17 19:15:55 +01:00
Yann Gautier 47065ffe44 fix(st-pmic): correct verbose message
Replace %d with %u in log, to avoid warning when
-Wformat-signedness is enabled.

Change-Id: Ied5823520181f225ae09bd164e2e52e9a7692c60
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-02-15 18:09:51 +01:00
Yann Gautier bc1c98a8c7 fix(st-sdmmc2): correct cmd_idx type in messages
As cmd_idx is unsigned, we have to use %u and not %d.
This avoids warning when -Wformat-signedness is enabled.

Change-Id: I6954a8c939f3fb47dbb2c6db56a1909565af078b
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-02-15 18:09:51 +01:00
Yann Gautier afcdc9d8d7 fix(st-fmc): fix type in message
As page is unsigned, we should use %u and not %d.
Find with -Wformat-signedness.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I7205971ee5e83163e4fe47d33bb9e90832b59ae0
2022-02-15 18:09:51 +01:00
Yann Gautier 6e86b46249 fix(mtd): correct types in messages
Some messages don't use the correct types, update them.
This avoids warning when -Wformat-signedness is enabled.

Change-Id: Ie5384a7d139c48a623e1617c93d15fecc8a36061
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-02-15 18:09:51 +01:00
Yann Gautier bd9cd63ba0 fix(usb): correct type in message
pdev->request.bm_request is unsigned, use %u.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Idaadb8440d0b56bcfa02abd7c94a4ab59f5e15ee
2022-02-15 18:09:51 +01:00
Yann Gautier bdc88d2154 fix(tzc400): correct message with filter
As filter is unsigned, we have to use %u and not %d.
This avoids warning when -Wformat-signedness is enabled.

Change-Id: I9fc9f15774dc974edfa3db65f5aecd1e70bc146b
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-02-15 18:09:51 +01:00
Jiafei Pan ae95b1782b fix(nxp-qspi): fix include path for QSPI driver
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: If9322cf2646d3be3391445cb72d338c2d20117a6
2022-02-15 08:59:58 +08:00
Manish Pandey 2ba3085b8c Merge "refactor(measured-boot): cleanup Event Log makefile" into integration 2022-02-11 17:57:26 +01:00
Yann Gautier 1af59c4570 feat(common): add SZ_* macros
Add the SZ_* macros from 32 to 2G.
This allows removing some defines in raw NAND driver
and STM32MP1 boot device selection code.

Change-Id: I3c4d4959b0f43e785eeb37a43d03b2906b7fcfbc
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
Signed-off-by: Arpita S.K <Arpita.S.K@arm.com>
2022-02-08 10:49:36 +01:00
Madhukar Pappireddy acd0e9bf64 Merge "fix(ufs): don't zero out the write buffer" into integration 2022-02-07 16:41:38 +01:00
Jorge Troncoso cd3ea90b20 fix(ufs): don't zero out the write buffer
Previously ufs_write_blocks was memsetting the write buffer before
calling ufs_prepare_cmd, causing zeros to be written to UFS. This change
deletes the memset call so the original buffer contents get written to
UFS.

Signed-off-by: Jorge Troncoso <jatron@google.com>
Change-Id: I3299f11b30e6d7d409408ce11a6759c88607ee18
2022-02-03 15:52:59 -08:00
Lionel Debieve 812daf916c feat(st): update the security based on new compatible
From the new binding, the RCC become secured based on the new
compatible. This must be done only from the secure OS initialisation.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: I7f0a62f22bfcca638ddaefc9563df00f89f01653
2022-02-03 09:20:49 +01:00
Manish V Badarkhe 992d97c45f refactor(measured-boot): cleanup Event Log makefile
The Event Log sources are added to the source-list of BL1 and BL2
images in the Event Log Makefile. It doesn't seem correct since
some platforms only compile Event Log sources for BL2.
Hence, moved compilation decision of Event Log sources to the
platform makefile.

Change-Id: I1cb96e24d6bea5e091d08167f3d1470d22b461cc
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2022-02-02 16:08:58 +00:00
Yann Gautier fc0aa10a2c feat(st-gpio): do not apply secure config in BL2
At boot, the devices under ETZPC control are secured, so should be
their GPIOs. As securable GPIOs are secured by default, keep the reset
values in BL2.

Change-Id: I9e560d936f8e8fda0f96f6299bb0c3b35ba9b71f
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-02-01 16:47:27 +01:00
Fabien Dessenne 53584e1d5b feat(st-gpio): allow to set a gpio in output mode
Allow to set a gpio in output mode from the device tree.

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: Ic483324bc5fe916a60df05f74706bd1da4d08aa5
2022-02-01 16:47:27 +01:00
Fabien Dessenne 417196faef refactor(st-gpio): code improvements
No functional, change, but some improvements:
- Declare set_gpio() as static (only called locally)
- Handle the type ('open-drain') property independently from the
  mode one.
- Replace mmio_clrbits_32() +  mmio_setbits_32() with
  mmio_clrsetbits_32().
- Add a missing log
- Add missing U() in macro definitions

Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com>
Change-Id: I1a79609609ac8e8001127ebefdb81def573f76fa
2022-02-01 16:35:28 +01:00
Madhukar Pappireddy 884a65064a Merge changes from topic "st-nvmem" into integration
* changes:
  feat(stm32mp1): manage monotonic counter
  feat(stm32mp1): new way to access platform OTP
  feat(stm32mp1-fdts): update NVMEM nodes
  refactor(st-drivers): improve BSEC driver
  feat(stm32mp1-fdts): add nvmem_layout node and OTP definitions
  feat(stm32mp1): add NVMEM layout compatibility definition
2022-02-01 00:18:48 +01:00
Madhukar Pappireddy 0fc22fcdbd Merge "fix(scmi): add missing \n in ERROR message" into integration 2022-01-31 15:02:38 +01:00
Nicolas Le Bayon 072d7532d2 refactor(st-drivers): improve BSEC driver
Rename driver file to BSEC2.
Split header file in IP and feature parts.
Add functions to access BSEC scratch register.
Several corrections and improvements.
Probe the driver earlier, especially to check debug features.

Change-Id: I1981536398d598d67a19d2d7766dacc18de72ec1
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-01-28 18:04:52 +01:00
Pascal Paillet 9b4ca70d97 feat(st-regulator): add support for regulator-always-on
Add support for regulator-always-on at BL2 level as it was supported
before using the regulator framework.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
Change-Id: Idb2f4ddc2fdd4e0d31fb33da87c84618aa2e5135
2022-01-28 14:18:12 +01:00
Yann Gautier 0dc9f52a2a fix(scmi): add missing \n in ERROR message
Correct ERROR message in scmi_process_message().

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I55e337a3904045aa188975f6a7ed3e989678f571
2022-01-28 13:09:17 +01:00
Manish Pandey 24ce8d134a Merge "fix(nxp-drivers): ddr: corrects mapping of HNFs nodes" into integration 2022-01-27 23:05:51 +01:00
Lionel Debieve 591d80c8b1 refactor(st-clock): update STGEN management
Rework STGEN config function, and move it to stm32mp_clkfunc.c file.

Change-Id: I7784a79c486d1b8811f6f8d123e49ea34899e9b6
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-01-27 18:06:36 +01:00
Yann Gautier 7418cf3979 feat(st-clock): assign clocks to the correct BL
Some clocks are only required in BL2, like boot devices clocks:
FMC, QSPI.
Some clocks are only used in BL32: Timers, devices that need special
care for independent reset.

Change-Id: Id4ba99afeea5095f419a86f7dc6423192c628d82
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-01-27 18:06:36 +01:00
Yann Gautier 3d69149a7e feat(st-clock): do not refcount on non-secure clocks in bl32
This change removes reference counting support in clock gating
implementation for clocks that rely on non-secure only RCC resources.
As RCC registers are accessed straight by non-secure world for these
clocks, secure world cannot safely store the clock state and even
disabling such clock from secure world can jeopardize the non-secure
world clock management framework and drivers.

As a consequence, for such clocks, stm32_clock_enable() forces the clock
ON without any increment of a refcount and stm32_clock_disable() does
not disable the clock.

Change-Id: I0cc159b36a25dbc8676f05edf2668ae63c640537
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2022-01-27 18:06:36 +01:00
Yann Gautier aaa09b713c feat(st-clock): define secure and non-secure gate clocks
Array stm32mp1_clk_gate[] defines the clock resources. This change
add a secure attribute to the clock: secure upon RCC[TZEN] (SEC),
secure upon RCC[TZEN] and RCC[MCKPROT] (MKP) or always accessible
from non-secure (N_S).

At init, lookup clock tree to check if any of the secure clocks
is derived from PLL3 in which case PLL3 shall be secure.

Note that this change does not grow byte size of stm32mp1_clk_gate[].

Change-Id: I933d8a30007f3c72f755aa1ef6d7e6bcfabbfa9e
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-01-27 18:06:36 +01:00
Yann Gautier 2444d2314c refactor(st-clock): use refcnt instead of secure status
Rework the internal functions __stm32mp1_clk_enable/disable to check for
reference count instead of secure status for a clock.
Some functions now unused can be removed.

Change-Id: Ie4359110d7144229f85c961dcd5a019222c3fd25
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-01-27 18:06:07 +01:00
Sughosh Ganu 40b085bddf feat(fwu): simplify the assert to check for fwu init
Simplify the assert to check if the FWU subsystem has been initialised
in the fwu_is_trial_run_state function.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Change-Id: I428668470ebd4b67e68777a62d5732cb96841ab9
2022-01-27 18:09:02 +05:30
Sughosh Ganu 9adce87efc feat(fwu): add a function to pass metadata structure to platforms
Add a helper function to pass the metadata structure to the
platforms. Platforms can then read the metadata structure and pass the
boot index value, i.e. the bank(partition) from which the firmware
images were booted, to the Update Agent.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Change-Id: I571179b9baa0fbc4d0f08d7a6e3b50c0c7165c5c
2022-01-27 18:09:02 +05:30
Sughosh Ganu 3cb1065581 feat(partition): add a function to identify a partition by GUID
With the GPT partition scheme, a partition can be identified using
it's UniquePartitionGUID, instead of it's name. Add a function to
identify the partition based on this GUID value. This functionality is
useful in identification of a partition whose UniquePartitionGUID
value is known.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Change-Id: I543f794e1f7773f969968a6bce85ecca6f6a1659
2022-01-27 18:09:02 +05:30
Sughosh Ganu 7585ec4d36 feat(partition): copy the partition GUID into the partition structure
Copy the UniquePartitionGUID member of a GPT partition entry into the
partition_entry structure. This GUID is subsequently used to identify
the image to boot on a platform which supports multiple partitions of
firmware components using the FWU metadata structure.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Change-Id: I8b55a1ee7deb1353886fbd8ebde53055d677fee0
2022-01-27 18:09:02 +05:30
Madhukar Pappireddy 0b1cfc2988 Merge "fix(st-ddr): add missing debug.h" into integration 2022-01-27 02:01:32 +01:00
Maninder Singh e3a234971a fix(nxp-drivers): ddr: corrects mapping of HNFs nodes
Corrects mapping of HNFs nodes with SNFs nodes based on their
proximity in CCN508 ring when disabling unused ddr controller.

When DDRC 2 disabled and DDR 1 is active the mapping is 0x3/3/8/8/8/8/3/3.
When DDRC 1 is disabled and DDR2 is active the mapping is 0x
18/18/13/13/13/13/18/18 .

Signed-off-by: Maninder Singh <maninder.singh_1@nxp.com>
Signed-off-by: JaiPrakash Singh <JaiPrakash.singh@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I6ec1e02f8ad7e8bb8628913625ff5313a054dcc6
2022-01-26 10:19:08 +08:00