Compare commits
12 Commits
v2022.04-r
...
v2018.11-s
| Author | SHA1 | Date | |
|---|---|---|---|
| a120b9bdb3 | |||
| 00a5933e98 | |||
| 3b9e8d9000 | |||
| 62f620eb8d | |||
| 85e7457155 | |||
| ffe232a956 | |||
| 6893b88a4a | |||
| 5b2ef8968d | |||
| 3c2227a329 | |||
| 908c3bf50f | |||
| e1532f83da | |||
| a012f551a8 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -88,3 +88,6 @@ GTAGS
|
||||
*.orig
|
||||
*~
|
||||
\#*#
|
||||
|
||||
/oe-*
|
||||
bitbake-cookerdaemon.log
|
||||
|
||||
@ -242,7 +242,9 @@ F: drivers/misc/stm32mp_fuse.c
|
||||
F: drivers/mmc/stm32_sdmmc2.c
|
||||
F: drivers/phy/phy-stm32-usbphyc.c
|
||||
F: drivers/pinctrl/pinctrl_stm32.c
|
||||
F: drivers/power/pmic/stpmic1.c
|
||||
F: drivers/power/regulator/stm32-vrefbuf.c
|
||||
F: drivers/power/regulator/stpmic1.c
|
||||
F: drivers/ram/stm32mp1/
|
||||
F: drivers/misc/stm32_rcc.c
|
||||
F: drivers/reset/stm32-reset.c
|
||||
|
||||
2
Makefile
2
Makefile
@ -3,7 +3,7 @@
|
||||
VERSION = 2018
|
||||
PATCHLEVEL = 11
|
||||
SUBLEVEL =
|
||||
EXTRAVERSION =
|
||||
EXTRAVERSION = -stm32mp-r2
|
||||
NAME =
|
||||
|
||||
# *DOCUMENTATION*
|
||||
|
||||
@ -1313,21 +1313,27 @@ config ARCH_STM32MP
|
||||
select DM_GPIO
|
||||
select DM_RESET
|
||||
select DM_SERIAL
|
||||
select ENV_VARS_UBOOT_RUNTIME_CONFIG
|
||||
select MISC
|
||||
select OF_CONTROL
|
||||
select OF_LIBFDT
|
||||
imply OF_LIBFDT_OVERLAY
|
||||
select OF_SYSTEM_SETUP
|
||||
select PINCTRL
|
||||
select REGMAP
|
||||
select SUPPORT_SPL
|
||||
select SYSCON
|
||||
select SYSRESET
|
||||
select SYS_ARCH_TIMER
|
||||
select SYS_THUMB_BUILD
|
||||
imply CMD_DM
|
||||
imply CMD_POWEROFF
|
||||
help
|
||||
Support for STM32MP SoC family developed by STMicroelectronics,
|
||||
MPUs based on ARM cortex A core
|
||||
U-BOOT is running in DDR and SPL support is the unsecure First Stage
|
||||
BootLoader (FSBL)
|
||||
U-BOOT is running in DDR, loaded by the First Stage BootLoader (FSBL).
|
||||
FBSL can be TF-A: Trusted Firmware for Cortex A, for trusted boot chain.
|
||||
SPL is the unsecure FSBL for the basic boot chain.
|
||||
|
||||
config ARCH_ROCKCHIP
|
||||
bool "Support Rockchip SoCs"
|
||||
|
||||
@ -49,6 +49,9 @@ unsigned long long get_ticks(void)
|
||||
|
||||
ulong timer_get_boot_us(void)
|
||||
{
|
||||
if (!gd->arch.timer_rate_hz)
|
||||
timer_init();
|
||||
|
||||
return lldiv(get_ticks(), gd->arch.timer_rate_hz / 1000000);
|
||||
}
|
||||
|
||||
|
||||
@ -553,6 +553,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
|
||||
dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
|
||||
|
||||
dtb-$(CONFIG_TARGET_STM32MP1) += \
|
||||
stm32mp157a-dk1.dtb \
|
||||
stm32mp157c-dk2.dtb \
|
||||
stm32mp157c-ed1.dtb \
|
||||
stm32mp157c-ev1.dtb
|
||||
|
||||
|
||||
@ -105,5 +105,5 @@
|
||||
<&pinctrl_sdmmc1_level_shifter>;
|
||||
pinctrl-names = "default";
|
||||
bus-width = <4>;
|
||||
st,dirpol;
|
||||
st,sig-dir;
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
/ {
|
||||
soc {
|
||||
ddr: ddr@0x5A003000{
|
||||
ddr: ddr@5A003000{
|
||||
u-boot,dm-pre-reloc;
|
||||
|
||||
compatible = "st,stm32mp1-ddr";
|
||||
|
||||
120
arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binF.dtsi
Normal file
120
arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binF.dtsi
Normal file
@ -0,0 +1,120 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
/* STM32MP157C DK1/DK2 BOARD configuration
|
||||
* 1x DDR3L 4Gb, 16-bit, 533MHz.
|
||||
* Reference used NT5CC256M16DP-DI from NANYA
|
||||
*
|
||||
* DDR type / Platform DDR3/3L
|
||||
* freq 533MHz
|
||||
* width 16
|
||||
* datasheet 1 = MT41J256M16-187 / DDR3-1066 bin F
|
||||
* DDR density 4
|
||||
* timing mode optimized
|
||||
* Scheduling/QoS options : type = 2
|
||||
* address mapping : RBC
|
||||
* Tc > + 85C : N
|
||||
*/
|
||||
#define DDR_MEM_NAME "DDR3-1066/777 bin F 1x4Gb 533MHz v1.41"
|
||||
#define DDR_MEM_SPEED 533000
|
||||
#define DDR_MEM_SIZE 0x20000000
|
||||
|
||||
#define DDR_MSTR 0x00041401
|
||||
#define DDR_MRCTRL0 0x00000010
|
||||
#define DDR_MRCTRL1 0x00000000
|
||||
#define DDR_DERATEEN 0x00000000
|
||||
#define DDR_DERATEINT 0x00800000
|
||||
#define DDR_PWRCTL 0x00000000
|
||||
#define DDR_PWRTMG 0x00400010
|
||||
#define DDR_HWLPCTL 0x00000000
|
||||
#define DDR_RFSHCTL0 0x00210000
|
||||
#define DDR_RFSHCTL3 0x00000000
|
||||
#define DDR_RFSHTMG 0x0081008B
|
||||
#define DDR_CRCPARCTL0 0x00000000
|
||||
#define DDR_DRAMTMG0 0x121B2414
|
||||
#define DDR_DRAMTMG1 0x000A041B
|
||||
#define DDR_DRAMTMG2 0x0607080F
|
||||
#define DDR_DRAMTMG3 0x0050400C
|
||||
#define DDR_DRAMTMG4 0x07040607
|
||||
#define DDR_DRAMTMG5 0x06060403
|
||||
#define DDR_DRAMTMG6 0x02020002
|
||||
#define DDR_DRAMTMG7 0x00000202
|
||||
#define DDR_DRAMTMG8 0x00001005
|
||||
#define DDR_DRAMTMG14 0x000000A0
|
||||
#define DDR_ZQCTL0 0xC2000040
|
||||
#define DDR_DFITMG0 0x02050105
|
||||
#define DDR_DFITMG1 0x00000202
|
||||
#define DDR_DFILPCFG0 0x07000000
|
||||
#define DDR_DFIUPD0 0xC0400003
|
||||
#define DDR_DFIUPD1 0x00000000
|
||||
#define DDR_DFIUPD2 0x00000000
|
||||
#define DDR_DFIPHYMSTR 0x00000000
|
||||
#define DDR_ADDRMAP1 0x00070707
|
||||
#define DDR_ADDRMAP2 0x00000000
|
||||
#define DDR_ADDRMAP3 0x1F000000
|
||||
#define DDR_ADDRMAP4 0x00001F1F
|
||||
#define DDR_ADDRMAP5 0x06060606
|
||||
#define DDR_ADDRMAP6 0x0F060606
|
||||
#define DDR_ADDRMAP9 0x00000000
|
||||
#define DDR_ADDRMAP10 0x00000000
|
||||
#define DDR_ADDRMAP11 0x00000000
|
||||
#define DDR_ODTCFG 0x06000600
|
||||
#define DDR_ODTMAP 0x00000001
|
||||
#define DDR_SCHED 0x00000C01
|
||||
#define DDR_SCHED1 0x00000000
|
||||
#define DDR_PERFHPR1 0x01000001
|
||||
#define DDR_PERFLPR1 0x08000200
|
||||
#define DDR_PERFWR1 0x08000400
|
||||
#define DDR_DBG0 0x00000000
|
||||
#define DDR_DBG1 0x00000000
|
||||
#define DDR_DBGCMD 0x00000000
|
||||
#define DDR_POISONCFG 0x00000000
|
||||
#define DDR_PCCFG 0x00000010
|
||||
#define DDR_PCFGR_0 0x00010000
|
||||
#define DDR_PCFGW_0 0x00000000
|
||||
#define DDR_PCFGQOS0_0 0x02100C03
|
||||
#define DDR_PCFGQOS1_0 0x00800100
|
||||
#define DDR_PCFGWQOS0_0 0x01100C03
|
||||
#define DDR_PCFGWQOS1_0 0x01000200
|
||||
#define DDR_PCFGR_1 0x00010000
|
||||
#define DDR_PCFGW_1 0x00000000
|
||||
#define DDR_PCFGQOS0_1 0x02100C03
|
||||
#define DDR_PCFGQOS1_1 0x00800040
|
||||
#define DDR_PCFGWQOS0_1 0x01100C03
|
||||
#define DDR_PCFGWQOS1_1 0x01000200
|
||||
#define DDR_PGCR 0x01442E02
|
||||
#define DDR_PTR0 0x0022AA5B
|
||||
#define DDR_PTR1 0x04841104
|
||||
#define DDR_PTR2 0x042DA068
|
||||
#define DDR_ACIOCR 0x10400812
|
||||
#define DDR_DXCCR 0x00000C40
|
||||
#define DDR_DSGCR 0xF200001F
|
||||
#define DDR_DCR 0x0000000B
|
||||
#define DDR_DTPR0 0x36D477D0
|
||||
#define DDR_DTPR1 0x098B00D8
|
||||
#define DDR_DTPR2 0x10023600
|
||||
#define DDR_MR0 0x00000830
|
||||
#define DDR_MR1 0x00000000
|
||||
#define DDR_MR2 0x00000208
|
||||
#define DDR_MR3 0x00000000
|
||||
#define DDR_ODTCR 0x00010000
|
||||
#define DDR_ZQ0CR1 0x00000038
|
||||
#define DDR_DX0GCR 0x0000CE81
|
||||
#define DDR_DX0DLLCR 0x40000000
|
||||
#define DDR_DX0DQTR 0xFFFFFFFF
|
||||
#define DDR_DX0DQSTR 0x3DB02000
|
||||
#define DDR_DX1GCR 0x0000CE81
|
||||
#define DDR_DX1DLLCR 0x40000000
|
||||
#define DDR_DX1DQTR 0xFFFFFFFF
|
||||
#define DDR_DX1DQSTR 0x3DB02000
|
||||
#define DDR_DX2GCR 0x0000CE81
|
||||
#define DDR_DX2DLLCR 0x40000000
|
||||
#define DDR_DX2DQTR 0xFFFFFFFF
|
||||
#define DDR_DX2DQSTR 0x3DB02000
|
||||
#define DDR_DX3GCR 0x0000CE81
|
||||
#define DDR_DX3DLLCR 0x40000000
|
||||
#define DDR_DX3DQTR 0xFFFFFFFF
|
||||
#define DDR_DX3DQSTR 0x3DB02000
|
||||
|
||||
#include "stm32mp15-ddr.dtsi"
|
||||
121
arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi
Normal file
121
arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi
Normal file
@ -0,0 +1,121 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
/* STM32MP157C DK1/DK2 BOARD configuration
|
||||
* 1x DDR3L 4Gb, 16-bit, 533MHz.
|
||||
* Reference used NT5CC256M16DP-DI from NANYA
|
||||
*
|
||||
* DDR type / Platform DDR3/3L
|
||||
* freq 533MHz
|
||||
* width 16
|
||||
* datasheet 0 = MT41J256M16-187 / DDR3-1066 bin G
|
||||
* DDR density 4
|
||||
* timing mode optimized
|
||||
* Scheduling/QoS options : type = 2
|
||||
* address mapping : RBC
|
||||
* Tc > + 85C : N
|
||||
*/
|
||||
|
||||
#define DDR_MEM_NAME "DDR3-1066/888 bin G 1x4Gb 533MHz v1.41"
|
||||
#define DDR_MEM_SPEED 533000
|
||||
#define DDR_MEM_SIZE 0x20000000
|
||||
|
||||
#define DDR_MSTR 0x00041401
|
||||
#define DDR_MRCTRL0 0x00000010
|
||||
#define DDR_MRCTRL1 0x00000000
|
||||
#define DDR_DERATEEN 0x00000000
|
||||
#define DDR_DERATEINT 0x00800000
|
||||
#define DDR_PWRCTL 0x00000000
|
||||
#define DDR_PWRTMG 0x00400010
|
||||
#define DDR_HWLPCTL 0x00000000
|
||||
#define DDR_RFSHCTL0 0x00210000
|
||||
#define DDR_RFSHCTL3 0x00000000
|
||||
#define DDR_RFSHTMG 0x0081008B
|
||||
#define DDR_CRCPARCTL0 0x00000000
|
||||
#define DDR_DRAMTMG0 0x121B2414
|
||||
#define DDR_DRAMTMG1 0x000A041C
|
||||
#define DDR_DRAMTMG2 0x0608090F
|
||||
#define DDR_DRAMTMG3 0x0050400C
|
||||
#define DDR_DRAMTMG4 0x08040608
|
||||
#define DDR_DRAMTMG5 0x06060403
|
||||
#define DDR_DRAMTMG6 0x02020002
|
||||
#define DDR_DRAMTMG7 0x00000202
|
||||
#define DDR_DRAMTMG8 0x00001005
|
||||
#define DDR_DRAMTMG14 0x000000A0
|
||||
#define DDR_ZQCTL0 0xC2000040
|
||||
#define DDR_DFITMG0 0x02060105
|
||||
#define DDR_DFITMG1 0x00000202
|
||||
#define DDR_DFILPCFG0 0x07000000
|
||||
#define DDR_DFIUPD0 0xC0400003
|
||||
#define DDR_DFIUPD1 0x00000000
|
||||
#define DDR_DFIUPD2 0x00000000
|
||||
#define DDR_DFIPHYMSTR 0x00000000
|
||||
#define DDR_ADDRMAP1 0x00070707
|
||||
#define DDR_ADDRMAP2 0x00000000
|
||||
#define DDR_ADDRMAP3 0x1F000000
|
||||
#define DDR_ADDRMAP4 0x00001F1F
|
||||
#define DDR_ADDRMAP5 0x06060606
|
||||
#define DDR_ADDRMAP6 0x0F060606
|
||||
#define DDR_ADDRMAP9 0x00000000
|
||||
#define DDR_ADDRMAP10 0x00000000
|
||||
#define DDR_ADDRMAP11 0x00000000
|
||||
#define DDR_ODTCFG 0x06000600
|
||||
#define DDR_ODTMAP 0x00000001
|
||||
#define DDR_SCHED 0x00000C01
|
||||
#define DDR_SCHED1 0x00000000
|
||||
#define DDR_PERFHPR1 0x01000001
|
||||
#define DDR_PERFLPR1 0x08000200
|
||||
#define DDR_PERFWR1 0x08000400
|
||||
#define DDR_DBG0 0x00000000
|
||||
#define DDR_DBG1 0x00000000
|
||||
#define DDR_DBGCMD 0x00000000
|
||||
#define DDR_POISONCFG 0x00000000
|
||||
#define DDR_PCCFG 0x00000010
|
||||
#define DDR_PCFGR_0 0x00010000
|
||||
#define DDR_PCFGW_0 0x00000000
|
||||
#define DDR_PCFGQOS0_0 0x02100C03
|
||||
#define DDR_PCFGQOS1_0 0x00800100
|
||||
#define DDR_PCFGWQOS0_0 0x01100C03
|
||||
#define DDR_PCFGWQOS1_0 0x01000200
|
||||
#define DDR_PCFGR_1 0x00010000
|
||||
#define DDR_PCFGW_1 0x00000000
|
||||
#define DDR_PCFGQOS0_1 0x02100C03
|
||||
#define DDR_PCFGQOS1_1 0x00800040
|
||||
#define DDR_PCFGWQOS0_1 0x01100C03
|
||||
#define DDR_PCFGWQOS1_1 0x01000200
|
||||
#define DDR_PGCR 0x01442E02
|
||||
#define DDR_PTR0 0x0022AA5B
|
||||
#define DDR_PTR1 0x04841104
|
||||
#define DDR_PTR2 0x042DA068
|
||||
#define DDR_ACIOCR 0x10400812
|
||||
#define DDR_DXCCR 0x00000C40
|
||||
#define DDR_DSGCR 0xF200001F
|
||||
#define DDR_DCR 0x0000000B
|
||||
#define DDR_DTPR0 0x38D488D0
|
||||
#define DDR_DTPR1 0x098B00D8
|
||||
#define DDR_DTPR2 0x10023600
|
||||
#define DDR_MR0 0x00000840
|
||||
#define DDR_MR1 0x00000000
|
||||
#define DDR_MR2 0x00000208
|
||||
#define DDR_MR3 0x00000000
|
||||
#define DDR_ODTCR 0x00010000
|
||||
#define DDR_ZQ0CR1 0x00000038
|
||||
#define DDR_DX0GCR 0x0000CE81
|
||||
#define DDR_DX0DLLCR 0x40000000
|
||||
#define DDR_DX0DQTR 0xFFFFFFFF
|
||||
#define DDR_DX0DQSTR 0x3DB02000
|
||||
#define DDR_DX1GCR 0x0000CE81
|
||||
#define DDR_DX1DLLCR 0x40000000
|
||||
#define DDR_DX1DQTR 0xFFFFFFFF
|
||||
#define DDR_DX1DQSTR 0x3DB02000
|
||||
#define DDR_DX2GCR 0x0000CE81
|
||||
#define DDR_DX2DLLCR 0x40000000
|
||||
#define DDR_DX2DQTR 0xFFFFFFFF
|
||||
#define DDR_DX2DQSTR 0x3DB02000
|
||||
#define DDR_DX3GCR 0x0000CE81
|
||||
#define DDR_DX3DLLCR 0x40000000
|
||||
#define DDR_DX3DQTR 0xFFFFFFFF
|
||||
#define DDR_DX3DQSTR 0x3DB02000
|
||||
|
||||
#include "stm32mp15-ddr.dtsi"
|
||||
120
arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binF.dtsi
Normal file
120
arch/arm/dts/stm32mp15-ddr3-2x4Gb-1066-binF.dtsi
Normal file
@ -0,0 +1,120 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
/* STM32MP157C ED1 BOARD configuration
|
||||
* 2x DDR3L 4Gb each, 16-bit, 533MHz, Single Die Package in flyby topology.
|
||||
* Reference used NT5CC256M16DP-DI from NANYA
|
||||
*
|
||||
* DDR type / Platform DDR3/3L
|
||||
* freq 533MHz
|
||||
* width 32
|
||||
* datasheet 1 = MT41J256M16-187 / DDR3-1066 bin F
|
||||
* DDR density 8
|
||||
* timing mode optimized
|
||||
* Scheduling/QoS options : type = 2
|
||||
* address mapping : RBC
|
||||
* Tc > + 85C : N
|
||||
*/
|
||||
#define DDR_MEM_NAME "DDR3-1066/777 bin F 2x4Gb 533MHz v1.41"
|
||||
#define DDR_MEM_SPEED 533000
|
||||
#define DDR_MEM_SIZE 0x40000000
|
||||
|
||||
#define DDR_MSTR 0x00040401
|
||||
#define DDR_MRCTRL0 0x00000010
|
||||
#define DDR_MRCTRL1 0x00000000
|
||||
#define DDR_DERATEEN 0x00000000
|
||||
#define DDR_DERATEINT 0x00800000
|
||||
#define DDR_PWRCTL 0x00000000
|
||||
#define DDR_PWRTMG 0x00400010
|
||||
#define DDR_HWLPCTL 0x00000000
|
||||
#define DDR_RFSHCTL0 0x00210000
|
||||
#define DDR_RFSHCTL3 0x00000000
|
||||
#define DDR_RFSHTMG 0x0081008B
|
||||
#define DDR_CRCPARCTL0 0x00000000
|
||||
#define DDR_DRAMTMG0 0x121B2414
|
||||
#define DDR_DRAMTMG1 0x000A041B
|
||||
#define DDR_DRAMTMG2 0x0607080F
|
||||
#define DDR_DRAMTMG3 0x0050400C
|
||||
#define DDR_DRAMTMG4 0x07040607
|
||||
#define DDR_DRAMTMG5 0x06060403
|
||||
#define DDR_DRAMTMG6 0x02020002
|
||||
#define DDR_DRAMTMG7 0x00000202
|
||||
#define DDR_DRAMTMG8 0x00001005
|
||||
#define DDR_DRAMTMG14 0x000000A0
|
||||
#define DDR_ZQCTL0 0xC2000040
|
||||
#define DDR_DFITMG0 0x02050105
|
||||
#define DDR_DFITMG1 0x00000202
|
||||
#define DDR_DFILPCFG0 0x07000000
|
||||
#define DDR_DFIUPD0 0xC0400003
|
||||
#define DDR_DFIUPD1 0x00000000
|
||||
#define DDR_DFIUPD2 0x00000000
|
||||
#define DDR_DFIPHYMSTR 0x00000000
|
||||
#define DDR_ADDRMAP1 0x00080808
|
||||
#define DDR_ADDRMAP2 0x00000000
|
||||
#define DDR_ADDRMAP3 0x00000000
|
||||
#define DDR_ADDRMAP4 0x00001F1F
|
||||
#define DDR_ADDRMAP5 0x07070707
|
||||
#define DDR_ADDRMAP6 0x0F070707
|
||||
#define DDR_ADDRMAP9 0x00000000
|
||||
#define DDR_ADDRMAP10 0x00000000
|
||||
#define DDR_ADDRMAP11 0x00000000
|
||||
#define DDR_ODTCFG 0x06000600
|
||||
#define DDR_ODTMAP 0x00000001
|
||||
#define DDR_SCHED 0x00000C01
|
||||
#define DDR_SCHED1 0x00000000
|
||||
#define DDR_PERFHPR1 0x01000001
|
||||
#define DDR_PERFLPR1 0x08000200
|
||||
#define DDR_PERFWR1 0x08000400
|
||||
#define DDR_DBG0 0x00000000
|
||||
#define DDR_DBG1 0x00000000
|
||||
#define DDR_DBGCMD 0x00000000
|
||||
#define DDR_POISONCFG 0x00000000
|
||||
#define DDR_PCCFG 0x00000010
|
||||
#define DDR_PCFGR_0 0x00010000
|
||||
#define DDR_PCFGW_0 0x00000000
|
||||
#define DDR_PCFGQOS0_0 0x02100C03
|
||||
#define DDR_PCFGQOS1_0 0x00800100
|
||||
#define DDR_PCFGWQOS0_0 0x01100C03
|
||||
#define DDR_PCFGWQOS1_0 0x01000200
|
||||
#define DDR_PCFGR_1 0x00010000
|
||||
#define DDR_PCFGW_1 0x00000000
|
||||
#define DDR_PCFGQOS0_1 0x02100C03
|
||||
#define DDR_PCFGQOS1_1 0x00800040
|
||||
#define DDR_PCFGWQOS0_1 0x01100C03
|
||||
#define DDR_PCFGWQOS1_1 0x01000200
|
||||
#define DDR_PGCR 0x01442E02
|
||||
#define DDR_PTR0 0x0022AA5B
|
||||
#define DDR_PTR1 0x04841104
|
||||
#define DDR_PTR2 0x042DA068
|
||||
#define DDR_ACIOCR 0x10400812
|
||||
#define DDR_DXCCR 0x00000C40
|
||||
#define DDR_DSGCR 0xF200001F
|
||||
#define DDR_DCR 0x0000000B
|
||||
#define DDR_DTPR0 0x36D477D0
|
||||
#define DDR_DTPR1 0x098B00D8
|
||||
#define DDR_DTPR2 0x10023600
|
||||
#define DDR_MR0 0x00000830
|
||||
#define DDR_MR1 0x00000000
|
||||
#define DDR_MR2 0x00000208
|
||||
#define DDR_MR3 0x00000000
|
||||
#define DDR_ODTCR 0x00010000
|
||||
#define DDR_ZQ0CR1 0x00000038
|
||||
#define DDR_DX0GCR 0x0000CE81
|
||||
#define DDR_DX0DLLCR 0x40000000
|
||||
#define DDR_DX0DQTR 0xFFFFFFFF
|
||||
#define DDR_DX0DQSTR 0x3DB02000
|
||||
#define DDR_DX1GCR 0x0000CE81
|
||||
#define DDR_DX1DLLCR 0x40000000
|
||||
#define DDR_DX1DQTR 0xFFFFFFFF
|
||||
#define DDR_DX1DQSTR 0x3DB02000
|
||||
#define DDR_DX2GCR 0x0000CE81
|
||||
#define DDR_DX2DLLCR 0x40000000
|
||||
#define DDR_DX2DQTR 0xFFFFFFFF
|
||||
#define DDR_DX2DQSTR 0x3DB02000
|
||||
#define DDR_DX3GCR 0x0000CE81
|
||||
#define DDR_DX3DLLCR 0x40000000
|
||||
#define DDR_DX3DQTR 0xFFFFFFFF
|
||||
#define DDR_DX3DQSTR 0x3DB02000
|
||||
|
||||
#include "stm32mp15-ddr.dtsi"
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
/* STM32MP157C ED1 and ED2 BOARD configuration
|
||||
/* STM32MP157C ED1 BOARD configuration
|
||||
* 2x DDR3L 4Gb each, 16-bit, 533MHz, Single Die Package in flyby topology.
|
||||
* Reference used NT5CC256M16DP-DI from NANYA
|
||||
*
|
||||
@ -15,10 +15,11 @@
|
||||
* timing mode optimized
|
||||
* Scheduling/QoS options : type = 2
|
||||
* address mapping : RBC
|
||||
* Tc > + 85C : N
|
||||
*/
|
||||
|
||||
#define DDR_MEM_NAME "DDR3-1066 bin G 2x4Gb 533MHz v1.36"
|
||||
#define DDR_MEM_SPEED 533
|
||||
#define DDR_MEM_NAME "DDR3-1066/888 bin G 2x4Gb 533MHz v1.41"
|
||||
#define DDR_MEM_SPEED 533000
|
||||
#define DDR_MEM_SIZE 0x40000000
|
||||
|
||||
#define DDR_MSTR 0x00040401
|
||||
@ -62,7 +63,7 @@
|
||||
#define DDR_ADDRMAP11 0x00000000
|
||||
#define DDR_ODTCFG 0x06000600
|
||||
#define DDR_ODTMAP 0x00000001
|
||||
#define DDR_SCHED 0x00001201
|
||||
#define DDR_SCHED 0x00000C01
|
||||
#define DDR_SCHED1 0x00000000
|
||||
#define DDR_PERFHPR1 0x01000001
|
||||
#define DDR_PERFLPR1 0x08000200
|
||||
@ -74,15 +75,15 @@
|
||||
#define DDR_PCCFG 0x00000010
|
||||
#define DDR_PCFGR_0 0x00010000
|
||||
#define DDR_PCFGW_0 0x00000000
|
||||
#define DDR_PCFGQOS0_0 0x02100B03
|
||||
#define DDR_PCFGQOS0_0 0x02100C03
|
||||
#define DDR_PCFGQOS1_0 0x00800100
|
||||
#define DDR_PCFGWQOS0_0 0x01100B03
|
||||
#define DDR_PCFGWQOS0_0 0x01100C03
|
||||
#define DDR_PCFGWQOS1_0 0x01000200
|
||||
#define DDR_PCFGR_1 0x00010000
|
||||
#define DDR_PCFGW_1 0x00000000
|
||||
#define DDR_PCFGQOS0_1 0x02100B03
|
||||
#define DDR_PCFGQOS1_1 0x00800100
|
||||
#define DDR_PCFGWQOS0_1 0x01100B03
|
||||
#define DDR_PCFGQOS0_1 0x02100C03
|
||||
#define DDR_PCFGQOS1_1 0x00800040
|
||||
#define DDR_PCFGWQOS0_1 0x01100C03
|
||||
#define DDR_PCFGWQOS1_1 0x01000200
|
||||
#define DDR_PGCR 0x01442E02
|
||||
#define DDR_PTR0 0x0022AA5B
|
||||
@ -100,7 +101,7 @@
|
||||
#define DDR_MR2 0x00000208
|
||||
#define DDR_MR3 0x00000000
|
||||
#define DDR_ODTCR 0x00010000
|
||||
#define DDR_ZQ0CR1 0x0000005B
|
||||
#define DDR_ZQ0CR1 0x00000038
|
||||
#define DDR_DX0GCR 0x0000CE81
|
||||
#define DDR_DX0DLLCR 0x40000000
|
||||
#define DDR_DX0DQTR 0xFFFFFFFF
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -17,19 +17,31 @@
|
||||
gpio9 = &gpioj;
|
||||
gpio10 = &gpiok;
|
||||
gpio25 = &gpioz;
|
||||
};
|
||||
|
||||
config {
|
||||
u-boot,dm-pre-reloc;
|
||||
pinctrl0 = &pinctrl;
|
||||
pinctrl1 = &pinctrl_z;
|
||||
};
|
||||
|
||||
clocks {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
config {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
reboot {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
soc {
|
||||
u-boot,dm-pre-reloc;
|
||||
|
||||
etzpc: etzpc@5C007000 {
|
||||
compatible = "st,stm32mp1-etzpc";
|
||||
reg = <0x5C007000 0x400>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
stgen: stgen@5C008000 {
|
||||
compatible = "st,stm32-stgen";
|
||||
reg = <0x5C008000 0x1000>;
|
||||
@ -39,6 +51,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
&bsec {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&clk_csi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&clk_hsi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
@ -47,31 +67,11 @@
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&clk_lse {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&clk_lsi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&clk_csi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&rcc {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&rcc_reboot {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pinctrl_z {
|
||||
&clk_lse {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
@ -134,3 +134,40 @@
|
||||
compatible = "st,stm32-gpio";
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&iwdg2 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* pre-reloc probe = reserve video frame buffer in video_reserve() */
|
||||
<dc {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pinctrl_z {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pwr {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&rcc {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
compatible = "st,stm32-sdmmc2";
|
||||
};
|
||||
|
||||
&sdmmc2 {
|
||||
compatible = "st,stm32-sdmmc2";
|
||||
};
|
||||
|
||||
&sdmmc3 {
|
||||
compatible = "st,stm32-sdmmc2";
|
||||
};
|
||||
|
||||
190
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
Normal file
190
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
Normal file
@ -0,0 +1,190 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright : STMicroelectronics 2018
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/stm32mp1-clksrc.h>
|
||||
#include "stm32mp157-u-boot.dtsi"
|
||||
#include "stm32mp15-ddr3-1x4Gb-1066-binG.dtsi"
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
i2c3 = &i2c4;
|
||||
mmc0 = &sdmmc1;
|
||||
};
|
||||
config {
|
||||
u-boot,boot-led = "heartbeat";
|
||||
u-boot,error-led = "error";
|
||||
st,adc_usb_pd = <&adc1 18>, <&adc1 19>;
|
||||
st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
|
||||
st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
led {
|
||||
red {
|
||||
label = "error";
|
||||
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
blue {
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&clk_hse {
|
||||
st,digbypass;
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
|
||||
stusb1600: typec@28 {
|
||||
#extcon-cells = <0>;
|
||||
compatible = "st,stusb1600";
|
||||
reg = <0x28>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4_pins_a {
|
||||
u-boot,dm-pre-reloc;
|
||||
pins {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
&pmic {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&rcc {
|
||||
st,clksrc = <
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
CLK_PLL12_HSE
|
||||
CLK_PLL3_HSE
|
||||
CLK_PLL4_HSE
|
||||
CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
>;
|
||||
|
||||
st,clkdiv = <
|
||||
1 /*MPU*/
|
||||
0 /*AXI*/
|
||||
0 /*MCU*/
|
||||
1 /*APB1*/
|
||||
1 /*APB2*/
|
||||
1 /*APB3*/
|
||||
1 /*APB4*/
|
||||
2 /*APB5*/
|
||||
23 /*RTC*/
|
||||
0 /*MCO1*/
|
||||
0 /*MCO2*/
|
||||
>;
|
||||
|
||||
st,pkcs = <
|
||||
CLK_CKPER_HSE
|
||||
CLK_FMC_ACLK
|
||||
CLK_QSPI_ACLK
|
||||
CLK_ETH_DISABLED
|
||||
CLK_SDMMC12_PLL4P
|
||||
CLK_DSI_DSIPLL
|
||||
CLK_STGEN_HSE
|
||||
CLK_USBPHY_HSE
|
||||
CLK_SPI2S1_PLL3Q
|
||||
CLK_SPI2S23_PLL3Q
|
||||
CLK_SPI45_HSI
|
||||
CLK_SPI6_HSI
|
||||
CLK_I2C46_HSI
|
||||
CLK_SDMMC3_PLL4P
|
||||
CLK_USBO_USBPHY
|
||||
CLK_ADC_CKPER
|
||||
CLK_CEC_LSE
|
||||
CLK_I2C12_HSI
|
||||
CLK_I2C35_HSI
|
||||
CLK_UART1_HSI
|
||||
CLK_UART24_HSI
|
||||
CLK_UART35_HSI
|
||||
CLK_UART6_HSI
|
||||
CLK_UART78_HSI
|
||||
CLK_SPDIF_PLL4P
|
||||
CLK_FDCAN_PLL4Q
|
||||
CLK_SAI1_PLL3Q
|
||||
CLK_SAI2_PLL3Q
|
||||
CLK_SAI3_PLL3Q
|
||||
CLK_SAI4_PLL3Q
|
||||
CLK_RNG1_LSI
|
||||
CLK_RNG2_LSI
|
||||
CLK_LPTIM1_PCLK1
|
||||
CLK_LPTIM23_PCLK3
|
||||
CLK_LPTIM45_LSE
|
||||
>;
|
||||
|
||||
/* VCO = 1300.0 MHz => P = 650 (CPU) */
|
||||
pll1: st,pll@0 {
|
||||
cfg = < 2 80 0 0 0 PQR(1,0,0) >;
|
||||
frac = < 0x800 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */
|
||||
pll2: st,pll@1 {
|
||||
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
|
||||
frac = < 0x1400 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
|
||||
pll3: st,pll@2 {
|
||||
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
|
||||
frac = < 0x1a04 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
|
||||
pll4: st,pll@3 {
|
||||
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
|
||||
&sdmmc1_b4_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&uart4_pins_a {
|
||||
u-boot,dm-pre-reloc;
|
||||
pins1 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
&usbotg_hs {
|
||||
usb1600;
|
||||
hnp-srp-disable;
|
||||
};
|
||||
|
||||
&v3v3 {
|
||||
regulator-always-on;
|
||||
};
|
||||
701
arch/arm/dts/stm32mp157a-dk1.dts
Normal file
701
arch/arm/dts/stm32mp157a-dk1.dts
Normal file
@ -0,0 +1,701 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "stm32mp157c.dtsi"
|
||||
#include "stm32mp157c-m4-srm.dtsi"
|
||||
#include "stm32mp157cac-pinctrl.dtsi"
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/mfd/st,stpmic1.h>
|
||||
|
||||
/ {
|
||||
model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
|
||||
compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
|
||||
|
||||
aliases {
|
||||
ethernet0 = ðernet0;
|
||||
serial0 = &uart4;
|
||||
};
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
memory@c0000000 {
|
||||
reg = <0xc0000000 0x20000000>;
|
||||
};
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
retram: retram@0x38000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x38000000 0x10000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
mcuram: mcuram@0x30000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x30000000 0x40000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
mcuram2: mcuram2@0x10000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10000000 0x40000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0vring0: vdev0vring0@10040000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10040000 0x2000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0vring1: vdev0vring1@10042000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10042000 0x2000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0buffer: vdev0buffer@10044000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10044000 0x4000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
gpu_reserved: gpu@dc000000 {
|
||||
reg = <0xdc000000 0x4000000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
sram: sram@10050000 {
|
||||
compatible = "mmio-sram";
|
||||
reg = <0x10050000 0x10000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges = <0 0x10050000 0x10000>;
|
||||
|
||||
dma_pool: dma_pool@0 {
|
||||
reg = <0x0 0x10000>;
|
||||
pool;
|
||||
};
|
||||
};
|
||||
|
||||
led {
|
||||
compatible = "gpio-leds";
|
||||
blue {
|
||||
label = "heartbeat";
|
||||
gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "off";
|
||||
};
|
||||
};
|
||||
|
||||
sound {
|
||||
compatible = "audio-graph-card";
|
||||
label = "STM32MP1-DK";
|
||||
routing =
|
||||
"Playback" , "MCLK",
|
||||
"Capture" , "MCLK",
|
||||
"MICL" , "Mic Bias";
|
||||
dais = <&sai2a_port &sai2b_port &i2s2_port>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
usb_phy_tuning: usb-phy-tuning {
|
||||
st,hs-dc-level = <2>;
|
||||
st,fs-rftime-tuning;
|
||||
st,hs-rftime-reduction;
|
||||
st,hs-current-trim = <15>;
|
||||
st,hs-impedance-trim = <1>;
|
||||
st,squelch-level = <3>;
|
||||
st,hs-rx-offset = <2>;
|
||||
st,no-lsfs-sc;
|
||||
};
|
||||
};
|
||||
|
||||
&adc {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&adc12_usb_pwr_pins_a>;
|
||||
vdd-supply = <&vdd>;
|
||||
vdda-supply = <&vdd>;
|
||||
vref-supply = <&vrefbuf>;
|
||||
status = "okay";
|
||||
adc1: adc@0 {
|
||||
/*
|
||||
* Type-C USB_PWR_CC1 & USB_PWR_CC2 on in18 & in19.
|
||||
* Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
|
||||
* 5 * (56 + 47kOhms) * 5pF => 2.5us.
|
||||
* Use arbitrary margin here (e.g. 5µs).
|
||||
*/
|
||||
st,min-sample-time-nsecs = <5000>;
|
||||
/* ANA0, ANA1, USB Type-C CC1 & CC2 */
|
||||
st,adc-channels = <0 1 18 19>;
|
||||
status = "okay";
|
||||
};
|
||||
adc2: adc@100 {
|
||||
/* ANA0, ANA1, temp sensor, USB Type-C CC1 & CC2 */
|
||||
st,adc-channels = <0 1 12 18 19>;
|
||||
/* temperature sensor min sample time */
|
||||
st,min-sample-time-nsecs = <10000>;
|
||||
status = "okay";
|
||||
};
|
||||
adc_temp: temp {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&cec {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&cec_pins_b>;
|
||||
pinctrl-1 = <&cec_pins_sleep_b>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dma1 {
|
||||
sram = <&dma_pool>;
|
||||
};
|
||||
|
||||
&dma2 {
|
||||
sram = <&dma_pool>;
|
||||
};
|
||||
|
||||
&dts {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet0 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <ðernet0_rgmii_pins_a>;
|
||||
pinctrl-1 = <ðernet0_rgmii_pins_sleep_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
phy-mode = "rgmii";
|
||||
max-speed = <1000>;
|
||||
phy-handle = <&phy0>;
|
||||
|
||||
mdio0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "snps,dwmac-mdio";
|
||||
phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gpu {
|
||||
contiguous-area = <&gpu_reserved>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2c1_pins_a>;
|
||||
pinctrl-1 = <&i2c1_pins_sleep_a>;
|
||||
i2c-scl-rising-time-ns = <100>;
|
||||
i2c-scl-falling-time-ns = <7>;
|
||||
status = "okay";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
|
||||
cs42l51: cs42l51@4a {
|
||||
compatible = "cirrus,cs42l51";
|
||||
reg = <0x4a>;
|
||||
#sound-dai-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
VL-supply = <&v3v3>;
|
||||
VD-supply = <&v1v8_audio>;
|
||||
VA-supply = <&v1v8_audio>;
|
||||
VAHP-supply = <&v1v8_audio>;
|
||||
|
||||
reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
|
||||
|
||||
clocks = <&sai2a>;
|
||||
clock-names = "MCLK";
|
||||
|
||||
cs42l51_port: port {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
cs42l51_tx_endpoint: endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&sai2a_endpoint>;
|
||||
frame-master;
|
||||
bitclock-master;
|
||||
};
|
||||
|
||||
cs42l51_rx_endpoint: endpoint@1 {
|
||||
reg = <1>;
|
||||
remote-endpoint = <&sai2b_endpoint>;
|
||||
frame-master;
|
||||
bitclock-master;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hdmi-transmitter@39 {
|
||||
compatible = "sil,sii9022";
|
||||
reg = <0x39>;
|
||||
iovcc-supply = <&v3v3_hdmi>;
|
||||
cvcc12-supply = <&v1v2_hdmi>;
|
||||
reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
|
||||
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
|
||||
interrupt-parent = <&gpiog>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <<dc_pins_a>;
|
||||
pinctrl-1 = <<dc_pins_sleep_a>;
|
||||
status = "okay";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
sii9022_in: endpoint {
|
||||
remote-endpoint = <<dc_ep0_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
sii9022_tx_endpoint: endpoint {
|
||||
remote-endpoint = <&i2s2_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2c4_pins_a>;
|
||||
pinctrl-1 = <&i2c4_pins_sleep_a>;
|
||||
i2c-scl-rising-time-ns = <185>;
|
||||
i2c-scl-falling-time-ns = <20>;
|
||||
status = "okay";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
|
||||
pmic: stpmic@33 {
|
||||
compatible = "st,stpmic1";
|
||||
reg = <0x33>;
|
||||
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
status = "okay";
|
||||
|
||||
st,main-control-register = <0x04>;
|
||||
st,vin-control-register = <0xc0>;
|
||||
st,usb-control-register = <0x30>;
|
||||
|
||||
regulators {
|
||||
compatible = "st,stpmic1-regulators";
|
||||
|
||||
ldo1-supply = <&v3v3>;
|
||||
ldo3-supply = <&vdd_ddr>;
|
||||
ldo6-supply = <&v3v3>;
|
||||
pwr_sw1-supply = <&bst_out>;
|
||||
pwr_sw2-supply = <&bst_out>;
|
||||
|
||||
vddcore: buck1 {
|
||||
regulator-name = "vddcore";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-always-on;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
};
|
||||
|
||||
vdd_ddr: buck2 {
|
||||
regulator-name = "vdd_ddr";
|
||||
regulator-min-microvolt = <1350000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-always-on;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
};
|
||||
|
||||
vdd: buck3 {
|
||||
regulator-name = "vdd";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
st,mask-reset;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
};
|
||||
|
||||
v3v3: buck4 {
|
||||
regulator-name = "v3v3";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
regulator-initial-mode = <0>;
|
||||
};
|
||||
|
||||
v1v8_audio: ldo1 {
|
||||
regulator-name = "v1v8_audio";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-always-on;
|
||||
interrupts = <IT_CURLIM_LDO1 0>;
|
||||
|
||||
};
|
||||
|
||||
v3v3_hdmi: ldo2 {
|
||||
regulator-name = "v3v3_hdmi";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
interrupts = <IT_CURLIM_LDO2 0>;
|
||||
|
||||
};
|
||||
|
||||
vtt_ddr: ldo3 {
|
||||
regulator-name = "vtt_ddr";
|
||||
regulator-min-microvolt = <500000>;
|
||||
regulator-max-microvolt = <750000>;
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
};
|
||||
|
||||
vdd_usb: ldo4 {
|
||||
regulator-name = "vdd_usb";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
interrupts = <IT_CURLIM_LDO4 0>;
|
||||
};
|
||||
|
||||
vdda: ldo5 {
|
||||
regulator-name = "vdda";
|
||||
regulator-min-microvolt = <2900000>;
|
||||
regulator-max-microvolt = <2900000>;
|
||||
interrupts = <IT_CURLIM_LDO5 0>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
v1v2_hdmi: ldo6 {
|
||||
regulator-name = "v1v2_hdmi";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
regulator-always-on;
|
||||
interrupts = <IT_CURLIM_LDO6 0>;
|
||||
|
||||
};
|
||||
|
||||
vref_ddr: vref_ddr {
|
||||
regulator-name = "vref_ddr";
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
};
|
||||
|
||||
bst_out: boost {
|
||||
regulator-name = "bst_out";
|
||||
interrupts = <IT_OCP_BOOST 0>;
|
||||
};
|
||||
|
||||
vbus_otg: pwr_sw1 {
|
||||
regulator-name = "vbus_otg";
|
||||
interrupts = <IT_OCP_OTG 0>;
|
||||
regulator-active-discharge;
|
||||
};
|
||||
|
||||
vbus_sw: pwr_sw2 {
|
||||
regulator-name = "vbus_sw";
|
||||
interrupts = <IT_OCP_SWOUT 0>;
|
||||
regulator-active-discharge;
|
||||
};
|
||||
};
|
||||
|
||||
onkey {
|
||||
compatible = "st,stpmic1-onkey";
|
||||
interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
|
||||
interrupt-names = "onkey-falling", "onkey-rising";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
watchdog {
|
||||
compatible = "st,stpmic1-wdt";
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2s2 {
|
||||
clocks = <&rcc SPI2>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
|
||||
clock-names = "pclk", "i2sclk", "x8k", "x11k";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2s2_pins_a>;
|
||||
pinctrl-1 = <&i2s2_pins_sleep_a>;
|
||||
status = "okay";
|
||||
|
||||
i2s2_port: port {
|
||||
i2s2_endpoint: endpoint {
|
||||
remote-endpoint = <&sii9022_tx_endpoint>;
|
||||
format = "i2s";
|
||||
mclk-fs = <256>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&ipcc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&iwdg2 {
|
||||
timeout-sec = <32>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
<dc {
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ltdc_ep0_out: endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&sii9022_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&m4_rproc {
|
||||
memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
|
||||
<&vdev0vring1>, <&vdev0buffer>;
|
||||
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
|
||||
mbox-names = "vq0", "vq1", "shutdown";
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <68 1>;
|
||||
interrupt-names = "wdg";
|
||||
recovery;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwr {
|
||||
pwr-supply = <&vdd>;
|
||||
};
|
||||
|
||||
&rng1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&rtc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sai2 {
|
||||
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
|
||||
clock-names = "pclk", "x8k", "x11k";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
|
||||
pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
|
||||
status = "okay";
|
||||
|
||||
sai2a: audio-controller@4400b004 {
|
||||
#clock-cells = <0>;
|
||||
dma-names = "tx";
|
||||
clocks = <&rcc SAI2_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "okay";
|
||||
|
||||
sai2a_port: port {
|
||||
sai2a_endpoint: endpoint {
|
||||
remote-endpoint = <&cs42l51_tx_endpoint>;
|
||||
format = "i2s";
|
||||
mclk-fs = <256>;
|
||||
dai-tdm-slot-num = <2>;
|
||||
dai-tdm-slot-width = <32>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sai2b: audio-controller@4400b024 {
|
||||
dma-names = "rx";
|
||||
st,sync = <&sai2a 2>;
|
||||
status = "okay";
|
||||
clocks = <&rcc SAI2_K>, <&sai2a>;
|
||||
clock-names = "sai_ck", "MCLK";
|
||||
|
||||
sai2b_port: port {
|
||||
sai2b_endpoint: endpoint {
|
||||
remote-endpoint = <&cs42l51_rx_endpoint>;
|
||||
format = "i2s";
|
||||
mclk-fs = <256>;
|
||||
dai-tdm-slot-num = <2>;
|
||||
dai-tdm-slot-width = <32>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
pinctrl-names = "default", "opendrain", "sleep";
|
||||
pinctrl-0 = <&sdmmc1_b4_pins_a>;
|
||||
pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
|
||||
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
|
||||
broken-cd;
|
||||
st,neg-edge;
|
||||
bus-width = <4>;
|
||||
vmmc-supply = <&v3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi4 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&spi4_pins_a>;
|
||||
pinctrl-1 = <&spi4_sleep_pins_a>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&spi5 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&spi5_pins_a>;
|
||||
pinctrl-1 = <&spi5_sleep_pins_a>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&timers1 {
|
||||
/* spare dmas for other usage */
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm1_pins_a>;
|
||||
pinctrl-1 = <&pwm1_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@0 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&timers3 {
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm3_pins_a>;
|
||||
pinctrl-1 = <&pwm3_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@2 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&timers4 {
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm4_pins_a &pwm4_pins_b>;
|
||||
pinctrl-1 = <&pwm4_sleep_pins_a &pwm4_sleep_pins_b>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@3 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&timers5 {
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm5_pins_a>;
|
||||
pinctrl-1 = <&pwm5_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@4 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&timers6 {
|
||||
status = "okay";
|
||||
/* spare dmas for other usage */
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
timer@5 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&timers12 {
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm12_pins_a>;
|
||||
pinctrl-1 = <&pwm12_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@11 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
pinctrl-names = "default", "sleep", "idle", "no_console_suspend";
|
||||
pinctrl-0 = <&uart4_pins_a>;
|
||||
pinctrl-1 = <&uart4_sleep_pins_a>;
|
||||
pinctrl-2 = <&uart4_idle_pins_a>;
|
||||
pinctrl-3 = <&uart4_pins_a>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usart3 {
|
||||
pinctrl-names = "default", "sleep", "idle";
|
||||
pinctrl-0 = <&usart3_pins_b>;
|
||||
pinctrl-1 = <&usart3_sleep_pins_b>;
|
||||
pinctrl-2 = <&usart3_idle_pins_b>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&usbh_ehci {
|
||||
phys = <&usbphyc_port0>;
|
||||
phy-names = "usb";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbotg_hs {
|
||||
dr_mode = "peripheral";
|
||||
force-b-session-valid;
|
||||
phys = <&usbphyc_port1 0>;
|
||||
phy-names = "usb2-phy";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphyc {
|
||||
vdd3v3-supply = <&vdd_usb>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphyc_port0 {
|
||||
st,phy-tuning = <&usb_phy_tuning>;
|
||||
};
|
||||
|
||||
&usbphyc_port1 {
|
||||
st,phy-tuning = <&usb_phy_tuning>;
|
||||
};
|
||||
|
||||
&vrefbuf {
|
||||
regulator-min-microvolt = <2500000>;
|
||||
regulator-max-microvolt = <2500000>;
|
||||
vdda-supply = <&vdd>;
|
||||
status = "okay";
|
||||
};
|
||||
6
arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
Normal file
6
arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
Normal file
@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright : STMicroelectronics 2018
|
||||
*/
|
||||
|
||||
#include "stm32mp157a-dk1-u-boot.dtsi"
|
||||
144
arch/arm/dts/stm32mp157c-dk2.dts
Normal file
144
arch/arm/dts/stm32mp157c-dk2.dts
Normal file
@ -0,0 +1,144 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include "stm32mp157a-dk1.dts"
|
||||
#include <dt-bindings/rtc/rtc-stm32.h>
|
||||
|
||||
/ {
|
||||
model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
|
||||
compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
|
||||
|
||||
aliases {
|
||||
serial1 = &usart2;
|
||||
};
|
||||
|
||||
wifi_pwrseq: wifi-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
reset-gpios = <&gpioh 4 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
&dsi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
dsi_in: endpoint {
|
||||
remote-endpoint = <<dc_ep1_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
dsi_out: endpoint {
|
||||
remote-endpoint = <&panel_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
panel@0 {
|
||||
compatible = "orisetech,otm8009a";
|
||||
reg = <0>;
|
||||
reset-gpios = <&gpioe 4 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
panel_in: endpoint {
|
||||
remote-endpoint = <&dsi_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c1 {
|
||||
touchscreen@2a {
|
||||
compatible = "focaltech,ft6236";
|
||||
reg = <0x2a>;
|
||||
interrupts = <2 2>;
|
||||
interrupt-parent = <&gpiof>;
|
||||
interrupt-controller;
|
||||
touchscreen-size-x = <480>;
|
||||
touchscreen-size-y = <800>;
|
||||
status = "okay";
|
||||
};
|
||||
touchscreen@38 {
|
||||
compatible = "focaltech,ft6336";
|
||||
reg = <0x38>;
|
||||
interrupts = <2 2>;
|
||||
interrupt-parent = <&gpiof>;
|
||||
interrupt-controller;
|
||||
touchscreen-size-x = <480>;
|
||||
touchscreen-size-y = <800>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
<dc {
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ltdc_ep1_out: endpoint@1 {
|
||||
reg = <1>;
|
||||
remote-endpoint = <&dsi_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&rtc {
|
||||
st,lsco = <RTC_OUT2_RMP>;
|
||||
pinctrl-0 = <&rtc_out2_rmp_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
/* Wifi */
|
||||
&sdmmc2 {
|
||||
pinctrl-names = "default", "opendrain", "sleep";
|
||||
pinctrl-0 = <&sdmmc2_b4_pins_a>;
|
||||
pinctrl-1 = <&sdmmc2_b4_od_pins_a>;
|
||||
pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
|
||||
non-removable;
|
||||
st,neg-edge;
|
||||
bus-width = <4>;
|
||||
vmmc-supply = <&v3v3>;
|
||||
mmc-pwrseq = <&wifi_pwrseq>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
keep-power-in-suspend;
|
||||
status = "okay";
|
||||
|
||||
brcmf: bcrmf@1 {
|
||||
reg = <1>;
|
||||
compatible = "brcm,bcm4329-fmac";
|
||||
};
|
||||
};
|
||||
|
||||
/* Bluetooth */
|
||||
&usart2 {
|
||||
pinctrl-names = "default", "sleep", "idle";
|
||||
pinctrl-0 = <&usart2_pins_a>;
|
||||
pinctrl-1 = <&usart2_sleep_pins_a>;
|
||||
pinctrl-2 = <&usart2_idle_pins_a>;
|
||||
st,hw-flow-ctrl;
|
||||
status = "okay";
|
||||
|
||||
bluetooth {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&btreg>;
|
||||
compatible = "brcm,bcm43438-bt";
|
||||
max-speed = <3000000>;
|
||||
};
|
||||
};
|
||||
@ -9,44 +9,30 @@
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
i2c3 = &i2c4;
|
||||
mmc0 = &sdmmc1;
|
||||
mmc1 = &sdmmc2;
|
||||
i2c3 = &i2c4;
|
||||
};
|
||||
|
||||
config {
|
||||
u-boot,boot-led = "heartbeat";
|
||||
st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
|
||||
st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
red {
|
||||
label = "stm32mp:red:status";
|
||||
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
};
|
||||
green {
|
||||
label = "stm32mp:green:user";
|
||||
gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
|
||||
default-state = "on";
|
||||
};
|
||||
orange {
|
||||
label = "stm32mp:orange:status";
|
||||
gpios = <&gpioh 7 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "off";
|
||||
};
|
||||
blue {
|
||||
label = "stm32mp:blue:user";
|
||||
gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart4_pins_a {
|
||||
&clk_hse {
|
||||
st,digbypass;
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
pins1 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4_pins_a {
|
||||
@ -56,19 +42,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&pmic {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* CLOCK init */
|
||||
&rcc {
|
||||
st,clksrc = <
|
||||
CLK_MPU_PLL1P
|
||||
@ -101,7 +78,7 @@
|
||||
CLK_FMC_ACLK
|
||||
CLK_QSPI_ACLK
|
||||
CLK_ETH_DISABLED
|
||||
CLK_SDMMC12_PLL3R
|
||||
CLK_SDMMC12_PLL4P
|
||||
CLK_DSI_DSIPLL
|
||||
CLK_STGEN_HSE
|
||||
CLK_USBPHY_HSE
|
||||
@ -110,7 +87,7 @@
|
||||
CLK_SPI45_HSI
|
||||
CLK_SPI6_HSI
|
||||
CLK_I2C46_HSI
|
||||
CLK_SDMMC3_PLL3R
|
||||
CLK_SDMMC3_PLL4P
|
||||
CLK_USBO_USBPHY
|
||||
CLK_ADC_CKPER
|
||||
CLK_CEC_LSE
|
||||
@ -121,17 +98,17 @@
|
||||
CLK_UART35_HSI
|
||||
CLK_UART6_HSI
|
||||
CLK_UART78_HSI
|
||||
CLK_SPDIF_PLL3Q
|
||||
CLK_SPDIF_PLL4P
|
||||
CLK_FDCAN_PLL4Q
|
||||
CLK_SAI1_PLL3Q
|
||||
CLK_SAI2_PLL3Q
|
||||
CLK_SAI3_PLL3Q
|
||||
CLK_SAI4_PLL3Q
|
||||
CLK_RNG1_CSI
|
||||
CLK_RNG2_CSI
|
||||
CLK_RNG1_LSI
|
||||
CLK_RNG2_LSI
|
||||
CLK_LPTIM1_PCLK1
|
||||
CLK_LPTIM23_PCLK3
|
||||
CLK_LPTIM45_PCLK3
|
||||
CLK_LPTIM45_LSE
|
||||
>;
|
||||
|
||||
/* VCO = 1300.0 MHz => P = 650 (CPU) */
|
||||
@ -148,44 +125,54 @@
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 786.4 MHz => P = 197, Q = 49, R = 98 */
|
||||
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
|
||||
pll3: st,pll@2 {
|
||||
cfg = < 2 97 3 15 7 PQR(1,1,1) >;
|
||||
frac = < 0x9ba >;
|
||||
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
|
||||
frac = < 0x1a04 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 508.0 MHz => P = 56, Q = 56, R = 56 */
|
||||
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
|
||||
pll4: st,pll@3 {
|
||||
cfg = < 5 126 8 8 8 PQR(1,1,1) >;
|
||||
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
/* SPL part **************************************/
|
||||
/* MMC1 boot */
|
||||
&sdmmc1_b4_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc1_dir_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
|
||||
/* MMC2 boot */
|
||||
&sdmmc1_b4_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc1_dir_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc2 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
|
||||
&sdmmc2_b4_pins_a {
|
||||
u-boot,dm-spl;
|
||||
pins {
|
||||
pins1 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
};
|
||||
@ -197,6 +184,16 @@
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc2 {
|
||||
u-boot,dm-spl;
|
||||
&uart4 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
&uart4_pins_a {
|
||||
u-boot,dm-pre-reloc;
|
||||
pins1 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
pins2 {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
@ -6,22 +6,97 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "stm32mp157c.dtsi"
|
||||
#include "stm32mp157-pinctrl.dtsi"
|
||||
#include "stm32mp157c-m4-srm.dtsi"
|
||||
#include "stm32mp157caa-pinctrl.dtsi"
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/mfd/st,stpmu1.h>
|
||||
#include <dt-bindings/mfd/st,stpmic1.h>
|
||||
|
||||
/ {
|
||||
model = "STMicroelectronics STM32MP157C eval daughter";
|
||||
compatible = "st,stm32mp157c-ed1", "st,stm32mp157";
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial3:115200n8";
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
memory@c0000000 {
|
||||
reg = <0xC0000000 0x40000000>;
|
||||
};
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
retram: retram@0x38000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x38000000 0x10000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
mcuram: mcuram@0x30000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x30000000 0x40000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
mcuram2: mcuram2@0x10000000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10000000 0x40000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0vring0: vdev0vring0@10040000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10040000 0x2000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0vring1: vdev0vring1@10042000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10042000 0x2000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
vdev0buffer: vdev0buffer@10044000 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x10044000 0x4000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
gpu_reserved: gpu@f8000000 {
|
||||
reg = <0xf8000000 0x8000000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
serial0 = &uart4;
|
||||
};
|
||||
|
||||
sram: sram@10050000 {
|
||||
compatible = "mmio-sram";
|
||||
reg = <0x10050000 0x10000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges = <0 0x10050000 0x10000>;
|
||||
|
||||
dma_pool: dma_pool@0 {
|
||||
reg = <0x0 0x10000>;
|
||||
pool;
|
||||
};
|
||||
};
|
||||
|
||||
led {
|
||||
compatible = "gpio-leds";
|
||||
blue {
|
||||
label = "heartbeat";
|
||||
gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>;
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "off";
|
||||
};
|
||||
};
|
||||
|
||||
sd_switch: regulator-sd_switch {
|
||||
compatible = "regulator-gpio";
|
||||
regulator-name = "sd_switch";
|
||||
@ -36,39 +111,87 @@
|
||||
};
|
||||
};
|
||||
|
||||
&rng1 {
|
||||
&adc {
|
||||
/* ANA0, ANA1 are dedicated pins and don't need pinctrl: only in6. */
|
||||
vdd-supply = <&vdd>;
|
||||
vdda-supply = <&vdda>;
|
||||
vref-supply = <&vdda>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&timers6 {
|
||||
status = "okay";
|
||||
timer@5 {
|
||||
adc1: adc@0 {
|
||||
st,adc-channels = <0 1>;
|
||||
/* 16.5 ck_cycles sampling time */
|
||||
st,min-sample-time-nsecs = <400>;
|
||||
status = "okay";
|
||||
};
|
||||
jadc1: jadc@0 {
|
||||
st,adc-channels = <0 1>;
|
||||
/* 16.5 ck_cycles sampling time */
|
||||
st,min-sample-time-nsecs = <400>;
|
||||
status = "okay";
|
||||
};
|
||||
/* temperature sensor on adc2 */
|
||||
adc2: adc@100 {
|
||||
status = "okay";
|
||||
};
|
||||
adc_temp: temp {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
&dac {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
|
||||
vref-supply = <&vdda>;
|
||||
status = "okay";
|
||||
dac1: dac@1 {
|
||||
status = "okay";
|
||||
};
|
||||
dac2: dac@2 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&dma1 {
|
||||
sram = <&dma_pool>;
|
||||
};
|
||||
|
||||
&dma2 {
|
||||
sram = <&dma_pool>;
|
||||
};
|
||||
|
||||
&dts {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpu {
|
||||
contiguous-area = <&gpu_reserved>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2c4_pins_a>;
|
||||
pinctrl-1 = <&i2c4_pins_sleep_a>;
|
||||
i2c-scl-rising-time-ns = <185>;
|
||||
i2c-scl-falling-time-ns = <20>;
|
||||
status = "okay";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
|
||||
pmic: stpmu1@33 {
|
||||
compatible = "st,stpmu1";
|
||||
pmic: stpmic@33 {
|
||||
compatible = "st,stpmic1";
|
||||
reg = <0x33>;
|
||||
interrupts = <0 2>;
|
||||
interrupt-parent = <&gpioa>;
|
||||
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
status = "okay";
|
||||
|
||||
st,main_control_register = <0x04>;
|
||||
st,vin_control_register = <0xc0>;
|
||||
st,usb_control_register = <0x30>;
|
||||
st,main-control-register = <0x04>;
|
||||
st,vin-control-register = <0xc0>;
|
||||
st,usb-control-register = <0x30>;
|
||||
|
||||
regulators {
|
||||
compatible = "st,stpmu1-regulators";
|
||||
compatible = "st,stpmic1-regulators";
|
||||
|
||||
ldo1-supply = <&v3v3>;
|
||||
ldo2-supply = <&v3v3>;
|
||||
@ -80,23 +203,11 @@
|
||||
|
||||
vddcore: buck1 {
|
||||
regulator-name = "vddcore";
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-always-on;
|
||||
regulator-initial-mode = <2>;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-on-in-suspend;
|
||||
regulator-suspend-microvolt = <1200000>;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vdd_ddr: buck2 {
|
||||
@ -104,22 +215,8 @@
|
||||
regulator-min-microvolt = <1350000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-always-on;
|
||||
regulator-initial-mode = <2>;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <1350000>;
|
||||
regulator-on-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-suspend-microvolt = <1350000>;
|
||||
regulator-on-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vdd: buck3 {
|
||||
@ -127,46 +224,18 @@
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
st,mask_reset;
|
||||
regulator-initial-mode = <8>;
|
||||
st,mask-reset;
|
||||
regulator-initial-mode = <0>;
|
||||
regulator-over-current-protection;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <3300000>;
|
||||
regulator-on-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-suspend-microvolt = <3300000>;
|
||||
regulator-on-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-suspend-microvolt = <3300000>;
|
||||
regulator-on-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
};
|
||||
|
||||
v3v3: buck4 {
|
||||
regulator-name = "v3v3";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
regulator-initial-mode = <8>;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <3300000>;
|
||||
regulator-unchanged-in-suspend;
|
||||
regulator-mode = <8>;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-initial-mode = <0>;
|
||||
};
|
||||
|
||||
vdda: ldo1 {
|
||||
@ -174,18 +243,6 @@
|
||||
regulator-min-microvolt = <2900000>;
|
||||
regulator-max-microvolt = <2900000>;
|
||||
interrupts = <IT_CURLIM_LDO1 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <2900000>;
|
||||
regulator-unchanged-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
v2v8: ldo2 {
|
||||
@ -193,36 +250,14 @@
|
||||
regulator-min-microvolt = <2800000>;
|
||||
regulator-max-microvolt = <2800000>;
|
||||
interrupts = <IT_CURLIM_LDO2 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <2800000>;
|
||||
regulator-unchanged-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vtt_ddr: ldo3 {
|
||||
regulator-name = "vtt_ddr";
|
||||
regulator-min-microvolt = <0000000>;
|
||||
regulator-max-microvolt = <1000000>;
|
||||
regulator-min-microvolt = <500000>;
|
||||
regulator-max-microvolt = <750000>;
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vdd_usb: ldo4 {
|
||||
@ -230,17 +265,6 @@
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
interrupts = <IT_CURLIM_LDO4 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-unchanged-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vdd_sd: ldo5 {
|
||||
@ -248,19 +272,7 @@
|
||||
regulator-min-microvolt = <2900000>;
|
||||
regulator-max-microvolt = <2900000>;
|
||||
interrupts = <IT_CURLIM_LDO5 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
regulator-boot-on;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <2900000>;
|
||||
regulator-unchanged-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
v1v8: ldo6 {
|
||||
@ -268,69 +280,88 @@
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
interrupts = <IT_CURLIM_LDO6 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-suspend-microvolt = <1800000>;
|
||||
regulator-unchanged-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
vref_ddr: vref_ddr {
|
||||
regulator-name = "vref_ddr";
|
||||
regulator-always-on;
|
||||
regulator-over-current-protection;
|
||||
|
||||
regulator-state-standby {
|
||||
regulator-on-in-suspend;
|
||||
};
|
||||
regulator-state-mem {
|
||||
regulator-on-in-suspend;
|
||||
};
|
||||
regulator-state-disk {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
|
||||
bst_out: boost {
|
||||
bst_out: boost {
|
||||
regulator-name = "bst_out";
|
||||
interrupts = <IT_OCP_BOOST 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
};
|
||||
};
|
||||
|
||||
vbus_otg: pwr_sw1 {
|
||||
regulator-name = "vbus_otg";
|
||||
interrupts = <IT_OCP_OTG 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
regulator-active-discharge;
|
||||
};
|
||||
|
||||
vbus_sw: pwr_sw2 {
|
||||
regulator-name = "vbus_sw";
|
||||
interrupts = <IT_OCP_SWOUT 0>;
|
||||
interrupt-parent = <&pmic>;
|
||||
regulator-active-discharge;
|
||||
};
|
||||
};
|
||||
|
||||
onkey {
|
||||
compatible = "st,stpmic1-onkey";
|
||||
interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 1>;
|
||||
interrupt-names = "onkey-falling", "onkey-rising";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
watchdog {
|
||||
compatible = "st,stpmic1-wdt";
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&ipcc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&iwdg2 {
|
||||
timeout-sec = <32>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&m4_rproc {
|
||||
memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
|
||||
<&vdev0vring1>, <&vdev0buffer>;
|
||||
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
|
||||
mbox-names = "vq0", "vq1", "shutdown";
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <68 1>;
|
||||
interrupt-names = "wdg";
|
||||
recovery;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwr {
|
||||
pwr-supply = <&vdd>;
|
||||
};
|
||||
|
||||
&rng1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&rtc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
pinctrl-names = "default", "opendrain", "sleep";
|
||||
pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
|
||||
pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
|
||||
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
|
||||
broken-cd;
|
||||
st,dirpol;
|
||||
st,negedge;
|
||||
st,pin-ckin;
|
||||
st,sig-dir;
|
||||
st,neg-edge;
|
||||
st,use-ckin;
|
||||
bus-width = <4>;
|
||||
vmmc-supply = <&vdd_sd>;
|
||||
vqmmc-supply = <&sd_switch>;
|
||||
@ -343,36 +374,44 @@
|
||||
};
|
||||
|
||||
&sdmmc2 {
|
||||
pinctrl-names = "default", "opendrain", "sleep";
|
||||
pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
|
||||
pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
|
||||
pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
|
||||
non-removable;
|
||||
no-sd;
|
||||
no-sdio;
|
||||
st,dirpol;
|
||||
st,negedge;
|
||||
st,neg-edge;
|
||||
bus-width = <8>;
|
||||
vmmc-supply = <&v3v3>;
|
||||
vqmmc-supply = <&vdd>;
|
||||
vqmmc-supply = <&v3v3>;
|
||||
mmc-ddr-3_3v;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&timers6 {
|
||||
status = "okay";
|
||||
/* spare dmas for other usage */
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
timer@5 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default", "sleep", "idle", "no_console_suspend";
|
||||
pinctrl-0 = <&uart4_pins_a>;
|
||||
pinctrl-1 = <&uart4_sleep_pins_a>;
|
||||
pinctrl-2 = <&uart4_idle_pins_a>;
|
||||
pinctrl-3 = <&uart4_pins_a>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbotg_hs {
|
||||
usb33d-supply = <&usb33>;
|
||||
vbus-supply = <&vbus_otg>;
|
||||
};
|
||||
|
||||
&usbphyc_port0 {
|
||||
phy-supply = <&vdd_usb>;
|
||||
vdda1v1-supply = <®11>;
|
||||
vdda1v8-supply = <®18>;
|
||||
};
|
||||
|
||||
&usbphyc_port1 {
|
||||
phy-supply = <&vdd_usb>;
|
||||
vdda1v1-supply = <®11>;
|
||||
vdda1v8-supply = <®18>;
|
||||
&usbphyc {
|
||||
vdd3v3-supply = <&vdd_usb>;
|
||||
};
|
||||
|
||||
@ -7,29 +7,23 @@
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
spi0 = &qspi;
|
||||
gpio26 = &stmfx_pinctrl;
|
||||
i2c1 = &i2c2;
|
||||
i2c4 = &i2c5;
|
||||
pinctrl2 = &stmfx_pinctrl;
|
||||
spi0 = &qspi;
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
compatible = "spi-flash";
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
|
||||
&flash1 {
|
||||
compatible = "spi-flash";
|
||||
};
|
||||
|
||||
&v3v3 {
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
&usbotg_hs {
|
||||
g-tx-fifo-size = <576>;
|
||||
};
|
||||
|
||||
/* SPL part **************************************/
|
||||
&qspi {
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
@ -61,7 +55,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
&flash0 {
|
||||
u-boot,dm-spl;
|
||||
&usbotg_hs {
|
||||
g-tx-fifo-size = <576>;
|
||||
};
|
||||
|
||||
|
||||
@ -6,44 +6,565 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "stm32mp157c-ed1.dts"
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/soc/stm32-hdp.h>
|
||||
|
||||
/ {
|
||||
model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
|
||||
compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", "st,stm32mp157";
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
aliases {
|
||||
serial1 = &usart3;
|
||||
ethernet0 = ðernet0;
|
||||
};
|
||||
|
||||
clocks {
|
||||
clk_ext_camera: clk-ext-camera {
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <24000000>;
|
||||
};
|
||||
};
|
||||
|
||||
joystick {
|
||||
compatible = "gpio-keys";
|
||||
#size-cells = <0>;
|
||||
pinctrl-0 = <&joystick_pins>;
|
||||
pinctrl-names = "default";
|
||||
button-0 {
|
||||
label = "JoySel";
|
||||
linux,code = <KEY_ENTER>;
|
||||
interrupt-parent = <&stmfx_pinctrl>;
|
||||
interrupts = <0 IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
button-1 {
|
||||
label = "JoyDown";
|
||||
linux,code = <KEY_DOWN>;
|
||||
interrupt-parent = <&stmfx_pinctrl>;
|
||||
interrupts = <1 IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
button-2 {
|
||||
label = "JoyLeft";
|
||||
linux,code = <KEY_LEFT>;
|
||||
interrupt-parent = <&stmfx_pinctrl>;
|
||||
interrupts = <2 IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
button-3 {
|
||||
label = "JoyRight";
|
||||
linux,code = <KEY_RIGHT>;
|
||||
interrupt-parent = <&stmfx_pinctrl>;
|
||||
interrupts = <3 IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
button-4 {
|
||||
label = "JoyUp";
|
||||
linux,code = <KEY_UP>;
|
||||
interrupt-parent = <&stmfx_pinctrl>;
|
||||
interrupts = <4 IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
};
|
||||
|
||||
panel_backlight: panel-backlight {
|
||||
compatible = "gpio-backlight";
|
||||
gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
|
||||
default-on;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
spdif_out: spdif-out {
|
||||
#sound-dai-cells = <0>;
|
||||
compatible = "linux,spdif-dit";
|
||||
status = "okay";
|
||||
|
||||
spdif_out_port: port {
|
||||
spdif_out_endpoint: endpoint {
|
||||
remote-endpoint = <&sai4a_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
spdif_in: spdif-in {
|
||||
#sound-dai-cells = <0>;
|
||||
compatible = "linux,spdif-dir";
|
||||
status = "okay";
|
||||
|
||||
spdif_in_port: port {
|
||||
spdif_in_endpoint: endpoint {
|
||||
remote-endpoint = <&spdifrx_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sound {
|
||||
compatible = "audio-graph-card";
|
||||
label = "STM32MP1-EV";
|
||||
routing =
|
||||
"AIF1CLK" , "MCLK1",
|
||||
"AIF2CLK" , "MCLK1",
|
||||
"IN1LN" , "MICBIAS2",
|
||||
"DMIC2DAT" , "MICBIAS1",
|
||||
"DMIC1DAT" , "MICBIAS1";
|
||||
dais = <&sai2a_port &sai2b_port &sai4a_port &spdifrx_port
|
||||
&dfsdm0_port &dfsdm1_port &dfsdm2_port &dfsdm3_port>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
dmic0: dmic-0 {
|
||||
compatible = "dmic-codec";
|
||||
#sound-dai-cells = <1>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dmic0_endpoint: endpoint {
|
||||
remote-endpoint = <&dfsdm_endpoint0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dmic1: dmic-1 {
|
||||
compatible = "dmic-codec";
|
||||
#sound-dai-cells = <1>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dmic1_endpoint: endpoint {
|
||||
remote-endpoint = <&dfsdm_endpoint1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dmic2: dmic-2 {
|
||||
compatible = "dmic-codec";
|
||||
#sound-dai-cells = <1>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dmic2_endpoint: endpoint {
|
||||
remote-endpoint = <&dfsdm_endpoint2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dmic3: dmic-3 {
|
||||
compatible = "dmic-codec";
|
||||
#sound-dai-cells = <1>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dmic3_endpoint: endpoint {
|
||||
remote-endpoint = <&dfsdm_endpoint3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
usb_phy_tuning: usb-phy-tuning {
|
||||
st,hs-dc-level = <2>;
|
||||
st,fs-rftime-tuning;
|
||||
st,hs-rftime-reduction;
|
||||
st,hs-current-trim = <15>;
|
||||
st,hs-impedance-trim = <1>;
|
||||
st,squelch-level = <3>;
|
||||
st,hs-rx-offset = <2>;
|
||||
st,no-lsfs-sc;
|
||||
};
|
||||
};
|
||||
|
||||
&cec {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&cec_pins_a>;
|
||||
pinctrl-1 = <&cec_pins_sleep_a>;
|
||||
};
|
||||
|
||||
&dcmi {
|
||||
status = "okay";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&dcmi_pins_a>;
|
||||
pinctrl-1 = <&dcmi_sleep_pins_a>;
|
||||
|
||||
port {
|
||||
dcmi_0: endpoint {
|
||||
remote-endpoint = <&ov5640_0>;
|
||||
bus-width = <8>;
|
||||
hsync-active = <0>;
|
||||
vsync-active = <0>;
|
||||
pclk-sample = <1>;
|
||||
pclk-max-frequency = <77000000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&dfsdm {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&dfsdm_clkout_pins_a
|
||||
&dfsdm_data1_pins_a &dfsdm_data3_pins_a>;
|
||||
pinctrl-1 = <&dfsdm_clkout_sleep_pins_a
|
||||
&dfsdm_data1_sleep_pins_a &dfsdm_data3_sleep_pins_a>;
|
||||
spi-max-frequency = <2048000>;
|
||||
|
||||
clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
|
||||
clock-names = "dfsdm", "audio";
|
||||
status = "okay";
|
||||
|
||||
dfsdm0: filter@0 {
|
||||
compatible = "st,stm32-dfsdm-dmic";
|
||||
st,adc-channels = <3>;
|
||||
st,adc-channel-names = "dmic_u1";
|
||||
st,adc-channel-types = "SPI_R";
|
||||
st,adc-channel-clk-src = "CLKOUT";
|
||||
st,filter-order = <3>;
|
||||
status = "okay";
|
||||
|
||||
asoc_pdm0: dfsdm-dai {
|
||||
compatible = "st,stm32h7-dfsdm-dai";
|
||||
#sound-dai-cells = <0>;
|
||||
io-channels = <&dfsdm0 0>;
|
||||
status = "okay";
|
||||
|
||||
dfsdm0_port: port {
|
||||
dfsdm_endpoint0: endpoint {
|
||||
remote-endpoint = <&dmic0_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dfsdm1: filter@1 {
|
||||
compatible = "st,stm32-dfsdm-dmic";
|
||||
st,adc-channels = <1>;
|
||||
st,adc-channel-names = "dmic_u2";
|
||||
st,adc-channel-types = "SPI_F";
|
||||
st,adc-channel-clk-src = "CLKOUT";
|
||||
st,filter-order = <3>;
|
||||
status = "okay";
|
||||
|
||||
asoc_pdm1: dfsdm-dai {
|
||||
compatible = "st,stm32h7-dfsdm-dai";
|
||||
#sound-dai-cells = <0>;
|
||||
io-channels = <&dfsdm1 0>;
|
||||
status = "okay";
|
||||
|
||||
dfsdm1_port: port {
|
||||
dfsdm_endpoint1: endpoint {
|
||||
remote-endpoint = <&dmic1_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dfsdm2: filter@2 {
|
||||
compatible = "st,stm32-dfsdm-dmic";
|
||||
st,adc-channels = <3>;
|
||||
st,adc-channel-names = "dmic_u3";
|
||||
st,adc-channel-types = "SPI_F";
|
||||
st,adc-channel-clk-src = "CLKOUT";
|
||||
st,filter-order = <3>;
|
||||
status = "okay";
|
||||
|
||||
asoc_pdm2: dfsdm-dai {
|
||||
compatible = "st,stm32h7-dfsdm-dai";
|
||||
#sound-dai-cells = <0>;
|
||||
io-channels = <&dfsdm2 0>;
|
||||
status = "okay";
|
||||
|
||||
dfsdm2_port: port {
|
||||
dfsdm_endpoint2: endpoint {
|
||||
remote-endpoint = <&dmic2_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dfsdm3: filter@3 {
|
||||
compatible = "st,stm32-dfsdm-dmic";
|
||||
st,adc-channels = <1>;
|
||||
st,adc-channel-names = "dmic_u4";
|
||||
st,adc-channel-types = "SPI_R";
|
||||
st,adc-channel-clk-src = "CLKOUT";
|
||||
st,filter-order = <3>;
|
||||
status = "okay";
|
||||
|
||||
asoc_pdm3: dfsdm-dai {
|
||||
compatible = "st,stm32h7-dfsdm-dai";
|
||||
#sound-dai-cells = <0>;
|
||||
io-channels = <&dfsdm3 0>;
|
||||
status = "okay";
|
||||
|
||||
dfsdm3_port: port {
|
||||
dfsdm_endpoint3: endpoint {
|
||||
remote-endpoint = <&dmic3_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&dsi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
dsi_in: endpoint {
|
||||
remote-endpoint = <<dc_ep0_out>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
dsi_out: endpoint {
|
||||
remote-endpoint = <&dsi_panel_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
panel-dsi@0 {
|
||||
compatible = "raydium,rm68200";
|
||||
reg = <0>;
|
||||
reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
|
||||
power-supply = <&v1v8>;
|
||||
backlight = <&panel_backlight>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dsi_panel_in: endpoint {
|
||||
remote-endpoint = <&dsi_out>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ðernet0 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <ðernet0_rgmii_pins_a>;
|
||||
pinctrl-1 = <ðernet0_rgmii_pins_sleep_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
phy-mode = "rgmii";
|
||||
max-speed = <1000>;
|
||||
phy-handle = <&phy0>;
|
||||
|
||||
mdio0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "snps,dwmac-mdio";
|
||||
phy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&fmc {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&fmc_pins_a>;
|
||||
pinctrl-1 = <&fmc_sleep_pins_a>;
|
||||
status = "okay";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
nand: nand@0 {
|
||||
reg = <0>;
|
||||
nand-on-flash-bbt;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
&hdp {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&hdp0_pins_a &hdp6_pins_a &hdp7_pins_a>;
|
||||
pinctrl-1 = <&hdp0_pins_sleep_a &hdp6_pins_sleep_a &hdp7_pins_sleep_a>;
|
||||
status = "disabled";
|
||||
|
||||
muxing-hdp = <(STM32_HDP(0, HDP0_GPOVAL_0) |
|
||||
STM32_HDP(6, HDP6_GPOVAL_6) |
|
||||
STM32_HDP(7, HDP7_GPOVAL_7))>;
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2c2_pins_a>;
|
||||
pinctrl-1 = <&i2c2_pins_sleep_a>;
|
||||
i2c-scl-rising-time-ns = <185>;
|
||||
i2c-scl-falling-time-ns = <20>;
|
||||
status = "okay";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
|
||||
wm8994: wm8994@1b {
|
||||
compatible = "wlf,wm8994";
|
||||
#sound-dai-cells = <0>;
|
||||
reg = <0x1b>;
|
||||
status = "okay";
|
||||
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
|
||||
DBVDD-supply = <&vdd>;
|
||||
SPKVDD1-supply = <&vdd>;
|
||||
SPKVDD2-supply = <&vdd>;
|
||||
AVDD2-supply = <&v1v8>;
|
||||
CPVDD-supply = <&v1v8>;
|
||||
|
||||
wlf,ldoena-always-driven;
|
||||
|
||||
clocks = <&sai2a>;
|
||||
clock-names = "MCLK1";
|
||||
|
||||
wlf,gpio-cfg = <0x8101 0xa100 0xa100 0xa100 0xa101 0xa101 0xa100 0xa101 0xa101 0xa101 0xa101>;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
wm8994_tx_port: port@0 {
|
||||
reg = <0>;
|
||||
wm8994_tx_endpoint: endpoint {
|
||||
remote-endpoint = <&sai2a_endpoint>;
|
||||
};
|
||||
};
|
||||
|
||||
wm8994_rx_port: port@1 {
|
||||
reg = <1>;
|
||||
wm8994_rx_endpoint: endpoint {
|
||||
remote-endpoint = <&sai2b_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ov5640: camera@3c {
|
||||
compatible = "ovti,ov5640";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&ov5640_pins>;
|
||||
reg = <0x3c>;
|
||||
clocks = <&clk_ext_camera>;
|
||||
clock-names = "xclk";
|
||||
DOVDD-supply = <&v2v8>;
|
||||
powerdown-gpios = <&stmfx_pinctrl 18 GPIO_ACTIVE_HIGH>;
|
||||
reset-gpios = <&stmfx_pinctrl 19 GPIO_ACTIVE_LOW>;
|
||||
rotation = <180>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
ov5640_0: endpoint {
|
||||
remote-endpoint = <&dcmi_0>;
|
||||
bus-width = <8>;
|
||||
data-shift = <2>; /* lines 9:2 are used */
|
||||
hsync-active = <0>;
|
||||
vsync-active = <0>;
|
||||
pclk-sample = <1>;
|
||||
pclk-max-frequency = <77000000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
stmfx: stmfx@42 {
|
||||
compatible = "st,stmfx-0300";
|
||||
reg = <0x42>;
|
||||
interrupts = <8 IRQ_TYPE_EDGE_RISING>;
|
||||
interrupt-parent = <&gpioi>;
|
||||
vdd-supply = <&v3v3>;
|
||||
|
||||
stmfx_pinctrl: stmfx-pin-controller {
|
||||
compatible = "st,stmfx-0300-pinctrl";
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
gpio-ranges = <&stmfx_pinctrl 0 0 24>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&hog_pins>;
|
||||
|
||||
hog_pins: hog {
|
||||
pins = "gpio14";
|
||||
drive-push-pull;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
joystick_pins: joystick {
|
||||
pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
|
||||
drive-push-pull;
|
||||
bias-pull-down;
|
||||
};
|
||||
|
||||
ov5640_pins: camera {
|
||||
pins = "agpio2", "agpio3"; /* stmfx pins 18 & 19 */
|
||||
drive-push-pull;
|
||||
output-low;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
gt9147: goodix_ts@5d {
|
||||
compatible = "goodix,gt9147";
|
||||
reg = <0x5d>;
|
||||
status = "okay";
|
||||
|
||||
irq-gpios = <&stmfx_pinctrl 14 GPIO_ACTIVE_HIGH>;
|
||||
irq-flags = <IRQ_TYPE_EDGE_RISING>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c4 {
|
||||
pmic: stpmic@33 {
|
||||
regulators {
|
||||
v1v8: ldo6 {
|
||||
regulator-enable-ramp-delay = <300000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c5 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&i2c5_pins_a>;
|
||||
pinctrl-1 = <&i2c5_pins_sleep_a>;
|
||||
i2c-scl-rising-time-ns = <185>;
|
||||
i2c-scl-falling-time-ns = <20>;
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
};
|
||||
|
||||
<dc {
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ltdc_ep0_out: endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&dsi_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&m_can1 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&m_can1_pins_a>;
|
||||
pinctrl-1 = <&m_can1_sleep_pins_a>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&qspi {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a &qspi_bk2_pins_a>;
|
||||
pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a &qspi_bk2_sleep_pins_a>;
|
||||
reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
flash0: mx66l51235l@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-rx-bus-width = <4>;
|
||||
spi-max-frequency = <108000000>;
|
||||
@ -52,6 +573,7 @@
|
||||
};
|
||||
|
||||
flash1: mx66l51235l@1 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <1>;
|
||||
spi-rx-bus-width = <4>;
|
||||
spi-max-frequency = <108000000>;
|
||||
@ -60,11 +582,110 @@
|
||||
};
|
||||
};
|
||||
|
||||
&sai2 {
|
||||
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_a>;
|
||||
pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_a>;
|
||||
clock-names = "pclk", "x8k", "x11k";
|
||||
status = "okay";
|
||||
|
||||
sai2a: audio-controller@4400b004 {
|
||||
#clock-cells = <0>;
|
||||
dma-names = "tx";
|
||||
clocks = <&rcc SAI2_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "okay";
|
||||
|
||||
sai2a_port: port {
|
||||
sai2a_endpoint: endpoint {
|
||||
remote-endpoint = <&wm8994_tx_endpoint>;
|
||||
format = "i2s";
|
||||
mclk-fs = <256>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
sai2b: audio-controller@4400b024 {
|
||||
dma-names = "rx";
|
||||
clocks = <&rcc SAI2_K>, <&sai2a>;
|
||||
clock-names = "sai_ck", "MCLK";
|
||||
status = "okay";
|
||||
|
||||
sai2b_port: port {
|
||||
sai2b_endpoint: endpoint {
|
||||
remote-endpoint = <&wm8994_rx_endpoint>;
|
||||
format = "i2s";
|
||||
mclk-fs = <256>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&sai4 {
|
||||
clocks = <&rcc SAI4>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
|
||||
clock-names = "pclk", "x8k", "x11k";
|
||||
status = "okay";
|
||||
|
||||
sai4a: audio-controller@50027004 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&sai4a_pins_a>;
|
||||
pinctrl-1 = <&sai4a_sleep_pins_a>;
|
||||
dma-names = "tx";
|
||||
clocks = <&rcc SAI4_K>;
|
||||
clock-names = "sai_ck";
|
||||
st,iec60958;
|
||||
status = "okay";
|
||||
|
||||
sai4a_port: port {
|
||||
sai4a_endpoint: endpoint {
|
||||
remote-endpoint = <&spdif_out_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&sdmmc3 {
|
||||
pinctrl-names = "default", "opendrain", "sleep";
|
||||
pinctrl-0 = <&sdmmc3_b4_pins_a>;
|
||||
pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
|
||||
pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
|
||||
vmmc-supply = <&v3v3>;
|
||||
broken-cd;
|
||||
st,neg-edge;
|
||||
bus-width = <4>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&spdifrx {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&spdifrx_pins_a>;
|
||||
pinctrl-1 = <&spdifrx_sleep_pins_a>;
|
||||
status = "okay";
|
||||
|
||||
spdifrx_port: port {
|
||||
spdifrx_endpoint: endpoint {
|
||||
remote-endpoint = <&spdif_in_endpoint>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
pinctrl-names = "default", "sleep";
|
||||
pinctrl-0 = <&spi1_pins_a>;
|
||||
pinctrl-1 = <&spi1_sleep_pins_a>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&timers2 {
|
||||
status = "disabled";
|
||||
/* spare dmas for other usage (un-delete to enable pwm capture) */
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm2_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-1 = <&pwm2_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@1 {
|
||||
@ -74,9 +695,12 @@
|
||||
|
||||
&timers8 {
|
||||
status = "disabled";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm8_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-1 = <&pwm8_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@7 {
|
||||
@ -86,9 +710,12 @@
|
||||
|
||||
&timers12 {
|
||||
status = "disabled";
|
||||
/delete-property/dmas;
|
||||
/delete-property/dma-names;
|
||||
pwm {
|
||||
pinctrl-0 = <&pwm12_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-1 = <&pwm12_sleep_pins_a>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
status = "okay";
|
||||
};
|
||||
timer@11 {
|
||||
@ -96,6 +723,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
&usart3 {
|
||||
pinctrl-names = "default", "sleep", "idle";
|
||||
pinctrl-0 = <&usart3_pins_a>;
|
||||
pinctrl-1 = <&usart3_sleep_pins_a>;
|
||||
pinctrl-2 = <&usart3_idle_pins_a>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&usbh_ehci {
|
||||
phys = <&usbphyc_port0>;
|
||||
phy-names = "usb";
|
||||
@ -114,3 +749,11 @@
|
||||
&usbphyc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usbphyc_port0 {
|
||||
st,phy-tuning = <&usb_phy_tuning>;
|
||||
};
|
||||
|
||||
&usbphyc_port1 {
|
||||
st,phy-tuning = <&usb_phy_tuning>;
|
||||
};
|
||||
|
||||
436
arch/arm/dts/stm32mp157c-m4-srm.dtsi
Normal file
436
arch/arm/dts/stm32mp157c-m4-srm.dtsi
Normal file
@ -0,0 +1,436 @@
|
||||
&m4_rproc {
|
||||
m4_system_resources {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
m4_timers2: timer@40000000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40000000>;
|
||||
clocks = <&rcc TIM2_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers3: timer@40001000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40001000>;
|
||||
clocks = <&rcc TIM3_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers4: timer@40002000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40002000>;
|
||||
clocks = <&rcc TIM4_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers5: timer@40003000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40003000>;
|
||||
clocks = <&rcc TIM5_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers6: timer@40004000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40004000>;
|
||||
clocks = <&rcc TIM6_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers7: timer@40005000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40005000>;
|
||||
clocks = <&rcc TIM7_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers12: timer@40006000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40006000>;
|
||||
clocks = <&rcc TIM12_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers13: timer@40007000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40007000>;
|
||||
clocks = <&rcc TIM13_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers14: timer@40008000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40008000>;
|
||||
clocks = <&rcc TIM14_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_lptimer1: timer@40009000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40009000>;
|
||||
clocks = <&rcc LPTIM1_K>;
|
||||
clock-names = "mux";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spi2: spi@4000b000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000b000>;
|
||||
clocks = <&rcc SPI2_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2s2: audio-controller@4000b000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000b000>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spi3: spi@4000c000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000c000>;
|
||||
clocks = <&rcc SPI3_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2s3: audio-controller@4000c000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000c000>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spdifrx: audio-controller@4000d000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000d000>;
|
||||
clocks = <&rcc SPDIF_K>;
|
||||
clock-names = "kclk";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_usart2: serial@4000e000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000e000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <27 1>;
|
||||
clocks = <&rcc USART2_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_usart3: serial@4000f000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4000f000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <28 1>;
|
||||
clocks = <&rcc USART3_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_uart4: serial@40010000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40010000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <30 1>;
|
||||
clocks = <&rcc UART4_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_uart5: serial@40011000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40011000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <31 1>;
|
||||
clocks = <&rcc UART5_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2c1: i2c@40012000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40012000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <21 1>;
|
||||
clocks = <&rcc I2C1_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2c2: i2c@40013000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40013000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <22 1>;
|
||||
clocks = <&rcc I2C2_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2c3: i2c@40014000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40014000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <23 1>;
|
||||
clocks = <&rcc I2C3_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2c5: i2c@40015000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40015000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <25 1>;
|
||||
clocks = <&rcc I2C5_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_cec: cec@40016000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40016000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <69 1>;
|
||||
clocks = <&rcc CEC_K>, <&rcc CK_LSE>;
|
||||
clock-names = "cec", "hdmi-cec";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dac: dac@40017000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40017000>;
|
||||
clocks = <&rcc DAC12>;
|
||||
clock-names = "pclk";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_uart7: serial@40018000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40018000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <32 1>;
|
||||
clocks = <&rcc UART7_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_uart8: serial@40019000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x40019000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <33 1>;
|
||||
clocks = <&rcc UART8_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers1: timer@44000000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44000000>;
|
||||
clocks = <&rcc TIM1_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers8: timer@44001000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44001000>;
|
||||
clocks = <&rcc TIM8_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_usart6: serial@44003000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44003000>;
|
||||
interrupt-parent = <&exti>;
|
||||
interrupts = <29 1>;
|
||||
clocks = <&rcc USART6_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spi1: spi@44004000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44004000>;
|
||||
clocks = <&rcc SPI1_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_i2s1: audio-controller@44004000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44004000>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spi4: spi@44005000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44005000>;
|
||||
clocks = <&rcc SPI4_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers15: timer@44006000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44006000>;
|
||||
clocks = <&rcc TIM15_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers16: timer@44007000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44007000>;
|
||||
clocks = <&rcc TIM16_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_timers17: timer@44008000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44008000>;
|
||||
clocks = <&rcc TIM17_K>;
|
||||
clock-names = "int";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_spi5: spi@44009000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x44009000>;
|
||||
clocks = <&rcc SPI5_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_sai1: sai@4400a000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400a000>;
|
||||
clocks = <&rcc SAI1_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_sai2: sai@4400b000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400b000>;
|
||||
clocks = <&rcc SAI2_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_sai3: sai@4400c000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400c000>;
|
||||
clocks = <&rcc SAI3_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dfsdm: dfsdm@4400d000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400d000>;
|
||||
clocks = <&rcc DFSDM_K>;
|
||||
clock-names = "dfsdm";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_m_can1: can@4400e000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400e000>, <0x44011000>;
|
||||
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
|
||||
clock-names = "hclk", "cclk";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_m_can2: can@4400f000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4400f000>, <0x44011000>;
|
||||
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
|
||||
clock-names = "hclk", "cclk";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dma1: dma@48000000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x48000000>;
|
||||
clocks = <&rcc DMA1>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dma2: dma@48001000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x48001000>;
|
||||
clocks = <&rcc DMA2>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dmamux1: dma-router@48002000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x48002000>;
|
||||
clocks = <&rcc DMAMUX>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_adc: adc@48003000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x48003000>;
|
||||
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
|
||||
clock-names = "bus", "adc";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_sdmmc3: sdmmc@48004000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x48004000>, <0x48005000>;
|
||||
clocks = <&rcc SDMMC3_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_usbotg_hs: usb-otg@49000000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x49000000>;
|
||||
clocks = <&rcc USBO_K>;
|
||||
clock-names = "otg";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_hash2: hash@4c002000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4c002000>;
|
||||
clocks = <&rcc HASH2>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_rng2: rng@4c003000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4c003000>;
|
||||
clocks = <&rcc RNG2_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_crc2: crc@4c004000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4c004000>;
|
||||
clocks = <&rcc CRC2>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_cryp2: cryp@4c005000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4c005000>;
|
||||
clocks = <&rcc CRYP2>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_dcmi: dcmi@4c006000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x4c006000>;
|
||||
clocks = <&rcc DCMI>;
|
||||
clock-names = "mclk";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_lptimer2: timer@50021000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x50021000>;
|
||||
clocks = <&rcc LPTIM2_K>;
|
||||
clock-names = "mux";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_lptimer3: timer@50022000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x50022000>;
|
||||
clocks = <&rcc LPTIM3_K>;
|
||||
clock-names = "mux";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_lptimer4: timer@50023000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x50023000>;
|
||||
clocks = <&rcc LPTIM4_K>;
|
||||
clock-names = "mux";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_lptimer5: timer@50024000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x50024000>;
|
||||
clocks = <&rcc LPTIM5_K>;
|
||||
clock-names = "mux";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_sai4: sai@50027000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x50027000>;
|
||||
clocks = <&rcc SAI4_K>;
|
||||
clock-names = "sai_ck";
|
||||
status = "disabled";
|
||||
};
|
||||
m4_qspi: qspi@58003000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x58003000>, <0x70000000>;
|
||||
clocks = <&rcc QSPI_K>;
|
||||
status = "disabled";
|
||||
};
|
||||
m4_ethernet0: ethernet@5800a000 {
|
||||
compatible = "rproc-srm-dev";
|
||||
reg = <0x5800a000>;
|
||||
clock-names = "stmmaceth",
|
||||
"mac-clk-tx",
|
||||
"mac-clk-rx",
|
||||
"ethstp",
|
||||
"syscfg-clk";
|
||||
clocks = <&rcc ETHMAC>,
|
||||
<&rcc ETHTX>,
|
||||
<&rcc ETHRX>,
|
||||
<&rcc ETHSTP>,
|
||||
<&rcc SYSCFG>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
90
arch/arm/dts/stm32mp157caa-pinctrl.dtsi
Normal file
90
arch/arm/dts/stm32mp157caa-pinctrl.dtsi
Normal file
@ -0,0 +1,90 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>
|
||||
*/
|
||||
|
||||
#include "stm32mp157-pinctrl.dtsi"
|
||||
/ {
|
||||
soc {
|
||||
pinctrl: pin-controller@50002000 {
|
||||
st,package = <STM32MP157CAA>;
|
||||
|
||||
gpioa: gpio@50002000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 0 16>;
|
||||
};
|
||||
|
||||
gpiob: gpio@50003000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 16 16>;
|
||||
};
|
||||
|
||||
gpioc: gpio@50004000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 32 16>;
|
||||
};
|
||||
|
||||
gpiod: gpio@50005000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 48 16>;
|
||||
};
|
||||
|
||||
gpioe: gpio@50006000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 64 16>;
|
||||
};
|
||||
|
||||
gpiof: gpio@50007000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 80 16>;
|
||||
};
|
||||
|
||||
gpiog: gpio@50008000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 96 16>;
|
||||
};
|
||||
|
||||
gpioh: gpio@50009000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 112 16>;
|
||||
};
|
||||
|
||||
gpioi: gpio@5000a000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 128 16>;
|
||||
};
|
||||
|
||||
gpioj: gpio@5000b000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 144 16>;
|
||||
};
|
||||
|
||||
gpiok: gpio@5000c000 {
|
||||
status = "okay";
|
||||
ngpios = <8>;
|
||||
gpio-ranges = <&pinctrl 0 160 8>;
|
||||
};
|
||||
};
|
||||
|
||||
pinctrl_z: pin-controller-z@54004000 {
|
||||
st,package = <STM32MP157CAA>;
|
||||
|
||||
gpioz: gpio@54004000 {
|
||||
status = "okay";
|
||||
ngpios = <8>;
|
||||
gpio-ranges = <&pinctrl_z 0 400 8>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
62
arch/arm/dts/stm32mp157cab-pinctrl.dtsi
Normal file
62
arch/arm/dts/stm32mp157cab-pinctrl.dtsi
Normal file
@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>
|
||||
*/
|
||||
|
||||
#include "stm32mp157-pinctrl.dtsi"
|
||||
/ {
|
||||
soc {
|
||||
pinctrl: pin-controller@50002000 {
|
||||
st,package = <STM32MP157CAB>;
|
||||
|
||||
gpioa: gpio@50002000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 0 16>;
|
||||
};
|
||||
|
||||
gpiob: gpio@50003000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 16 16>;
|
||||
};
|
||||
|
||||
gpioc: gpio@50004000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 32 16>;
|
||||
};
|
||||
|
||||
gpiod: gpio@50005000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 48 16>;
|
||||
};
|
||||
|
||||
gpioe: gpio@50006000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 64 16>;
|
||||
};
|
||||
|
||||
gpiof: gpio@50007000 {
|
||||
status = "okay";
|
||||
ngpios = <6>;
|
||||
gpio-ranges = <&pinctrl 6 86 6>;
|
||||
};
|
||||
|
||||
gpiog: gpio@50008000 {
|
||||
status = "okay";
|
||||
ngpios = <10>;
|
||||
gpio-ranges = <&pinctrl 6 102 10>;
|
||||
};
|
||||
|
||||
gpioh: gpio@50009000 {
|
||||
status = "okay";
|
||||
ngpios = <2>;
|
||||
gpio-ranges = <&pinctrl 0 112 2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
78
arch/arm/dts/stm32mp157cac-pinctrl.dtsi
Normal file
78
arch/arm/dts/stm32mp157cac-pinctrl.dtsi
Normal file
@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>
|
||||
*/
|
||||
|
||||
#include "stm32mp157-pinctrl.dtsi"
|
||||
/ {
|
||||
soc {
|
||||
pinctrl: pin-controller@50002000 {
|
||||
st,package = <STM32MP157CAC>;
|
||||
|
||||
gpioa: gpio@50002000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 0 16>;
|
||||
};
|
||||
|
||||
gpiob: gpio@50003000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 16 16>;
|
||||
};
|
||||
|
||||
gpioc: gpio@50004000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 32 16>;
|
||||
};
|
||||
|
||||
gpiod: gpio@50005000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 48 16>;
|
||||
};
|
||||
|
||||
gpioe: gpio@50006000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 64 16>;
|
||||
};
|
||||
|
||||
gpiof: gpio@50007000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 80 16>;
|
||||
};
|
||||
|
||||
gpiog: gpio@50008000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 96 16>;
|
||||
};
|
||||
|
||||
gpioh: gpio@50009000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 112 16>;
|
||||
};
|
||||
|
||||
gpioi: gpio@5000a000 {
|
||||
status = "okay";
|
||||
ngpios = <12>;
|
||||
gpio-ranges = <&pinctrl 0 128 12>;
|
||||
};
|
||||
};
|
||||
|
||||
pinctrl_z: pin-controller-z@54004000 {
|
||||
st,package = <STM32MP157CAC>;
|
||||
|
||||
gpioz: gpio@54004000 {
|
||||
status = "okay";
|
||||
ngpios = <8>;
|
||||
gpio-ranges = <&pinctrl_z 0 400 8>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
62
arch/arm/dts/stm32mp157cad-pinctrl.dtsi
Normal file
62
arch/arm/dts/stm32mp157cad-pinctrl.dtsi
Normal file
@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
|
||||
/*
|
||||
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
|
||||
* Author: Alexandre Torgue <alexandre.torgue@st.com>
|
||||
*/
|
||||
|
||||
#include "stm32mp157-pinctrl.dtsi"
|
||||
/ {
|
||||
soc {
|
||||
pinctrl: pin-controller@50002000 {
|
||||
st,package = <STM32MP157CAD>;
|
||||
|
||||
gpioa: gpio@50002000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 0 16>;
|
||||
};
|
||||
|
||||
gpiob: gpio@50003000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 16 16>;
|
||||
};
|
||||
|
||||
gpioc: gpio@50004000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 32 16>;
|
||||
};
|
||||
|
||||
gpiod: gpio@50005000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 48 16>;
|
||||
};
|
||||
|
||||
gpioe: gpio@50006000 {
|
||||
status = "okay";
|
||||
ngpios = <16>;
|
||||
gpio-ranges = <&pinctrl 0 64 16>;
|
||||
};
|
||||
|
||||
gpiof: gpio@50007000 {
|
||||
status = "okay";
|
||||
ngpios = <6>;
|
||||
gpio-ranges = <&pinctrl 6 86 6>;
|
||||
};
|
||||
|
||||
gpiog: gpio@50008000 {
|
||||
status = "okay";
|
||||
ngpios = <10>;
|
||||
gpio-ranges = <&pinctrl 6 102 10>;
|
||||
};
|
||||
|
||||
gpioh: gpio@50009000 {
|
||||
status = "okay";
|
||||
ngpios = <2>;
|
||||
gpio-ranges = <&pinctrl 0 112 2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef _GPIO_H_
|
||||
#define _GPIO_H_
|
||||
|
||||
#define STM32_GPIOS_PER_BANK 16
|
||||
|
||||
enum stm32_gpio_port {
|
||||
STM32_GPIO_PORT_A = 0,
|
||||
STM32_GPIO_PORT_B,
|
||||
@ -109,6 +111,9 @@ struct stm32_gpio_regs {
|
||||
|
||||
struct stm32_gpio_priv {
|
||||
struct stm32_gpio_regs *regs;
|
||||
unsigned int gpio_range;
|
||||
};
|
||||
|
||||
int stm32_offset_to_index(struct udevice *dev, unsigned int offset);
|
||||
|
||||
#endif /* _GPIO_H_ */
|
||||
|
||||
@ -16,8 +16,12 @@ config SPL
|
||||
select SPL_REGMAP
|
||||
select SPL_DM_RESET
|
||||
select SPL_SERIAL_SUPPORT
|
||||
select SPL_SPI_LOAD
|
||||
select SPL_SYSCON
|
||||
select SPL_DRIVERS_MISC_SUPPORT
|
||||
select SPL_WATCHDOG_SUPPORT
|
||||
imply BOOTSTAGE_STASH if SPL_BOOTSTAGE
|
||||
imply SPL_BOOTSTAGE
|
||||
imply SPL_DISPLAY_PRINT
|
||||
imply SPL_LIBDISK_SUPPORT
|
||||
|
||||
config SYS_SOC
|
||||
@ -25,18 +29,100 @@ config SYS_SOC
|
||||
|
||||
config TARGET_STM32MP1
|
||||
bool "Support stm32mp1xx"
|
||||
select ARCH_SUPPORT_PSCI
|
||||
select ARCH_SUPPORT_PSCI if !STM32MP1_TRUSTED
|
||||
select CPU_V7A
|
||||
select CPU_V7_HAS_NONSEC
|
||||
select CPU_V7_HAS_NONSEC if !STM32MP1_TRUSTED
|
||||
select CPU_V7_HAS_VIRT
|
||||
select OF_BOARD_SETUP
|
||||
select PINCTRL_STM32
|
||||
select STM32_RCC
|
||||
select STM32_RESET
|
||||
select SYS_ARCH_TIMER
|
||||
select SYSRESET_SYSCON
|
||||
select STM32_SERIAL
|
||||
imply BOOTCOUNT_LIMIT
|
||||
imply SYSRESET_PSCI if STM32MP1_TRUSTED
|
||||
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
|
||||
help
|
||||
target STMicroelectronics SOC STM32MP1 family
|
||||
STM32MP153 or STM32MP151
|
||||
STMicroelectronics MPU with core ARMv7
|
||||
dual core A7 for STM32MP153, monocore for STM32MP151
|
||||
|
||||
config STM32MP1_RESET_HALT_WORKAROUND
|
||||
bool "workaround for reset halt deubg on stm32mp15x"
|
||||
depends on TARGET_STM32MP1
|
||||
default y
|
||||
help
|
||||
Activate a workaround for current STM32MP15x revision B
|
||||
limitation on debug reset halt not handle by ROM code:
|
||||
add a delay loop early in the SPL boot process to wait for
|
||||
the debugger to attach
|
||||
it can be removed when using the Soc revision
|
||||
that fixes the limitation.
|
||||
|
||||
|
||||
config STM32MP1_TRUSTED
|
||||
bool "Support trusted boot with TF-A"
|
||||
default y if !SPL
|
||||
select ARM_SMCCC
|
||||
help
|
||||
Say Y here to enable boot with TF-A
|
||||
Trusted boot chain is :
|
||||
BootRom => TF-A.stm32 (clock & DDR) => U-Boot.stm32
|
||||
TF-A monitor provide ST smc to manage secure devices
|
||||
|
||||
config STM32MP1_OPTEE
|
||||
bool "Support trusted boot with TF-A and OPTEE"
|
||||
depends on STM32MP1_TRUSTED
|
||||
default n
|
||||
help
|
||||
Say Y here to enable boot with TF-A and OPTEE
|
||||
Trusted boot chain is :
|
||||
BootRom => TF-A.stm32 (clock & DDR) => OPTEE => U-Boot.stm32
|
||||
OPTEE monitor provide ST smc to manage secure devices
|
||||
|
||||
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
|
||||
hex "Partition to use for MMC2 to load U-Boot from"
|
||||
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION && TARGET_STM32MP1
|
||||
default 1
|
||||
help
|
||||
Partition on the MMC2 to load U-Boot from when the MMC2 is being
|
||||
used in raw mode
|
||||
|
||||
config STM32_ETZPC
|
||||
bool "STM32 Extended TrustZone Protection"
|
||||
depends on TARGET_STM32MP1
|
||||
default y
|
||||
help
|
||||
Say y to enable STM32 Extended TrustZone Protection
|
||||
Controller (ETZPC)
|
||||
|
||||
source "board/st/stm32mp1/Kconfig"
|
||||
|
||||
config CMD_STM32PROG
|
||||
bool "command stm32prog for STM32CudeProgrammer"
|
||||
default y
|
||||
depends on CMD_DFU
|
||||
imply CMD_GPT if MMC
|
||||
imply DFU_MMC if MMC
|
||||
imply DFU_NAND if NAND
|
||||
select DFU_RAM
|
||||
imply DFU_SF if DM_SPI_FLASH
|
||||
select DFU_VIRT
|
||||
select PARTITION_TYPE_GUID
|
||||
help
|
||||
activate a specific command stm32prog for STM32MP soc family
|
||||
witch update the device with the tools STM32CubeProgrammer,
|
||||
using UART with STM32 protocol or USB with DFU protocol
|
||||
NB: access to not volatile memory (NOR/NAND/SD/eMMC) is based
|
||||
on U-Boot DFU framework
|
||||
|
||||
config CMD_STM32KEY
|
||||
bool "command stm32key to fuse public key hash"
|
||||
default y
|
||||
depends on CMD_FUSE
|
||||
help
|
||||
fuse public key hash in corresponding fuse used to authenticate
|
||||
binary.
|
||||
|
||||
config SYS_TEXT_BASE
|
||||
prompt "U-Boot base address"
|
||||
@ -46,22 +132,23 @@ config SYS_TEXT_BASE
|
||||
when DDR driver is used:
|
||||
DDR + 1MB (0xC0100000)
|
||||
|
||||
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
|
||||
hex "Partition on MMC2 to use to load U-Boot from"
|
||||
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
|
||||
config NR_DRAM_BANKS
|
||||
default 1
|
||||
help
|
||||
Partition on the second MMC to load U-Boot from when the MMC is being
|
||||
used in raw mode
|
||||
|
||||
source "board/st/stm32mp1/Kconfig"
|
||||
config BOOTSTAGE_STASH_ADDR
|
||||
default 0xC3000000
|
||||
|
||||
# currently activated for debug / should be deactivated for real product
|
||||
if DEBUG_UART
|
||||
|
||||
config DEBUG_UART_BOARD_INIT
|
||||
if BOOTCOUNT_LIMIT
|
||||
config SYS_BOOTCOUNT_SINGLEWORD
|
||||
default y
|
||||
|
||||
# TAMP_BOOTCOUNT = TAMP_BACKUP_REGISTER(21)
|
||||
config SYS_BOOTCOUNT_ADDR
|
||||
default 0x5C00A154
|
||||
endif
|
||||
|
||||
if DEBUG_UART
|
||||
# debug on UART4 by default
|
||||
config DEBUG_UART_BASE
|
||||
default 0x40010000
|
||||
@ -69,6 +156,10 @@ config DEBUG_UART_BASE
|
||||
# clock source is HSI on reset
|
||||
config DEBUG_UART_CLOCK
|
||||
default 64000000
|
||||
|
||||
# currently activated for debug / should be deactivated for real product
|
||||
config DEBUG_UART_BOARD_INIT
|
||||
default y
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@ -9,8 +9,15 @@ obj-y += syscon.o
|
||||
|
||||
ifdef CONFIG_SPL_BUILD
|
||||
obj-y += spl.o
|
||||
obj-$(CONFIG_STM32MP1_RESET_HALT_WORKAROUND) += stm32mp1_helper_dgb.o
|
||||
else
|
||||
obj-y += bsec.o
|
||||
endif
|
||||
obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/
|
||||
obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o
|
||||
|
||||
obj-$(CONFIG_ARMV7_PSCI) += psci.o
|
||||
obj-y += bsec.o
|
||||
obj-y += cmd_poweroff.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
|
||||
obj-$(CONFIG_STM32_ETZPC) += stm32-etzpc.o
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
@ -7,10 +7,14 @@
|
||||
#include <dm.h>
|
||||
#include <misc.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/stm32mp1_smc.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <linux/iopoll.h>
|
||||
|
||||
#define BSEC_OTP_MAX_VALUE 95
|
||||
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
|
||||
#define BSEC_TIMEOUT_US 10000
|
||||
|
||||
/* BSEC REGISTER OFFSET (base relative) */
|
||||
@ -168,7 +172,7 @@ static int bsec_shadow_register(u32 base, u32 otp)
|
||||
ret = bsec_power_safmem(base, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
power_up = 1;
|
||||
power_up = true;
|
||||
}
|
||||
/* set BSEC_OTP_CTRL_OFF with the otp value*/
|
||||
writel(otp | BSEC_READ, base + BSEC_OTP_CTRL_OFF);
|
||||
@ -270,6 +274,7 @@ static int bsec_program_otp(long base, u32 val, u32 otp)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_STM32MP1_TRUSTED */
|
||||
|
||||
/* BSEC MISC driver *******************************************************/
|
||||
struct stm32mp_bsec_platdata {
|
||||
@ -278,6 +283,11 @@ struct stm32mp_bsec_platdata {
|
||||
|
||||
static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp)
|
||||
{
|
||||
#ifdef CONFIG_STM32MP1_TRUSTED
|
||||
return stm32_smc(STM32_SMC_BSEC,
|
||||
STM32_SMC_READ_OTP,
|
||||
otp, 0, val);
|
||||
#else
|
||||
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
|
||||
u32 tmp_data = 0;
|
||||
int ret;
|
||||
@ -299,27 +309,46 @@ static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp)
|
||||
/* restore shadow value */
|
||||
ret = bsec_write_shadow(plat->base, tmp_data, otp);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int stm32mp_bsec_read_shadow(struct udevice *dev, u32 *val, u32 otp)
|
||||
{
|
||||
#ifdef CONFIG_STM32MP1_TRUSTED
|
||||
return stm32_smc(STM32_SMC_BSEC,
|
||||
STM32_SMC_READ_SHADOW,
|
||||
otp, 0, val);
|
||||
#else
|
||||
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
return bsec_read_shadow(plat->base, val, otp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int stm32mp_bsec_write_otp(struct udevice *dev, u32 val, u32 otp)
|
||||
{
|
||||
#ifdef CONFIG_STM32MP1_TRUSTED
|
||||
return stm32_smc_exec(STM32_SMC_BSEC,
|
||||
STM32_SMC_PROG_OTP,
|
||||
otp, val);
|
||||
#else
|
||||
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
return bsec_program_otp(plat->base, val, otp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int stm32mp_bsec_write_shadow(struct udevice *dev, u32 val, u32 otp)
|
||||
{
|
||||
#ifdef CONFIG_STM32MP1_TRUSTED
|
||||
return stm32_smc_exec(STM32_SMC_BSEC,
|
||||
STM32_SMC_WRITE_SHADOW,
|
||||
otp, val);
|
||||
#else
|
||||
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
return bsec_write_shadow(plat->base, val, otp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int stm32mp_bsec_read(struct udevice *dev, int offset,
|
||||
@ -405,8 +434,23 @@ static int stm32mp_bsec_ofdata_to_platdata(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
static int stm32mp_bsec_probe(struct udevice *dev)
|
||||
{
|
||||
int otp;
|
||||
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
/* update unlocked shadow for OTP cleared by the rom code */
|
||||
for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++)
|
||||
if (!bsec_read_SR_lock(plat->base, otp))
|
||||
bsec_shadow_register(plat->base, otp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct udevice_id stm32mp_bsec_ids[] = {
|
||||
{ .compatible = "st,stm32mp-bsec" },
|
||||
{ .compatible = "st,stm32mp15-bsec" },
|
||||
{}
|
||||
};
|
||||
|
||||
@ -417,15 +461,7 @@ U_BOOT_DRIVER(stm32mp_bsec) = {
|
||||
.ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata,
|
||||
.platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata),
|
||||
.ops = &stm32mp_bsec_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
|
||||
/* bsec IP is not present in device tee, manage IP address by platdata */
|
||||
static struct stm32mp_bsec_platdata stm32_bsec_platdata = {
|
||||
.base = STM32_BSEC_BASE,
|
||||
};
|
||||
|
||||
U_BOOT_DEVICE(stm32mp_bsec) = {
|
||||
.name = "stm32mp_bsec",
|
||||
.platdata = &stm32_bsec_platdata,
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
.probe = stm32mp_bsec_probe,
|
||||
#endif
|
||||
};
|
||||
|
||||
24
arch/arm/mach-stm32mp/cmd_poweroff.c
Normal file
24
arch/arm/mach-stm32mp/cmd_poweroff.c
Normal file
@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <sysreset.h>
|
||||
|
||||
int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
puts("poweroff ...\n");
|
||||
mdelay(100);
|
||||
|
||||
ret = sysreset_walk(SYSRESET_POWER);
|
||||
|
||||
if (ret == -EINPROGRESS)
|
||||
mdelay(1000);
|
||||
|
||||
/*NOTREACHED when power off*/
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
100
arch/arm/mach-stm32mp/cmd_stm32key.c
Normal file
100
arch/arm/mach-stm32mp/cmd_stm32key.c
Normal file
@ -0,0 +1,100 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <console.h>
|
||||
#include <misc.h>
|
||||
#include <dm/device.h>
|
||||
#include <dm/uclass.h>
|
||||
|
||||
#define STM32_OTP_HASH_KEY_START 24
|
||||
#define STM32_OTP_HASH_KEY_SIZE 8
|
||||
|
||||
static void read_hash_value(u32 addr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
|
||||
printf("OTP value %i: %x\n", STM32_OTP_HASH_KEY_START + i,
|
||||
__be32_to_cpu(*(u32 *)addr));
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void fuse_hash_value(u32 addr, bool print)
|
||||
{
|
||||
struct udevice *dev;
|
||||
u32 word, val;
|
||||
int i, ret;
|
||||
|
||||
ret = uclass_get_device_by_driver(UCLASS_MISC,
|
||||
DM_GET_DRIVER(stm32mp_bsec),
|
||||
&dev);
|
||||
if (ret) {
|
||||
pr_err("Can't find stm32mp_bsec driver\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
|
||||
if (print)
|
||||
printf("Fuse OTP %i : %x\n",
|
||||
STM32_OTP_HASH_KEY_START + i,
|
||||
__be32_to_cpu(*(u32 *)addr));
|
||||
|
||||
word = STM32_OTP_HASH_KEY_START + i;
|
||||
val = __be32_to_cpu(*(u32 *)addr);
|
||||
misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
|
||||
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static int confirm_prog(void)
|
||||
{
|
||||
puts("Warning: Programming fuses is an irreversible operation!\n"
|
||||
" This may brick your system.\n"
|
||||
" Use this command only if you are sure of what you are doing!\n"
|
||||
"\nReally perform this fuse programming? <y/N>\n");
|
||||
|
||||
if (confirm_yesno())
|
||||
return 1;
|
||||
|
||||
puts("Fuse programming aborted\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_stm32key(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
u32 addr;
|
||||
const char *op = argc >= 2 ? argv[1] : NULL;
|
||||
int confirmed = argc > 3 && !strcmp(argv[2], "-y");
|
||||
|
||||
argc -= 2 + confirmed;
|
||||
argv += 2 + confirmed;
|
||||
|
||||
if (argc < 1)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
addr = simple_strtoul(argv[0], NULL, 16);
|
||||
if (!addr)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
if (!strcmp(op, "read"))
|
||||
read_hash_value(addr);
|
||||
|
||||
if (!strcmp(op, "fuse")) {
|
||||
if (!confirmed && !confirm_prog())
|
||||
return CMD_RET_FAILURE;
|
||||
fuse_hash_value(addr, !confirmed);
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(stm32key, 4, 1, do_stm32key,
|
||||
"Fuse ST Hash key",
|
||||
"read <addr>: Read the hash store at addr in memory\n"
|
||||
"stm32key fuse [-y] <addr> : Fuse hash store at addr in otp\n");
|
||||
9
arch/arm/mach-stm32mp/cmd_stm32prog/Makefile
Normal file
9
arch/arm/mach-stm32mp/cmd_stm32prog/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
#
|
||||
|
||||
obj-y += cmd_stm32prog.o
|
||||
obj-y += stm32prog.o
|
||||
obj-y += stm32prog_serial.o
|
||||
obj-y += stm32prog_usb.o
|
||||
102
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
Normal file
102
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
Normal file
@ -0,0 +1,102 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <dfu.h>
|
||||
#include "stm32prog.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static void enable_vidconsole(void)
|
||||
{
|
||||
#ifdef CONFIG_DM_VIDEO
|
||||
char *stdname;
|
||||
char buf[64];
|
||||
|
||||
stdname = env_get("stdout");
|
||||
if (!strstr(stdname, "vidconsole")) {
|
||||
snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
|
||||
env_set("stdout", buf);
|
||||
}
|
||||
|
||||
stdname = env_get("stderr");
|
||||
if (!strstr(stdname, "vidconsole")) {
|
||||
snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
|
||||
env_set("stderr", buf);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char * const argv[])
|
||||
{
|
||||
struct stm32prog_data *data;
|
||||
ulong addr, size;
|
||||
int dev;
|
||||
enum stm32prog_link_t link = LINK_UNDEFINED;
|
||||
bool reset = false;
|
||||
|
||||
if (argc < 3 || argc > 5)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
if (!strcmp(argv[1], "serial")) {
|
||||
link = LINK_SERIAL;
|
||||
} else {
|
||||
if (!strcmp(argv[1], "usb")) {
|
||||
link = LINK_USB;
|
||||
} else {
|
||||
pr_err("not supported link=%s\n", argv[1]);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
}
|
||||
dev = (int)simple_strtoul(argv[2], NULL, 10);
|
||||
|
||||
addr = STM32_DDR_BASE;
|
||||
size = 0;
|
||||
if (argc > 3) {
|
||||
addr = simple_strtoul(argv[3], NULL, 16);
|
||||
if (!addr)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
if (argc > 4)
|
||||
size = simple_strtoul(argv[4], NULL, 16);
|
||||
|
||||
enable_vidconsole();
|
||||
|
||||
data = stm32prog_init(link, dev, addr, size);
|
||||
if (!data)
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
switch (link) {
|
||||
case LINK_SERIAL:
|
||||
reset = stm32prog_serial_loop(data);
|
||||
break;
|
||||
case LINK_USB:
|
||||
reset = stm32prog_usb_loop(data, dev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
stm32prog_clean(data);
|
||||
|
||||
puts("Download done\n");
|
||||
if (reset) {
|
||||
puts("Reset...\n");
|
||||
run_command("reset", 0);
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(stm32prog, 5, 0, do_stm32prog,
|
||||
"<link> <dev> [<addr>] [<size>]\n"
|
||||
"start communication with tools STM32Cubeprogrammer on <link> with Flashlayout at <addr>",
|
||||
"<link> = serial|usb\n"
|
||||
"<dev> = device instance\n"
|
||||
"<addr> = address of flashlayout\n"
|
||||
"<size> = size of flashlayout\n"
|
||||
);
|
||||
1647
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
Normal file
1647
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
Normal file
File diff suppressed because it is too large
Load Diff
202
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
Normal file
202
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
Normal file
@ -0,0 +1,202 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#ifndef _STM32PROG_H_
|
||||
#define _STM32PROG_H_
|
||||
|
||||
/* - configuration part -----------------------------*/
|
||||
#define USART_BL_VERSION 0x40 /* USART bootloader version V4.0*/
|
||||
#define UBOOT_BL_VERSION 0x03 /* bootloader version V0.3*/
|
||||
#define DEVICE_ID_BYTE1 0x05 /* MSB byte of device ID*/
|
||||
#define DEVICE_ID_BYTE2 0x00 /* LSB byte of device ID*/
|
||||
#define USART_RAM_BUFFER_SIZE 256 /* Size of USART_RAM_Buf buffer*/
|
||||
|
||||
/* - Commands -----------------------------*/
|
||||
#define GET_CMD_COMMAND 0x00 /* Get CMD command*/
|
||||
#define GET_VER_COMMAND 0x01 /* Get Version command*/
|
||||
#define GET_ID_COMMAND 0x02 /* Get ID command*/
|
||||
#define GET_PHASE_COMMAND 0x03 /* Get Phase command*/
|
||||
#define RM_COMMAND 0x11 /* Read Memory command*/
|
||||
#define READ_PART_COMMAND 0x12 /* Read Partition command*/
|
||||
#define START_COMMAND 0x21 /* START command (Go)*/
|
||||
#define DOWNLOAD_COMMAND 0x31 /* Download command*/
|
||||
/* existing command for other STM32 but not used */
|
||||
/* ERASE 0x43 */
|
||||
/* EXTENDED_ERASE 0x44 */
|
||||
/* WRITE_UNPROTECTED 0x73 */
|
||||
/* READOUT_PROTECT 0x82 */
|
||||
/* READOUT_UNPROTECT 0x92 */
|
||||
|
||||
/* - miscellaneous defines ----------------------------------------*/
|
||||
#define INIT_BYTE 0x7F /*Init Byte ID*/
|
||||
#define ACK_BYTE 0x79 /*Acknowlede Byte ID*/
|
||||
#define NACK_BYTE 0x1F /*No Acknowlede Byte ID*/
|
||||
#define ABORT_BYTE 0x5F /*ABORT*/
|
||||
|
||||
/* - phase defines ------------------------------------------------*/
|
||||
#define PHASE_FLASHLAYOUT 0x00
|
||||
#define PHASE_FIRST_USER 0x10
|
||||
#define PHASE_LAST_USER 0xF0
|
||||
#define PHASE_CMD 0xF1
|
||||
#define PHASE_OTP 0xF2
|
||||
#define PHASE_SSP 0xF3
|
||||
#define PHASE_PMIC 0xF4
|
||||
#define PHASE_END 0xFE
|
||||
#define PHASE_RESET 0xFF
|
||||
#define PHASE_DO_RESET 0x1FF
|
||||
|
||||
#define DEFAULT_ADDRESS 0xFFFFFFFF
|
||||
|
||||
#define OTP_SIZE 1024
|
||||
#define PMIC_SIZE 8
|
||||
|
||||
enum stm32prog_link_t {
|
||||
LINK_SERIAL,
|
||||
LINK_USB,
|
||||
LINK_UNDEFINED,
|
||||
};
|
||||
|
||||
struct image_header_s {
|
||||
bool present;
|
||||
u32 image_checksum;
|
||||
u32 image_length;
|
||||
};
|
||||
|
||||
struct raw_header_s {
|
||||
u32 magic_number;
|
||||
u32 image_signature[64 / 4];
|
||||
u32 image_checksum;
|
||||
u32 header_version;
|
||||
u32 image_length;
|
||||
u32 image_entry_point;
|
||||
u32 reserved1;
|
||||
u32 load_address;
|
||||
u32 reserved2;
|
||||
u32 version_number;
|
||||
u32 option_flags;
|
||||
u32 ecdsa_algorithm;
|
||||
u32 ecdsa_public_key[64 / 4];
|
||||
u32 padding[83 / 4];
|
||||
u32 binary_type;
|
||||
};
|
||||
|
||||
#define BL_HEADER_SIZE sizeof(struct raw_header_s)
|
||||
|
||||
/* partition type in flashlayout file */
|
||||
enum stm32prog_part_type {
|
||||
PART_BINARY,
|
||||
PART_SYSTEM,
|
||||
PART_FILESYSTEM,
|
||||
RAW_IMAGE
|
||||
};
|
||||
|
||||
/* device information */
|
||||
struct stm32prog_dev_t {
|
||||
enum dfu_device_type dev_type;
|
||||
char dev_id;
|
||||
struct blk_desc *block_dev;
|
||||
u32 lba_blk_size; /* for MMC RAW */
|
||||
u32 erase_size;
|
||||
struct mtd_info *mtd;
|
||||
/* list of partition for this device / ordered in offset */
|
||||
struct list_head part_list;
|
||||
};
|
||||
|
||||
/* partition information build form FlashLayout and device */
|
||||
struct stm32prog_part_t {
|
||||
/* FlashLayout inforamtion */
|
||||
int option;
|
||||
int id;
|
||||
enum stm32prog_part_type part_type;
|
||||
enum dfu_device_type dev_type;
|
||||
char dev_id;
|
||||
/* partition name
|
||||
* (16 char in gpt, + 1 for null terminated string
|
||||
*/
|
||||
char name[16 + 1];
|
||||
u64 addr;
|
||||
u64 size;
|
||||
enum stm32prog_part_type bin_nb; /* SSBL repeatition */
|
||||
|
||||
/* information on associated device */
|
||||
struct stm32prog_dev_t *dev; /* pointer to device */
|
||||
/* partition id in gpt when >0, -1 and -2 for boot partition of MMC */
|
||||
s16 part_id;
|
||||
int alt_id; /* alt id in usb/dfu */
|
||||
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
#define STM32PROG_MAX_DEV 5
|
||||
struct stm32prog_data {
|
||||
/* Layout information */
|
||||
int dev_nb; /* device number*/
|
||||
struct stm32prog_dev_t dev[STM32PROG_MAX_DEV]; /* array of device */
|
||||
int part_nb; /* nb of partition */
|
||||
struct stm32prog_part_t *part_array; /* array of partition */
|
||||
int full_update;
|
||||
|
||||
/* command internal information */
|
||||
int phase;
|
||||
u32 offset;
|
||||
char error[255];
|
||||
struct stm32prog_part_t *cur_part;
|
||||
u32 *otp_part;
|
||||
u8 pmic_part[PMIC_SIZE];
|
||||
|
||||
/* STM32 header information */
|
||||
struct raw_header_s *header_data;
|
||||
struct image_header_s header;
|
||||
|
||||
/* SERIAL information */
|
||||
u32 cursor;
|
||||
u32 packet_number;
|
||||
u32 checksum;
|
||||
u8 *buffer; /* size = USART_RAM_BUFFER_SIZE*/
|
||||
int dfu_seq;
|
||||
u8 read_phase;
|
||||
};
|
||||
|
||||
/* OTP access */
|
||||
int stm32prog_otp_write(struct stm32prog_data *data, u32 offset,
|
||||
u8 *buffer, long *size);
|
||||
int stm32prog_otp_read(struct stm32prog_data *data, u32 offset,
|
||||
u8 *buffer, long *size);
|
||||
int stm32prog_otp_start(struct stm32prog_data *data);
|
||||
|
||||
/* PMIC access */
|
||||
int stm32prog_pmic_write(struct stm32prog_data *data, u32 offset,
|
||||
u8 *buffer, long *size);
|
||||
int stm32prog_pmic_read(struct stm32prog_data *data, u32 offset,
|
||||
u8 *buffer, long *size);
|
||||
int stm32prog_pmic_start(struct stm32prog_data *data);
|
||||
|
||||
/* generic part*/
|
||||
u8 stm32prog_header_check(struct raw_header_s *raw_header,
|
||||
struct image_header_s *header);
|
||||
int stm32prog_dfu_init(struct stm32prog_data *data);
|
||||
void stm32prog_end_phase(struct stm32prog_data *data);
|
||||
void stm32prog_next_phase(struct stm32prog_data *data);
|
||||
void stm32prog_do_reset(struct stm32prog_data *data);
|
||||
|
||||
int stm32prog_serial_init(struct stm32prog_data *data, int link_dev);
|
||||
|
||||
char *stm32prog_get_error(struct stm32prog_data *data);
|
||||
|
||||
#define stm32prog_err(args...) {\
|
||||
if (data->phase != PHASE_RESET) { \
|
||||
sprintf(data->error, args); \
|
||||
data->phase = PHASE_RESET; \
|
||||
pr_err("Error: %s\n", data->error); } \
|
||||
}
|
||||
|
||||
/* Main function */
|
||||
struct stm32prog_data *stm32prog_init(enum stm32prog_link_t link,
|
||||
int dev, ulong addr, ulong size);
|
||||
bool stm32prog_serial_loop(struct stm32prog_data *data);
|
||||
bool stm32prog_usb_loop(struct stm32prog_data *data, int dev);
|
||||
void stm32prog_clean(struct stm32prog_data *data);
|
||||
|
||||
#endif
|
||||
972
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
Normal file
972
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
Normal file
@ -0,0 +1,972 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <dfu.h>
|
||||
#include <malloc.h>
|
||||
#include <serial.h>
|
||||
#include <watchdog.h>
|
||||
#include <dm/lists.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include "stm32prog.h"
|
||||
|
||||
struct udevice *down_serial_dev;
|
||||
|
||||
const u8 cmd_id[] = {
|
||||
GET_CMD_COMMAND,
|
||||
GET_VER_COMMAND,
|
||||
GET_ID_COMMAND,
|
||||
GET_PHASE_COMMAND,
|
||||
RM_COMMAND,
|
||||
READ_PART_COMMAND,
|
||||
START_COMMAND,
|
||||
DOWNLOAD_COMMAND
|
||||
};
|
||||
|
||||
#define NB_CMD sizeof(cmd_id)
|
||||
|
||||
/* DFU support for serial *********************************************/
|
||||
struct dfu_entity *stm32prog_get_entity(struct stm32prog_data *data)
|
||||
{
|
||||
int alt_id;
|
||||
|
||||
if (!data->cur_part)
|
||||
if (data->phase == PHASE_FLASHLAYOUT)
|
||||
alt_id = 0;
|
||||
else
|
||||
return NULL;
|
||||
else
|
||||
alt_id = data->cur_part->alt_id;
|
||||
|
||||
return dfu_get_entity(alt_id);
|
||||
}
|
||||
|
||||
static int stm32prog_write(struct stm32prog_data *data, u8 *buffer,
|
||||
u32 buffer_size)
|
||||
{
|
||||
struct dfu_entity *dfu_entity;
|
||||
u8 ret = 0;
|
||||
|
||||
dfu_entity = stm32prog_get_entity(data);
|
||||
if (!dfu_entity)
|
||||
return -ENODEV;
|
||||
|
||||
ret = dfu_write(dfu_entity,
|
||||
buffer,
|
||||
buffer_size,
|
||||
data->dfu_seq);
|
||||
|
||||
if (ret) {
|
||||
stm32prog_err("DFU write failed [%d] cnt: %d",
|
||||
ret, data->dfu_seq);
|
||||
}
|
||||
data->dfu_seq++;
|
||||
/* handle rollover as in driver/dfu/dfu.c */
|
||||
data->dfu_seq &= 0xffff;
|
||||
if (buffer_size == 0)
|
||||
data->dfu_seq = 0; /* flush done */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int stm32prog_read(struct stm32prog_data *data, u8 phase, u32 offset,
|
||||
u8 *buffer, u32 buffer_size)
|
||||
{
|
||||
struct dfu_entity *dfu_entity;
|
||||
int ret;
|
||||
|
||||
/* pr_debug("%s entry\n", __func__); */
|
||||
if (data->dfu_seq) {
|
||||
stm32prog_err("DFU write pending for phase %d, seq %d",
|
||||
data->phase, data->dfu_seq);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (phase == PHASE_FLASHLAYOUT || phase > PHASE_LAST_USER) {
|
||||
stm32prog_err("read failed : phase %d is invalid", phase);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (data->read_phase <= PHASE_LAST_USER &&
|
||||
phase != data->read_phase) {
|
||||
/* clear previous read session */
|
||||
dfu_entity = dfu_get_entity(data->read_phase - 1);
|
||||
if (dfu_entity)
|
||||
dfu_transaction_cleanup(dfu_entity);
|
||||
}
|
||||
dfu_entity = dfu_get_entity(phase - 1);
|
||||
if (!dfu_entity) {
|
||||
stm32prog_err("read failed : phase %d is unknown", phase);
|
||||
return -ENODEV;
|
||||
}
|
||||
/* clear pending read before to force offset */
|
||||
if (dfu_entity->inited &&
|
||||
(data->read_phase != phase || data->offset != offset))
|
||||
dfu_transaction_cleanup(dfu_entity);
|
||||
|
||||
/* initiate before to force offset */
|
||||
if (!dfu_entity->inited) {
|
||||
ret = dfu_transaction_initiate(dfu_entity, true);
|
||||
if (ret < 0) {
|
||||
stm32prog_err("DFU read init failed [%d] phase = %d offset = 0x%08x",
|
||||
ret, phase, offset);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* force new offset */
|
||||
if (dfu_entity->offset != offset)
|
||||
dfu_entity->offset = offset;
|
||||
data->offset = offset;
|
||||
data->read_phase = phase;
|
||||
pr_debug("\nSTM32 download read %s offset=0x%x\n",
|
||||
dfu_entity->name, offset);
|
||||
ret = dfu_read(dfu_entity, buffer, buffer_size,
|
||||
dfu_entity->i_blk_seq_num);
|
||||
if (ret < 0) {
|
||||
stm32prog_err("DFU read failed [%d] phase = %d offset = 0x%08x",
|
||||
ret, phase, offset);
|
||||
return ret;
|
||||
}
|
||||
if (ret < buffer_size) {
|
||||
data->offset = 0;
|
||||
data->read_phase = PHASE_END;
|
||||
memset(buffer + ret, 0, buffer_size - ret);
|
||||
} else {
|
||||
data->offset += ret;
|
||||
}
|
||||
/*pr_debug("%s exit ret=%d\n", __func__, ret);*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* UART access ***************************************************/
|
||||
int stm32prog_serial_init(struct stm32prog_data *data, int link_dev)
|
||||
{
|
||||
struct udevice *dev = NULL;
|
||||
int node;
|
||||
char alias[10];
|
||||
const char *path;
|
||||
struct dm_serial_ops *ops;
|
||||
/* no parity, 8 bits, 1 stop */
|
||||
u32 serial_config = SERIAL_DEFAULT_CONFIG;
|
||||
|
||||
down_serial_dev = NULL;
|
||||
|
||||
sprintf(alias, "serial%d", link_dev);
|
||||
path = fdt_get_alias(gd->fdt_blob, alias);
|
||||
if (!path) {
|
||||
pr_err("%s alias not found", alias);
|
||||
return -ENODEV;
|
||||
}
|
||||
node = fdt_path_offset(gd->fdt_blob, path);
|
||||
if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node,
|
||||
&dev)) {
|
||||
down_serial_dev = dev;
|
||||
} else if (node > 0 &&
|
||||
!lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
|
||||
&dev)) {
|
||||
if (!device_probe(dev))
|
||||
down_serial_dev = dev;
|
||||
}
|
||||
/*pr_debug("alias=%s, path=%s, node = %d, dev=%0x\n",
|
||||
* alias, path, node, (u32)down_serial_dev);
|
||||
*/
|
||||
if (!down_serial_dev) {
|
||||
pr_err("%s = %s device not found", alias, path);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* force silent console on uart only when used */
|
||||
if (gd->cur_serial_dev == down_serial_dev)
|
||||
gd->flags |= GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT;
|
||||
else
|
||||
gd->flags &= ~(GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT);
|
||||
|
||||
ops = serial_get_ops(down_serial_dev);
|
||||
|
||||
if (!ops) {
|
||||
pr_err("%s = %s missing ops", alias, path);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (!ops->setconfig) {
|
||||
pr_err("%s = %s missing setconfig", alias, path);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
clrsetbits_le32(&serial_config, SERIAL_PAR_MASK, SERIAL_PAR_EVEN);
|
||||
|
||||
return ops->setconfig(down_serial_dev, serial_config);
|
||||
}
|
||||
|
||||
static void stm32prog_serial_flush(void)
|
||||
{
|
||||
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
|
||||
int err;
|
||||
|
||||
do {
|
||||
err = ops->getc(down_serial_dev);
|
||||
} while (err != -EAGAIN);
|
||||
}
|
||||
|
||||
static int stm32prog_serial_getc_err(void)
|
||||
{
|
||||
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
|
||||
int err;
|
||||
|
||||
do {
|
||||
err = ops->getc(down_serial_dev);
|
||||
if (err == -EAGAIN)
|
||||
ctrlc();
|
||||
} while ((err == -EAGAIN) && (!had_ctrlc()));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static u8 stm32prog_serial_getc(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = stm32prog_serial_getc_err();
|
||||
|
||||
return err >= 0 ? err : 0;
|
||||
}
|
||||
|
||||
static bool stm32prog_serial_get_buffer(u8 *buffer, u32 *count)
|
||||
{
|
||||
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
|
||||
int err;
|
||||
|
||||
do {
|
||||
err = ops->getc(down_serial_dev);
|
||||
if (err >= 0) {
|
||||
*buffer++ = err;
|
||||
*count -= 1;
|
||||
} else if (err == -EAGAIN) {
|
||||
ctrlc();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (*count && !had_ctrlc());
|
||||
|
||||
return !!(err < 0);
|
||||
}
|
||||
|
||||
static void stm32prog_serial_putc(u8 w_byte)
|
||||
{
|
||||
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
|
||||
int err;
|
||||
|
||||
do {
|
||||
err = ops->putc(down_serial_dev, w_byte);
|
||||
} while (err == -EAGAIN);
|
||||
}
|
||||
|
||||
/* Helper function ************************************************/
|
||||
|
||||
static u8 stm32prog_header(struct stm32prog_data *data)
|
||||
{
|
||||
u8 ret;
|
||||
u8 boot = 0;
|
||||
struct dfu_entity *dfu_entity;
|
||||
u64 size = 0;
|
||||
|
||||
/*pr_debug("%s entry\n", __func__);*/
|
||||
|
||||
dfu_entity = stm32prog_get_entity(data);
|
||||
if (!dfu_entity)
|
||||
return -ENODEV;
|
||||
|
||||
printf("\nSTM32 download write %s\n", dfu_entity->name);
|
||||
|
||||
/* force cleanup to avoid issue with previous read */
|
||||
dfu_transaction_cleanup(dfu_entity);
|
||||
|
||||
ret = stm32prog_header_check(data->header_data,
|
||||
&data->header);
|
||||
|
||||
/* no header : max size is partition size */
|
||||
if (ret) {
|
||||
dfu_entity->get_medium_size(dfu_entity, &size);
|
||||
data->header.image_length = size;
|
||||
}
|
||||
|
||||
/**** Flash the header if necessary for boot partition */
|
||||
if (data->phase < PHASE_FIRST_USER)
|
||||
boot = 1;
|
||||
|
||||
/* write header if boot partition */
|
||||
if (boot) {
|
||||
if (ret) {
|
||||
stm32prog_err("invalid header (error %d)", ret);
|
||||
} else {
|
||||
ret = stm32prog_write(data,
|
||||
(u8 *)data->header_data,
|
||||
BL_HEADER_SIZE);
|
||||
}
|
||||
} else {
|
||||
if (ret)
|
||||
printf(" partition without checksum\n");
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
free(data->header_data);
|
||||
data->header_data = NULL;
|
||||
/*pr_debug("%s result=%d\n", __func__, ret);*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
|
||||
{
|
||||
u8 ret = 0;
|
||||
struct dfu_entity *dfu_entity;
|
||||
|
||||
/*pr_debug("%s entry\n", __func__);*/
|
||||
|
||||
if (address < 0x100) {
|
||||
if (address == PHASE_OTP)
|
||||
return stm32prog_otp_start(data);
|
||||
|
||||
if (address == PHASE_PMIC)
|
||||
return stm32prog_pmic_start(data);
|
||||
|
||||
if (address == PHASE_RESET || address == PHASE_END) {
|
||||
data->cur_part = NULL;
|
||||
data->dfu_seq = 0;
|
||||
data->phase = address;
|
||||
return 0;
|
||||
}
|
||||
if (address != data->phase) {
|
||||
stm32prog_err("invalid received phase id %d, current phase is %d",
|
||||
(u8)address, (u8)data->phase);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
/* check the last loaded partition */
|
||||
if (address == DEFAULT_ADDRESS || address == data->phase) {
|
||||
switch (data->phase) {
|
||||
case PHASE_END:
|
||||
case PHASE_RESET:
|
||||
case PHASE_DO_RESET:
|
||||
data->cur_part = NULL;
|
||||
data->phase = PHASE_DO_RESET;
|
||||
return 0;
|
||||
}
|
||||
dfu_entity = stm32prog_get_entity(data);
|
||||
if (!dfu_entity)
|
||||
return -ENODEV;
|
||||
|
||||
if (data->dfu_seq) {
|
||||
ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq);
|
||||
data->dfu_seq = 0;
|
||||
if (ret) {
|
||||
stm32prog_err("DFU flush failed [%d]", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
printf("\n received length = 0x%x\n", data->cursor);
|
||||
if (data->header.present) {
|
||||
if (data->cursor !=
|
||||
(data->header.image_length + BL_HEADER_SIZE)) {
|
||||
stm32prog_err("transmission interrupted (length=0x%x expected=0x%x)",
|
||||
data->cursor,
|
||||
data->header.image_length +
|
||||
BL_HEADER_SIZE);
|
||||
return -EIO;
|
||||
}
|
||||
if (data->header.image_checksum != data->checksum) {
|
||||
stm32prog_err("invalid checksum received (0x%x expected 0x%x)",
|
||||
data->checksum,
|
||||
data->header.image_checksum);
|
||||
return -EIO;
|
||||
}
|
||||
printf("\n checksum OK (0x%x)\n", data->checksum);
|
||||
}
|
||||
|
||||
stm32prog_end_phase(data);
|
||||
/* update DFU with received flashlayout */
|
||||
if (data->phase == PHASE_FLASHLAYOUT)
|
||||
stm32prog_dfu_init(data);
|
||||
/* found next selected partition */
|
||||
stm32prog_next_phase(data);
|
||||
} else {
|
||||
void (*entry)(void) = (void *)address;
|
||||
|
||||
printf("## Starting application at 0x%x ...\n", address);
|
||||
(*entry)();
|
||||
printf("## Application terminated\n");
|
||||
ret = -ENOEXEC;
|
||||
}
|
||||
/*pr_debug("%s exit ret=%d, phase=0x%x, add=0x%x\n", __func__,
|
||||
* ret, data->phase, address);
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : get_address
|
||||
* Description : Get address if it is valid
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : The address area or Error_32
|
||||
*/
|
||||
static u32 get_address(u8 *tmp_xor)
|
||||
{
|
||||
u32 address = 0x0;
|
||||
u8 data;
|
||||
|
||||
data = stm32prog_serial_getc();
|
||||
*tmp_xor ^= data;
|
||||
address |= ((u32)data) << 24;
|
||||
|
||||
data = stm32prog_serial_getc();
|
||||
address |= ((u32)data) << 16;
|
||||
*tmp_xor ^= data;
|
||||
|
||||
data = stm32prog_serial_getc();
|
||||
address |= ((u32)data) << 8;
|
||||
*tmp_xor ^= data;
|
||||
|
||||
data = stm32prog_serial_getc();
|
||||
address |= ((u32)data);
|
||||
*tmp_xor ^= data;
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
static void stm32prog_serial_result(u8 result)
|
||||
{
|
||||
/* always flush fifo before to send result */
|
||||
stm32prog_serial_flush();
|
||||
stm32prog_serial_putc(result);
|
||||
}
|
||||
|
||||
/* Command -----------------------------------------------*/
|
||||
/*
|
||||
* Function Name : get_cmd_command
|
||||
* Description : Respond to Get command
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void get_cmd_command(struct stm32prog_data *data)
|
||||
{
|
||||
u32 counter = 0x0;
|
||||
|
||||
stm32prog_serial_putc(NB_CMD);
|
||||
stm32prog_serial_putc(USART_BL_VERSION);
|
||||
|
||||
for (counter = 0; counter < NB_CMD; counter++)
|
||||
stm32prog_serial_putc(cmd_id[counter]);
|
||||
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : get_version_command
|
||||
* Description : Respond to Get Version command
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void get_version_command(struct stm32prog_data *data)
|
||||
{
|
||||
stm32prog_serial_putc(UBOOT_BL_VERSION);
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : get_id_command
|
||||
* Description : Respond to Get ID command
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void get_id_command(struct stm32prog_data *data)
|
||||
{
|
||||
/* Send Device IDCode */
|
||||
stm32prog_serial_putc(0x1);
|
||||
stm32prog_serial_putc(DEVICE_ID_BYTE1);
|
||||
stm32prog_serial_putc(DEVICE_ID_BYTE2);
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : get_phase_command
|
||||
* Description : Respond to Get phase
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void get_phase_command(struct stm32prog_data *data)
|
||||
{
|
||||
char *err_msg = NULL;
|
||||
u8 i, length = 0;
|
||||
u32 destination = DEFAULT_ADDRESS; /* destination address */
|
||||
int phase = data->phase;
|
||||
|
||||
if (phase == PHASE_RESET || phase == PHASE_DO_RESET) {
|
||||
err_msg = stm32prog_get_error(data);
|
||||
length = strlen(err_msg);
|
||||
}
|
||||
if (phase == PHASE_FLASHLAYOUT)
|
||||
destination = STM32_DDR_BASE;
|
||||
|
||||
stm32prog_serial_putc(length + 5); /* Total length */
|
||||
stm32prog_serial_putc(phase & 0xFF); /* partition ID */
|
||||
stm32prog_serial_putc(destination); /* byte 1 of address */
|
||||
stm32prog_serial_putc(destination >> 8); /* byte 2 of address */
|
||||
stm32prog_serial_putc(destination >> 16); /* byte 3 of address */
|
||||
stm32prog_serial_putc(destination >> 24); /* byte 4 of address */
|
||||
|
||||
stm32prog_serial_putc(length); /* Information length */
|
||||
for (i = 0; i < length; i++)
|
||||
stm32prog_serial_putc(err_msg[i]);
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
|
||||
if (phase == PHASE_RESET)
|
||||
stm32prog_do_reset(data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : read_memory_command
|
||||
* Description : Read data from memory
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void read_memory_command(struct stm32prog_data *data)
|
||||
{
|
||||
u32 address = 0x0;
|
||||
u8 rcv_data = 0x0, tmp_xor = 0x0;
|
||||
u32 counter = 0x0;
|
||||
|
||||
/* Read memory address */
|
||||
address = get_address(&tmp_xor);
|
||||
|
||||
/* If address memory is not received correctly */
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
if (rcv_data != tmp_xor) {
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
return;
|
||||
}
|
||||
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
|
||||
/* Read the number of bytes to be received:
|
||||
* Max NbrOfData = Data + 1 = 256
|
||||
*/
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
tmp_xor = ~rcv_data;
|
||||
if (stm32prog_serial_getc() != tmp_xor) {
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If checksum is correct send ACK */
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
|
||||
/* Send data to the host:
|
||||
* Number of data to read = data + 1
|
||||
*/
|
||||
for (counter = (rcv_data + 1); counter != 0; counter--)
|
||||
stm32prog_serial_putc(*(u8 *)(address++));
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : start_command
|
||||
* Description : Jump to user application in RAM or partition check
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
static void start_command(struct stm32prog_data *data)
|
||||
{
|
||||
u32 address = 0;
|
||||
u8 tmp_xor = 0x0;
|
||||
u8 ret, rcv_data;
|
||||
|
||||
/* Read memory address */
|
||||
address = get_address(&tmp_xor);
|
||||
|
||||
/* If address memory is not received correctly */
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
if (rcv_data != tmp_xor) {
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
return;
|
||||
}
|
||||
/* validate partition */
|
||||
ret = stm32prog_start(data,
|
||||
address);
|
||||
|
||||
if (ret)
|
||||
stm32prog_serial_result(ABORT_BYTE);
|
||||
else
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : download_command
|
||||
* Description : Write data to Flash
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Result
|
||||
*/
|
||||
static void download_command(struct stm32prog_data *data)
|
||||
{
|
||||
u32 address = 0x0;
|
||||
u8 my_xor = 0x0;
|
||||
u8 rcv_xor;
|
||||
u32 counter = 0x0, codesize = 0x0;
|
||||
u8 *ramaddress = 0;
|
||||
u8 rcv_data = 0x0;
|
||||
struct image_header_s *image_header = &data->header;
|
||||
u32 cursor = data->cursor;
|
||||
long size = 0;
|
||||
u8 operation;
|
||||
u32 packet_number;
|
||||
u32 result = ACK_BYTE;
|
||||
u8 ret;
|
||||
int i;
|
||||
bool error;
|
||||
int rcv;
|
||||
|
||||
address = get_address(&my_xor);
|
||||
|
||||
/* If address memory is not received correctly */
|
||||
rcv_xor = stm32prog_serial_getc();
|
||||
if (rcv_xor != my_xor) {
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* If address valid send ACK */
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
|
||||
/* get packet number and operation type */
|
||||
operation = (u8)((u32)address >> 24);
|
||||
packet_number = ((u32)(((u32)address << 8))) >> 8;
|
||||
|
||||
switch (operation) {
|
||||
/* supported operation */
|
||||
case PHASE_FLASHLAYOUT:
|
||||
case PHASE_OTP:
|
||||
case PHASE_PMIC:
|
||||
break;
|
||||
default:
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
/* check the packet number */
|
||||
if (packet_number == 0) {
|
||||
/* erase: re-initialize the image_header struct */
|
||||
data->packet_number = 0;
|
||||
if (data->header_data)
|
||||
memset(data->header_data, 0, BL_HEADER_SIZE);
|
||||
else
|
||||
data->header_data = calloc(1, BL_HEADER_SIZE);
|
||||
cursor = 0;
|
||||
data->cursor = 0;
|
||||
data->checksum = 0;
|
||||
/*idx = cursor;*/
|
||||
} else {
|
||||
data->packet_number++;
|
||||
}
|
||||
|
||||
/* Check with the number of current packet if the device receive
|
||||
* the true packet
|
||||
*/
|
||||
if (packet_number != data->packet_number) {
|
||||
data->packet_number--;
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*-- Read number of bytes to be written and data -----------*/
|
||||
|
||||
/* Read the number of bytes to be written:
|
||||
* Max NbrOfData = data + 1 <= 256
|
||||
*/
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
|
||||
/* NbrOfData to write = data + 1 */
|
||||
codesize = rcv_data + 0x01;
|
||||
|
||||
if (codesize > USART_RAM_BUFFER_SIZE) {
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Checksum Initialization */
|
||||
my_xor = rcv_data;
|
||||
|
||||
/* UART receive data and send to Buffer */
|
||||
counter = codesize;
|
||||
error = stm32prog_serial_get_buffer(data->buffer, &counter);
|
||||
|
||||
/* read checksum */
|
||||
if (!error) {
|
||||
rcv = stm32prog_serial_getc_err();
|
||||
error = !!(rcv < 0);
|
||||
rcv_xor = rcv;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
printf("transmission error on packet %d, byte %d\n",
|
||||
packet_number, codesize - counter);
|
||||
/* waiting end of packet before flush & NACK */
|
||||
mdelay(30);
|
||||
data->packet_number--;
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Compute Checksum */
|
||||
ramaddress = data->buffer;
|
||||
for (counter = codesize; counter != 0; counter--)
|
||||
my_xor ^= *(ramaddress++);
|
||||
|
||||
/* If Checksum is incorrect */
|
||||
if (rcv_xor != my_xor) {
|
||||
printf("checksum error on packet %d\n",
|
||||
packet_number);
|
||||
data->packet_number--;
|
||||
result = NACK_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Update current position in buffer */
|
||||
data->cursor += codesize;
|
||||
|
||||
if (operation == PHASE_OTP) {
|
||||
size = data->cursor - cursor;
|
||||
/* no header for OTP */
|
||||
if (stm32prog_otp_write(data, cursor,
|
||||
data->buffer, &size))
|
||||
result = ABORT_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (operation == PHASE_PMIC) {
|
||||
size = data->cursor - cursor;
|
||||
/* no header for PMIC */
|
||||
if (stm32prog_pmic_write(data, cursor,
|
||||
data->buffer, &size))
|
||||
result = ABORT_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (cursor < BL_HEADER_SIZE) {
|
||||
/* size = portion of header in this chunck */
|
||||
if (data->cursor >= BL_HEADER_SIZE)
|
||||
size = BL_HEADER_SIZE - cursor;
|
||||
else
|
||||
size = data->cursor - cursor;
|
||||
memcpy((void *)((u32)(data->header_data) + cursor),
|
||||
data->buffer, size);
|
||||
cursor += size;
|
||||
|
||||
if (cursor == BL_HEADER_SIZE) {
|
||||
/* Check and Write the header */
|
||||
if (stm32prog_header(data)) {
|
||||
result = ABORT_BYTE;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* pr_debug("packet_number = 0x%x\n", packet_number);
|
||||
* pr_debug("cursor = 0x%x\n", data->cursor);
|
||||
* pr_debug("image_length = 0x%x\n", image_header->image_length);
|
||||
* pr_debug("codesize = 0x%x\n", codesize);
|
||||
*/
|
||||
if (image_header->present) {
|
||||
if (data->cursor <= BL_HEADER_SIZE)
|
||||
goto end;
|
||||
/* compute checksum on payload */
|
||||
for (i = size; i < codesize; i++)
|
||||
data->checksum += data->buffer[i];
|
||||
|
||||
if (data->cursor >
|
||||
image_header->image_length + BL_HEADER_SIZE) {
|
||||
pr_err("expected size exceeded\n");
|
||||
result = ABORT_BYTE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* write data (payload) */
|
||||
ret = stm32prog_write(data,
|
||||
&data->buffer[size],
|
||||
codesize - size);
|
||||
} else {
|
||||
/* write all */
|
||||
ret = stm32prog_write(data,
|
||||
data->buffer,
|
||||
codesize);
|
||||
}
|
||||
if (ret)
|
||||
result = ABORT_BYTE;
|
||||
|
||||
end:
|
||||
/*pr_debug("%s : result = 0x%x\n", __func__, result);*/
|
||||
stm32prog_serial_result(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function Name : read_partition
|
||||
* Description : read data from Flash
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Result
|
||||
*/
|
||||
static void read_partition_command(struct stm32prog_data *data)
|
||||
{
|
||||
u32 part_id, codesize, offset = 0, rcv_data;
|
||||
long size;
|
||||
u8 tmp_xor;
|
||||
int i, res;
|
||||
u8 buffer[256];
|
||||
|
||||
part_id = stm32prog_serial_getc();
|
||||
tmp_xor = part_id;
|
||||
|
||||
offset = get_address(&tmp_xor);
|
||||
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
if (rcv_data != tmp_xor) {
|
||||
pr_debug("1st checksum received = %x, computed %x\n",
|
||||
rcv_data, tmp_xor);
|
||||
goto error;
|
||||
}
|
||||
stm32prog_serial_putc(ACK_BYTE);
|
||||
|
||||
/* NbrOfData to read = data + 1 */
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
codesize = rcv_data + 0x01;
|
||||
tmp_xor = rcv_data;
|
||||
|
||||
rcv_data = stm32prog_serial_getc();
|
||||
if ((rcv_data ^ tmp_xor) != 0xFF) {
|
||||
pr_debug("2nd checksum received = %x, computed %x\n",
|
||||
rcv_data, tmp_xor);
|
||||
goto error;
|
||||
}
|
||||
|
||||
pr_debug("%s : %x\n", __func__, part_id);
|
||||
switch (part_id) {
|
||||
case PHASE_OTP:
|
||||
res = 0;
|
||||
size = codesize;
|
||||
if (!stm32prog_otp_read(data, offset, buffer, &size))
|
||||
res = size;
|
||||
break;
|
||||
case PHASE_PMIC:
|
||||
res = 0;
|
||||
size = codesize;
|
||||
if (!stm32prog_pmic_read(data, offset, buffer, &size))
|
||||
res = size;
|
||||
break;
|
||||
default:
|
||||
res = stm32prog_read(data, part_id, offset,
|
||||
buffer, codesize);
|
||||
break;
|
||||
}
|
||||
if (res > 0) {
|
||||
stm32prog_serial_putc(ACK_BYTE);
|
||||
/*----------- Send data to the host -----------*/
|
||||
for (i = 0; i < res; i++)
|
||||
stm32prog_serial_putc(buffer[i]);
|
||||
/*----------- Send filler to the host -----------*/
|
||||
for (; i < codesize; i++)
|
||||
stm32prog_serial_putc(0x0);
|
||||
return;
|
||||
}
|
||||
stm32prog_serial_result(ABORT_BYTE);
|
||||
return;
|
||||
|
||||
error:
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
}
|
||||
|
||||
/** SERIAL LOOP ****************************************************/
|
||||
|
||||
/*
|
||||
* Function Name : stm32prog_serial_loop
|
||||
* Description : USART bootloader Loop routine
|
||||
* Input : data
|
||||
* Output : None
|
||||
* Return : None
|
||||
*/
|
||||
bool stm32prog_serial_loop(struct stm32prog_data *data)
|
||||
{
|
||||
u32 counter = 0x0;
|
||||
u8 command = 0x0;
|
||||
u8 found;
|
||||
int phase = data->phase;
|
||||
|
||||
/* element of cmd_func need to aligned with cmd_id[]*/
|
||||
void (*cmd_func[NB_CMD])(struct stm32prog_data *) = {
|
||||
/* GET_CMD_COMMAND */ get_cmd_command,
|
||||
/* GET_VER_COMMAND */ get_version_command,
|
||||
/* GET_ID_COMMAND */ get_id_command,
|
||||
/* GET_PHASE_COMMAND */ get_phase_command,
|
||||
/* RM_COMMAND */ read_memory_command,
|
||||
/* READ_PART_COMMAND */ read_partition_command,
|
||||
/* START_COMMAND */ start_command,
|
||||
/* DOWNLOAD_COMMAND */ download_command
|
||||
};
|
||||
|
||||
/* flush and NACK pending command received during u-boot init
|
||||
* request command reemit
|
||||
*/
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
|
||||
clear_ctrlc(); /* forget any previous Control C */
|
||||
while (!had_ctrlc()) {
|
||||
phase = data->phase;
|
||||
|
||||
if (phase == PHASE_DO_RESET)
|
||||
return true;
|
||||
|
||||
/* Get the user command: read first byte */
|
||||
command = stm32prog_serial_getc();
|
||||
|
||||
if (command == INIT_BYTE) {
|
||||
puts("\nConnected\n");
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
continue;
|
||||
}
|
||||
|
||||
found = 0;
|
||||
for (counter = 0; counter < NB_CMD; counter++)
|
||||
if (cmd_id[counter] == command) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
if (found)
|
||||
if ((command ^ stm32prog_serial_getc()) != 0xFF)
|
||||
found = 0;
|
||||
if (!found) {
|
||||
/* wait to be sure that all data are received
|
||||
* in the FIFO before flush (CMD and XOR)
|
||||
*/
|
||||
mdelay(2);
|
||||
stm32prog_serial_result(NACK_BYTE);
|
||||
} else {
|
||||
/*pr_debug("+ cmd %x\n", counter);*/
|
||||
stm32prog_serial_result(ACK_BYTE);
|
||||
cmd_func[counter](data);
|
||||
}
|
||||
WATCHDOG_RESET();
|
||||
}
|
||||
|
||||
/* clean device */
|
||||
if (gd->cur_serial_dev == down_serial_dev) {
|
||||
/* restore console on uart */
|
||||
gd->flags &= ~(GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT);
|
||||
}
|
||||
down_serial_dev = NULL;
|
||||
|
||||
return false; /* no reset after ctrlc */
|
||||
}
|
||||
278
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
Normal file
278
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
Normal file
@ -0,0 +1,278 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <dfu.h>
|
||||
#include <g_dnl.h>
|
||||
#include <usb.h>
|
||||
#include <watchdog.h>
|
||||
#include "stm32prog.h"
|
||||
|
||||
struct stm32prog_data *stm32prog_data;
|
||||
|
||||
static int stm32prog_get_alternate(struct stm32prog_data *data)
|
||||
{
|
||||
if (data->cur_part)
|
||||
return data->cur_part->alt_id;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int stm32prog_set_phase(struct stm32prog_data *data, u8 phase,
|
||||
u32 offset)
|
||||
{
|
||||
struct stm32prog_part_t *part;
|
||||
int i;
|
||||
|
||||
if (phase == data->phase) {
|
||||
data->offset = offset;
|
||||
data->dfu_seq = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* found partition */
|
||||
for (i = 0; i < data->part_nb; i++) {
|
||||
part = &data->part_array[i];
|
||||
if (part->id == phase) {
|
||||
data->cur_part = part;
|
||||
data->phase = phase;
|
||||
data->offset = offset;
|
||||
data->dfu_seq = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int stm32prog_cmd_write(u64 offset, void *buf, long *len)
|
||||
{
|
||||
u8 phase;
|
||||
u32 address;
|
||||
u8 *pt = buf;
|
||||
void (*entry)(void);
|
||||
int ret;
|
||||
|
||||
if (*len < 5) {
|
||||
pr_err("size not allowed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (offset) {
|
||||
pr_err("invalid offset\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
phase = pt[0];
|
||||
address = (pt[1] << 24) | (pt[2] << 16) | (pt[3] << 8) | pt[4];
|
||||
if (phase == PHASE_RESET) {
|
||||
entry = (void *)address;
|
||||
printf("## Starting application at 0x%x ...\n", address);
|
||||
(*entry)();
|
||||
printf("## Application terminated\n");
|
||||
return 0;
|
||||
}
|
||||
/* set phase and offset */
|
||||
ret = stm32prog_set_phase(stm32prog_data, phase, address);
|
||||
if (ret)
|
||||
pr_err("failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define PHASE_MIN_SIZE 9
|
||||
static int stm32prog_cmd_read(u64 offset, void *buf, long *len)
|
||||
{
|
||||
u32 destination = DEFAULT_ADDRESS; /* destination address */
|
||||
u32 dfu_offset;
|
||||
u8 *pt_buf = buf;
|
||||
int phase;
|
||||
char *err_msg;
|
||||
int length;
|
||||
|
||||
if (*len < PHASE_MIN_SIZE) {
|
||||
pr_err("request exceeds allowed area\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (offset) {
|
||||
*len = 0; /* EOF for second request */
|
||||
return 0;
|
||||
}
|
||||
phase = stm32prog_data->phase;
|
||||
if (phase == PHASE_FLASHLAYOUT)
|
||||
destination = STM32_DDR_BASE;
|
||||
dfu_offset = stm32prog_data->offset;
|
||||
|
||||
/* mandatory header, size = PHASE_MIN_SIZE */
|
||||
*pt_buf++ = (u8)(phase & 0xFF);
|
||||
*pt_buf++ = (u8)(destination);
|
||||
*pt_buf++ = (u8)(destination >> 8);
|
||||
*pt_buf++ = (u8)(destination >> 16);
|
||||
*pt_buf++ = (u8)(destination >> 24);
|
||||
*pt_buf++ = (u8)(dfu_offset);
|
||||
*pt_buf++ = (u8)(dfu_offset >> 8);
|
||||
*pt_buf++ = (u8)(dfu_offset >> 16);
|
||||
*pt_buf++ = (u8)(dfu_offset >> 24);
|
||||
|
||||
if (phase == PHASE_RESET || phase == PHASE_DO_RESET) {
|
||||
err_msg = stm32prog_get_error(stm32prog_data);
|
||||
length = strlen(err_msg);
|
||||
if (length + PHASE_MIN_SIZE > *len)
|
||||
length = *len - PHASE_MIN_SIZE;
|
||||
|
||||
memcpy(pt_buf, err_msg, length);
|
||||
*len = PHASE_MIN_SIZE + length;
|
||||
stm32prog_do_reset(stm32prog_data);
|
||||
} else if (phase == PHASE_FLASHLAYOUT) {
|
||||
*pt_buf++ = stm32prog_data->part_nb ? 1 : 0;
|
||||
*len = PHASE_MIN_SIZE + 1;
|
||||
} else {
|
||||
*len = PHASE_MIN_SIZE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* DFU access to virtual partition */
|
||||
|
||||
void dfu_flush_callback(struct dfu_entity *dfu)
|
||||
{
|
||||
if (!stm32prog_data)
|
||||
return;
|
||||
|
||||
if (dfu->dev_type == DFU_DEV_VIRT) {
|
||||
if (dfu->data.virt.dev_num == PHASE_OTP)
|
||||
stm32prog_otp_start(stm32prog_data);
|
||||
else if (dfu->data.virt.dev_num == PHASE_PMIC)
|
||||
stm32prog_pmic_start(stm32prog_data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dfu->dev_type == DFU_DEV_RAM) {
|
||||
if (dfu->alt == 0 &&
|
||||
stm32prog_data->phase == PHASE_FLASHLAYOUT) {
|
||||
stm32prog_end_phase(stm32prog_data);
|
||||
/* waiting DFU DETACH for reenumeration */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (dfu->alt == stm32prog_get_alternate(stm32prog_data)) {
|
||||
stm32prog_end_phase(stm32prog_data);
|
||||
stm32prog_next_phase(stm32prog_data);
|
||||
}
|
||||
}
|
||||
|
||||
void dfu_initiated_callback(struct dfu_entity *dfu)
|
||||
{
|
||||
int phase;
|
||||
|
||||
if (!stm32prog_data)
|
||||
return;
|
||||
|
||||
phase = stm32prog_data->phase;
|
||||
if (dfu->alt == stm32prog_get_alternate(stm32prog_data)) {
|
||||
dfu->offset = stm32prog_data->offset;
|
||||
stm32prog_set_phase(stm32prog_data, phase, 0);
|
||||
pr_debug("dfu offset = 0x%llx\n", dfu->offset);
|
||||
}
|
||||
}
|
||||
|
||||
int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
|
||||
void *buf, long *len)
|
||||
{
|
||||
if (dfu->dev_type != DFU_DEV_VIRT)
|
||||
return -EINVAL;
|
||||
|
||||
switch (dfu->data.virt.dev_num) {
|
||||
case PHASE_CMD:
|
||||
return stm32prog_cmd_write(offset, buf, len);
|
||||
|
||||
case PHASE_OTP:
|
||||
return stm32prog_otp_write(stm32prog_data, (u32)offset,
|
||||
buf, len);
|
||||
|
||||
case PHASE_PMIC:
|
||||
return stm32prog_pmic_write(stm32prog_data, (u32)offset,
|
||||
buf, len);
|
||||
}
|
||||
*len = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset,
|
||||
void *buf, long *len)
|
||||
{
|
||||
if (dfu->dev_type != DFU_DEV_VIRT)
|
||||
return -EINVAL;
|
||||
|
||||
switch (dfu->data.virt.dev_num) {
|
||||
case PHASE_CMD:
|
||||
return stm32prog_cmd_read(offset, buf, len);
|
||||
|
||||
case PHASE_OTP:
|
||||
return stm32prog_otp_read(stm32prog_data, (u32)offset,
|
||||
buf, len);
|
||||
|
||||
case PHASE_PMIC:
|
||||
return stm32prog_pmic_read(stm32prog_data, (u32)offset,
|
||||
buf, len);
|
||||
}
|
||||
*len = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
|
||||
{
|
||||
if (dfu->dev_type != DFU_DEV_VIRT) {
|
||||
*size = 0;
|
||||
pr_debug("%s, invalid dev_type = %d\n",
|
||||
__func__, dfu->dev_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (dfu->data.virt.dev_num) {
|
||||
case PHASE_CMD:
|
||||
*size = 512;
|
||||
break;
|
||||
case PHASE_OTP:
|
||||
*size = OTP_SIZE;
|
||||
break;
|
||||
case PHASE_PMIC:
|
||||
*size = PMIC_SIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* USB download gadget for STM32 Programmer */
|
||||
|
||||
static const char product[] =
|
||||
"USB download gadget@Device ID /0x500, @Revision ID /0x0000";
|
||||
|
||||
bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
stm32prog_data = data;
|
||||
g_dnl_set_product(product);
|
||||
if (stm32prog_data->phase == PHASE_FLASHLAYOUT) {
|
||||
ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
|
||||
if (ret || stm32prog_data->phase == PHASE_DO_RESET)
|
||||
return ret;
|
||||
/* prepare the second enumeration with the FlashLayout */
|
||||
if (stm32prog_data->phase == PHASE_FLASHLAYOUT)
|
||||
stm32prog_dfu_init(data);
|
||||
/* found next selected partition */
|
||||
stm32prog_next_phase(data);
|
||||
}
|
||||
return (run_usb_dnl_gadget(dev, "usb_dnl_dfu") ||
|
||||
(stm32prog_data->phase == PHASE_DO_RESET));
|
||||
}
|
||||
|
||||
int g_dnl_get_board_bcd_device_number(int gcnum)
|
||||
{
|
||||
pr_debug("%s\n", __func__);
|
||||
return 0x200;
|
||||
}
|
||||
@ -3,7 +3,21 @@
|
||||
# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
#
|
||||
|
||||
ALL-$(CONFIG_SPL_BUILD) += spl/u-boot-spl.stm32
|
||||
ifndef CONFIG_SPL
|
||||
ALL-y += u-boot.stm32
|
||||
else
|
||||
ifdef CONFIG_SPL_BUILD
|
||||
ALL-y += spl/u-boot-spl.stm32
|
||||
endif
|
||||
endif
|
||||
|
||||
MKIMAGEFLAGS_u-boot.stm32 = -T stm32image -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
|
||||
|
||||
u-boot.stm32: MKIMAGEOUTPUT = u-boot.stm32.log
|
||||
|
||||
u-boot.stm32: u-boot.bin FORCE
|
||||
$(call if_changed,mkimage)
|
||||
|
||||
|
||||
MKIMAGEFLAGS_u-boot-spl.stm32 = -T stm32image -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
|
||||
|
||||
|
||||
@ -6,18 +6,23 @@
|
||||
#include <clk.h>
|
||||
#include <debug_uart.h>
|
||||
#include <environment.h>
|
||||
#include <fdt_support.h>
|
||||
#include <misc.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/stm32.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <dm/device.h>
|
||||
#include <dm/lists.h>
|
||||
#include <dm/uclass.h>
|
||||
#include <dt-bindings/clock/stm32mp1-clks.h>
|
||||
#include <dt-bindings/pinctrl/stm32-pinfunc.h>
|
||||
|
||||
/* RCC register */
|
||||
#define RCC_TZCR (STM32_RCC_BASE + 0x00)
|
||||
#define RCC_DBGCFGR (STM32_RCC_BASE + 0x080C)
|
||||
#define RCC_BDCR (STM32_RCC_BASE + 0x0140)
|
||||
#define RCC_MP_APB5ENSETR (STM32_RCC_BASE + 0x0208)
|
||||
|
||||
#define RCC_BDCR_VSWRST BIT(31)
|
||||
#define RCC_BDCR_RTCSRC GENMASK(17, 16)
|
||||
#define RCC_DBGCFGR_DBGCKEN BIT(8)
|
||||
@ -55,10 +60,34 @@
|
||||
#define BOOTROM_INSTANCE_SHIFT 16
|
||||
|
||||
/* BSEC OTP index */
|
||||
#define BSEC_OTP_RPN 1
|
||||
#define BSEC_OTP_SERIAL 13
|
||||
#define BSEC_OTP_PKG 16
|
||||
#define BSEC_OTP_MAC 57
|
||||
|
||||
/* Device Part Number (RPN) = OTP_DATA1 lower 8 bits */
|
||||
#define RPN_SHIFT 0
|
||||
#define RPN_MASK GENMASK(7, 0)
|
||||
|
||||
/* Package = bit 27:29 of OTP16
|
||||
* - 100: LBGA448 (FFI) => AA = LFBGA 18x18mm 448 balls p. 0.8mm
|
||||
* - 011: LBGA354 (LCI) => AB = LFBGA 16x16mm 359 balls p. 0.8mm
|
||||
* - 010: TFBGA361 (FFC) => AC = TFBGA 12x12mm 361 balls p. 0.5mm
|
||||
* - 001: TFBGA257 (LCC) => AD = TFBGA 10x10mm 257 balls p. 0.5mm
|
||||
* - others: Reserved
|
||||
*/
|
||||
#define PKG_SHIFT 27
|
||||
#define PKG_MASK GENMASK(2, 0)
|
||||
|
||||
#define PKG_AA_LBGA448 4
|
||||
#define PKG_AB_LBGA354 3
|
||||
#define PKG_AC_TFBGA361 2
|
||||
#define PKG_AD_TFBGA257 1
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
static void security_init(void)
|
||||
{
|
||||
/* Disable the backup domain write protection */
|
||||
@ -114,6 +143,7 @@ static void security_init(void)
|
||||
*/
|
||||
writel(0x0, TAMP_CR1);
|
||||
}
|
||||
#endif /* CONFIG_STM32MP1_TRUSTED */
|
||||
|
||||
/*
|
||||
* Debug init
|
||||
@ -130,10 +160,12 @@ static void dbgmcu_init(void)
|
||||
static u32 get_bootmode(void)
|
||||
{
|
||||
u32 boot_mode;
|
||||
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
|
||||
#if !defined(CONFIG_STM32MP1_TRUSTED) && \
|
||||
(!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
|
||||
u32 bootrom_itf = readl(BOOTROM_PARAM_ADDR);
|
||||
u32 bootrom_device, bootrom_instance;
|
||||
|
||||
/* read bootrom context */
|
||||
bootrom_device =
|
||||
(bootrom_itf & BOOTROM_MODE_MASK) >> BOOTROM_MODE_SHIFT;
|
||||
bootrom_instance =
|
||||
@ -167,8 +199,9 @@ int arch_cpu_init(void)
|
||||
|
||||
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
|
||||
dbgmcu_init();
|
||||
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
security_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* get bootmode from BootRom context: saved in TAMP register */
|
||||
@ -176,7 +209,8 @@ int arch_cpu_init(void)
|
||||
|
||||
if ((boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
|
||||
gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
|
||||
#if defined(CONFIG_DEBUG_UART) && \
|
||||
#if defined(CONFIG_DEBUG_UART) &&\
|
||||
!defined(CONFIG_STM32MP1_TRUSTED) && \
|
||||
(!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
|
||||
else
|
||||
debug_uart_init();
|
||||
@ -203,25 +237,94 @@ u32 get_cpu_rev(void)
|
||||
return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
|
||||
}
|
||||
|
||||
static u32 get_otp(int index, int shift, int mask)
|
||||
{
|
||||
int ret;
|
||||
struct udevice *dev;
|
||||
u32 otp = 0;
|
||||
|
||||
ret = uclass_get_device_by_driver(UCLASS_MISC,
|
||||
DM_GET_DRIVER(stm32mp_bsec),
|
||||
&dev);
|
||||
|
||||
if (!ret)
|
||||
ret = misc_read(dev, STM32_BSEC_SHADOW(index),
|
||||
&otp, sizeof(otp));
|
||||
|
||||
return (otp >> shift) & mask;
|
||||
}
|
||||
|
||||
/* Get Device Part Number (RPN) from OTP */
|
||||
static u32 get_cpu_rpn(void)
|
||||
{
|
||||
return get_otp(BSEC_OTP_RPN, RPN_SHIFT, RPN_MASK);
|
||||
}
|
||||
|
||||
u32 get_cpu_type(void)
|
||||
{
|
||||
return (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
|
||||
u32 id;
|
||||
|
||||
id = (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
|
||||
|
||||
return (id << 16) | get_cpu_rpn();
|
||||
}
|
||||
|
||||
/* Get Package options from OTP */
|
||||
static u32 get_cpu_package(void)
|
||||
{
|
||||
return get_otp(BSEC_OTP_PKG, PKG_SHIFT, PKG_MASK);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_DISPLAY_CPUINFO)
|
||||
int print_cpuinfo(void)
|
||||
{
|
||||
char *cpu_s, *cpu_r;
|
||||
char *cpu_s, *cpu_r, *pkg;
|
||||
|
||||
/* MPUs Part Numbers */
|
||||
switch (get_cpu_type()) {
|
||||
case CPU_STMP32MP15x:
|
||||
cpu_s = "15x";
|
||||
case CPU_STM32MP157Cxx:
|
||||
cpu_s = "157C";
|
||||
break;
|
||||
case CPU_STM32MP157Axx:
|
||||
cpu_s = "157A";
|
||||
break;
|
||||
case CPU_STM32MP153Cxx:
|
||||
cpu_s = "153C";
|
||||
break;
|
||||
case CPU_STM32MP153Axx:
|
||||
cpu_s = "153A";
|
||||
break;
|
||||
case CPU_STM32MP151Cxx:
|
||||
cpu_s = "151C";
|
||||
break;
|
||||
case CPU_STM32MP151Axx:
|
||||
cpu_s = "151A";
|
||||
break;
|
||||
default:
|
||||
cpu_s = "?";
|
||||
cpu_s = "????";
|
||||
break;
|
||||
}
|
||||
|
||||
/* Package */
|
||||
switch (get_cpu_package()) {
|
||||
case PKG_AA_LBGA448:
|
||||
pkg = "AA";
|
||||
break;
|
||||
case PKG_AB_LBGA354:
|
||||
pkg = "AB";
|
||||
break;
|
||||
case PKG_AC_TFBGA361:
|
||||
pkg = "AC";
|
||||
break;
|
||||
case PKG_AD_TFBGA257:
|
||||
pkg = "AD";
|
||||
break;
|
||||
default:
|
||||
pkg = "??";
|
||||
break;
|
||||
}
|
||||
|
||||
/* REVISION */
|
||||
switch (get_cpu_rev()) {
|
||||
case CPU_REVA:
|
||||
cpu_r = "A";
|
||||
@ -234,7 +337,7 @@ int print_cpuinfo(void)
|
||||
break;
|
||||
}
|
||||
|
||||
printf("CPU: STM32MP%s.%s\n", cpu_s, cpu_r);
|
||||
printf("CPU: STM32MP%s%s Rev.%s\n", cpu_s, pkg, cpu_r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -242,20 +345,48 @@ int print_cpuinfo(void)
|
||||
|
||||
static void setup_boot_mode(void)
|
||||
{
|
||||
const u32 serial_addr[] = {
|
||||
STM32_USART1_BASE,
|
||||
STM32_USART2_BASE,
|
||||
STM32_USART3_BASE,
|
||||
STM32_UART4_BASE,
|
||||
STM32_UART5_BASE,
|
||||
STM32_USART6_BASE,
|
||||
STM32_UART7_BASE,
|
||||
STM32_UART8_BASE
|
||||
};
|
||||
char cmd[60];
|
||||
u32 boot_ctx = readl(TAMP_BOOT_CONTEXT);
|
||||
u32 boot_mode =
|
||||
(boot_ctx & TAMP_BOOT_MODE_MASK) >> TAMP_BOOT_MODE_SHIFT;
|
||||
int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1;
|
||||
u32 forced_mode = (boot_ctx & TAMP_BOOT_FORCED_MASK);
|
||||
struct udevice *dev;
|
||||
int alias;
|
||||
|
||||
pr_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d\n",
|
||||
__func__, boot_ctx, boot_mode, instance);
|
||||
|
||||
debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n",
|
||||
__func__, boot_ctx, boot_mode, instance, forced_mode);
|
||||
switch (boot_mode & TAMP_BOOT_DEVICE_MASK) {
|
||||
case BOOT_SERIAL_UART:
|
||||
sprintf(cmd, "%d", instance);
|
||||
env_set("boot_device", "uart");
|
||||
if (instance > ARRAY_SIZE(serial_addr))
|
||||
break;
|
||||
/* serial : search associated alias in devicetree */
|
||||
sprintf(cmd, "serial@%x", serial_addr[instance]);
|
||||
if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev))
|
||||
break;
|
||||
if (fdtdec_get_alias_seq(gd->fdt_blob, "serial",
|
||||
dev_of_offset(dev), &alias))
|
||||
break;
|
||||
sprintf(cmd, "%d", alias);
|
||||
env_set("boot_device", "serial");
|
||||
env_set("boot_instance", cmd);
|
||||
|
||||
/* restore console on uart when not used */
|
||||
if (gd->cur_serial_dev != dev) {
|
||||
gd->flags &= ~(GD_FLG_SILENT |
|
||||
GD_FLG_DISABLE_CONSOLE);
|
||||
printf("serial boot with console enabled!\n");
|
||||
}
|
||||
break;
|
||||
case BOOT_SERIAL_USB:
|
||||
env_set("boot_device", "usb");
|
||||
@ -268,17 +399,44 @@ static void setup_boot_mode(void)
|
||||
env_set("boot_instance", cmd);
|
||||
break;
|
||||
case BOOT_FLASH_NAND:
|
||||
sprintf(cmd, "%d", instance);
|
||||
env_set("boot_device", "nand");
|
||||
env_set("boot_instance", "0");
|
||||
env_set("boot_instance", cmd);
|
||||
break;
|
||||
case BOOT_FLASH_NOR:
|
||||
env_set("boot_device", "nor");
|
||||
env_set("boot_instance", "0");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (forced_mode) {
|
||||
case BOOT_FASTBOOT:
|
||||
printf("Enter fastboot!\n");
|
||||
env_set("preboot", "env set preboot; fastboot 0");
|
||||
break;
|
||||
case BOOT_STM32PROG:
|
||||
printf("Enter STM32CubeProgrammer mode!\n");
|
||||
env_set("preboot", "env set preboot; stm32prog usb 0");
|
||||
break;
|
||||
case BOOT_UMS_MMC0:
|
||||
case BOOT_UMS_MMC1:
|
||||
case BOOT_UMS_MMC2:
|
||||
printf("Enter UMS!\n");
|
||||
instance = forced_mode - BOOT_UMS_MMC0;
|
||||
sprintf(cmd, "env set preboot; ums 0 mmc %d", instance);
|
||||
env_set("preboot", cmd);
|
||||
break;
|
||||
case BOOT_RECOVERY:
|
||||
env_set("preboot", "env set preboot; run altbootcmd");
|
||||
break;
|
||||
case BOOT_NORMAL:
|
||||
default:
|
||||
pr_debug("unexpected boot mode = %x\n", boot_mode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* clear TAMP for next reboot */
|
||||
clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -304,7 +462,7 @@ static int setup_mac_address(void)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = misc_read(dev, BSEC_OTP_MAC * 4 + STM32_BSEC_OTP_OFFSET,
|
||||
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC),
|
||||
otp, sizeof(otp));
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -342,12 +500,12 @@ static int setup_serial_number(void)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = misc_read(dev, BSEC_OTP_SERIAL * 4 + STM32_BSEC_OTP_OFFSET,
|
||||
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL),
|
||||
otp, sizeof(otp));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sprintf(serial_string, "%08x%08x%08x", otp[0], otp[1], otp[2]);
|
||||
sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]);
|
||||
env_set("serial#", serial_string);
|
||||
|
||||
return 0;
|
||||
@ -361,3 +519,45 @@ int arch_misc_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is called right before the kernel is booted. "blob" is the
|
||||
* device tree that will be passed to the kernel.
|
||||
*/
|
||||
int ft_system_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int ret = 0;
|
||||
u32 pkg;
|
||||
|
||||
#if CONFIG_STM32_ETZPC
|
||||
ret = stm32_fdt_fixup_etzpc(blob);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
switch (get_cpu_package()) {
|
||||
case PKG_AA_LBGA448:
|
||||
pkg = STM32MP157CAA;
|
||||
break;
|
||||
case PKG_AB_LBGA354:
|
||||
pkg = STM32MP157CAB;
|
||||
break;
|
||||
case PKG_AC_TFBGA361:
|
||||
pkg = STM32MP157CAC;
|
||||
break;
|
||||
case PKG_AD_TFBGA257:
|
||||
pkg = STM32MP157CAD;
|
||||
break;
|
||||
default:
|
||||
pkg = 0;
|
||||
break;
|
||||
}
|
||||
if (pkg) {
|
||||
do_fixup_by_compat_u32(blob, "st,stm32mp157-pinctrl",
|
||||
"st,package", pkg, false);
|
||||
do_fixup_by_compat_u32(blob, "st,stm32mp157-z-pinctrl",
|
||||
"st,package", pkg, false);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6,6 +6,13 @@
|
||||
#ifndef __MACH_STM32MP_DDR_H_
|
||||
#define __MACH_STM32MP_DDR_H_
|
||||
|
||||
int board_ddr_power_init(void);
|
||||
/* DDR power initializations */
|
||||
enum ddr_type {
|
||||
STM32MP_DDR3,
|
||||
STM32MP_LPDDR2,
|
||||
STM32MP_LPDDR3,
|
||||
};
|
||||
|
||||
int board_ddr_power_init(enum ddr_type ddr_type);
|
||||
|
||||
#endif
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
#define _STM32_GPIO_H_
|
||||
#include <asm/gpio.h>
|
||||
|
||||
#define STM32_GPIOS_PER_BANK 16
|
||||
|
||||
enum stm32_gpio_port {
|
||||
STM32_GPIO_PORT_A = 0,
|
||||
STM32_GPIO_PORT_B,
|
||||
@ -110,5 +112,9 @@ struct stm32_gpio_regs {
|
||||
|
||||
struct stm32_gpio_priv {
|
||||
struct stm32_gpio_regs *regs;
|
||||
unsigned int gpio_range;
|
||||
};
|
||||
|
||||
int stm32_offset_to_index(struct udevice *dev, unsigned int offset);
|
||||
|
||||
#endif /* _STM32_GPIO_H_ */
|
||||
|
||||
@ -13,13 +13,10 @@
|
||||
#define STM32_RCC_BASE 0x50000000
|
||||
#define STM32_PWR_BASE 0x50001000
|
||||
#define STM32_DBGMCU_BASE 0x50081000
|
||||
#define STM32_BSEC_BASE 0x5C005000
|
||||
#define STM32_TZC_BASE 0x5C006000
|
||||
#define STM32_ETZPC_BASE 0x5C007000
|
||||
#define STM32_TAMP_BASE 0x5C00A000
|
||||
|
||||
#ifdef CONFIG_DEBUG_UART_BASE
|
||||
/* hardcoded value can be only used for DEBUG UART */
|
||||
#define STM32_USART1_BASE 0x5C000000
|
||||
#define STM32_USART2_BASE 0x4000E000
|
||||
#define STM32_USART3_BASE 0x4000F000
|
||||
@ -28,20 +25,30 @@
|
||||
#define STM32_USART6_BASE 0x44003000
|
||||
#define STM32_UART7_BASE 0x40018000
|
||||
#define STM32_UART8_BASE 0x40019000
|
||||
#endif
|
||||
|
||||
#define STM32_SYSRAM_BASE 0x2FFC0000
|
||||
#define STM32_SYSRAM_SIZE SZ_256K
|
||||
|
||||
#define STM32_MCU_SRAM_BASE 0x30000000
|
||||
#define STM32_MCU_SRAM_SIZE (3 * SZ_128K)
|
||||
|
||||
#define STM32_DDR_BASE 0xC0000000
|
||||
#define STM32_DDR_SIZE SZ_1G
|
||||
|
||||
#define STM32_RETRAM_BASE 0x38000000
|
||||
#define STM32_RETRAM_SIZE 0x00010000
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <asm/types.h>
|
||||
|
||||
/* enumerated used to identify the SYSCON driver instance */
|
||||
enum {
|
||||
STM32MP_SYSCON_UNKNOWN,
|
||||
STM32MP_SYSCON_STGEN,
|
||||
STM32MP_SYSCON_ETZPC,
|
||||
STM32MP_SYSCON_IWDG,
|
||||
STM32MP_SYSCON_PWR,
|
||||
STM32MP_SYSCON_STGEN,
|
||||
STM32MP_SYSCON_SYSCFG,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -87,18 +94,41 @@ enum boot_device {
|
||||
|
||||
/* TAMP registers */
|
||||
#define TAMP_BACKUP_REGISTER(x) (STM32_TAMP_BASE + 0x100 + 4 * x)
|
||||
/* secure access */
|
||||
#define TAMP_BACKUP_MAGIC_NUMBER TAMP_BACKUP_REGISTER(4)
|
||||
#define TAMP_BACKUP_BRANCH_ADDRESS TAMP_BACKUP_REGISTER(5)
|
||||
/* non secure access */
|
||||
#define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20)
|
||||
#define TAMP_BOOTCOUNT TAMP_BACKUP_REGISTER(21)
|
||||
|
||||
#define TAMP_BOOT_MODE_MASK GENMASK(15, 8)
|
||||
#define TAMP_BOOT_MODE_SHIFT 8
|
||||
#define TAMP_BOOT_DEVICE_MASK GENMASK(7, 4)
|
||||
#define TAMP_BOOT_INSTANCE_MASK GENMASK(3, 0)
|
||||
#define TAMP_BOOT_FORCED_MASK GENMASK(7, 0)
|
||||
#define TAMP_BOOT_DEBUG_ON BIT(16)
|
||||
|
||||
enum forced_boot_mode {
|
||||
BOOT_NORMAL = 0x00,
|
||||
BOOT_FASTBOOT = 0x01,
|
||||
BOOT_RECOVERY = 0x02,
|
||||
BOOT_STM32PROG = 0x03,
|
||||
BOOT_UMS_MMC0 = 0x10,
|
||||
BOOT_UMS_MMC1 = 0x11,
|
||||
BOOT_UMS_MMC2 = 0x12,
|
||||
};
|
||||
|
||||
/* offset used for BSEC driver: misc_read and misc_write */
|
||||
#define STM32_BSEC_SHADOW_OFFSET 0x0
|
||||
#define STM32_BSEC_SHADOW(id) (STM32_BSEC_SHADOW_OFFSET + (id) * 4)
|
||||
#define STM32_BSEC_OTP_OFFSET 0x80000000
|
||||
#define STM32_BSEC_OTP(id) (STM32_BSEC_OTP_OFFSET + (id) * 4)
|
||||
|
||||
#define BSEC_OTP_BOARD 59
|
||||
|
||||
#if CONFIG_STM32_ETZPC
|
||||
int stm32_fdt_fixup_etzpc(void *fdt);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__*/
|
||||
#endif /* _MACH_STM32_H_ */
|
||||
|
||||
75
arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h
Normal file
75
arch/arm/mach-stm32mp/include/mach/stm32mp1_smc.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#ifndef __STM32MP1_SMC_H__
|
||||
#define __STM32MP1_SMC_H__
|
||||
|
||||
#include <linux/arm-smccc.h>
|
||||
|
||||
/*
|
||||
* SMC function IDs for STM32 Service queries
|
||||
* STM32 SMC services use the space between 0x82000000 and 0x8200FFFF
|
||||
* like this is defined in SMC calling Convention by ARM
|
||||
* for SiP (silicon Partner)
|
||||
* http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
|
||||
*/
|
||||
#define STM32_SMC_VERSION 0x82000000
|
||||
/* SMC reserved for future ST services */
|
||||
#define STM32_SMC_RESERVED_ST 0x82000001
|
||||
|
||||
/* Secure Service access from Non-secure */
|
||||
#define STM32_SMC_RCC 0x82001000
|
||||
#define STM32_SMC_PWR 0x82001001
|
||||
#define STM32_SMC_RTC 0x82001002
|
||||
#define STM32_SMC_BSEC 0x82001003
|
||||
|
||||
/* Register access service use for RCC/RTC/PWR */
|
||||
#define STM32_SMC_REG_WRITE 0x1
|
||||
#define STM32_SMC_REG_SET 0x2
|
||||
#define STM32_SMC_REG_CLEAR 0x3
|
||||
|
||||
/* Service for BSEC */
|
||||
#define STM32_SMC_READ_SHADOW 0x01
|
||||
#define STM32_SMC_PROG_OTP 0x02
|
||||
#define STM32_SMC_WRITE_SHADOW 0x03
|
||||
#define STM32_SMC_READ_OTP 0x04
|
||||
#define STM32_SMC_READ_ALL 0x05
|
||||
#define STM32_SMC_WRITE_ALL 0x06
|
||||
|
||||
/* SMC error codes */
|
||||
#define STM32_SMC_OK 0x0
|
||||
#define STM32_SMC_NOT_SUPPORTED -1
|
||||
#define STM32_SMC_FAILED -2
|
||||
#define STM32_SMC_INVALID_PARAMS -3
|
||||
|
||||
#define stm32_smc_exec(svc, op, data1, data2) \
|
||||
stm32_smc(svc, op, data1, data2, NULL)
|
||||
|
||||
#ifdef CONFIG_ARM_SMCCC
|
||||
static inline u32 stm32_smc(u32 svc, u8 op, u32 data1, u32 data2, u32 *result)
|
||||
{
|
||||
struct arm_smccc_res res;
|
||||
|
||||
arm_smccc_smc(svc, op, data1, data2, 0, 0, 0, 0, &res);
|
||||
|
||||
if (res.a0) {
|
||||
pr_err("%s: Failed to exec in secure mode (err = %ld)\n",
|
||||
__func__, res.a0);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (result)
|
||||
*result = (u32)res.a1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static inline u32 stm32_smc(u32 svc, u8 op, u32 data1, u32 data2, u32 *result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __STM32MP1_SMC_H__ */
|
||||
@ -3,9 +3,15 @@
|
||||
* Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#define CPU_STMP32MP15x 0x500
|
||||
/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0)*/
|
||||
#define CPU_STM32MP157Cxx 0x05000000
|
||||
#define CPU_STM32MP157Axx 0x05000001
|
||||
#define CPU_STM32MP153Cxx 0x05000024
|
||||
#define CPU_STM32MP153Axx 0x05000025
|
||||
#define CPU_STM32MP151Cxx 0x0500002E
|
||||
#define CPU_STM32MP151Axx 0x0500002F
|
||||
|
||||
/* return CPU_STMP32MPxx constants */
|
||||
/* return CPU_STMP32MP...Xxx constants */
|
||||
u32 get_cpu_type(void);
|
||||
|
||||
#define CPU_REVA 0x1000
|
||||
|
||||
@ -103,7 +103,13 @@ int __secure psci_affinity_info(u32 function_id, u32 target_affinity,
|
||||
|
||||
int __secure psci_migrate_info_type(u32 function_id)
|
||||
{
|
||||
/* Trusted OS is either not present or does not require migration */
|
||||
/*
|
||||
* in Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
|
||||
* return 2 = Trusted OS is either not present or does not require
|
||||
* migration, system of this type does not require the caller
|
||||
* to use the MIGRATE function.
|
||||
* MIGRATE function calls return NOT_SUPPORTED.
|
||||
*/
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <regmap.h>
|
||||
#include <syscon.h>
|
||||
#include <asm/arch/stm32mp1_smc.h>
|
||||
#include <power/pmic.h>
|
||||
#include <power/regulator.h>
|
||||
|
||||
@ -32,13 +33,20 @@ struct stm32mp_pwr_priv {
|
||||
static int stm32mp_pwr_write(struct udevice *dev, uint reg,
|
||||
const uint8_t *buff, int len)
|
||||
{
|
||||
#ifndef CONFIG_STM32MP1_TRUSTED
|
||||
struct stm32mp_pwr_priv *priv = dev_get_priv(dev);
|
||||
#endif
|
||||
u32 val = *(u32 *)buff;
|
||||
|
||||
if (len != 4)
|
||||
return -EINVAL;
|
||||
|
||||
#ifdef CONFIG_STM32MP1_TRUSTED
|
||||
return stm32_smc_exec(STM32_SMC_PWR, STM32_SMC_REG_WRITE,
|
||||
STM32MP_PWR_CR3, val);
|
||||
#else /* CONFIG_STM32MP1_TRUSTED */
|
||||
return regmap_write(priv->regmap, STM32MP_PWR_CR3, val);
|
||||
#endif /* CONFIG_STM32MP1_TRUSTED */
|
||||
}
|
||||
|
||||
static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,
|
||||
|
||||
@ -7,6 +7,18 @@
|
||||
#include <dm.h>
|
||||
#include <spl.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <linux/libfdt.h>
|
||||
|
||||
static int spl_board_load_image(struct spl_image_info *spl_image,
|
||||
struct spl_boot_device *bootdev)
|
||||
{
|
||||
/* TODO : add download support in SPL without TF-A */
|
||||
return -1;
|
||||
}
|
||||
|
||||
SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_board_load_image);
|
||||
SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_board_load_image);
|
||||
|
||||
u32 spl_boot_device(void)
|
||||
{
|
||||
@ -22,8 +34,22 @@ u32 spl_boot_device(void)
|
||||
case BOOT_FLASH_SD_2:
|
||||
case BOOT_FLASH_EMMC_2:
|
||||
return BOOT_DEVICE_MMC2;
|
||||
case BOOT_SERIAL_UART_1:
|
||||
case BOOT_SERIAL_UART_2:
|
||||
case BOOT_SERIAL_UART_3:
|
||||
case BOOT_SERIAL_UART_4:
|
||||
case BOOT_SERIAL_UART_5:
|
||||
case BOOT_SERIAL_UART_6:
|
||||
case BOOT_SERIAL_UART_7:
|
||||
case BOOT_SERIAL_UART_8:
|
||||
return BOOT_DEVICE_UART;
|
||||
case BOOT_SERIAL_USB_OTG:
|
||||
return BOOT_DEVICE_USB;
|
||||
case BOOT_FLASH_NAND_FMC:
|
||||
return BOOT_DEVICE_NAND;
|
||||
case BOOT_FLASH_NOR_QSPI:
|
||||
return BOOT_DEVICE_SPI;
|
||||
}
|
||||
|
||||
return BOOT_DEVICE_MMC1;
|
||||
}
|
||||
|
||||
@ -44,6 +70,21 @@ int spl_boot_partition(const u32 boot_device)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_DISPLAY_PRINT
|
||||
void spl_display_print(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
const char *model;
|
||||
|
||||
/* same code than show_board_info() but not compiled for SPL
|
||||
* see CONFIG_DISPLAY_BOARDINFO & common/board_info.c
|
||||
*/
|
||||
model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
|
||||
if (model)
|
||||
printf("Model: %s\n", model);
|
||||
}
|
||||
#endif
|
||||
|
||||
void board_init_f(ulong dummy)
|
||||
{
|
||||
struct udevice *dev;
|
||||
@ -80,7 +121,7 @@ void board_init_f(ulong dummy)
|
||||
|
||||
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
|
||||
if (ret) {
|
||||
debug("DRAM init failed: %d\n", ret);
|
||||
return;
|
||||
printf("DRAM init failed: %d\n", ret);
|
||||
hang();
|
||||
}
|
||||
}
|
||||
|
||||
199
arch/arm/mach-stm32mp/stm32-etzpc.c
Normal file
199
arch/arm/mach-stm32mp/stm32-etzpc.c
Normal file
@ -0,0 +1,199 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <fdt_support.h>
|
||||
#include <syscon.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#define ETZPC_DECPROT(n) (0x10 + 4 * (n))
|
||||
#define ETZPC_DECPROT_NB 6
|
||||
|
||||
#define ETZPC_IP_VER 0x3F4
|
||||
|
||||
#define IP_VER_STM32MP1 0x00000020
|
||||
|
||||
#define DECPROT_MASK 0x03
|
||||
#define NB_PROT_PER_REG 0x10
|
||||
#define DECPROT_NB_BITS 2
|
||||
|
||||
#define DECPROT_SECURED 0x00
|
||||
#define DECPROT_WRITE_SECURE 0x01
|
||||
#define DECPROT_MCU_ISOLATION 0x02
|
||||
#define DECPROT_NON_SECURED 0x03
|
||||
|
||||
#define ETZPC_RESERVED 0xffffffff
|
||||
|
||||
static const u32 stm32mp1_ip_addr[] = {
|
||||
0x5c008000, /* 00 stgenc */
|
||||
0x54000000, /* 01 bkpsram */
|
||||
0x5c003000, /* 02 iwdg1 */
|
||||
0x5c000000, /* 03 usart1 */
|
||||
0x5c001000, /* 04 spi6 */
|
||||
0x5c002000, /* 05 i2c4 */
|
||||
ETZPC_RESERVED, /* 06 reserved */
|
||||
0x54003000, /* 07 rng1 */
|
||||
0x54002000, /* 08 hash1 */
|
||||
0x54001000, /* 09 cryp1 */
|
||||
0x5a003000, /* 0A ddrctrl */
|
||||
0x5a004000, /* 0B ddrphyc */
|
||||
0x5c009000, /* 0C i2c6 */
|
||||
ETZPC_RESERVED, /* 0D reserved */
|
||||
ETZPC_RESERVED, /* 0E reserved */
|
||||
ETZPC_RESERVED, /* 0F reserved */
|
||||
0x40000000, /* 10 tim2 */
|
||||
0x40001000, /* 11 tim3 */
|
||||
0x40002000, /* 12 tim4 */
|
||||
0x40003000, /* 13 tim5 */
|
||||
0x40004000, /* 14 tim6 */
|
||||
0x40005000, /* 15 tim7 */
|
||||
0x40006000, /* 16 tim12 */
|
||||
0x40007000, /* 17 tim13 */
|
||||
0x40008000, /* 18 tim14 */
|
||||
0x40009000, /* 19 lptim1 */
|
||||
0x4000a000, /* 1A wwdg1 */
|
||||
0x4000b000, /* 1B spi2 */
|
||||
0x4000c000, /* 1C spi3 */
|
||||
0x4000d000, /* 1D spdifrx */
|
||||
0x4000e000, /* 1E usart2 */
|
||||
0x4000f000, /* 1F usart3 */
|
||||
0x40010000, /* 20 uart4 */
|
||||
0x40011000, /* 21 uart5 */
|
||||
0x40012000, /* 22 i2c1 */
|
||||
0x40013000, /* 23 i2c2 */
|
||||
0x40014000, /* 24 i2c3 */
|
||||
0x40015000, /* 25 i2c5 */
|
||||
0x40016000, /* 26 cec */
|
||||
0x40017000, /* 27 dac */
|
||||
0x40018000, /* 28 uart7 */
|
||||
0x40019000, /* 29 uart8 */
|
||||
ETZPC_RESERVED, /* 2A reserved */
|
||||
ETZPC_RESERVED, /* 2B reserved */
|
||||
0x4001c000, /* 2C mdios */
|
||||
ETZPC_RESERVED, /* 2D reserved */
|
||||
ETZPC_RESERVED, /* 2E reserved */
|
||||
ETZPC_RESERVED, /* 2F reserved */
|
||||
0x44000000, /* 30 tim1 */
|
||||
0x44001000, /* 31 tim8 */
|
||||
ETZPC_RESERVED, /* 32 reserved */
|
||||
0x44003000, /* 33 usart6 */
|
||||
0x44004000, /* 34 spi1 */
|
||||
0x44005000, /* 35 spi4 */
|
||||
0x44006000, /* 36 tim15 */
|
||||
0x44007000, /* 37 tim16 */
|
||||
0x44008000, /* 38 tim17 */
|
||||
0x44009000, /* 39 spi5 */
|
||||
0x4400a000, /* 3A sai1 */
|
||||
0x4400b000, /* 3B sai2 */
|
||||
0x4400c000, /* 3C sai3 */
|
||||
0x4400d000, /* 3D dfsdm */
|
||||
0x4400e000, /* 3E tt_fdcan */
|
||||
ETZPC_RESERVED, /* 3F reserved */
|
||||
0x50021000, /* 40 lptim2 */
|
||||
0x50022000, /* 41 lptim3 */
|
||||
0x50023000, /* 42 lptim4 */
|
||||
0x50024000, /* 43 lptim5 */
|
||||
0x50027000, /* 44 sai4 */
|
||||
0x50025000, /* 45 vrefbuf */
|
||||
0x4c006000, /* 46 dcmi */
|
||||
0x4c004000, /* 47 crc2 */
|
||||
0x48003000, /* 48 adc */
|
||||
0x4c002000, /* 49 hash2 */
|
||||
0x4c003000, /* 4A rng2 */
|
||||
0x4c005000, /* 4B cryp2 */
|
||||
ETZPC_RESERVED, /* 4C reserved */
|
||||
ETZPC_RESERVED, /* 4D reserved */
|
||||
ETZPC_RESERVED, /* 4E reserved */
|
||||
ETZPC_RESERVED, /* 4F reserved */
|
||||
ETZPC_RESERVED, /* 50 sram1 */
|
||||
ETZPC_RESERVED, /* 51 sram2 */
|
||||
ETZPC_RESERVED, /* 52 sram3 */
|
||||
ETZPC_RESERVED, /* 53 sram4 */
|
||||
ETZPC_RESERVED, /* 54 retram */
|
||||
0x49000000, /* 55 otg */
|
||||
0x48004000, /* 56 sdmmc3 */
|
||||
0x48005000, /* 57 dlybsd3 */
|
||||
0x48000000, /* 58 dma1 */
|
||||
0x48001000, /* 59 dma2 */
|
||||
0x48002000, /* 5A dmamux */
|
||||
0x58002000, /* 5B fmc */
|
||||
0x58003000, /* 5C qspi */
|
||||
0x58004000, /* 5D dlybq */
|
||||
0x5800a000, /* 5E eth */
|
||||
ETZPC_RESERVED, /* 5F reserved */
|
||||
};
|
||||
|
||||
/* fdt helper */
|
||||
static bool fdt_disable_subnode_by_address(void *fdt, int offset, u32 addr)
|
||||
{
|
||||
int node;
|
||||
|
||||
for (node = fdt_first_subnode(fdt, offset);
|
||||
node >= 0;
|
||||
node = fdt_next_subnode(fdt, node)) {
|
||||
if (addr == (u32)fdt_getprop(fdt, node, "reg", 0)) {
|
||||
if (fdtdec_get_is_enabled(fdt, node)) {
|
||||
fdt_status_disabled(fdt, node);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int stm32_fdt_fixup_etzpc(void *fdt)
|
||||
{
|
||||
void *base;
|
||||
u32 version;
|
||||
const u32 *array;
|
||||
int array_size, i;
|
||||
int soc_node, offset, shift;
|
||||
u32 addr, status, decprot[ETZPC_DECPROT_NB];
|
||||
|
||||
base = syscon_get_first_range(STM32MP_SYSCON_ETZPC);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
version = readl(base + ETZPC_IP_VER);
|
||||
|
||||
switch (version) {
|
||||
case IP_VER_STM32MP1:
|
||||
array = stm32mp1_ip_addr;
|
||||
array_size = ARRAY_SIZE(stm32mp1_ip_addr);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ETZPC_DECPROT_NB; i++)
|
||||
decprot[i] = readl(base + ETZPC_DECPROT(i));
|
||||
|
||||
soc_node = fdt_path_offset(fdt, "/soc");
|
||||
if (soc_node < 0)
|
||||
return soc_node;
|
||||
|
||||
for (i = 0; i < array_size; i++) {
|
||||
offset = i / NB_PROT_PER_REG;
|
||||
shift = (i % NB_PROT_PER_REG) * DECPROT_NB_BITS;
|
||||
status = (decprot[offset] >> shift) & DECPROT_MASK;
|
||||
addr = array[i];
|
||||
|
||||
debug("ETZPC: 0x%08x decprot %d=%d\n", addr, i, status);
|
||||
|
||||
if (addr == ETZPC_RESERVED ||
|
||||
status == DECPROT_NON_SECURED)
|
||||
continue;
|
||||
|
||||
if (fdt_disable_subnode_by_address(fdt, soc_node, addr))
|
||||
printf("ETZPC: 0x%08x node disabled, decprot %d=%d\n",
|
||||
addr, i, status);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
124
arch/arm/mach-stm32mp/stm32mp1_helper_dgb.S
Normal file
124
arch/arm/mach-stm32mp/stm32mp1_helper_dgb.S
Normal file
@ -0,0 +1,124 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
|
||||
/*
|
||||
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* This file is only needed for current Soc revision which has a limitation on
|
||||
* debug reset halt. This can be removed when using the Soc revision that
|
||||
* fixes the limitation. Anyway, this source code identifies the Soc revision
|
||||
* and is only executed if it corresponds, so it can be kept on other
|
||||
* revisions without any consequence.
|
||||
****************************************************************************/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/macro.h>
|
||||
|
||||
#define BIT(nr) (1 << (nr))
|
||||
|
||||
#define DBG_DSCR_ADDR 0x500D0088
|
||||
#define DBG_DSCR_HDBGEN BIT(14)
|
||||
|
||||
#define RCC_DBGCFGR_ADDR 0x5000080C
|
||||
#define RCC_DBGCFGR_DBGCKEN BIT(8)
|
||||
|
||||
#define PWR_CR1_ADDR 0x50001000
|
||||
#define PWR_CR1_DBP BIT(8)
|
||||
|
||||
#define DBGMCU_IDC_ADDR 0x50081000
|
||||
#define DBGMCU_IDC_MASK 0xFFFF0FFF
|
||||
#define DBGMCU_IDC_VALUE 0x20000500
|
||||
|
||||
#define TAMP_BKP_REGISTER_20 (0x5C00A100 + (20 << 2))
|
||||
|
||||
|
||||
.globl save_boot_params
|
||||
|
||||
ENTRY(save_boot_params)
|
||||
/*
|
||||
* This function is the first call after reset.
|
||||
* Boot rom parameters are stored in r0..r3, so we mustn't use them
|
||||
* here. And because they are saved in r9..r12 just after the
|
||||
* execution of this function, we should firstly use these registers.
|
||||
* And then, if more registers needed, we have to start by using
|
||||
* r8, and then r7 and so on. By this way, debug will be done in
|
||||
* conditions closed to the initial context.
|
||||
*/
|
||||
|
||||
/* Check Soc revision */
|
||||
ldr r12, =RCC_DBGCFGR_ADDR
|
||||
ldr r11, [r12] /* read RCC_DBGCFGR (r11) */
|
||||
orr r10, r11, #RCC_DBGCFGR_DBGCKEN
|
||||
str r10, [r12] /* update RCC_DBGCFGR */
|
||||
ldr r10, =DBGMCU_IDC_ADDR
|
||||
ldr r10, [r10] /* read DBGMCU_IDC (r10) */
|
||||
str r11, [r12] /* restore RCC_DBGCFGR (r11) */
|
||||
ldr r12, =DBGMCU_IDC_MASK
|
||||
and r10, r12 /* mask reserved bits */
|
||||
ldr r11, =DBGMCU_IDC_VALUE
|
||||
teq r10, r11 /* test DBGMCU_IDC */
|
||||
bne func_exit
|
||||
|
||||
/* Disable the backup domain write protection */
|
||||
ldr r12, =PWR_CR1_ADDR
|
||||
ldr r11, [r12]
|
||||
orr r11, r11, #PWR_CR1_DBP
|
||||
str r11, [r12]
|
||||
poll_dbp:
|
||||
ldr r11, [r12]
|
||||
tst r11, #PWR_CR1_DBP
|
||||
beq poll_dbp
|
||||
|
||||
/* Clear tamper 20 bit 16 if set */
|
||||
ldr r12, =TAMP_BKP_REGISTER_20
|
||||
ldr r11, [r12]
|
||||
tst r11, #(BIT(16))
|
||||
beq func_exit
|
||||
bic r11, #(BIT(16))
|
||||
str r11, [r12]
|
||||
|
||||
/* Re-enable the backup domain write protection */
|
||||
ldr r12, =PWR_CR1_ADDR
|
||||
ldr r11, [r12]
|
||||
bic r11, #PWR_CR1_DBP
|
||||
str r11, [r12]
|
||||
poll_dbp_2:
|
||||
ldr r11, [r12]
|
||||
tst r11, #PWR_CR1_DBP
|
||||
bne poll_dbp_2
|
||||
|
||||
/* Get current time + 1 second */
|
||||
/* CNTFRQ */
|
||||
mrc p15, 0, r12, c14, c0, 0
|
||||
/* CNTPCT_64 */
|
||||
mrrc p15, 0, r11, r10, c14
|
||||
add r12, r12, r11
|
||||
|
||||
loop:
|
||||
/* Check A7 DBG_DSCR HDBGEN bit value */
|
||||
ldr r10, =DBG_DSCR_ADDR
|
||||
ldr r10, [r10]
|
||||
tst r10, #DBG_DSCR_HDBGEN
|
||||
beq loop_continue
|
||||
/* Sw break */
|
||||
bkpt 5
|
||||
/* Jump entrypoint */
|
||||
b reset
|
||||
loop_continue:
|
||||
/* Check 1 second expiration */
|
||||
mrrc p15, 0, r10, r9, c14
|
||||
/* Check if MSB 64-bit increment needed */
|
||||
cmp r12, r11
|
||||
bmi msb_incr
|
||||
cmp r12, r10
|
||||
bmi func_exit
|
||||
b loop
|
||||
msb_incr:
|
||||
cmp r12, r10
|
||||
bpl loop
|
||||
cmp r11, r10
|
||||
bmi loop
|
||||
func_exit:
|
||||
b save_boot_params_ret
|
||||
ENDPROC(save_boot_params)
|
||||
@ -9,10 +9,11 @@
|
||||
#include <asm/arch/stm32.h>
|
||||
|
||||
static const struct udevice_id stm32mp_syscon_ids[] = {
|
||||
{ .compatible = "st,stm32-stgen",
|
||||
.data = STM32MP_SYSCON_STGEN },
|
||||
{ .compatible = "st,stm32mp1-pwr",
|
||||
.data = STM32MP_SYSCON_PWR },
|
||||
{ .compatible = "st,stm32mp1-etzpc", .data = STM32MP_SYSCON_ETZPC },
|
||||
{ .compatible = "st,stm32mp1-pwr", .data = STM32MP_SYSCON_PWR },
|
||||
{ .compatible = "st,stm32-stgen", .data = STM32MP_SYSCON_STGEN },
|
||||
{ .compatible = "st,stm32mp157-syscfg",
|
||||
.data = STM32MP_SYSCON_SYSCFG },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -712,6 +712,14 @@
|
||||
sandbox_tee {
|
||||
compatible = "sandbox,tee";
|
||||
};
|
||||
|
||||
pinctrl {
|
||||
compatible = "sandbox,pinctrl";
|
||||
};
|
||||
|
||||
hwspinlock@0 {
|
||||
compatible = "sandbox,hwspinlock";
|
||||
};
|
||||
};
|
||||
|
||||
#include "sandbox_pmic.dtsi"
|
||||
|
||||
@ -97,6 +97,7 @@ struct sandbox_state {
|
||||
/* Information about Watchdog */
|
||||
struct sandbox_wdt_info wdt;
|
||||
|
||||
bool hwspinlock; /* Hardware Spinlock status */
|
||||
ulong next_tag; /* Next address tag to allocate */
|
||||
struct list_head mapmem_head; /* struct sandbox_mapmem_entry */
|
||||
};
|
||||
|
||||
@ -9,4 +9,11 @@ config SYS_VENDOR
|
||||
config SYS_CONFIG_NAME
|
||||
default "stm32mp1"
|
||||
|
||||
config CMD_STBOARD
|
||||
bool "stboard - command for OTP board information"
|
||||
default y
|
||||
help
|
||||
This compile the stboard command to
|
||||
read and write the board in the OTP.
|
||||
|
||||
endif
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
STM32MP1 BOARD
|
||||
M: Patrick Delaunay <patrick.delaunay@st.com>
|
||||
M: Christophe Kerello <christophe.kerello@st.com>
|
||||
L: uboot-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
F: board/st/stm32mp1
|
||||
F: include/configs/stm32mp1.h
|
||||
F: configs/stm32mp15_basic_defconfig
|
||||
F: arch/arm/dts/stm32mp157*
|
||||
F: board/st/stm32mp1
|
||||
F: configs/stm32mp15_trusted_defconfig
|
||||
F: configs/stm32mp15_optee_defconfig
|
||||
F: configs/stm32mp15_basic_defconfig
|
||||
F: include/configs/stm32mp1.h
|
||||
|
||||
@ -7,6 +7,7 @@ ifdef CONFIG_SPL_BUILD
|
||||
obj-y += spl.o
|
||||
else
|
||||
obj-y += stm32mp1.o
|
||||
obj-$(CONFIG_CMD_STBOARD) += cmd_stboard.o
|
||||
endif
|
||||
|
||||
obj-y += board.o
|
||||
|
||||
@ -25,17 +25,21 @@ It features:
|
||||
Everything is supported in Linux but U-Boot is limited to:
|
||||
1. UART
|
||||
2. SDCard/MMC controller (SDMMC)
|
||||
3. NAND controller (FMC)
|
||||
4. NOR controller (QSPI)
|
||||
5. USB controller (OTG DWC2)
|
||||
|
||||
And the necessary drivers
|
||||
1. I2C
|
||||
2. STPMU1
|
||||
2. STPMU1 (PMIC and regulator)
|
||||
2. STPMIC1 (PMIC and regulator)
|
||||
3. Clock, Reset, Sysreset
|
||||
4. Fuse
|
||||
|
||||
Currently the following boards are supported:
|
||||
+ stm32mp157c-ev1
|
||||
+ stm32mp157c-ed1
|
||||
+ stm32mp157a-dk1
|
||||
+ stm32mp157c-dk2
|
||||
|
||||
3. Boot Sequences
|
||||
=================
|
||||
@ -45,15 +49,22 @@ BootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
|
||||
with FSBL = First Stage Bootloader
|
||||
SSBL = Second Stage Bootloader
|
||||
|
||||
One boot configuration is supported:
|
||||
2 boot configurations are supported:
|
||||
|
||||
The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
|
||||
1) The "Trusted" boot chain (defconfig_file : stm32mp15_trusted_defconfig)
|
||||
BootRom => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot
|
||||
TF-A performs a full initialization of Secure peripherals and installs a
|
||||
secure monitor.
|
||||
U-Boot is running in normal world and uses TF-A monitor
|
||||
to access to secure resources
|
||||
|
||||
2) The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
|
||||
BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
|
||||
SPL has limited security initialisation
|
||||
U-Boot is running in secure mode and provide a secure monitor to the kernel
|
||||
with only PSCI support (Power State Coordination Interface defined by ARM)
|
||||
|
||||
All the STM32MP1 board supported by U-Boot use the same generic board
|
||||
All the STM32MP1 boards supported by U-Boot use the same generic board
|
||||
stm32mp1 which support all the bootable devices.
|
||||
|
||||
Each board is configurated only with the associated device tree.
|
||||
@ -64,12 +75,18 @@ Each board is configurated only with the associated device tree.
|
||||
You need to select the appropriate device tree for your board,
|
||||
the supported device trees for stm32mp157 are:
|
||||
|
||||
+ ev1: eval board with pmic stpmu1 (ev1 = mother board + daughter ed1)
|
||||
+ ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
|
||||
dts: stm32mp157c-ev1
|
||||
|
||||
+ ed1: daughter board with pmic stpmu1
|
||||
+ ed1: daughter board with pmic stpmic1
|
||||
dts: stm32mp157c-ed1
|
||||
|
||||
+ dk1: Discovery board
|
||||
dts: stm32mp157a-dk1
|
||||
|
||||
+ dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel
|
||||
dts: stm32mp157c-dk2
|
||||
|
||||
5. Build Procedure
|
||||
==================
|
||||
|
||||
@ -90,29 +107,30 @@ the supported device trees for stm32mp157 are:
|
||||
# export KBUILD_OUTPUT=/path/to/output
|
||||
|
||||
for example: use one output directory for each configuration
|
||||
# export KBUILD_OUTPUT=stm32mp15_trusted
|
||||
# export KBUILD_OUTPUT=stm32mp15_basic
|
||||
|
||||
4. Configure the U-Boot:
|
||||
4. Configure U-Boot:
|
||||
|
||||
# make <defconfig_file>
|
||||
|
||||
- For trusted boot mode : "stm32mp15_trusted_defconfig"
|
||||
- For basic boot mode: "stm32mp15_basic_defconfig"
|
||||
|
||||
5. Configure the device-tree and build the U-Boot image:
|
||||
|
||||
# make DEVICE_TREE=<name> all
|
||||
|
||||
|
||||
example:
|
||||
basic boot on ev1
|
||||
# export KBUILD_OUTPUT=stm32mp15_basic
|
||||
# make stm32mp15_basic_defconfig
|
||||
a) trusted boot on ev1
|
||||
# export KBUILD_OUTPUT=stm32mp15_trusted
|
||||
# make stm32mp15_trusted_defconfig
|
||||
# make DEVICE_TREE=stm32mp157c-ev1 all
|
||||
|
||||
basic boot on ed1
|
||||
b) basic boot on dk2
|
||||
# export KBUILD_OUTPUT=stm32mp15_basic
|
||||
# make stm32mp15_basic_defconfig
|
||||
# make DEVICE_TREE=stm32mp157c-ed1 all
|
||||
# make DEVICE_TREE=stm32mp157c-dk2 all
|
||||
|
||||
6. Output files
|
||||
|
||||
@ -122,13 +140,20 @@ the supported device trees for stm32mp157 are:
|
||||
So in the output directory (selected by KBUILD_OUTPUT),
|
||||
you can found the needed files:
|
||||
|
||||
a) For Trusted boot
|
||||
+ FSBL = tf-a.stm32 (provided by TF-A compilation)
|
||||
+ SSBL = u-boot.stm32
|
||||
|
||||
b) For Basic boot
|
||||
+ FSBL = spl/u-boot-spl.stm32
|
||||
+ SSBL = u-boot.img
|
||||
|
||||
6. Switch Setting for Boot Mode
|
||||
===============================
|
||||
|
||||
You can select the boot mode, on the board ed1 with the switch SW1
|
||||
You can select the boot mode,
|
||||
- on the daugther board ed1 with the switch SW1 : BOOT0, BOOT1, BOOT2
|
||||
- on board DK1/DK2 with the switch SW1 (BOOT1 forced to 0)
|
||||
|
||||
-----------------------------------
|
||||
Boot Mode BOOT2 BOOT1 BOOT0
|
||||
@ -142,6 +167,16 @@ You can select the boot mode, on the board ed1 with the switch SW1
|
||||
Recovery 1 1 0
|
||||
Recovery 0 0 0
|
||||
|
||||
- on board DK1/DK2 with the switch SW1 : BOOT0, BOOT2
|
||||
(BOOT1 forced to 0, NOR not supported)
|
||||
|
||||
--------------------------
|
||||
Boot Mode BOOT2 BOOT0
|
||||
--------------------------
|
||||
Reserved 1 0
|
||||
SD-Card 1 1
|
||||
Recovery 0 0
|
||||
|
||||
Recovery is a boot from serial link (UART/USB) and it is used with
|
||||
STM32CubeProgrammer tool to load executable in RAM and to update the flash
|
||||
devices available on the board (NOR/NAND/eMMC/SDCARD).
|
||||
@ -158,14 +193,14 @@ The minimal requirements for STMP32MP1 boot up to U-Boot are:
|
||||
- one ssbl partition for U-Boot
|
||||
|
||||
Then the minimal GPT partition is:
|
||||
----- ------- --------- -------------
|
||||
| Num | Name | Size | Content |
|
||||
----- ------- -------- --------------
|
||||
----- ------- --------- ---------------
|
||||
| Num | Name | Size | Content |
|
||||
----- ------- -------- ----------------
|
||||
| 1 | fsbl1 | 256 KiB | TF-A or SPL |
|
||||
| 2 | fsbl2 | 256 KiB | TF-A or SPL |
|
||||
| 3 | ssbl | enought | U-Boot |
|
||||
| * | - | - | Boot/Rootfs|
|
||||
----- ------- --------- -------------
|
||||
| 3 | ssbl | enought | U-Boot |
|
||||
| * | - | - | Boot/Rootfs |
|
||||
----- ------- --------- ---------------
|
||||
|
||||
(*) add bootable partition for extlinux.conf
|
||||
following Generic Distribution
|
||||
@ -189,7 +224,7 @@ for example: with gpt table with 128 entries
|
||||
|
||||
you can add other partitions for kernel
|
||||
one partition rootfs for example:
|
||||
-n 3:5154: -c 4:rootfs
|
||||
-n 3:5154: -c 4:rootfs \
|
||||
|
||||
c) copy the FSBL (2 times) and SSBL file on the correct partition.
|
||||
in this example in partition 1 to 3
|
||||
@ -199,6 +234,11 @@ for example: with gpt table with 128 entries
|
||||
# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
|
||||
# dd if=u-boot.img of=/dev/mmcblk0p3
|
||||
|
||||
for trusted boot mode :
|
||||
# dd if=tf-a.stm32 of=/dev/mmcblk0p1
|
||||
# dd if=tf-a.stm32 of=/dev/mmcblk0p2
|
||||
# dd if=u-boot.stm32 of=/dev/mmcblk0p3
|
||||
|
||||
To boot from SDCard, select BootPinMode = 1 1 1 and reset.
|
||||
|
||||
8. Prepare eMMC
|
||||
@ -266,3 +306,37 @@ on bank 0 to access to internal OTP:
|
||||
4 check env update
|
||||
STM32MP> print ethaddr
|
||||
ethaddr=12:34:56:78:9a:bc
|
||||
|
||||
10. Coprocessor firmware
|
||||
========================
|
||||
|
||||
U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
|
||||
|
||||
A/ Manuallly by using rproc commands (update the bootcmd)
|
||||
Configurations
|
||||
# env set name_copro "stm32mp15_m4.elf"
|
||||
# env set dev_copro 0
|
||||
# env set loadaddr_copro 0xC1000000
|
||||
|
||||
Load binary from bootfs partition (number 4) on SDCard (mmc 0)
|
||||
# ext4load mmc 0:4 ${loadaddr_copro} ${name_copro}
|
||||
=> ${filesize} updated with the size of the loaded file
|
||||
|
||||
Start M4 firmware with remote proc command
|
||||
# rproc init
|
||||
# rproc load ${dev_copro} ${loadaddr_copro} ${filesize}
|
||||
# rproc load_rsc ${dev_copro} ${loadaddr_copro} ${filesize}
|
||||
# rproc start ${dev_copro}
|
||||
|
||||
B/ Automatically by using FIT feature and generic DISTRO bootcmd
|
||||
|
||||
see examples in this directory :
|
||||
|
||||
Generate FIT including kernel + device tree + M4 firmware
|
||||
with cfg with M4 boot
|
||||
$> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
|
||||
|
||||
Then using DISTRO configuration file: see extlinux.conf to select
|
||||
the correct configuration
|
||||
=> stm32mp157c-ev1-m4
|
||||
=> stm32mp157c-dk2-m4
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/ddr.h>
|
||||
#include <power/pmic.h>
|
||||
#include <power/stpmu1.h>
|
||||
#include <power/stpmic1.h>
|
||||
|
||||
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
|
||||
void board_debug_uart_init(void)
|
||||
@ -37,64 +37,140 @@ void board_debug_uart_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PMIC_STPMU1
|
||||
int board_ddr_power_init(void)
|
||||
#ifdef CONFIG_PMIC_STPMIC1
|
||||
int board_ddr_power_init(enum ddr_type ddr_type)
|
||||
{
|
||||
struct udevice *dev;
|
||||
bool buck3_at_1800000v = false;
|
||||
int ret;
|
||||
|
||||
ret = uclass_get_device_by_driver(UCLASS_PMIC,
|
||||
DM_GET_DRIVER(pmic_stpmu1), &dev);
|
||||
DM_GET_DRIVER(pmic_stpmic1), &dev);
|
||||
if (ret)
|
||||
/* No PMIC on board */
|
||||
/* No PMIC on power discrete board */
|
||||
return 0;
|
||||
|
||||
/* Set LDO3 to sync mode */
|
||||
ret = pmic_reg_read(dev, STPMU1_LDOX_CTRL_REG(STPMU1_LDO3));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
switch (ddr_type) {
|
||||
case STM32MP_DDR3:
|
||||
/* VTT = Set LDO3 to sync mode */
|
||||
ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret &= ~STPMU1_LDO3_MODE;
|
||||
ret &= ~STPMU1_LDO12356_OUTPUT_MASK;
|
||||
ret |= STPMU1_LDO3_DDR_SEL << STPMU1_LDO12356_OUTPUT_SHIFT;
|
||||
ret &= ~STPMIC1_LDO3_MODE;
|
||||
ret &= ~STPMIC1_LDO12356_VOUT_MASK;
|
||||
ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
|
||||
|
||||
ret = pmic_reg_write(dev, STPMU1_LDOX_CTRL_REG(STPMU1_LDO3),
|
||||
ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
|
||||
ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set BUCK2 to 1.35V */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMU1_BUCKX_CTRL_REG(STPMU1_BUCK2),
|
||||
STPMU1_BUCK_OUTPUT_MASK,
|
||||
STPMU1_BUCK2_1350000V);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* VDD_DDR = Set BUCK2 to 1.35V */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
|
||||
STPMIC1_BUCK_VOUT_MASK,
|
||||
STPMIC1_BUCK2_1350000V);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Enable BUCK2 and VREF */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMU1_BUCKX_CTRL_REG(STPMU1_BUCK2),
|
||||
STPMU1_BUCK_EN, STPMU1_BUCK_EN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Enable VDD_DDR = BUCK2 */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
|
||||
STPMIC1_BUCK_ENA, STPMIC1_BUCK_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
ret = pmic_clrsetbits(dev, STPMU1_VREF_CTRL_REG,
|
||||
STPMU1_VREF_EN, STPMU1_VREF_EN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Enable VREF */
|
||||
ret = pmic_clrsetbits(dev, STPMIC1_REFDDR_MAIN_CR,
|
||||
STPMIC1_VREF_ENA, STPMIC1_VREF_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
/* Enable LDO3 */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMU1_LDOX_CTRL_REG(STPMU1_LDO3),
|
||||
STPMU1_LDO_EN, STPMU1_LDO_EN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Enable VTT = LDO3 */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
|
||||
STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
break;
|
||||
|
||||
case STM32MP_LPDDR2:
|
||||
case STM32MP_LPDDR3:
|
||||
/*
|
||||
* configure VDD_DDR1 = LDO3
|
||||
* Set LDO3 to 1.8V
|
||||
* + bypass mode if BUCK3 = 1.8V
|
||||
* + normal mode if BUCK3 != 1.8V
|
||||
*/
|
||||
ret = pmic_reg_read(dev,
|
||||
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK3));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret & STPMIC1_BUCK3_1800000V) == STPMIC1_BUCK3_1800000V)
|
||||
buck3_at_1800000v = true;
|
||||
|
||||
ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret &= ~STPMIC1_LDO3_MODE;
|
||||
ret &= ~STPMIC1_LDO12356_VOUT_MASK;
|
||||
ret |= STPMIC1_LDO3_1800000;
|
||||
if (buck3_at_1800000v)
|
||||
ret |= STPMIC1_LDO3_MODE;
|
||||
|
||||
ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
|
||||
ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* VDD_DDR2 : Set BUCK2 to 1.2V */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
|
||||
STPMIC1_BUCK_VOUT_MASK,
|
||||
STPMIC1_BUCK2_1200000V);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Enable VDD_DDR1 = LDO3 */
|
||||
ret = pmic_clrsetbits(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
|
||||
STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
/* Enable VDD_DDR22 =BUCK2 */
|
||||
ret = pmic_clrsetbits(dev,
|
||||
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
|
||||
STPMIC1_BUCK_ENA, STPMIC1_BUCK_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
/* Enable VREF */
|
||||
ret = pmic_clrsetbits(dev, STPMIC1_REFDDR_MAIN_CR,
|
||||
STPMIC1_VREF_ENA, STPMIC1_VREF_ENA);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
145
board/st/stm32mp1/cmd_stboard.c
Normal file
145
board/st/stm32mp1/cmd_stboard.c
Normal file
@ -0,0 +1,145 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <misc.h>
|
||||
#include <dm/device.h>
|
||||
#include <dm/uclass.h>
|
||||
|
||||
static bool check_stboard(u16 board)
|
||||
{
|
||||
int i;
|
||||
const u16 st_board_id[] = {
|
||||
0x1272,
|
||||
0x1263,
|
||||
0x1264,
|
||||
0x1298,
|
||||
0x1341,
|
||||
0x1497,
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(st_board_id); i++)
|
||||
if (board == st_board_id[i])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void display_stboard(u32 otp)
|
||||
{
|
||||
printf("Board: MB%04x Var%d Rev.%c-%02d\n",
|
||||
otp >> 16,
|
||||
(otp >> 12) & 0xF,
|
||||
((otp >> 8) & 0xF) - 1 + 'A',
|
||||
otp & 0xF);
|
||||
}
|
||||
|
||||
static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char * const argv[])
|
||||
{
|
||||
int ret;
|
||||
u32 otp;
|
||||
u8 revision;
|
||||
unsigned long board, variant, bom;
|
||||
struct udevice *dev;
|
||||
int confirmed = argc == 6 && !strcmp(argv[1], "-y");
|
||||
|
||||
argc -= 1 + confirmed;
|
||||
argv += 1 + confirmed;
|
||||
|
||||
if (argc != 0 && argc != 4)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
ret = uclass_get_device_by_driver(UCLASS_MISC,
|
||||
DM_GET_DRIVER(stm32mp_bsec),
|
||||
&dev);
|
||||
|
||||
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
|
||||
&otp, sizeof(otp));
|
||||
|
||||
if (ret) {
|
||||
puts("OTP read error");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
if (argc == 0) {
|
||||
if (!otp)
|
||||
puts("Board : OTP board FREE\n");
|
||||
else
|
||||
display_stboard(otp);
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
if (otp) {
|
||||
display_stboard(otp);
|
||||
printf("ERROR: OTP board not FREE\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
if (strict_strtoul(argv[0], 16, &board) < 0 ||
|
||||
board == 0 || board > 0xFFFF) {
|
||||
printf("argument %d invalid: %s\n", 1, argv[0]);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
if (strict_strtoul(argv[1], 10, &variant) < 0 ||
|
||||
variant == 0 || variant > 15) {
|
||||
printf("argument %d invalid: %s\n", 2, argv[1]);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
revision = argv[2][0] - 'A' + 1;
|
||||
if (strlen(argv[2]) > 1 || revision == 0 || revision > 15) {
|
||||
printf("argument %d invalid: %s\n", 3, argv[2]);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
if (strict_strtoul(argv[3], 10, &bom) < 0 ||
|
||||
bom == 0 || bom > 15) {
|
||||
printf("argument %d invalid: %s\n", 4, argv[3]);
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
otp = (board << 16) | (variant << 12) | (revision << 8) | bom;
|
||||
display_stboard(otp);
|
||||
printf("=> OTP[%d] = %08X\n", BSEC_OTP_BOARD, otp);
|
||||
|
||||
if (!check_stboard((u16)board)) {
|
||||
printf("Unknown board MB%04x\n", (u16)board);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
if (!confirmed) {
|
||||
printf("Warning: Programming BOARD in OTP is irreversible!\n");
|
||||
printf("Really perform this OTP programming? <y/N>\n");
|
||||
|
||||
if (!confirm_yesno()) {
|
||||
puts("BOARD programming aborted\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
ret = misc_write(dev, STM32_BSEC_OTP(BSEC_OTP_BOARD),
|
||||
&otp, sizeof(otp));
|
||||
|
||||
if (ret) {
|
||||
puts("BOARD programming error\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
puts("BOARD programming done\n");
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(stboard, 6, 0, do_stboard,
|
||||
"read/write board reference in OTP",
|
||||
"\n"
|
||||
" Print current board information\n"
|
||||
"stboard [-y] <Board> <Variant> <Revision> <BOM>\n"
|
||||
" Write board information\n"
|
||||
" - Board: xxxx, example 1264 for MB1264\n"
|
||||
" - Variant: 1 ... 15\n"
|
||||
" - Revision: A...O\n"
|
||||
" - BOM: 1...15\n");
|
||||
20
board/st/stm32mp1/extlinux.conf
Normal file
20
board/st/stm32mp1/extlinux.conf
Normal file
@ -0,0 +1,20 @@
|
||||
# Generic Distro Configuration for STM32MP157
|
||||
menu title Select the boot mode
|
||||
TIMEOUT 20
|
||||
DEFAULT stm32mp157c-ev1
|
||||
|
||||
LABEL stm32mp157c-ev1
|
||||
KERNEL /fit_kernel_dtb.itb#ev1
|
||||
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
|
||||
|
||||
LABEL stm32mp157c-ev1-m4
|
||||
KERNEL /fit_copro_kernel_dtb.itb#ev1-m4
|
||||
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
|
||||
|
||||
LABEL stm32mp157c-dk2
|
||||
KERNEL /fit_kernel_dtb.itb#dk2
|
||||
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
|
||||
|
||||
LABEL stm32mp157c-dk2-m4
|
||||
KERNEL /fit_copro_kernel_dtb.itb#dk2-m4
|
||||
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
|
||||
103
board/st/stm32mp1/fit_copro_kernel_dtb.its
Normal file
103
board/st/stm32mp1/fit_copro_kernel_dtb.its
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Compilation:
|
||||
* mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/ {
|
||||
description = "U-Boot fitImage for stm32mp157";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
|
||||
copro {
|
||||
description = "M4 copro";
|
||||
data = /incbin/("stm32mp15_m4.elf");
|
||||
type = "stm32copro";
|
||||
arch = "arm";
|
||||
compression = "none";
|
||||
load = <0xC0800000>;
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
kernel {
|
||||
description = "Linux kernel";
|
||||
data = /incbin/("zImage");
|
||||
type = "kernel";
|
||||
arch = "arm";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
load = <0xC0008000>;
|
||||
entry = <0xC0008000>;
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
fdt-dk2 {
|
||||
description = "FDT dk2";
|
||||
data = /incbin/("stm32mp157c-dk2.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "arm";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
fdt-ev1 {
|
||||
description = "FDT ev1";
|
||||
data = /incbin/("stm32mp157c-ev1.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "arm";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "dk2-m4";
|
||||
|
||||
dk2-m4 {
|
||||
description = "dk2-m4";
|
||||
loadables = "copro";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-dk2";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
dk2 {
|
||||
description = "dk2";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-dk2";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
ev1-m4 {
|
||||
description = "ev1-m4";
|
||||
loadables = "copro";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-ev1";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
ev1 {
|
||||
description = "ev1";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-ev1";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
82
board/st/stm32mp1/fit_kernel_dtb.its
Normal file
82
board/st/stm32mp1/fit_kernel_dtb.its
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Compilation:
|
||||
* mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb
|
||||
*
|
||||
* Files in linux build dir:
|
||||
* - arch/arm/boot/zImage
|
||||
* - arch/arm/boot/dts/stm32mp157c-dk2.dtb
|
||||
* - arch/arm/boot/dts/stm32mp157c-ev1.dtb
|
||||
*
|
||||
* load mmc 0:4 $kernel_addr_r fit_kernel_dtb.itb
|
||||
* bootm $kernel_addr_r
|
||||
* bootm $kernel_addr_r#dk2
|
||||
* bootm $kernel_addr_r#ev1
|
||||
*
|
||||
* or use extlinux.conf in this directory
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/ {
|
||||
description = "U-Boot fitImage for stm32mp157";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
kernel {
|
||||
description = "Linux kernel";
|
||||
data = /incbin/("zImage");
|
||||
type = "kernel";
|
||||
arch = "arm";
|
||||
os = "linux";
|
||||
compression = "none";
|
||||
load = <0xC0008000>;
|
||||
entry = <0xC0008000>;
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
fdt-dk2 {
|
||||
description = "FDT dk2";
|
||||
data = /incbin/("stm32mp157c-dk2.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "arm";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
fdt-ev1 {
|
||||
description = "FDT ev1";
|
||||
data = /incbin/("stm32mp157c-ev1.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "arm";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "dk2";
|
||||
|
||||
dk2 {
|
||||
description = "dk2";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-dk2";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
|
||||
ev1 {
|
||||
description = "ev1";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt-ev1";
|
||||
hash-1 {
|
||||
algo = "sha1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -9,24 +9,37 @@
|
||||
#include <dm.h>
|
||||
#include <ram.h>
|
||||
#include <asm/io.h>
|
||||
#include <post.h>
|
||||
#include <power/pmic.h>
|
||||
#include <power/stpmu1.h>
|
||||
#include <power/stpmic1.h>
|
||||
#include <asm/arch/ddr.h>
|
||||
|
||||
void spl_board_init(void)
|
||||
{
|
||||
/* Keep vdd on during the reset cycle */
|
||||
#if defined(CONFIG_PMIC_STPMU1) && defined(CONFIG_SPL_POWER_SUPPORT)
|
||||
#if defined(CONFIG_PMIC_STPMIC1) && defined(CONFIG_SPL_POWER_SUPPORT)
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
ret = uclass_get_device_by_driver(UCLASS_PMIC,
|
||||
DM_GET_DRIVER(pmic_stpmu1), &dev);
|
||||
DM_GET_DRIVER(pmic_stpmic1), &dev);
|
||||
if (!ret)
|
||||
pmic_clrsetbits(dev,
|
||||
STPMU1_MASK_RESET_BUCK,
|
||||
STPMU1_MASK_RESET_BUCK3,
|
||||
STPMU1_MASK_RESET_BUCK3);
|
||||
STPMIC1_BUCKS_MRST_CR,
|
||||
STPMIC1_MRST_BUCK(STPMIC1_BUCK3),
|
||||
STPMIC1_MRST_BUCK(STPMIC1_BUCK3));
|
||||
|
||||
/* Check if debug is enabled to program PMIC according to the bit */
|
||||
if ((readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_DEBUG_ON) && !ret) {
|
||||
printf("Keep debug unit ON\n");
|
||||
|
||||
pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
|
||||
STPMIC1_MRST_BUCK_DEBUG,
|
||||
STPMIC1_MRST_BUCK_DEBUG);
|
||||
|
||||
if (STPMIC1_MRST_LDO_DEBUG)
|
||||
pmic_clrsetbits(dev, STPMIC1_LDOS_MRST_CR,
|
||||
STPMIC1_MRST_LDO_DEBUG,
|
||||
STPMIC1_MRST_LDO_DEBUG);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -953,6 +953,14 @@ config CMD_PCMCIA
|
||||
about 1990. These devices are typically removable memory or network
|
||||
cards using a standard 68-pin connector.
|
||||
|
||||
config CMD_PINMUX
|
||||
bool "pinmux - show pins muxing"
|
||||
default y if PINCTRL
|
||||
help
|
||||
Parse all available pin-controllers and show pins muxing. This
|
||||
is useful for debug purpoer to check the pin muxing and to know if
|
||||
a pin is configured as a GPIO or as an alternate function.
|
||||
|
||||
config CMD_POWEROFF
|
||||
bool "poweroff"
|
||||
help
|
||||
|
||||
@ -103,6 +103,7 @@ ifdef CONFIG_PCI
|
||||
obj-$(CONFIG_CMD_PCI) += pci.o
|
||||
endif
|
||||
obj-y += pcmcia.o
|
||||
obj-$(CONFIG_CMD_PINMUX) += pinmux.o
|
||||
obj-$(CONFIG_CMD_PXE) += pxe.o
|
||||
obj-$(CONFIG_CMD_WOL) += wol.o
|
||||
obj-$(CONFIG_CMD_QFW) += qfw.o
|
||||
|
||||
70
cmd/adc.c
70
cmd/adc.c
@ -35,7 +35,7 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct udevice *dev;
|
||||
unsigned int data_mask;
|
||||
unsigned int data_mask, ch_mask;
|
||||
int ret, vss, vdd;
|
||||
|
||||
if (argc < 2)
|
||||
@ -49,6 +49,10 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
|
||||
printf("ADC Device '%s' :\n", argv[1]);
|
||||
|
||||
ret = adc_channel_mask(dev, &ch_mask);
|
||||
if (!ret)
|
||||
printf("channel mask: %x\n", ch_mask);
|
||||
|
||||
ret = adc_data_mask(dev, &data_mask);
|
||||
if (!ret)
|
||||
printf("data mask: %x\n", data_mask);
|
||||
@ -67,8 +71,9 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct udevice *dev;
|
||||
unsigned int data;
|
||||
int ret;
|
||||
int ret, uV;
|
||||
|
||||
if (argc < 3)
|
||||
return CMD_RET_USAGE;
|
||||
@ -81,7 +86,62 @@ static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
printf("%u\n", data);
|
||||
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
|
||||
if (!ret && !adc_raw_to_uV(dev, data, &uV))
|
||||
printf("%u, %d uV\n", data, uV);
|
||||
else
|
||||
printf("%u\n", data);
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
static int do_adc_scan(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct adc_channel ch[ADC_MAX_CHANNEL];
|
||||
struct udevice *dev;
|
||||
unsigned int ch_mask;
|
||||
int i, chan, ret, uV;
|
||||
|
||||
if (argc < 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
|
||||
if (ret) {
|
||||
pr_err("Can't get the ADC %s: %d\n", argv[1], ret);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
switch (argc) {
|
||||
case 3:
|
||||
ch_mask = simple_strtoul(argv[2], NULL, 0);
|
||||
if (ch_mask)
|
||||
break;
|
||||
case 2:
|
||||
ret = adc_channel_mask(dev, &ch_mask);
|
||||
if (ret) {
|
||||
pr_err("Can't get mask for %s: %d\n", dev->name, ret);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ret = adc_channels_single_shot(dev->name, ch_mask, ch);
|
||||
if (ret) {
|
||||
pr_err("Can't get single shot for %s (chans mask: 0x%x): %d\n",
|
||||
dev->name, ch_mask, ret);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
for (chan = 0, i = 0; chan < ADC_MAX_CHANNEL; chan++) {
|
||||
if (!(ch_mask & ADC_CHANNEL(chan)))
|
||||
continue;
|
||||
if (!adc_raw_to_uV(dev, ch[i].data, &uV))
|
||||
printf("[%02d]: %u, %d uV\n", ch[i].id, ch[i].data, uV);
|
||||
else
|
||||
printf("[%02d]: %u\n", ch[i].id, ch[i].data);
|
||||
i++;
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
@ -90,6 +150,7 @@ static cmd_tbl_t cmd_adc_sub[] = {
|
||||
U_BOOT_CMD_MKENT(list, 1, 1, do_adc_list, "", ""),
|
||||
U_BOOT_CMD_MKENT(info, 2, 1, do_adc_info, "", ""),
|
||||
U_BOOT_CMD_MKENT(single, 3, 1, do_adc_single, "", ""),
|
||||
U_BOOT_CMD_MKENT(scan, 3, 1, do_adc_scan, "", ""),
|
||||
};
|
||||
|
||||
static int do_adc(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
@ -115,6 +176,7 @@ static int do_adc(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
static char adc_help_text[] =
|
||||
"list - list ADC devices\n"
|
||||
"adc info <name> - Get ADC device info\n"
|
||||
"adc single <name> <channel> - Get Single data of ADC device channel";
|
||||
"adc single <name> <channel> - Get Single data of ADC device channel\n"
|
||||
"adc scan <name> [channel mask] - Scan all [or masked] ADC channels";
|
||||
|
||||
U_BOOT_CMD(adc, 4, 1, do_adc, "ADC sub-system", adc_help_text);
|
||||
|
||||
18
cmd/bmp.c
18
cmd/bmp.c
@ -124,8 +124,14 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
|
||||
break;
|
||||
case 4:
|
||||
addr = simple_strtoul(argv[1], NULL, 16);
|
||||
x = simple_strtoul(argv[2], NULL, 10);
|
||||
y = simple_strtoul(argv[3], NULL, 10);
|
||||
if (!strcmp(argv[2], "m"))
|
||||
x = BMP_ALIGN_CENTER;
|
||||
else
|
||||
x = simple_strtoul(argv[2], NULL, 10);
|
||||
if (!strcmp(argv[3], "m"))
|
||||
y = BMP_ALIGN_CENTER;
|
||||
else
|
||||
y = simple_strtoul(argv[3], NULL, 10);
|
||||
break;
|
||||
default:
|
||||
return CMD_RET_USAGE;
|
||||
@ -249,9 +255,11 @@ int bmp_display(ulong addr, int x, int y)
|
||||
if (!ret) {
|
||||
bool align = false;
|
||||
|
||||
# ifdef CONFIG_SPLASH_SCREEN_ALIGN
|
||||
align = true;
|
||||
# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
|
||||
if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) ||
|
||||
x == BMP_ALIGN_CENTER ||
|
||||
y == BMP_ALIGN_CENTER)
|
||||
align = true;
|
||||
|
||||
ret = video_bmp_display(dev, addr, x, y, align);
|
||||
}
|
||||
#elif defined(CONFIG_LCD)
|
||||
|
||||
146
cmd/pinmux.c
Normal file
146
cmd/pinmux.c
Normal file
@ -0,0 +1,146 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <dm/pinctrl.h>
|
||||
#include <dm/uclass-internal.h>
|
||||
|
||||
#define LIMIT_DEVNAME 30
|
||||
|
||||
static struct udevice *currdev;
|
||||
|
||||
static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
const char *name;
|
||||
int ret;
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
name = argv[1];
|
||||
ret = uclass_get_device_by_name(UCLASS_PINCTRL, name, &currdev);
|
||||
if (ret) {
|
||||
printf("Can't get the pin-controller: %s!\n", name);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
case 1:
|
||||
if (!currdev) {
|
||||
printf("Pin-controller device is not set!\n");
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
printf("dev: %s\n", currdev->name);
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
static int show_pinmux(struct udevice *dev)
|
||||
{
|
||||
char pin_name[PINNAME_SIZE];
|
||||
char pin_mux[PINMUX_SIZE];
|
||||
int pins_count;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
pins_count = pinctrl_get_pins_count(dev);
|
||||
|
||||
if (pins_count == -ENOSYS) {
|
||||
printf("Ops get_pins_count not supported\n");
|
||||
return pins_count;
|
||||
}
|
||||
|
||||
for (i = 0; i < pins_count; i++) {
|
||||
ret = pinctrl_get_pin_name(dev, i, pin_name, PINNAME_SIZE);
|
||||
if (ret == -ENOSYS) {
|
||||
printf("Ops get_pin_name not supported\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pinctrl_get_pin_muxing(dev, i, pin_mux, PINMUX_SIZE);
|
||||
if (ret) {
|
||||
printf("Ops get_pin_muxing error (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
printf("%-*s: %-*s\n", PINNAME_SIZE, pin_name,
|
||||
PINMUX_SIZE, pin_mux);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
struct udevice *dev;
|
||||
int ret = CMD_RET_USAGE;
|
||||
|
||||
if (currdev && (argc < 2 || strcmp(argv[1], "-a")))
|
||||
return show_pinmux(currdev);
|
||||
|
||||
if (argc < 2 || strcmp(argv[1], "-a"))
|
||||
return ret;
|
||||
|
||||
uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
|
||||
/* insert a separator between each pin-controller display */
|
||||
printf("--------------------------\n");
|
||||
printf("%s:\n", dev->name);
|
||||
ret = show_pinmux(dev);
|
||||
if (ret < 0)
|
||||
printf("Can't display pin muxing for %s\n",
|
||||
dev->name);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
printf("| %-*.*s| %-*.*s| %s\n",
|
||||
LIMIT_DEVNAME, LIMIT_DEVNAME, "Device",
|
||||
LIMIT_DEVNAME, LIMIT_DEVNAME, "Driver",
|
||||
"Parent");
|
||||
|
||||
uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
|
||||
printf("| %-*.*s| %-*.*s| %s\n",
|
||||
LIMIT_DEVNAME, LIMIT_DEVNAME, dev->name,
|
||||
LIMIT_DEVNAME, LIMIT_DEVNAME, dev->driver->name,
|
||||
dev->parent->name);
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
static cmd_tbl_t pinmux_subcmd[] = {
|
||||
U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
|
||||
U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
|
||||
U_BOOT_CMD_MKENT(status, 2, 1, do_status, "", ""),
|
||||
};
|
||||
|
||||
static int do_pinmux(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char * const argv[])
|
||||
{
|
||||
cmd_tbl_t *cmd;
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
cmd = find_cmd_tbl(argv[0], pinmux_subcmd, ARRAY_SIZE(pinmux_subcmd));
|
||||
if (!cmd || argc > cmd->maxargs)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
return cmd->cmd(cmdtp, flag, argc, argv);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(pinmux, CONFIG_SYS_MAXARGS, 1, do_pinmux,
|
||||
"show pin-controller muxing",
|
||||
"list - list UCLASS_PINCTRL devices\n"
|
||||
"pinmux dev [pincontroller-name] - select pin-controller device\n"
|
||||
"pinmux status [-a] - print pin-controller muxing [for all]\n"
|
||||
)
|
||||
24
cmd/pxe.c
24
cmd/pxe.c
@ -8,11 +8,13 @@
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <mapmem.h>
|
||||
#include <lcd.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <errno.h>
|
||||
#include <linux/list.h>
|
||||
#include <fs.h>
|
||||
#include <splash.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include "menu.h"
|
||||
@ -488,6 +490,7 @@ struct pxe_label {
|
||||
*
|
||||
* title - the name of the menu as given by a 'menu title' line.
|
||||
* default_label - the name of the default label, if any.
|
||||
* bmp - the bmp file name which is displayed in background
|
||||
* timeout - time in tenths of a second to wait for a user key-press before
|
||||
* booting the default label.
|
||||
* prompt - if 0, don't prompt for a choice unless the timeout period is
|
||||
@ -498,6 +501,7 @@ struct pxe_label {
|
||||
struct pxe_menu {
|
||||
char *title;
|
||||
char *default_label;
|
||||
char *bmp;
|
||||
int timeout;
|
||||
int prompt;
|
||||
struct list_head labels;
|
||||
@ -850,6 +854,7 @@ enum token_type {
|
||||
T_FDTDIR,
|
||||
T_ONTIMEOUT,
|
||||
T_IPAPPEND,
|
||||
T_BACKGROUND,
|
||||
T_INVALID
|
||||
};
|
||||
|
||||
@ -883,6 +888,7 @@ static const struct token keywords[] = {
|
||||
{"fdtdir", T_FDTDIR},
|
||||
{"ontimeout", T_ONTIMEOUT,},
|
||||
{"ipappend", T_IPAPPEND,},
|
||||
{"background", T_BACKGROUND,},
|
||||
{NULL, T_INVALID}
|
||||
};
|
||||
|
||||
@ -1160,6 +1166,10 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
|
||||
nest_level + 1);
|
||||
break;
|
||||
|
||||
case T_BACKGROUND:
|
||||
err = parse_sliteral(c, &cfg->bmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Ignoring malformed menu command: %.*s\n",
|
||||
(int)(*c - s), s);
|
||||
@ -1574,6 +1584,20 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
|
||||
struct menu *m;
|
||||
int err;
|
||||
|
||||
#ifdef CONFIG_CMD_BMP
|
||||
/* display BMP if available */
|
||||
if (cfg->bmp) {
|
||||
if (get_relfile(cmdtp, cfg->bmp, load_addr)) {
|
||||
run_command("cls", 0);
|
||||
bmp_display(load_addr,
|
||||
BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
|
||||
} else {
|
||||
printf("Skipping background bmp %s for failure\n",
|
||||
cfg->bmp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m = pxe_menu_to_menu(cfg);
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
@ -103,7 +103,7 @@ static int do_remoteproc_list(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
}
|
||||
|
||||
/**
|
||||
* do_remoteproc_load() - Load a remote processor with binary image
|
||||
* do_remoteproc_load() - Load a remote processor with binary or elf image
|
||||
* @cmdtp: unused
|
||||
* @flag: unused
|
||||
* @argc: argument count for the load function
|
||||
@ -142,6 +142,53 @@ static int do_remoteproc_load(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
return ret ? CMD_RET_FAILURE : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* do_remoteproc_load_rsc_table() - Get resource table from an elf image
|
||||
* @cmdtp: unused
|
||||
* @flag: unused
|
||||
* @argc: argument count for the load function
|
||||
* @argv: arguments for the load function
|
||||
*
|
||||
* Return: 0 if no error, else returns appropriate error value.
|
||||
*/
|
||||
static int do_remoteproc_load_rsc_table(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
ulong addr, size, rsc_addr;
|
||||
unsigned int rsc_size;
|
||||
int id, ret;
|
||||
|
||||
if (argc != 4)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
id = (int)simple_strtoul(argv[1], NULL, 3);
|
||||
addr = simple_strtoul(argv[2], NULL, 16);
|
||||
|
||||
size = simple_strtoul(argv[3], NULL, 16);
|
||||
|
||||
if (!size) {
|
||||
printf("\t Expect some size??\n");
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
if (!rproc_is_initialized()) {
|
||||
printf("\tRemote Processors are not initialized\n");
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
ret = rproc_load_rsc_table(id, addr, size, &rsc_addr, &rsc_size);
|
||||
if (!ret) {
|
||||
env_set_hex("copro_rsc_addr", rsc_addr);
|
||||
env_set_hex("copro_rsc_size", rsc_size);
|
||||
}
|
||||
|
||||
printf("Remote Processor %d resource table %s : 0x%08lx-0x%x\n",
|
||||
id, ret ? "Not found" : "Found", ret ? 0 : rsc_addr,
|
||||
ret ? 0 : rsc_size);
|
||||
|
||||
return ret ? CMD_RET_FAILURE : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* do_remoteproc_wrapper() - wrapper for various rproc commands
|
||||
* @cmdtp: unused
|
||||
@ -172,6 +219,9 @@ static int do_remoteproc_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
|
||||
if (!strcmp(argv[0], "start")) {
|
||||
ret = rproc_start(id);
|
||||
if (!ret)
|
||||
env_set("copro_state", "booted");
|
||||
|
||||
} else if (!strcmp(argv[0], "stop")) {
|
||||
ret = rproc_stop(id);
|
||||
} else if (!strcmp(argv[0], "reset")) {
|
||||
@ -213,6 +263,12 @@ static cmd_tbl_t cmd_remoteproc_sub[] = {
|
||||
"- id: ID of the remote processor(see 'list' cmd)\n"
|
||||
"- addr: Address in memory of the image to loadup\n"
|
||||
"- size: Size of the image to loadup\n"),
|
||||
U_BOOT_CMD_MKENT(load_rsc, 5, 1, do_remoteproc_load_rsc_table,
|
||||
"Load resource table address from remote processor provided image",
|
||||
"<id> [addr] [size]\n"
|
||||
"- id: ID of the remote processor(see 'list' cmd)\n"
|
||||
"- addr: Address in memory of the image\n"
|
||||
"- size: Size of the image\n"),
|
||||
U_BOOT_CMD_MKENT(start, 1, 1, do_remoteproc_wrapper,
|
||||
"Start remote processor",
|
||||
"id - ID of the remote processor (see 'list' cmd)\n"),
|
||||
@ -272,8 +328,10 @@ U_BOOT_CMD(rproc, 5, 1, do_remoteproc,
|
||||
"\n\tSubcommands:\n"
|
||||
"\tinit - Enumerate and initalize the remote processors\n"
|
||||
"\tlist - list available remote processors\n"
|
||||
"\tload <id> [addr] [size]- Load the remote processor with binary\n"
|
||||
"\tload <id> [addr] [size]- Load the remote processor with\n"
|
||||
"\t image stored at address [addr] in memory\n"
|
||||
"\tload_rsc <id> [addr] [size]- Load resource table from remote\n"
|
||||
"\t processor provided image at address [addr]\n"
|
||||
"\tstart <id> - Start the remote processor(must be loaded)\n"
|
||||
"\tstop <id> - Stop the remote processor\n"
|
||||
"\treset <id> - Reset the remote processor\n"
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <part.h>
|
||||
#include <usb.h>
|
||||
#include <usb_mass_storage.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
static int ums_read_sector(struct ums *ums_dev,
|
||||
ulong start, lbaint_t blkcnt, void *buf)
|
||||
@ -226,6 +227,8 @@ static int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
|
||||
rc = CMD_RET_SUCCESS;
|
||||
goto cleanup_register;
|
||||
}
|
||||
|
||||
WATCHDOG_RESET();
|
||||
}
|
||||
|
||||
cleanup_register:
|
||||
|
||||
@ -116,6 +116,7 @@ endif
|
||||
|
||||
obj-y += cli.o
|
||||
obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
|
||||
obj-$(CONFIG_STM32MP1_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
|
||||
obj-$(CONFIG_DFU_OVER_USB) += dfu.o
|
||||
obj-y += command.o
|
||||
obj-$(CONFIG_$(SPL_)LOG) += log.o
|
||||
|
||||
@ -92,7 +92,7 @@ static int init_func_watchdog_init(void)
|
||||
(defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
|
||||
defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
|
||||
defined(CONFIG_DESIGNWARE_WATCHDOG) || \
|
||||
defined(CONFIG_IMX_WATCHDOG))
|
||||
defined(CONFIG_IMX_WATCHDOG) || defined(CONFIG_STM32MP_WATCHDOG))
|
||||
hw_watchdog_init();
|
||||
puts(" Watchdog enabled\n");
|
||||
# endif
|
||||
@ -434,7 +434,6 @@ static int reserve_uboot(void)
|
||||
debug("Reserving %ldk for U-Boot at: %08lx\n",
|
||||
gd->mon_len >> 10, gd->relocaddr);
|
||||
}
|
||||
|
||||
gd->start_addr_sp = gd->relocaddr;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -166,6 +166,7 @@ static const table_entry_t uimage_type[] = {
|
||||
{ IH_TYPE_FIRMWARE_IVT, "firmware_ivt", "Firmware with HABv4 IVT" },
|
||||
{ IH_TYPE_PMMC, "pmmc", "TI Power Management Micro-Controller Firmware",},
|
||||
{ IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
|
||||
{ IH_TYPE_STM32COPRO, "stm32copro", "STMicroelectronics STM32 Coprocessor Image"},
|
||||
{ -1, "", "", },
|
||||
};
|
||||
|
||||
|
||||
@ -78,11 +78,18 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
|
||||
/*
|
||||
* Load U-Boot image from SPI flash into RAM
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DM_SPI_FLASH
|
||||
/* In DM mode defaults will be taken from DT */
|
||||
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
|
||||
CONFIG_SF_DEFAULT_CS,
|
||||
0,
|
||||
0);
|
||||
#else
|
||||
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
|
||||
CONFIG_SF_DEFAULT_CS,
|
||||
CONFIG_SF_DEFAULT_SPEED,
|
||||
CONFIG_SF_DEFAULT_MODE);
|
||||
#endif
|
||||
if (!flash) {
|
||||
puts("SPI probe failed.\n");
|
||||
return -ENODEV;
|
||||
|
||||
@ -233,6 +233,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
|
||||
request, requesttype, value, index, size);
|
||||
dev->status = USB_ST_NOT_PROC; /*not yet processed */
|
||||
|
||||
mdelay(5);
|
||||
|
||||
err = submit_control_msg(dev, pipe, data, size, setup_packet);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@ -215,3 +215,5 @@ CONFIG_UT_TIME=y
|
||||
CONFIG_UT_DM=y
|
||||
CONFIG_UT_ENV=y
|
||||
CONFIG_UT_OVERLAY=y
|
||||
CONFIG_DM_HWSPINLOCK=y
|
||||
CONFIG_HWSPINLOCK_SANDBOX=y
|
||||
|
||||
@ -1,14 +1,18 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_STM32MP=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x2000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x3000
|
||||
CONFIG_SPL_MMC_SUPPORT=y
|
||||
CONFIG_SPL=y
|
||||
CONFIG_TARGET_STM32MP1=y
|
||||
CONFIG_SPL_SPI_FLASH_SUPPORT=y
|
||||
CONFIG_SPL_SPI_SUPPORT=y
|
||||
# CONFIG_ARMV7_VIRT is not set
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
|
||||
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
|
||||
CONFIG_SPL_I2C_SUPPORT=y
|
||||
CONFIG_SPL_MTD_SUPPORT=y
|
||||
CONFIG_SPL_POWER_SUPPORT=y
|
||||
CONFIG_SYS_PROMPT="STM32MP> "
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
@ -18,48 +22,97 @@ CONFIG_SYS_PROMPT="STM32MP> "
|
||||
# CONFIG_CMD_EXPORTENV is not set
|
||||
# CONFIG_CMD_IMPORTENV is not set
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_ADC=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DFU=y
|
||||
CONFIG_CMD_FUSE=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_REMOTEPROC=y
|
||||
CONFIG_CMD_SF=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
CONFIG_CMD_BMP=y
|
||||
CONFIG_CMD_CACHE=y
|
||||
CONFIG_CMD_TIME=y
|
||||
CONFIG_CMD_TIMER=y
|
||||
CONFIG_CMD_PMIC=y
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_CMD_EXT4_WRITE=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_CMD_UBI=y
|
||||
# CONFIG_SPL_DOS_PARTITION is not set
|
||||
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
|
||||
CONFIG_STM32_ADC=y
|
||||
CONFIG_USB_FUNCTION_FASTBOOT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
|
||||
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
|
||||
CONFIG_FASTBOOT_USB_DEV=1
|
||||
CONFIG_FASTBOOT_FLASH=y
|
||||
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
|
||||
CONFIG_DM_HWSPINLOCK=y
|
||||
CONFIG_HWSPINLOCK_STM32=y
|
||||
CONFIG_DM_I2C=y
|
||||
CONFIG_SYS_I2C_STM32F7=y
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_DM_MAILBOX=y
|
||||
CONFIG_STM32_IPCC=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_STM32_SDMMC2=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_NAND=y
|
||||
CONFIG_NAND_STM32_FMC2=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_BAR=y
|
||||
CONFIG_SPI_FLASH_MACRONIX=y
|
||||
CONFIG_SPI_FLASH_SPANSION=y
|
||||
CONFIG_SPI_FLASH_STMICRO=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
CONFIG_SPI_FLASH_MTD=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_DM_ETH=y
|
||||
CONFIG_DWC_ETH_QOS=y
|
||||
CONFIG_PHY=y
|
||||
CONFIG_PHY_STM32_USBPHYC=y
|
||||
# CONFIG_PINCTRL_FULL is not set
|
||||
CONFIG_PINCONF=y
|
||||
# CONFIG_SPL_PINCTRL_FULL is not set
|
||||
CONFIG_PINCTRL_STMFX=y
|
||||
CONFIG_DM_PMIC=y
|
||||
# CONFIG_SPL_PMIC_CHILDREN is not set
|
||||
CONFIG_PMIC_STPMU1=y
|
||||
CONFIG_PMIC_STPMIC1=y
|
||||
CONFIG_DM_REGULATOR_FIXED=y
|
||||
CONFIG_DM_REGULATOR_GPIO=y
|
||||
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
|
||||
CONFIG_DM_REGULATOR_STPMU1=y
|
||||
CONFIG_DM_REGULATOR_STPMIC1=y
|
||||
CONFIG_STM32MP1_DDR_INTERACTIVE=y
|
||||
CONFIG_REMOTEPROC_STM32_COPRO=y
|
||||
CONFIG_SERIAL_RX_BUFFER=y
|
||||
CONFIG_STM32_SERIAL=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_STM32_QSPI=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
CONFIG_USB_DWC2=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
|
||||
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_BACKLIGHT_GPIO=y
|
||||
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
|
||||
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
|
||||
CONFIG_VIDEO_STM32=y
|
||||
CONFIG_VIDEO_STM32_DSI=y
|
||||
CONFIG_VIDEO_STM32_MAX_XRES=1280
|
||||
CONFIG_VIDEO_STM32_MAX_YRES=800
|
||||
CONFIG_STM32MP_WATCHDOG=y
|
||||
CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
|
||||
105
configs/stm32mp15_optee_defconfig
Normal file
105
configs/stm32mp15_optee_defconfig
Normal file
@ -0,0 +1,105 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_STM32MP=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x3000
|
||||
CONFIG_TARGET_STM32MP1=y
|
||||
CONFIG_STM32MP1_OPTEE=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SYS_PROMPT="STM32MP> "
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_IMI is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
# CONFIG_CMD_EXPORTENV is not set
|
||||
# CONFIG_CMD_IMPORTENV is not set
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_ADC=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DFU=y
|
||||
CONFIG_CMD_FUSE=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_REMOTEPROC=y
|
||||
CONFIG_CMD_SF=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
CONFIG_CMD_BMP=y
|
||||
CONFIG_CMD_CACHE=y
|
||||
CONFIG_CMD_TIME=y
|
||||
CONFIG_CMD_TIMER=y
|
||||
CONFIG_CMD_PMIC=y
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_CMD_EXT4_WRITE=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
|
||||
CONFIG_STM32_ADC=y
|
||||
CONFIG_USB_FUNCTION_FASTBOOT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
|
||||
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
|
||||
CONFIG_FASTBOOT_USB_DEV=1
|
||||
CONFIG_FASTBOOT_FLASH=y
|
||||
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
|
||||
CONFIG_DM_HWSPINLOCK=y
|
||||
CONFIG_HWSPINLOCK_STM32=y
|
||||
CONFIG_DM_I2C=y
|
||||
CONFIG_SYS_I2C_STM32F7=y
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_DM_MAILBOX=y
|
||||
CONFIG_STM32_IPCC=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_STM32_SDMMC2=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_NAND=y
|
||||
CONFIG_NAND_STM32_FMC2=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_BAR=y
|
||||
CONFIG_SPI_FLASH_MACRONIX=y
|
||||
CONFIG_SPI_FLASH_SPANSION=y
|
||||
CONFIG_SPI_FLASH_STMICRO=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
CONFIG_SPI_FLASH_MTD=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_DM_ETH=y
|
||||
CONFIG_DWC_ETH_QOS=y
|
||||
CONFIG_PHY=y
|
||||
CONFIG_PHY_STM32_USBPHYC=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_STMFX=y
|
||||
CONFIG_DM_PMIC=y
|
||||
CONFIG_PMIC_STPMIC1=y
|
||||
CONFIG_DM_REGULATOR_FIXED=y
|
||||
CONFIG_DM_REGULATOR_GPIO=y
|
||||
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
|
||||
CONFIG_DM_REGULATOR_STPMIC1=y
|
||||
CONFIG_REMOTEPROC_STM32_COPRO=y
|
||||
CONFIG_SERIAL_RX_BUFFER=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_STM32_QSPI=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
|
||||
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_BACKLIGHT_GPIO=y
|
||||
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
|
||||
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
|
||||
CONFIG_VIDEO_STM32=y
|
||||
CONFIG_VIDEO_STM32_DSI=y
|
||||
CONFIG_VIDEO_STM32_MAX_XRES=1280
|
||||
CONFIG_VIDEO_STM32_MAX_YRES=800
|
||||
CONFIG_STM32MP_WATCHDOG=y
|
||||
CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
104
configs/stm32mp15_trusted_defconfig
Normal file
104
configs/stm32mp15_trusted_defconfig
Normal file
@ -0,0 +1,104 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARCH_STM32MP=y
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x3000
|
||||
CONFIG_TARGET_STM32MP1=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SYS_PROMPT="STM32MP> "
|
||||
# CONFIG_CMD_BOOTD is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_IMI is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
# CONFIG_CMD_EXPORTENV is not set
|
||||
# CONFIG_CMD_IMPORTENV is not set
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_MEMTEST=y
|
||||
CONFIG_CMD_ADC=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DFU=y
|
||||
CONFIG_CMD_FUSE=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_REMOTEPROC=y
|
||||
CONFIG_CMD_SF=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
CONFIG_CMD_BMP=y
|
||||
CONFIG_CMD_CACHE=y
|
||||
CONFIG_CMD_TIME=y
|
||||
CONFIG_CMD_TIMER=y
|
||||
CONFIG_CMD_PMIC=y
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_CMD_EXT4_WRITE=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
|
||||
CONFIG_STM32_ADC=y
|
||||
CONFIG_USB_FUNCTION_FASTBOOT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
|
||||
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
|
||||
CONFIG_FASTBOOT_USB_DEV=1
|
||||
CONFIG_FASTBOOT_FLASH=y
|
||||
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
|
||||
CONFIG_DM_HWSPINLOCK=y
|
||||
CONFIG_HWSPINLOCK_STM32=y
|
||||
CONFIG_DM_I2C=y
|
||||
CONFIG_SYS_I2C_STM32F7=y
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_DM_MAILBOX=y
|
||||
CONFIG_STM32_IPCC=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_STM32_SDMMC2=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_NAND=y
|
||||
CONFIG_NAND_STM32_FMC2=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_BAR=y
|
||||
CONFIG_SPI_FLASH_MACRONIX=y
|
||||
CONFIG_SPI_FLASH_SPANSION=y
|
||||
CONFIG_SPI_FLASH_STMICRO=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
CONFIG_SPI_FLASH_MTD=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_DM_ETH=y
|
||||
CONFIG_DWC_ETH_QOS=y
|
||||
CONFIG_PHY=y
|
||||
CONFIG_PHY_STM32_USBPHYC=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_STMFX=y
|
||||
CONFIG_DM_PMIC=y
|
||||
CONFIG_PMIC_STPMIC1=y
|
||||
CONFIG_DM_REGULATOR_FIXED=y
|
||||
CONFIG_DM_REGULATOR_GPIO=y
|
||||
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
|
||||
CONFIG_DM_REGULATOR_STPMIC1=y
|
||||
CONFIG_REMOTEPROC_STM32_COPRO=y
|
||||
CONFIG_SERIAL_RX_BUFFER=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_STM32_QSPI=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_DM_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
|
||||
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
|
||||
CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_BACKLIGHT_GPIO=y
|
||||
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
|
||||
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
|
||||
CONFIG_VIDEO_STM32=y
|
||||
CONFIG_VIDEO_STM32_DSI=y
|
||||
CONFIG_VIDEO_STM32_MAX_XRES=1280
|
||||
CONFIG_VIDEO_STM32_MAX_YRES=800
|
||||
CONFIG_STM32MP_WATCHDOG=y
|
||||
CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
17
doc/device-tree-bindings/arm/stm32.txt
Normal file
17
doc/device-tree-bindings/arm/stm32.txt
Normal file
@ -0,0 +1,17 @@
|
||||
STMicroelectronics STM32 Platforms Device Tree Bindings
|
||||
|
||||
Each device tree must specify which STM32 SoC it uses,
|
||||
using one of the following compatible strings:
|
||||
|
||||
st,stm32f429
|
||||
st,stm32f469
|
||||
st,stm32f746
|
||||
st,stm32h743
|
||||
st,stm32mp157
|
||||
|
||||
Required nodes:
|
||||
|
||||
- syscon: some subnode of the STM32 SoC node must be a
|
||||
system controller node pointing to the control registers,
|
||||
with the compatible string set to one of these tuples:
|
||||
"st,stm32-syscfg", "syscon"
|
||||
@ -10,6 +10,7 @@ Required properties:
|
||||
- compatible: Should be:
|
||||
"st,stm32f42xx-rcc"
|
||||
"st,stm32f469-rcc"
|
||||
"st,stm32f746-rcc"
|
||||
- reg: should be register base and length as documented in the
|
||||
datasheet
|
||||
- #reset-cells: 1, see below
|
||||
@ -17,6 +18,9 @@ Required properties:
|
||||
property, containing a phandle to the clock device node, an index selecting
|
||||
between gated clocks and other clocks and an index specifying the clock to
|
||||
use.
|
||||
- clocks: External oscillator clock phandle
|
||||
- high speed external clock signal (HSE)
|
||||
- external I2S clock (I2S_CKIN)
|
||||
|
||||
Example:
|
||||
|
||||
@ -25,6 +29,7 @@ Example:
|
||||
#clock-cells = <2>
|
||||
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
|
||||
reg = <0x40023800 0x400>;
|
||||
clocks = <&clk_hse>, <&clk_i2s_ckin>;
|
||||
};
|
||||
|
||||
Specifying gated clocks
|
||||
@ -66,6 +71,38 @@ The secondary index is bound with the following magic numbers:
|
||||
|
||||
0 SYSTICK
|
||||
1 FCLK
|
||||
2 CLK_LSI (low-power clock source)
|
||||
3 CLK_LSE (generated from a 32.768 kHz low-speed external
|
||||
crystal or ceramic resonator)
|
||||
4 CLK_HSE_RTC (HSE division factor for RTC clock)
|
||||
5 CLK_RTC (real-time clock)
|
||||
6 PLL_VCO_I2S (vco frequency of I2S pll)
|
||||
7 PLL_VCO_SAI (vco frequency of SAI pll)
|
||||
8 CLK_LCD (LCD-TFT)
|
||||
9 CLK_I2S (I2S clocks)
|
||||
10 CLK_SAI1 (audio clocks)
|
||||
11 CLK_SAI2
|
||||
12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor)
|
||||
13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor)
|
||||
|
||||
14 CLK_HSI (Internal ocscillator clock)
|
||||
15 CLK_SYSCLK (System Clock)
|
||||
16 CLK_HDMI_CEC (HDMI-CEC clock)
|
||||
17 CLK_SPDIF (SPDIF-Rx clock)
|
||||
18 CLK_USART1 (U(s)arts clocks)
|
||||
19 CLK_USART2
|
||||
20 CLK_USART3
|
||||
21 CLK_UART4
|
||||
22 CLK_UART5
|
||||
23 CLK_USART6
|
||||
24 CLK_UART7
|
||||
25 CLK_UART8
|
||||
26 CLK_I2C1 (I2S clocks)
|
||||
27 CLK_I2C2
|
||||
28 CLK_I2C3
|
||||
29 CLK_I2C4
|
||||
30 CLK_LPTIMER (LPTimer1 clock)
|
||||
)
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
60
doc/device-tree-bindings/clock/st,stm32mp1-rcc.txt
Normal file
60
doc/device-tree-bindings/clock/st,stm32mp1-rcc.txt
Normal file
@ -0,0 +1,60 @@
|
||||
STMicroelectronics STM32 Peripheral Reset Clock Controller
|
||||
==========================================================
|
||||
|
||||
The RCC IP is both a reset and a clock controller.
|
||||
|
||||
RCC makes also power management (resume/supend and wakeup interrupt).
|
||||
|
||||
Please also refer to reset.txt for common reset controller binding usage.
|
||||
|
||||
Please also refer to clock-bindings.txt for common clock controller
|
||||
binding usage.
|
||||
|
||||
|
||||
Required properties:
|
||||
- compatible: "st,stm32mp1-rcc", "syscon"
|
||||
- reg: should be register base and length as documented in the datasheet
|
||||
- #clock-cells: 1, device nodes should specify the clock in their
|
||||
"clocks" property, containing a phandle to the clock device node,
|
||||
an index specifying the clock to use.
|
||||
- #reset-cells: Shall be 1
|
||||
- interrupts: Should contain a general interrupt line and a interrupt line
|
||||
to the wake-up of processor (CSTOP).
|
||||
|
||||
Example:
|
||||
rcc: rcc@50000000 {
|
||||
compatible = "st,stm32mp1-rcc", "syscon";
|
||||
reg = <0x50000000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
interrupts = <GIC_SPI 5 IRQ_TYPE_NONE>,
|
||||
<GIC_SPI 145 IRQ_TYPE_NONE>;
|
||||
};
|
||||
|
||||
Specifying clocks
|
||||
=================
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/stm32mp1-clks.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Specifying softreset control of devices
|
||||
=======================================
|
||||
|
||||
Device nodes should specify the reset channel required in their "resets"
|
||||
property, containing a phandle to the reset device node and an index specifying
|
||||
which channel to use.
|
||||
The index is the bit number within the RCC registers bank, starting from RCC
|
||||
base address.
|
||||
It is calculated as: index = register_offset / 4 * 32 + bit_offset.
|
||||
Where bit_offset is the bit offset within the register.
|
||||
|
||||
For example on STM32MP1, for LTDC reset:
|
||||
ltdc = APB4_RSTSETR_offset / 4 * 32 + LTDC_bit_offset
|
||||
= 0x180 / 4 * 32 + 0 = 3072
|
||||
|
||||
The list of valid indices for STM32MP1 is available in:
|
||||
include/dt-bindings/reset-controller/stm32mp1-resets.h
|
||||
|
||||
This file implements defines like:
|
||||
#define LTDC_R 3072
|
||||
@ -1,185 +1,186 @@
|
||||
STMicroelectronics STM32MP1 clock tree initialization
|
||||
=====================================================
|
||||
|
||||
The STM32MP clock tree initialization is based on device tree information
|
||||
for RCC IP and on fixed clocks.
|
||||
The STM32MP1 clock tree initialization is based on device tree information
|
||||
for RCC IP node (st,stm32mp1-rcc) and on fixed-clock nodes.
|
||||
|
||||
-------------------------------
|
||||
RCC CLOCK = st,stm32mp1-rcc-clk
|
||||
-------------------------------
|
||||
RCC IP = st,stm32mp1-rcc
|
||||
========================
|
||||
|
||||
The RCC IP is both a reset and a clock controller but this documentation only
|
||||
describes the fields added for clock tree initialization which are not present
|
||||
in Linux binding.
|
||||
in Linux binding for compatible "st,stm32mp1-rcc" defined in st,stm32mp1-rcc.txt
|
||||
file.
|
||||
|
||||
Please refer to ../mfd/st,stm32-rcc.txt for all the other properties common
|
||||
with Linux.
|
||||
The added properties for clock tree initialization are:
|
||||
|
||||
Required properties:
|
||||
- st,clksrc : The clock sources configuration array in a platform specific
|
||||
order.
|
||||
|
||||
- compatible: Should be "st,stm32mp1-rcc-clk"
|
||||
For the STM32MP15x family there are 9 clock sources selector which are
|
||||
configured in the following order:
|
||||
MPU AXI MCU PLL12 PLL3 PLL4 RTC MCO1 MCO2
|
||||
|
||||
- st,clksrc : The clock source in this order
|
||||
Clock source configuration values are defined by macros CLK_<NAME>_<SOURCE>
|
||||
from dt-bindings/clock/stm32mp1-clksrc.h.
|
||||
|
||||
for STM32MP15x: 9 clock sources are requested
|
||||
MPU AXI MCU PLL12 PLL3 PLL4 RTC MCO1 MCO2
|
||||
Example:
|
||||
st,clksrc = <
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
CLK_PLL12_HSE
|
||||
CLK_PLL3_HSE
|
||||
CLK_PLL4_HSE
|
||||
CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
>;
|
||||
|
||||
with value equals to RCC clock specifier as defined in
|
||||
dt-bindings/clock/stm32mp1-clksrc.h: CLK_<NAME>_<SOURCE>
|
||||
- st,clkdiv : The clock main dividers value specified in an array
|
||||
in a platform specific order.
|
||||
|
||||
- st,clkdiv : The div parameters in this order
|
||||
for STM32MP15x: 11 dividers value are requested
|
||||
When used, it shall describe the whole clock dividers tree.
|
||||
|
||||
For the STM32MP15x family there are 11 dividers values expected.
|
||||
They shall be configured in the following order:
|
||||
MPU AXI MCU APB1 APB2 APB3 APB4 APB5 RTC MCO1 MCO2
|
||||
|
||||
with DIV coding defined in RCC associated register RCC_xxxDIVR
|
||||
|
||||
most the case, it is:
|
||||
The each divider value uses the DIV coding defined in RCC associated
|
||||
register RCC_xxxDIVR. In most the case, it is:
|
||||
0x0: not divided
|
||||
0x1: division by 2
|
||||
0x2: division by 4
|
||||
0x3: division by 8
|
||||
...
|
||||
|
||||
but for RTC MCO1 MCO2, the coding is different:
|
||||
Note that for RTC MCO1 MCO2, the coding is different:
|
||||
0x0: not divided
|
||||
0x1: division by 2
|
||||
0x2: division by 3
|
||||
0x3: division by 4
|
||||
...
|
||||
|
||||
Optional Properties:
|
||||
- st,pll
|
||||
PLL children node for PLL1 to PLL4 : (see ref manual for details)
|
||||
with associated index 0 to 3 (st,pll@0 to st,pll@4)
|
||||
PLLx is off when the associated node is absent
|
||||
|
||||
- Sub-nodes:
|
||||
|
||||
- cfg: The parameters for PLL configuration in this order:
|
||||
DIVM DIVN DIVP DIVQ DIVR Output
|
||||
|
||||
with DIV value as defined in RCC spec:
|
||||
0x0: bypass (division by 1)
|
||||
0x1: division by 2
|
||||
0x2: division by 3
|
||||
0x3: division by 4
|
||||
...
|
||||
|
||||
and Output = bitfield for each output value = 1:ON/0:OFF
|
||||
BIT(0) => output P : DIVPEN
|
||||
BIT(1) => output Q : DIVQEN
|
||||
BIT(2) => output R : DIVREN
|
||||
NB : macro PQR(p,q,r) can be used to build this value
|
||||
with p,p,r = 0 or 1
|
||||
|
||||
- frac : Fractional part of the multiplication factor
|
||||
(optional, PLL is in integer mode when absent)
|
||||
|
||||
- csg : Clock Spreading Generator (optional)
|
||||
with parameters in this order:
|
||||
MOD_PER INC_STEP SSCG_MODE
|
||||
|
||||
* MOD_PER: Modulation Period Adjustment
|
||||
* INC_STEP: Modulation Depth Adjustment
|
||||
* SSCG_MODE: Spread spectrum clock generator mode
|
||||
you can use associated defines from stm32mp1-clksrc.h
|
||||
* SSCG_MODE_CENTER_SPREAD = 0
|
||||
* SSCG_MODE_DOWN_SPREAD = 1
|
||||
|
||||
|
||||
- st,pkcs : used to configure the peripherals kernel clock selection
|
||||
containing a list of peripheral kernel clock source identifier as defined
|
||||
in the file dt-bindings/clock/stm32mp1-clksrc.h
|
||||
|
||||
Example:
|
||||
st,clkdiv = <
|
||||
1 /*MPU*/
|
||||
0 /*AXI*/
|
||||
0 /*MCU*/
|
||||
1 /*APB1*/
|
||||
1 /*APB2*/
|
||||
1 /*APB3*/
|
||||
1 /*APB4*/
|
||||
2 /*APB5*/
|
||||
23 /*RTC*/
|
||||
0 /*MCO1*/
|
||||
0 /*MCO2*/
|
||||
>;
|
||||
|
||||
rcc: rcc@50000000 {
|
||||
compatible = "syscon", "simple-mfd";
|
||||
Optional Properties:
|
||||
- st,pll : A specific PLL configuration, including frequency.
|
||||
|
||||
reg = <0x50000000 0x1000>;
|
||||
PLL children nodes for PLL1 to PLL4 (see ref manual for details)
|
||||
are listed with associated index 0 to 3 (st,pll@0 to st,pll@3).
|
||||
PLLx is off when the associated node is absent.
|
||||
|
||||
rcc_clk: rcc-clk@50000000 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,stm32mp1-rcc-clk";
|
||||
Here are the available properties for each PLL node:
|
||||
|
||||
st,clksrc = < CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_HSI
|
||||
CLK_PLL12_HSE
|
||||
CLK_PLL3_HSE
|
||||
CLK_PLL4_HSE
|
||||
CLK_RTC_HSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
>;
|
||||
- cfg: The parameters for PLL configuration in the following order:
|
||||
DIVM DIVN DIVP DIVQ DIVR Output.
|
||||
|
||||
st,clkdiv = <
|
||||
1 /*MPU*/
|
||||
0 /*AXI*/
|
||||
0 /*MCU*/
|
||||
1 /*APB1*/
|
||||
1 /*APB2*/
|
||||
1 /*APB3*/
|
||||
1 /*APB4*/
|
||||
5 /*APB5*/
|
||||
23 /*RTC*/
|
||||
0 /*MCO1*/
|
||||
0 /*MCO2*/
|
||||
>;
|
||||
DIVx values are defined as in RCC spec:
|
||||
0x0: bypass (division by 1)
|
||||
0x1: division by 2
|
||||
0x2: division by 3
|
||||
0x3: division by 4
|
||||
...
|
||||
|
||||
st,pll@0 {
|
||||
cfg = < 1 53 0 0 0 1 >;
|
||||
frac = < 0x810 >;
|
||||
};
|
||||
st,pll@1 {
|
||||
cfg = < 1 43 1 0 0 PQR(0,1,1)>;
|
||||
csg = <10 20 1>;
|
||||
};
|
||||
st,pll@2 {
|
||||
cfg = < 2 85 3 13 3 0>;
|
||||
csg = <10 20 SSCG_MODE_CENTER_SPREAD>;
|
||||
};
|
||||
st,pll@3 {
|
||||
cfg = < 2 78 4 7 9 3>;
|
||||
};
|
||||
st,pkcs = <
|
||||
CLK_STGEN_HSE
|
||||
CLK_CKPER_HSI
|
||||
CLK_USBPHY_PLL2P
|
||||
CLK_DSI_PLL2Q
|
||||
>;
|
||||
Output contains a bitfield for each output value (1:ON/0:OFF)
|
||||
BIT(0) => output P : DIVPEN
|
||||
BIT(1) => output Q : DIVQEN
|
||||
BIT(2) => output R : DIVREN
|
||||
NB: macro PQR(p,q,r) can be used to build this value
|
||||
with p,q,r = 0 or 1.
|
||||
|
||||
- frac : Fractional part of the multiplication factor
|
||||
(optional, PLL is in integer mode when absent).
|
||||
|
||||
- csg : Clock Spreading Generator (optional) with parameters in the
|
||||
following order: MOD_PER INC_STEP SSCG_MODE.
|
||||
|
||||
MOD_PER: Modulation Period Adjustment
|
||||
INC_STEP: Modulation Depth Adjustment
|
||||
SSCG_MODE: Spread spectrum clock generator mode, with associated
|
||||
defined from stm32mp1-clksrc.h:
|
||||
- SSCG_MODE_CENTER_SPREAD = 0
|
||||
- SSCG_MODE_DOWN_SPREAD = 1
|
||||
|
||||
Example:
|
||||
st,pll@0 {
|
||||
cfg = < 1 53 0 0 0 1 >;
|
||||
frac = < 0x810 >;
|
||||
};
|
||||
st,pll@1 {
|
||||
cfg = < 1 43 1 0 0 PQR(0,1,1) >;
|
||||
csg = < 10 20 1 >;
|
||||
};
|
||||
st,pll@2 {
|
||||
cfg = < 2 85 3 13 3 0 >;
|
||||
csg = < 10 20 SSCG_MODE_CENTER_SPREAD >;
|
||||
};
|
||||
st,pll@3 {
|
||||
cfg = < 2 78 4 7 9 3 >;
|
||||
};
|
||||
|
||||
--------------------------
|
||||
- st,pkcs : used to configure the peripherals kernel clock selection.
|
||||
|
||||
The property is a list of peripheral kernel clock source identifiers defined
|
||||
by macros CLK_<KERNEL-CLOCK>_<PARENT-CLOCK> as defined by header file
|
||||
dt-bindings/clock/stm32mp1-clksrc.h.
|
||||
|
||||
st,pkcs may not list all the kernel clocks and has no ordering requirements.
|
||||
|
||||
Example:
|
||||
st,pkcs = <
|
||||
CLK_STGEN_HSE
|
||||
CLK_CKPER_HSI
|
||||
CLK_USBPHY_PLL2P
|
||||
CLK_DSI_PLL2Q
|
||||
CLK_I2C46_HSI
|
||||
CLK_UART1_HSI
|
||||
CLK_UART24_HSI
|
||||
>;
|
||||
|
||||
other clocks = fixed-clock
|
||||
--------------------------
|
||||
==========================
|
||||
|
||||
The clock tree is also based on 5 fixed-clock in clocks node
|
||||
used to define the state of associated ST32MP1 oscillators:
|
||||
- clk-lsi
|
||||
- clk-lse
|
||||
- clk-hsi
|
||||
- clk-hse
|
||||
- clk-csi
|
||||
- clk-lsi
|
||||
- clk-lse
|
||||
- clk-hsi
|
||||
- clk-hse
|
||||
- clk-csi
|
||||
|
||||
At boot the clock tree initialization will
|
||||
- enable the oscillator present in device tree
|
||||
- disable HSI oscillator if the node is absent (always activated by bootrom)
|
||||
- enable oscillators present in device tree
|
||||
- disable HSI oscillator if the node is absent (always activated by bootrom)
|
||||
|
||||
Optional properties :
|
||||
|
||||
a) for external oscillator: "clk-lse", "clk-hse"
|
||||
|
||||
4 optional fields are managed
|
||||
- "st,bypass" Configure the oscillator bypass mode (HSEBYP, LSEBYP)
|
||||
- "st,digbypass" Configure the bypass mode as full-swing digital signal
|
||||
(DIGBYP)
|
||||
- "st,css" Activate the clock security system (HSECSSON, LSECSSON)
|
||||
- "st,drive" (only for LSE) value of the drive for the oscillator
|
||||
(see LSEDRV_ define in the file dt-bindings/clock/stm32mp1-clksrc.h)
|
||||
|
||||
Example board file:
|
||||
4 optional fields are managed
|
||||
- "st,bypass" configures the oscillator bypass mode (HSEBYP, LSEBYP)
|
||||
- "st,digbypass" configures the bypass mode as full-swing digital
|
||||
signal (DIGBYP)
|
||||
- "st,css" activates the clock security system (HSECSSON, LSECSSON)
|
||||
- "st,drive" (only for LSE) contains the value of the drive for the
|
||||
oscillator (see LSEDRV_ defined in the file
|
||||
dt-bindings/clock/stm32mp1-clksrc.h)
|
||||
|
||||
Example board file:
|
||||
/ {
|
||||
clocks {
|
||||
clk_hse: clk-hse {
|
||||
@ -200,13 +201,12 @@ a) for external oscillator: "clk-lse", "clk-hse"
|
||||
|
||||
b) for internal oscillator: "clk-hsi"
|
||||
|
||||
internally HSI clock is fixed to 64MHz for STM32MP157 soc
|
||||
in device tree clk-hsi is the clock after HSIDIV (ck_hsi in RCC doc)
|
||||
So this clock frequency is used to compute the expected HSI_DIV
|
||||
for the clock tree initialisation
|
||||
|
||||
ex: for HSIDIV = /1
|
||||
Internally HSI clock is fixed to 64MHz for STM32MP157 SoC.
|
||||
In device tree, clk-hsi is the clock after HSIDIV (clk_hsi in RCC
|
||||
doc). So this clock frequency is used to compute the expected HSI_DIV
|
||||
for the clock tree initialization.
|
||||
|
||||
Example with HSIDIV = /1:
|
||||
/ {
|
||||
clocks {
|
||||
clk_hsi: clk-hsi {
|
||||
@ -216,8 +216,7 @@ b) for internal oscillator: "clk-hsi"
|
||||
};
|
||||
};
|
||||
|
||||
ex: for HSIDIV = /2
|
||||
|
||||
Example with HSIDIV = /2
|
||||
/ {
|
||||
clocks {
|
||||
clk_hsi: clk-hsi {
|
||||
@ -226,3 +225,151 @@ b) for internal oscillator: "clk-hsi"
|
||||
clock-frequency = <32000000>;
|
||||
};
|
||||
};
|
||||
|
||||
Example of clock tree initialization
|
||||
====================================
|
||||
|
||||
/ {
|
||||
clocks {
|
||||
u-boot,dm-pre-reloc;
|
||||
clk_hse: clk-hse {
|
||||
u-boot,dm-pre-reloc;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <24000000>;
|
||||
st,digbypass;
|
||||
};
|
||||
|
||||
clk_hsi: clk-hsi {
|
||||
u-boot,dm-pre-reloc;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <64000000>;
|
||||
};
|
||||
|
||||
clk_lse: clk-lse {
|
||||
u-boot,dm-pre-reloc;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <32768>;
|
||||
};
|
||||
|
||||
clk_lsi: clk-lsi {
|
||||
u-boot,dm-pre-reloc;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <32000>;
|
||||
};
|
||||
|
||||
clk_csi: clk-csi {
|
||||
u-boot,dm-pre-reloc;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <4000000>;
|
||||
};
|
||||
};
|
||||
|
||||
soc {
|
||||
|
||||
rcc: rcc@50000000 {
|
||||
u-boot,dm-pre-reloc;
|
||||
compatible = "st,stm32mp1-rcc", "syscon";
|
||||
reg = <0x50000000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
|
||||
|
||||
st,clksrc = <
|
||||
CLK_MPU_PLL1P
|
||||
CLK_AXI_PLL2P
|
||||
CLK_MCU_PLL3P
|
||||
CLK_PLL12_HSE
|
||||
CLK_PLL3_HSE
|
||||
CLK_PLL4_HSE
|
||||
CLK_RTC_LSE
|
||||
CLK_MCO1_DISABLED
|
||||
CLK_MCO2_DISABLED
|
||||
>;
|
||||
|
||||
st,clkdiv = <
|
||||
1 /*MPU*/
|
||||
0 /*AXI*/
|
||||
0 /*MCU*/
|
||||
1 /*APB1*/
|
||||
1 /*APB2*/
|
||||
1 /*APB3*/
|
||||
1 /*APB4*/
|
||||
2 /*APB5*/
|
||||
23 /*RTC*/
|
||||
0 /*MCO1*/
|
||||
0 /*MCO2*/
|
||||
>;
|
||||
|
||||
st,pkcs = <
|
||||
CLK_CKPER_HSE
|
||||
CLK_FMC_ACLK
|
||||
CLK_QSPI_ACLK
|
||||
CLK_ETH_DISABLED
|
||||
CLK_SDMMC12_PLL4P
|
||||
CLK_DSI_DSIPLL
|
||||
CLK_STGEN_HSE
|
||||
CLK_USBPHY_HSE
|
||||
CLK_SPI2S1_PLL3Q
|
||||
CLK_SPI2S23_PLL3Q
|
||||
CLK_SPI45_HSI
|
||||
CLK_SPI6_HSI
|
||||
CLK_I2C46_HSI
|
||||
CLK_SDMMC3_PLL4P
|
||||
CLK_USBO_USBPHY
|
||||
CLK_ADC_CKPER
|
||||
CLK_CEC_LSE
|
||||
CLK_I2C12_HSI
|
||||
CLK_I2C35_HSI
|
||||
CLK_UART1_HSI
|
||||
CLK_UART24_HSI
|
||||
CLK_UART35_HSI
|
||||
CLK_UART6_HSI
|
||||
CLK_UART78_HSI
|
||||
CLK_SPDIF_PLL4P
|
||||
CLK_FDCAN_PLL4Q
|
||||
CLK_SAI1_PLL3Q
|
||||
CLK_SAI2_PLL3Q
|
||||
CLK_SAI3_PLL3Q
|
||||
CLK_SAI4_PLL3Q
|
||||
CLK_RNG1_LSI
|
||||
CLK_RNG2_LSI
|
||||
CLK_LPTIM1_PCLK1
|
||||
CLK_LPTIM23_PCLK3
|
||||
CLK_LPTIM45_LSE
|
||||
>;
|
||||
|
||||
/* VCO = 1300.0 MHz => P = 650 (CPU) */
|
||||
pll1: st,pll@0 {
|
||||
cfg = < 2 80 0 0 0 PQR(1,0,0) >;
|
||||
frac = < 0x800 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU),
|
||||
R = 533 (DDR) */
|
||||
pll2: st,pll@1 {
|
||||
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
|
||||
frac = < 0x1400 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
|
||||
pll3: st,pll@2 {
|
||||
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
|
||||
frac = < 0x1a04 >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
|
||||
pll4: st,pll@3 {
|
||||
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,30 +1,102 @@
|
||||
* I2C controller embedded in STMicroelectronis STM32 platforms
|
||||
* I2C controller embedded in STMicroelectronics STM32 I2C platform
|
||||
|
||||
Required properties :
|
||||
- compatible : Must be "st,stm32f7-i2c"
|
||||
- compatible : Must be one of the following
|
||||
- "st,stm32f4-i2c"
|
||||
- "st,stm32f7-i2c"
|
||||
- reg : Offset and length of the register set for the device
|
||||
- resets: Must contain the phandle to the reset controller
|
||||
- clocks: Must contain the input clock of the I2C instance
|
||||
- interrupts : Must contain the interrupt id for I2C event and then the
|
||||
interrupt id for I2C error.
|
||||
- resets: Must contain the phandle to the reset controller.
|
||||
- clocks: Must contain the input clock of the I2C instance.
|
||||
- A pinctrl state named "default" must be defined to set pins in mode of
|
||||
operation for I2C transfer
|
||||
operation for I2C transfer. An optional pinctrl state named "sleep" has to
|
||||
be defined as well as to put I2C in low power mode in suspend mode.
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
|
||||
Optional properties :
|
||||
- clock-frequency : Desired I2C bus clock frequency in Hz. If not specified,
|
||||
the default 100 kHz frequency will be used. As only Normal, Fast and Fast+
|
||||
modes are implemented, possible values are 100000, 400000 and 1000000.
|
||||
the default 100 kHz frequency will be used.
|
||||
For STM32F4 SoC Standard-mode and Fast-mode are supported, possible values are
|
||||
100000 and 400000.
|
||||
For STM32F7 SoC, Standard-mode, Fast-mode and Fast-mode Plus are supported,
|
||||
possible values are 100000, 400000 and 1000000.
|
||||
- i2c-scl-rising-time-ns : Only for STM32F7, I2C SCL Rising time for the board
|
||||
(default: 25)
|
||||
- i2c-scl-falling-time-ns : Only for STM32F7, I2C SCL Falling time for the board
|
||||
(default: 10)
|
||||
I2C Timings are derived from these 2 values
|
||||
- st,syscfg-fmp: Only for STM32F7, use to set Fast Mode Plus bit within SYSCFG
|
||||
whether Fast Mode Plus speed is selected by slave.
|
||||
1st cell : phandle to syscfg
|
||||
2nd cell : register offset within SYSCFG
|
||||
3rd cell : register bitmask for FMP bit
|
||||
|
||||
Example :
|
||||
|
||||
i2c1: i2c@40005400 {
|
||||
compatible = "st,stm32f7-i2c";
|
||||
reg = <0x40005400 0x400>;
|
||||
resets = <&rcc 181>;
|
||||
clocks = <&clk_pclk1>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_i2c1>;
|
||||
clock-frequency = <400000>;
|
||||
i2c@40005400 {
|
||||
compatible = "st,stm32f4-i2c";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0x40005400 0x400>;
|
||||
interrupts = <31>,
|
||||
<32>;
|
||||
resets = <&rcc 277>;
|
||||
clocks = <&rcc 0 149>;
|
||||
pinctrl-0 = <&i2c1_sda_pin>, <&i2c1_scl_pin>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
i2c@40005400 {
|
||||
compatible = "st,stm32f7-i2c";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0x40005400 0x400>;
|
||||
interrupts = <31>,
|
||||
<32>;
|
||||
resets = <&rcc STM32F7_APB1_RESET(I2C1)>;
|
||||
clocks = <&rcc 1 CLK_I2C1>;
|
||||
pinctrl-0 = <&i2c1_sda_pin>, <&i2c1_scl_pin>;
|
||||
pinctrl-1 = <&i2c1_sda_pin_sleep>, <&i2c1_scl_pin_sleep>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
st,syscfg-fmp = <&syscfg 0x4 0x1>;
|
||||
};
|
||||
|
||||
* I2C Devices
|
||||
|
||||
An I2C device connected onto STM32 I2C controller must use a format described by
|
||||
i2c.txt file.
|
||||
|
||||
Required properties :
|
||||
- compatible
|
||||
Device driver compatible name
|
||||
- reg
|
||||
I2C slave addresses (see i2c.txt for more details)
|
||||
|
||||
Optional properties :
|
||||
- wakeup-source
|
||||
device can be used as a wakeup source. Valid only if device is a
|
||||
master.
|
||||
- interrupt-names
|
||||
should be set as "wakeup" if a dedicated wakeup source is used.
|
||||
Imply "wakeup-source" property
|
||||
- interrupts
|
||||
defined dedicated IRQ wakeup source from controller.
|
||||
|
||||
i2c@40005400 {
|
||||
camera@3c {
|
||||
compatible = "ovti,ov5640";
|
||||
reg = <0x3c>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c@40005400 {
|
||||
eeprom@64 {
|
||||
compatible = "linux,slave-24c02";
|
||||
reg = <0x40000064>;
|
||||
wakeup-source;
|
||||
interrupt-names = "wakeup";
|
||||
interrupts-extended = <&exti 25 1>;
|
||||
};
|
||||
};
|
||||
|
||||
138
doc/device-tree-bindings/mfd/stpmic1.txt
Normal file
138
doc/device-tree-bindings/mfd/stpmic1.txt
Normal file
@ -0,0 +1,138 @@
|
||||
* STMicroelectronics STPMIC1 Power Management IC
|
||||
|
||||
Required parent device properties:
|
||||
- compatible: "st,stpmic1"
|
||||
- reg: the I2C slave address for the stpmic1 chip
|
||||
- interrupts-extended: interrupt lines to use: second irq is for wakeup.
|
||||
- #interrupt-cells: should be 2.
|
||||
- interrupt-controller: describes the STPMIC1 as an interrupt
|
||||
controller (has its own domain). interrupt number are the following:
|
||||
/* Interrupt Register 1 (0x50 for latch) */
|
||||
IT_SWOUT_R=0
|
||||
IT_SWOUT_F=1
|
||||
IT_VBUS_OTG_R=2
|
||||
IT_VBUS_OTG_F=3
|
||||
IT_WAKEUP_R=4
|
||||
IT_WAKEUP_F=5
|
||||
IT_PONKEY_R=6
|
||||
IT_PONKEY_F=7
|
||||
/* Interrupt Register 2 (0x51 for latch) */
|
||||
IT_OVP_BOOST=8
|
||||
IT_OCP_BOOST=9
|
||||
IT_OCP_SWOUT=10
|
||||
IT_OCP_OTG=11
|
||||
IT_CURLIM_BUCK4=12
|
||||
IT_CURLIM_BUCK3=13
|
||||
IT_CURLIM_BUCK2=14
|
||||
IT_CURLIM_BUCK1=15
|
||||
/* Interrupt Register 3 (0x52 for latch) */
|
||||
IT_SHORT_SWOUT=16
|
||||
IT_SHORT_SWOTG=17
|
||||
IT_CURLIM_LDO6=18
|
||||
IT_CURLIM_LDO5=19
|
||||
IT_CURLIM_LDO4=20
|
||||
IT_CURLIM_LDO3=21
|
||||
IT_CURLIM_LDO2=22
|
||||
IT_CURLIM_LDO1=23
|
||||
/* Interrupt Register 3 (0x52 for latch) */
|
||||
IT_SWIN_R=24
|
||||
IT_SWIN_F=25
|
||||
IT_RESERVED_1=26
|
||||
IT_RESERVED_2=27
|
||||
IT_VINLOW_R=28
|
||||
IT_VINLOW_F=29
|
||||
IT_TWARN_R=30
|
||||
IT_TWARN_F=31
|
||||
|
||||
Optional parent device properties:
|
||||
- st,main_control_register:
|
||||
-bit 1: Power cycling will be performed on turn OFF condition
|
||||
-bit 2: PWRCTRL is functional
|
||||
-bit 3: PWRCTRL active high
|
||||
- st,pads_pull_register:
|
||||
-bit 1: WAKEUP pull down is not active
|
||||
-bit 2: PWRCTRL pull up is active
|
||||
-bit 3: PWRCTRL pull down is active
|
||||
-bit 4: WAKEUP detector is disabled
|
||||
- st,vin_control_register:
|
||||
-bit 0: VINLOW monitoring is enabled
|
||||
-bit [1...3]: VINLOW rising threshold
|
||||
000 VINOK_f + 50mV
|
||||
001 VINOK_f + 100mV
|
||||
010 VINOK_f + 150mV
|
||||
011 VINOK_f + 200mV
|
||||
100 VINOK_f + 250mV
|
||||
101 VINOK_f + 300mV
|
||||
110 VINOK_f + 350mV
|
||||
111 VINOK_f + 400mV
|
||||
-bit [4...5]: VINLOW hyst
|
||||
00 100mV
|
||||
01 200mV
|
||||
10 300mV
|
||||
11 400mV
|
||||
-bit 6: SW_OUT detector is disabled
|
||||
-bit 7: SW_IN detector is enabled.
|
||||
- st,usb_control_register:
|
||||
-bit 3: SW_OUT current limit
|
||||
0: 600mA
|
||||
1: 1.1A
|
||||
-bit 4: VBUS_OTG discharge is enabled
|
||||
-bit 5: SW_OUT discharge is enabled
|
||||
-bit 6: VBUS_OTG detection is enabled
|
||||
-bit 7: BOOST_OVP is disabled
|
||||
|
||||
|
||||
stpmic1 consists is a varied group of sub-devices:
|
||||
|
||||
Device Description
|
||||
------ ------------
|
||||
stpmic1-onkey : On key
|
||||
stpmic1-regulators : Regulators
|
||||
stpmic1-wdt : Watchdog
|
||||
|
||||
each sub-device bindings is be described in associated driver
|
||||
documentation section.
|
||||
|
||||
Example:
|
||||
|
||||
pmic: stpmic1@33 {
|
||||
compatible = "st,stpmic1";
|
||||
reg = <0x33>;
|
||||
interrupts = <0 2>;
|
||||
interrupts-extended = <&intc GIC_SPI 149 IRQ_TYPE_NONE>,
|
||||
<&exti 55 1>;
|
||||
st,version_status = <0x10>;
|
||||
st,main_control_register=<0x0c>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
onkey {
|
||||
compatible = "st,stpmic1-onkey";
|
||||
interrupt-parent = <&pmic>;
|
||||
interrupts = <7 0>,<6 1>;
|
||||
st,onkey-pwroff-enabled;
|
||||
st,onkey-press-seconds = <10>;
|
||||
};
|
||||
|
||||
watchdog {
|
||||
compatible = "st,stpmic1-wdt";
|
||||
};
|
||||
|
||||
regulators {
|
||||
compatible = "st,stpmic1-regulators";
|
||||
|
||||
vdd_core: regulator@0 {
|
||||
regulator-compatible = "buck1";
|
||||
regulator-name = "vdd_core";
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <700000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
};
|
||||
vdd: regulator@1 {
|
||||
regulator-compatible = "buck3";
|
||||
regulator-name = "vdd";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-boot-on;
|
||||
regulator-pull-down;
|
||||
};
|
||||
};
|
||||
59
doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt
Normal file
59
doc/device-tree-bindings/mtd/stm32-fmc2-nand.txt
Normal file
@ -0,0 +1,59 @@
|
||||
STMicroelectronics Flexible Memory Controller 2 (FMC2)
|
||||
NAND Interface
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be one of:
|
||||
* st,stm32mp15-fmc2
|
||||
- reg: NAND flash controller memory areas.
|
||||
First region contains the register location.
|
||||
Regions 2 to 4 respectively contain the data, command,
|
||||
and address space for CS0.
|
||||
Regions 5 to 7 contain the same areas for CS1.
|
||||
- interrupts: The interrupt number
|
||||
- pinctrl-0: Standard Pinctrl phandle (see: pinctrl/pinctrl-bindings.txt)
|
||||
- clocks: The clock needed by the NAND flash controller
|
||||
|
||||
Optional properties:
|
||||
- resets: Reference to a reset controller asserting the FMC controller
|
||||
|
||||
* NAND device bindings:
|
||||
|
||||
Required properties:
|
||||
- reg: describes the CS lines assigned to the NAND device.
|
||||
|
||||
Optional properties:
|
||||
- nand-on-flash-bbt: see nand.txt
|
||||
- nand-ecc-strength: see nand.txt
|
||||
- nand-ecc-step-size: see nand.txt
|
||||
|
||||
The following ECC strength and step size are currently supported:
|
||||
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Hamming)
|
||||
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
|
||||
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8) (default)
|
||||
|
||||
Example:
|
||||
|
||||
fmc: nand-controller@58002000 {
|
||||
compatible = "st,stm32mp15-fmc2";
|
||||
reg = <0x58002000 0x1000>,
|
||||
<0x80000000 0x1000>,
|
||||
<0x88010000 0x1000>,
|
||||
<0x88020000 0x1000>,
|
||||
<0x81000000 0x1000>,
|
||||
<0x89010000 0x1000>,
|
||||
<0x89020000 0x1000>;
|
||||
interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&rcc FMC_K>;
|
||||
resets = <&rcc FMC_R>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&fmc_pins_a>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
nand@0 {
|
||||
reg = <0>;
|
||||
nand-on-flash-bbt;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
};
|
||||
};
|
||||
43
doc/device-tree-bindings/mtd/stm32-quadspi.txt
Normal file
43
doc/device-tree-bindings/mtd/stm32-quadspi.txt
Normal file
@ -0,0 +1,43 @@
|
||||
* STMicroelectronics Quad Serial Peripheral Interface(QuadSPI)
|
||||
|
||||
Required properties:
|
||||
- compatible: should be "st,stm32f469-qspi"
|
||||
- reg: the first contains the register location and length.
|
||||
the second contains the memory mapping address and length
|
||||
- reg-names: should contain the reg names "qspi" "qspi_mm"
|
||||
- interrupts: should contain the interrupt for the device
|
||||
- clocks: the phandle of the clock needed by the QSPI controller
|
||||
- A pinctrl must be defined to set pins in mode of operation for QSPI transfer
|
||||
|
||||
Optional properties:
|
||||
- resets: must contain the phandle to the reset controller.
|
||||
|
||||
A spi flash must be a child of the nor_flash node and could have some
|
||||
properties. Also see jedec,spi-nor.txt.
|
||||
|
||||
Required properties:
|
||||
- reg: chip-Select number (QSPI controller may connect 2 nor flashes)
|
||||
- spi-max-frequency: max frequency of spi bus
|
||||
|
||||
Optional property:
|
||||
- spi-rx-bus-width: see ../spi/spi-bus.txt for the description
|
||||
|
||||
Example:
|
||||
|
||||
qspi: spi@a0001000 {
|
||||
compatible = "st,stm32f469-qspi";
|
||||
reg = <0xa0001000 0x1000>, <0x90000000 0x10000000>;
|
||||
reg-names = "qspi", "qspi_mm";
|
||||
interrupts = <91>;
|
||||
resets = <&rcc STM32F4_AHB3_RESET(QSPI)>;
|
||||
clocks = <&rcc 0 STM32F4_AHB3_CLOCK(QSPI)>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_qspi0>;
|
||||
|
||||
flash@0 {
|
||||
reg = <0>;
|
||||
spi-rx-bus-width = <4>;
|
||||
spi-max-frequency = <108000000>;
|
||||
...
|
||||
};
|
||||
};
|
||||
@ -1,5 +1,8 @@
|
||||
* Synopsys DWC Ethernet QoS IP version 4.10 driver (GMAC)
|
||||
|
||||
This binding is deprecated, but it continues to be supported, but new
|
||||
features should be preferably added to the stmmac binding document.
|
||||
|
||||
This binding supports the Synopsys Designware Ethernet QoS (Quality Of Service)
|
||||
IP block. The IP supports multiple options for bus type, clocking and reset
|
||||
structure, and feature list. Consequently, a number of properties and list
|
||||
|
||||
62
doc/device-tree-bindings/net/stm32-dwmac.txt
Normal file
62
doc/device-tree-bindings/net/stm32-dwmac.txt
Normal file
@ -0,0 +1,62 @@
|
||||
STMicroelectronics STM32 / MCU DWMAC glue layer controller
|
||||
|
||||
This file documents platform glue layer for stmmac.
|
||||
Please see stmmac.txt for the other unchanged properties.
|
||||
|
||||
The device node has following properties.
|
||||
|
||||
Required properties:
|
||||
- compatible: For MCU family should be "st,stm32-dwmac" to select glue, and
|
||||
"snps,dwmac-3.50a" to select IP version.
|
||||
For MPU family should be "st,stm32mp1-dwmac" to select
|
||||
glue, and "snps,dwmac-4.20a" to select IP version.
|
||||
- clocks: Must contain a phandle for each entry in clock-names.
|
||||
- clock-names: Should be "stmmaceth" for the host clock.
|
||||
Should be "mac-clk-tx" for the MAC TX clock.
|
||||
Should be "mac-clk-rx" for the MAC RX clock.
|
||||
For MPU family need to add also "ethstp" for power mode clock and,
|
||||
"syscfg-clk" for SYSCFG clock.
|
||||
- interrupt-names: Should contain a list of interrupt names corresponding to
|
||||
the interrupts in the interrupts property, if available.
|
||||
Should be "macirq" for the main MAC IRQ
|
||||
Should be "eth_wake_irq" for the IT which wake up system
|
||||
- st,syscon : Should be phandle/offset pair. The phandle to the syscon node which
|
||||
encompases the glue register, and the offset of the control register.
|
||||
|
||||
Optional properties:
|
||||
- clock-names: For MPU family "mac-clk-ck" for PHY without quartz
|
||||
- st,eth_clk_sel (boolean) : set this property in RGMII PHY when you do not want use 125Mhz
|
||||
- st,eth_ref_clk_sel (boolean) : set this property in RMII mode when you have PHY without crystal 50MHz
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
| PHY_MODE | Normal | PHY wo crystal| PHY wo crystal |No 125Mhz from PHY|
|
||||
| | | 25MHz | 50MHz | |
|
||||
---------------------------------------------------------------------------------------
|
||||
| MII | - | eth-ck | n/a | n/a |
|
||||
| | | | | |
|
||||
---------------------------------------------------------------------------------------
|
||||
| GMII | - | eth-ck | n/a | n/a |
|
||||
| | | | | |
|
||||
---------------------------------------------------------------------------------------
|
||||
| RGMII | - | eth-ck | n/a | eth-ck (no pin) |
|
||||
| | | | | st,eth_clk_sel |
|
||||
---------------------------------------------------------------------------------------
|
||||
| RMII | - | eth-ck | eth-ck | n/a |
|
||||
| | | | st,eth_ref_clk_sel | |
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
Example:
|
||||
|
||||
ethernet@40028000 {
|
||||
compatible = "st,stm32-dwmac", "snps,dwmac-3.50a";
|
||||
reg = <0x40028000 0x8000>;
|
||||
reg-names = "stmmaceth";
|
||||
interrupts = <0 61 0>, <0 62 0>;
|
||||
interrupt-names = "macirq", "eth_wake_irq";
|
||||
clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
|
||||
clocks = <&rcc 0 25>, <&rcc 0 26>, <&rcc 0 27>;
|
||||
st,syscon = <&syscfg 0x4>;
|
||||
snps,pbl = <8>;
|
||||
snps,mixed-burst;
|
||||
dma-ranges;
|
||||
};
|
||||
@ -23,8 +23,12 @@ Required properties:
|
||||
- compatible: must be "st,stm32mp1-usbphyc"
|
||||
- reg: address and length of the usb phy control register set
|
||||
- clocks: phandle + clock specifier for the PLL phy clock
|
||||
- vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY
|
||||
- vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY
|
||||
- vdd3v3-supply: phandle to the regulator providing 3V3 power to the PHY
|
||||
- #address-cells: number of address cells for phys sub-nodes, must be <1>
|
||||
- #size-cells: number of size cells for phys sub-nodes, must be <0>
|
||||
- #clock-cells: number of clock cells for ck_usbo_48m consumer, must be <0>
|
||||
|
||||
Optional properties:
|
||||
- assigned-clocks: phandle + clock specifier for the PLL phy clock
|
||||
@ -34,40 +38,79 @@ Optional properties:
|
||||
Required nodes: one sub-node per port the controller provides.
|
||||
|
||||
Phy sub-nodes
|
||||
==============
|
||||
=============
|
||||
|
||||
Required properties:
|
||||
- reg: phy port index
|
||||
- phy-supply: phandle to the regulator providing 3V3 power to the PHY,
|
||||
see phy-bindings.txt in the same directory.
|
||||
- vdda1v1-supply: phandle to the regulator providing 1V1 power to the PHY
|
||||
- vdda1v8-supply: phandle to the regulator providing 1V8 power to the PHY
|
||||
- #phy-cells: see phy-bindings.txt in the same directory, must be <0> for PHY
|
||||
port#1 and must be <1> for PHY port#2, to select USB controller
|
||||
|
||||
Optional properties:
|
||||
- st,phy-tuning : phandle to the usb phy tuning node, see Phy tuning node below
|
||||
|
||||
Phy tuning node
|
||||
===============
|
||||
|
||||
It may be necessary to adjust the phy settings to compensate parasitics, which
|
||||
can be due to USB connector/receptacle, routing, ESD protection component, ...
|
||||
|
||||
Here is the list of all optional parameters to tune the interface of the phy
|
||||
(HS for High-Speed, FS for Full-Speed, LS for Low-Speed)
|
||||
|
||||
Optional properties:
|
||||
- st,current-boost: <1> current boosting of 1mA
|
||||
<2> current boosting of 2mA
|
||||
- st,no-lsfs-fb-cap: disables the LS/FS feedback capacitor
|
||||
- st,hs-slew-ctrl: slows the HS driver slew rate by 10%
|
||||
- st,hs-dc-level: <0> decreases the HS driver DC level by 5 to 7mV
|
||||
<1> increases the HS driver DC level by 5 to 7mV
|
||||
<2> increases the HS driver DC level by 10 to 14mV
|
||||
- st,fs-rftime-tuning: enables the FS rise/fall tuning option
|
||||
- st,hs-rftime-reduction: enables the HS rise/fall reduction feature
|
||||
- st,hs-current-trim: controls HS driver current trimming for choke
|
||||
- st,hs-impedance-trim: controls HS driver impedance tuning for choke
|
||||
- st,squelch-level: adjusts the squelch DC threshold value
|
||||
- st,hs-rx-gain-eq: enables the HS Rx gain equalizer
|
||||
- st,hs-rx-offset: adjusts the HS Rx offset
|
||||
- st,no-hs-ftime-ctrl: disables the HS fall time control of single
|
||||
ended signals during pre-emphasis
|
||||
- st,no-lsfs-sc: disables the short circuit protection in LS/FS driver
|
||||
- st,hs-tx-staggering: enables the basic staggering in HS Tx mode
|
||||
|
||||
|
||||
Example:
|
||||
usb_phy_tuning: usb-phy-tuning {
|
||||
st,current-boost = <2>;
|
||||
st,no-lfs-fb-cap;
|
||||
st,hs-dc-level = <2>;
|
||||
st,hs-rftime-reduction;
|
||||
st,hs-current-trim = <5>;
|
||||
st,hs-impedance-trim = <0>;
|
||||
st,squelch-level = <1>;
|
||||
st,no-hs-ftime-ctrl;
|
||||
st,hs-tx-staggering;
|
||||
};
|
||||
|
||||
usbphyc: usb-phy@5a006000 {
|
||||
compatible = "st,stm32mp1-usbphyc";
|
||||
reg = <0x5a006000 0x1000>;
|
||||
clocks = <&rcc_clk USBPHY_K>;
|
||||
resets = <&rcc_rst USBPHY_R>;
|
||||
vdda1v1-supply = <®11>;
|
||||
vdda1v8-supply = <®18>;
|
||||
vdd3v3-supply = <&vdd_usb>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#clock-cells = <0>;
|
||||
|
||||
usbphyc_port0: usb-phy@0 {
|
||||
reg = <0>;
|
||||
phy-supply = <&vdd_usb>;
|
||||
vdda1v1-supply = <®11>;
|
||||
vdda1v8-supply = <®18>
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
|
||||
usbphyc_port1: usb-phy@1 {
|
||||
reg = <1>;
|
||||
phy-supply = <&vdd_usb>;
|
||||
vdda1v1-supply = <®11>;
|
||||
vdda1v8-supply = <®18>
|
||||
#phy-cells = <1>;
|
||||
st,phy-tuning = <&usb_phy_tuning>;
|
||||
};
|
||||
};
|
||||
|
||||
@ -8,8 +8,13 @@ controllers onto these pads.
|
||||
Pin controller node:
|
||||
Required properies:
|
||||
- compatible: value should be one of the following:
|
||||
(a) "st,stm32f429-pinctrl"
|
||||
(b) "st,stm32f746-pinctrl"
|
||||
"st,stm32f429-pinctrl"
|
||||
"st,stm32f469-pinctrl"
|
||||
"st,stm32f746-pinctrl"
|
||||
"st,stm32f769-pinctrl"
|
||||
"st,stm32h743-pinctrl"
|
||||
"st,stm32mp157-pinctrl"
|
||||
"st,stm32mp157-z-pinctrl"
|
||||
- #address-cells: The value of this property must be 1
|
||||
- #size-cells : The value of this property must be 1
|
||||
- ranges : defines mapping between pin controller node (parent) to
|
||||
@ -32,13 +37,30 @@ Required properties:
|
||||
|
||||
Optional properties:
|
||||
- reset: : Reference to the reset controller
|
||||
- interrupt-parent: phandle of the interrupt parent to which the external
|
||||
GPIO interrupts are forwarded to.
|
||||
- st,syscfg: Should be phandle/offset pair. The phandle to the syscon node
|
||||
which includes IRQ mux selection register, and the offset of the IRQ mux
|
||||
selection register.
|
||||
- st,syscfg: Should be phandle/offset/mask.
|
||||
-The phandle to the syscon node which includes IRQ mux selection register.
|
||||
-The offset of the IRQ mux selection register
|
||||
-The field mask of IRQ mux, needed if different of 0xf.
|
||||
- gpio-ranges: Define a dedicated mapping between a pin-controller and
|
||||
a gpio controller. Format is <&phandle a b c> with:
|
||||
-(phandle): phandle of pin-controller.
|
||||
-(a): gpio base offset in range.
|
||||
-(b): pin base offset in range.
|
||||
-(c): gpio count in range
|
||||
This entry has to be used either if there are holes inside a bank:
|
||||
GPIOB0/B1/B2/B14/B15 (see example 2)
|
||||
or if banks are not contiguous:
|
||||
GPIOA/B/C/E...
|
||||
NOTE: If "gpio-ranges" is used for a gpio controller, all gpio-controller
|
||||
have to use a "gpio-ranges" entry.
|
||||
More details in Documentation/devicetree/bindings/gpio/gpio.txt.
|
||||
- st,bank-ioport: should correspond to the EXTI IOport selection (EXTI line
|
||||
used to select GPIOs as interrupts).
|
||||
- st,package: Indicates the SOC package used.
|
||||
More details in include/dt-bindings/pinctrl/stm32-pinfunc.h
|
||||
- hwlocks: reference to a phandle of a hardware spinlock provider node.
|
||||
|
||||
Example:
|
||||
Example 1:
|
||||
#include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
|
||||
...
|
||||
|
||||
@ -60,6 +82,43 @@ Example:
|
||||
pin-functions nodes follow...
|
||||
};
|
||||
|
||||
Example 2:
|
||||
#include <dt-bindings/pinctrl/stm32f429-pinfunc.h>
|
||||
...
|
||||
|
||||
pinctrl: pin-controller {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "st,stm32f429-pinctrl";
|
||||
ranges = <0 0x40020000 0x3000>;
|
||||
pins-are-numbered;
|
||||
|
||||
gpioa: gpio@40020000 {
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
reg = <0x0 0x400>;
|
||||
resets = <&reset_ahb1 0>;
|
||||
st,bank-name = "GPIOA";
|
||||
gpio-ranges = <&pinctrl 0 0 16>;
|
||||
};
|
||||
|
||||
gpiob: gpio@40020400 {
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
reg = <0x0 0x400>;
|
||||
resets = <&reset_ahb1 0>;
|
||||
st,bank-name = "GPIOB";
|
||||
ngpios = 4;
|
||||
gpio-ranges = <&pinctrl 0 16 3>,
|
||||
<&pinctrl 14 30 2>;
|
||||
};
|
||||
|
||||
|
||||
...
|
||||
pin-functions nodes follow...
|
||||
};
|
||||
|
||||
|
||||
Contents of function subnode node:
|
||||
----------------------------------
|
||||
Subnode format
|
||||
@ -83,14 +142,31 @@ Required properties:
|
||||
- port: The gpio port index (PA = 0, PB = 1, ..., PK = 11)
|
||||
- line: The line offset within the port (PA0 = 0, PA1 = 1, ..., PA15 = 15)
|
||||
- function: The function number, can be:
|
||||
* 0 : GPIO IN
|
||||
* 0 : GPIO
|
||||
* 1 : Alternate Function 0
|
||||
* 2 : Alternate Function 1
|
||||
* 3 : Alternate Function 2
|
||||
* ...
|
||||
* 16 : Alternate Function 15
|
||||
* 17 : Analog
|
||||
* 18 : GPIO OUT
|
||||
|
||||
To simplify the usage, macro is available to generate "pinmux" field.
|
||||
This macro is available here:
|
||||
- include/dt-bindings/pinctrl/stm32-pinfunc.h
|
||||
|
||||
Some examples of using macro:
|
||||
/* GPIO A9 set as alernate function 2 */
|
||||
... {
|
||||
pinmux = <STM32_PINMUX('A', 9, AF2)>;
|
||||
};
|
||||
/* GPIO A9 set as GPIO */
|
||||
... {
|
||||
pinmux = <STM32_PINMUX('A', 9, GPIO)>;
|
||||
};
|
||||
/* GPIO A9 set as analog */
|
||||
... {
|
||||
pinmux = <STM32_PINMUX('A', 9, ANALOG)>;
|
||||
};
|
||||
|
||||
Optional properties:
|
||||
- GENERIC_PINCONFIG: is the generic pinconfig options to use.
|
||||
@ -114,13 +190,13 @@ pin-controller {
|
||||
...
|
||||
usart1_pins_a: usart1@0 {
|
||||
pins1 {
|
||||
pinmux = <STM32F429_PA9_FUNC_USART1_TX>;
|
||||
pinmux = <STM32_PINMUX('A', 9, AF7)>;
|
||||
bias-disable;
|
||||
drive-push-pull;
|
||||
slew-rate = <0>;
|
||||
};
|
||||
pins2 {
|
||||
pinmux = <STM32F429_PA10_FUNC_USART1_RX>;
|
||||
pinmux = <STM32_PINMUX('A', 10, AF7)>;
|
||||
bias-disable;
|
||||
};
|
||||
};
|
||||
@ -129,5 +205,4 @@ pin-controller {
|
||||
&usart1 {
|
||||
pinctrl-0 = <&usart1_pins_a>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
52
doc/device-tree-bindings/power/st,stm32mp1-pwr.txt
Normal file
52
doc/device-tree-bindings/power/st,stm32mp1-pwr.txt
Normal file
@ -0,0 +1,52 @@
|
||||
STMicroelectronics STM32MP1 Power Management Controller
|
||||
=======================================================
|
||||
|
||||
The PWR IP is responsible for handling the power related resources such as
|
||||
clocks, power supplies and resets. It provides 6 wake-up pins that are handled
|
||||
by an interrupt-controller. Wake-up pin can be used to wake-up from STANDBY SoC state.
|
||||
|
||||
Required properties:
|
||||
- compatible should be: "st,stm32mp1-pwr"
|
||||
- reg: should be register base and length as documented in the
|
||||
datasheet
|
||||
- interrupts: contains the reference to the gic wake-up pin interrupt
|
||||
- interrupt-controller; Enable interrupt controller for wake-up pins.
|
||||
- #interrupt-cells = <3>
|
||||
|
||||
Optional Properties:
|
||||
- pwr-supply: main soc power supply
|
||||
|
||||
Interrupt consumers have to specify 3 cells:
|
||||
- cell 1: wake-up pin id from 0 to 5
|
||||
- cell 2: IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_RISING
|
||||
- cell 3: Pull config: 0 = No Pull, 1=Pull Up, 2=Pull Down
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
pwr: pwr@50001000 {
|
||||
compatible = "st,stm32mp1-pwr", "simple-mfd";
|
||||
reg = <0x50001000 0x400>;
|
||||
interrupts = <GIC_SPI 149 IRQ_TYPE_NONE>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <3>;
|
||||
|
||||
pwr-supply = <&vdd>;
|
||||
};
|
||||
|
||||
|
||||
Example of interrupt user:
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
button@4 {
|
||||
label = "WakeUp4";
|
||||
linux,code = <BTN_4>;
|
||||
interrupt-parent = <&pwr>;
|
||||
interrupts = <3 IRQ_TYPE_EDGE_FALLING 1>;
|
||||
status = "okay";
|
||||
wakeup-source;
|
||||
};
|
||||
};
|
||||
@ -16,7 +16,7 @@ included in STM32 Cube tool
|
||||
info attributes:
|
||||
----------------
|
||||
- st,mem-name : name for DDR configuration, simple string for information
|
||||
- st,mem-speed : DDR expected speed for the setting in MHz
|
||||
- st,mem-speed : DDR expected speed for the setting in kHz
|
||||
- st,mem-size : DDR mem size in byte
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ Example:
|
||||
"ddrphycapb";
|
||||
|
||||
st,mem-name = "DDR3 2x4Gb 533MHz";
|
||||
st,mem-speed = <533>;
|
||||
st,mem-speed = <533000>;
|
||||
st,mem-size = <0x40000000>;
|
||||
|
||||
st,ctl-reg = <
|
||||
|
||||
31
doc/device-tree-bindings/regulator/st,stm32mp1-pwr-reg.txt
Normal file
31
doc/device-tree-bindings/regulator/st,stm32mp1-pwr-reg.txt
Normal file
@ -0,0 +1,31 @@
|
||||
STM32MP1 POWER Regulators
|
||||
-------------------------
|
||||
|
||||
Required properties:
|
||||
- compatible: Must be "st,stm32mp1,pwr-reg"
|
||||
- list of child nodes that specify the regulator
|
||||
initialization data for defined regulators. The definition for each of
|
||||
these nodes is defined using the standard binding for regulators found at
|
||||
Documentation/devicetree/bindings/regulator/regulator.txt.
|
||||
- st,tzcr: syscon of Trust Zone Configuration Register. Usefull to know if we
|
||||
are in secure mode.
|
||||
st,tzcr = &<phandle> <offset> <mask>;
|
||||
|
||||
Example:
|
||||
|
||||
pwr-regulators@c {
|
||||
compatible = "st,stm32mp1,pwr-reg";
|
||||
st,tzcr = <&rcc 0x0 0x1>;
|
||||
|
||||
reg11: reg11 {
|
||||
regulator-name = "reg11";
|
||||
regulator-min-microvolt = <1100000>;
|
||||
regulator-max-microvolt = <1100000>;
|
||||
};
|
||||
|
||||
reg18: reg18 {
|
||||
regulator-name = "reg18";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
};
|
||||
};
|
||||
88
doc/device-tree-bindings/serial/st,stm32-usart.txt
Normal file
88
doc/device-tree-bindings/serial/st,stm32-usart.txt
Normal file
@ -0,0 +1,88 @@
|
||||
* STMicroelectronics STM32 USART
|
||||
|
||||
Required properties:
|
||||
- compatible: can be either:
|
||||
- "st,stm32-uart",
|
||||
- "st,stm32f7-uart",
|
||||
- "st,stm32h7-uart".
|
||||
depending is compatible with stm32(f4), stm32f7 or stm32h7.
|
||||
- reg: The address and length of the peripheral registers space
|
||||
- interrupts:
|
||||
- The interrupt line for the USART instance,
|
||||
- An optional wake-up interrupt.
|
||||
- interrupt-names: Contains "event" for the USART interrupt line.
|
||||
- clocks: The input clock of the USART instance
|
||||
|
||||
Optional properties:
|
||||
- resets: Must contain the phandle to the reset controller.
|
||||
- pinctrl-names: Set to "default". An additional "sleep" state can be defined
|
||||
to set pins in sleep state when in low power. In case the device is used as
|
||||
a wakeup source, "idle" state is defined in order to keep RX pin active.
|
||||
For a console device, an optional state "no_console_suspend" can be defined
|
||||
to enable console messages during suspend. Typically, "no_console_suspend" and
|
||||
"default" states can refer to the same pin configuration.
|
||||
- pinctrl-n: Phandle(s) pointing to pin configuration nodes.
|
||||
For Pinctrl properties see ../pinctrl/pinctrl-bindings.txt
|
||||
- st,hw-flow-ctrl: bool flag to enable hardware flow control.
|
||||
- rs485-rts-delay, rs485-rx-during-tx, rs485-rts-active-low,
|
||||
linux,rs485-enabled-at-boot-time: see rs485.txt.
|
||||
- dmas: phandle(s) to DMA controller node(s). Refer to stm32-dma.txt
|
||||
- dma-names: "rx" and/or "tx"
|
||||
- wakeup-source: bool flag to indicate this device has wakeup capabilities
|
||||
- interrupt-names : Should contain "wakeup" if optional wake-up interrupt is
|
||||
used.
|
||||
|
||||
Note for dma using:
|
||||
- "tx" dma can be used without any constraint since it uses single
|
||||
dma transfers.
|
||||
- "rx" dma using requires some attention:
|
||||
1) if you cannot anticipate the length of your received packets
|
||||
and if your usart device embeds an internal fifo, then DON'T use
|
||||
dma mode.
|
||||
2) if you enable dma mode WITHOUT mdma intermediate copy (cf.
|
||||
stm32-dma.txt), then the availability of the received data will
|
||||
depend on the dma driver policy and it may be delayed until dma
|
||||
internal fifo is full. The usart driver will see this checking
|
||||
the dma residue when rx interrupt (RXNE or RTO) occurs.
|
||||
3) if you enable dma mode WITH mdma intermediate copy (cf.
|
||||
stm32-dma.txt) then the usart driver will never see the dma
|
||||
residue becoming smaller than RX_BUF_P but it will get its
|
||||
rx dma complete callback called when the cyclic transfer period
|
||||
(RX_BUF_P) is reached.
|
||||
The three possibilities above are ordered from the most cpu time
|
||||
consuming one to the least one. The counterpart of this optimisation
|
||||
is the reception granularity achievable by the usart driver, from
|
||||
one byte up to RX_BUF_P.
|
||||
|
||||
Examples:
|
||||
usart4: serial@40004c00 {
|
||||
compatible = "st,stm32-uart";
|
||||
reg = <0x40004c00 0x400>;
|
||||
interrupts = <52>;
|
||||
clocks = <&clk_pclk1>;
|
||||
pinctrl-names = "default", "sleep", "idle", "no_console_suspend";
|
||||
pinctrl-0 = <&pinctrl_usart4>;
|
||||
pinctrl-1 = <&pinctrl_usart4_sleep>;
|
||||
pinctrl-2 = <&pinctrl_usart4_idle>;
|
||||
pinctrl-3 = <&pinctrl_usart4>;
|
||||
};
|
||||
|
||||
usart2: serial@40004400 {
|
||||
compatible = "st,stm32-uart";
|
||||
reg = <0x40004400 0x400>;
|
||||
interrupts = <38>;
|
||||
clocks = <&clk_pclk1>;
|
||||
st,hw-flow-ctrl;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_usart2 &pinctrl_usart2_rtscts>;
|
||||
};
|
||||
|
||||
usart1: serial@40011000 {
|
||||
compatible = "st,stm32-uart";
|
||||
reg = <0x40011000 0x400>;
|
||||
interrupts = <37>;
|
||||
clocks = <&rcc 0 164>;
|
||||
dmas = <&dma2 2 4 0x414 0x0>,
|
||||
<&dma2 7 4 0x414 0x0>;
|
||||
dma-names = "rx", "tx";
|
||||
};
|
||||
26
doc/device-tree-bindings/watchdog/st,stm32-iwdg.txt
Normal file
26
doc/device-tree-bindings/watchdog/st,stm32-iwdg.txt
Normal file
@ -0,0 +1,26 @@
|
||||
STM32 Independent WatchDoG (IWDG)
|
||||
---------------------------------
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be either:
|
||||
- "st,stm32-iwdg"
|
||||
- "st,stm32mp1-iwdg"
|
||||
- reg: Physical base address and length of the registers set for the device
|
||||
- clocks: Reference to the clock entry lsi. Additional pclk clock entry
|
||||
is required only for st,stm32mp1-iwdg.
|
||||
- clock-names: Name of the clocks used.
|
||||
"lsi" for st,stm32-iwdg
|
||||
"lsi", "pclk" for st,stm32mp1-iwdg
|
||||
|
||||
Optional Properties:
|
||||
- timeout-sec: Watchdog timeout value in seconds.
|
||||
|
||||
Example:
|
||||
|
||||
iwdg: watchdog@40003000 {
|
||||
compatible = "st,stm32-iwdg";
|
||||
reg = <0x40003000 0x400>;
|
||||
clocks = <&clk_lsi>;
|
||||
clock-names = "lsi";
|
||||
timeout-sec = <32>;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user