Add STM32MP1 Discovery boards
Subsystems (2)
cover Add STM32MP1 Discovery boards
This series:
- Synchronizes DT with kernel one
- Adds STM32MP1 Discovery boards DK1 and DK2
- Adds power supply information at boot for DK1 and DK2 boards
Patrice Chotard (4):
ARM: dts: stm32: Synchronize DT with kernel one
board: stm32mp1: Update README file
Board: stm32mp1: Add supply current boot information
ARM: dts: stm32mp1: Add adc nodes
arch/arm/dts/Makefile | 2 + arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi | 120 ++++++++++ arch/arm/dts/stm32mp157-pinctrl.dtsi | 81 +++++++ arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 196 ++++++++++++++++ arch/arm/dts/stm32mp157a-dk1.dts | 262 ++++++++++++++++++++++ arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 6 + arch/arm/dts/stm32mp157c-dk2.dts | 67 ++++++ arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 36 ++- arch/arm/dts/stm32mp157c-ed1.dts | 47 ++-- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 19 +- arch/arm/dts/stm32mp157c-ev1.dts | 100 +++++++++ arch/arm/dts/stm32mp157c.dtsi | 272 ++++++++++++++++++++--- board/st/stm32mp1/README | 23 ++ board/st/stm32mp1/stm32mp1.c | 154 ++++++++++++- 14 files changed, 1310 insertions(+), 75 deletions(-) create mode 100644 arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi create mode 100644 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi create mode 100644 arch/arm/dts/stm32mp157a-dk1.dts create mode 100644 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi create mode 100644 arch/arm/dts/stm32mp157c-dk2.dts
Signature · 1 line
1.9.1
PATCH 1/4 ARM: dts: stm32: Synchronize DT with kernel one
This patch synchronizes U-boot DT with kernel one This is based on https://patchwork.kernel.org/cover/10797115/
This patch adds initial support of STM32MP157 discovery boards:
- Add support of stm32mp157a discovery1 board (part number: STM32MP157A-DK1). This board embeds a STM32MP157a SOC with AC package (TFBGA361, 148 ios) and 512MB of DDR3. Several connections are available on this boards:
4*USB2.0, 1*USB2.0 typeC, SDcard, RJ45, HDMI, Arduino connector, ...
- Add support of stm32mp157c discovery2 board (part number: STM32MP157C-DK2). This board is a "super-set" of stm32mp157a-dk1. A display panel (otm8009a) and Murata wifi/BT combo is added.
---
arch/arm/dts/Makefile | 2 + arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi | 120 ++++++++++ arch/arm/dts/stm32mp157-pinctrl.dtsi | 74 ++++++ arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 175 +++++++++++++++ arch/arm/dts/stm32mp157a-dk1.dts | 262 ++++++++++++++++++++++ arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 6 + arch/arm/dts/stm32mp157c-dk2.dts | 67 ++++++ arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 36 ++- arch/arm/dts/stm32mp157c-ed1.dts | 47 ++-- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 19 +- arch/arm/dts/stm32mp157c-ev1.dts | 100 +++++++++ arch/arm/dts/stm32mp157c.dtsi | 272 ++++++++++++++++++++--- 12 files changed, 1106 insertions(+), 74 deletions(-) create mode 100644 arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi create mode 100644 arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi create mode 100644 arch/arm/dts/stm32mp157a-dk1.dts create mode 100644 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi create mode 100644 arch/arm/dts/stm32mp157c-dk2.dts
arch/arm/dts/Makefile +2 -0
@@ -575,6 +575,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
arch/arm/dts/stm32mp15-ddr3-1x4Gb-1066-binG.dtsi new file +120 -0
120 lines not on this page · raw message
arch/arm/dts/stm32mp157-pinctrl.dtsi +74 -0
92 lines not on this page · raw message
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi new file +175 -0
175 lines not on this page · raw message
arch/arm/dts/stm32mp157a-dk1.dts new file +262 -0
262 lines not on this page · raw message
arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* + * Copyright : STMicroelectronics 2018 + */ + +#include "stm32mp157a-dk1-u-boot.dtsi"
arch/arm/dts/stm32mp157c-dk2.dts new file +67 -0
67 lines not on this page · raw message
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +16 -20
@@ -9,9 +9,9 @@ / { aliases { + i2c3 = &i2c4; mmc0 = &sdmmc1; mmc1 = &sdmmc2; - i2c3 = &i2c4; }; led {
@@ -39,14 +39,8 @@ }; }; -&uart4_pins_a { +&i2c4 { u-boot,dm-pre-reloc; - pins1 { - u-boot,dm-pre-reloc; - }; - pins2 { - u-boot,dm-pre-reloc; - }; }; &i2c4_pins_a {
@@ -56,19 +50,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
@@ -162,8 +147,6 @@ }; }; -/* SPL part **************************************/ -/* MMC1 boot */ &sdmmc1_b4_pins_a { u-boot,dm-spl; pins {
@@ -182,7 +165,6 @@ u-boot,dm-spl; }; -/* MMC2 boot */ &sdmmc2_b4_pins_a { u-boot,dm-spl; pins {
@@ -200,3 +182,17 @@ &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; + }; +};
arch/arm/dts/stm32mp157c-ed1.dts +30 -17
88 lines not on this page · raw message
arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +7 -12
@@ -7,29 +7,21 @@ / { aliases { - spi0 = &qspi; i2c1 = &i2c2; i2c4 = &i2c5; + 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 +53,10 @@ }; }; -&flash0 { - u-boot,dm-spl; +&usbotg_hs { + g-tx-fifo-size = <576>; }; +&v3v3 { + regulator-always-on; +};
arch/arm/dts/stm32mp157c-ev1.dts +100 -0
130 lines not on this page · raw message
arch/arm/dts/stm32mp157c.dtsi +247 -25
362 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 2/4 board: stm32mp1: Update README file
In reply to Patrice ChotardUpdate README with DK1 and DK2 boards related informations
---
board/st/stm32mp1/README | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
board/st/stm32mp1/README +23 -0
@@ -35,6 +35,8 @@ And the necessary drivers Currently the following boards are supported: + stm32mp157c-ev1 + stm32mp157c-ed1 ++ stm32mp157a-dk1 ++ stm32mp157c-dk2 3. Boot Sequences =================
@@ -76,6 +78,12 @@ the supported device trees for stm32mp157 are: + 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 ==================
@@ -127,6 +135,11 @@ the supported device trees for stm32mp157 are: # make stm32mp15_basic_defconfig # make DEVICE_TREE=stm32mp157c-ed1 all + d) basic boot on dk2 + # export KBUILD_OUTPUT=stm32mp15_basic + # make stm32mp15_basic_defconfig + # make DEVICE_TREE=stm32mp157c-dk2 all + 6. Output files BootRom and TF-A expect binaries with STM32 image header
@@ -159,6 +172,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).
Signature · 1 line
1.9.1
PATCH 3/4 Board: stm32mp1: Add supply current boot information
In reply to Patrice ChotardFor DK1/DK2 boards, check if power supply provides enough current to allow the board to boot correctly.
ADC at 0 channel 18 and 19 are connected to USB type-C CC1 and CC2 signals. The table below shows the behavior for different range of CC1 or CC2:
range | power supply | red led | console message (Volts) | (Amps) | blinks | --------------|--------------|---------|----------------------------------- [2.10 - 1.23[ | 3 | NO | NO [1.23 - 0.66[ | 1.5 | 3 times | WARNING 1.5A power supply detected [0.66 - 0] | 0.5 | 2 times | WARNING 500mA power supply detected
If detected current is < 3A, red led is kept ON after blinking.
---
board/st/stm32mp1/stm32mp1.c | 154 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 153 insertions(+), 1 deletion(-)
board/st/stm32mp1/stm32mp1.c +153 -1
@@ -2,9 +2,10 @@/* * Copyright (C) 2018, STMicroelectronics - All Rights Reserved */ +#include <common.h> +#include <adc.h> #include <config.h> #include <clk.h> -#include <common.h> #include <dm.h> #include <generic-phy.h> #include <led.h>
@@ -27,6 +28,10 @@ DECLARE_GLOBAL_DATA_PTR;#define STM32MP_GGPIO 0x38#define STM32MP_GGPIO_VBUS_SENSING BIT(21) +#define USB_WARNING_LOW_THRESHOLD_UV 660000 +#define USB_START_LOW_THRESHOLD_UV 1230000 +#define USB_START_HIGH_THRESHOLD_UV 2100000 +int checkboard (void ) {int ret;
@@ -210,6 +215,145 @@ clk_err:return ret; } +static int get_led (struct udevice **dev,char *led_string) +{ +char *led_name; +int ret; + + led_name =fdtdec_get_config_string (gd->fdt_blob, led_string); +if (!led_name) { +pr_debug ("%s: could not find %s config string\n" , + __func__, led_string); +return -ENOENT ; + } + ret =led_get_by_label (led_name, dev); +if (ret) { +debug ("%s: get=%d\n" , __func__, ret); +return ret; + } + +return 0 ; +} + +static int setup_led (enum led_state_t cmd) +{ +struct udevice *dev; +int ret; + + ret =get_led (&dev,"u-boot,boot-led" ); +if (ret) +return ret; + + ret =led_set_state (dev, cmd); +return ret; +} + +static int board_check_usb_power (void ) +{ +struct ofnode_phandle_args adc_args; +struct udevice *adc; +struct udevice *led; +ofnode node; +unsigned int raw; +int max_uV =0 ; +int ret, uV, adc_count; +u8 i, nb_blink; + + node =ofnode_path ("/config" ); +if (!ofnode_valid (node)) { +debug ("%s: no /config node?\n" , __func__); +return -ENOENT ; + } + +/* +* Retrieve the ADC channels devices and get measurement +* for each of them +*/ + adc_count =ofnode_count_phandle_with_args (node,"st,adc_usb_pd" , +"#io-channel-cells" ); +if (adc_count <0 ) { +if (adc_count == -ENOENT ) +return 0 ; + +pr_err ("%s: can't find adc channel (%d)\n" , __func__, + adc_count); + +return adc_count; + } + +for (i =0 ; i < adc_count; i++) { +if (ofnode_parse_phandle_with_args (node,"st,adc_usb_pd" , +"#io-channel-cells" ,0 , i, + &adc_args)) { +pr_debug ("%s: can't find /config/st,adc_usb_pd\n" , + __func__); +return 0 ; + } + + ret =uclass_get_device_by_ofnode (UCLASS_ADC , adc_args.node, + &adc); + +if (ret) { +pr_err ("%s: Can't get adc device(%d)\n" , __func__, + ret); +return ret; + } + + ret =adc_channel_single_shot (adc->name, adc_args.args[0 ], + &raw); +if (ret) { +pr_err ("%s: single shot failed for %s[%d]!\n" , + __func__, adc->name, adc_args.args[0 ]); +return ret; + } +/* Convert to uV */ +if (!adc_raw_to_uV (adc, raw, &uV)) { +if (uV > max_uV) + max_uV = uV; +pr_debug ("%s: %s[%02d] = %u, %d uV\n" , __func__, + adc->name, adc_args.args[0 ], raw, uV); + }else { +pr_err ("%s: Can't get uV value for %s[%d]\n" , + __func__, adc->name, adc_args.args[0 ]); + } + } + +/* +* If highest value is inside 1.23 Volts and 2.10 Volts, that means +* board is plugged on an USB-C 3A power supply and boot process can +* continue. +*/ +if (max_uV >USB_START_LOW_THRESHOLD_UV && + max_uV <USB_START_HIGH_THRESHOLD_UV ) +return 0 ; + +/* Display warning message and make u-boot,error-led blinking */ +pr_err ("\n*******************************************\n" ); + +if (max_uV <USB_WARNING_LOW_THRESHOLD_UV ) { +pr_err ("* WARNING 500mA power supply detected *\n" ); + nb_blink =2 ; + }else { +pr_err ("* WARNING 1.5A power supply detected *\n" ); + nb_blink =3 ; + } + +pr_err ("* Current too low, use a 3A power supply! *\n" ); +pr_err ("*******************************************\n\n" ); + + ret =get_led (&led,"u-boot,error-led" ); +if (ret) +return ret; + +for (i =0 ; i < nb_blink *2 ; i++) { +led_set_state (led,LEDST_TOGGLE ); +mdelay (125 ); + } +led_set_state (led,LEDST_ON ); + +return 0 ; +} +int board_usb_cleanup (int index,enum usb_init_type init) {/* Reset usbotg */
@@ -234,5 +378,13 @@ int board_init(void)if (IS_ENABLED (CONFIG_LED ))led_default_state (); +/* for DK1/DK2 boards */ +board_check_usb_power (); +return 0 ; } + +void board_quiesce_devices (void ) +{ +setup_led (LEDST_OFF ); +}
Signature · 1 line
1.9.1
PATCH 4/4 ARM: dts: stm32mp1: Add adc nodes
In reply to Patrice ChotardAdd adc related nodes. These nodes are used to detect the current supplied by USB type-C power in port on DK1 and DK2 boards.
---
arch/arm/dts/stm32mp157-pinctrl.dtsi | 7 +++++++ arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+)
arch/arm/dts/stm32mp157-pinctrl.dtsi +7 -0
@@ -148,6 +148,13 @@ gpio-ranges = <&pinctrl 0 160 8>; }; + adc12_usb_pwr_pins_a: adc12-usb-pwr-pins-0 { + pins { + pinmux = <STM32_PINMUX('A', 4, ANALOG)>, /* ADC12 in18 */ + <STM32_PINMUX('A', 5, ANALOG)>; /* ADC12 in19 */ + }; + }; + cec_pins_a: cec-0 { pins { pinmux = <STM32_PINMUX('A', 15, AF4)>;
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +21 -0
@@ -31,6 +31,27 @@ }; }; +&adc { + pinctrl-names = "default"; + pinctrl-0 = <&adc12_usb_pwr_pins_a>; + vdd-supply = <&vdd>; + vdda-supply = <&vdd>; + vref-supply = <&vrefbuf>; + status = "okay"; + adc1: adc at 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"; + }; +}; + &clk_hse { st,digbypass; };
Signature · 1 line
1.9.1