memory: Add driver for FMC2 External Bus Interface on STM32MP SoCs
Subsystems (7)
PATCH 1/3 memory: Add driver for FMC2 External Bus Interface on STM32MP SoCs
This adds support for FMC2 External Bus Interface on STM32MP SoCs. The original source is taken from linux-6.4.
--- drivers/memory/Kconfig | 11 + drivers/memory/Makefile | 1 + drivers/memory/stm32-fmc2-ebi.c | 1136 +++++++++++++++++++++++++++++++ 3 files changed, 1148 insertions(+) create mode 100644 drivers/memory/stm32-fmc2-ebi.c
drivers/memory/Kconfig +11 -0
@@ -23,4 +23,15 @@ config MC_TEGRA124 the Tegra124 SoC. This driver performs the necessary initialization to provide a function GPU when the OS is running. +config STM32_FMC2_EBI + bool "Support for FMC2 External Bus Interface on STM32MP SoCs" + depends on ARCH_STM32MP || COMPILE_TEST + select RESET_CONTROLLER if ARCH_STM32MP + select RESET_SIMPLE if ARCH_STM32MP + help + Select this option to enable the STM32 FMC2 External Bus Interface + controller. This driver configures the transactions with external + devices (like SRAM, ethernet adapters, FPGAs, LCD displays, ...) on + SOCs containing the FMC2 External Bus Interface. + endmenu
drivers/memory/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o obj-$(CONFIG_MC_TEGRA124) += mc-tegra124.o +obj-$(CONFIG_STM32_FMC2_EBI) += stm32-fmc2-ebi.o
drivers/memory/stm32-fmc2-ebi.c new file +1136 -0
1,136 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH 2/3 mtd: nand: Add driver for NAND controller on STM32MP SoCs
This adds support for NAND controller on STM32MP SoCs. The original source is taken from linux-6.4.
--- drivers/mtd/nand/Kconfig | 12 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/stm32_fmc2_nand.c | 1354 ++++++++++++++++++++++++++++ 3 files changed, 1367 insertions(+) create mode 100644 drivers/mtd/nand/stm32_fmc2_nand.c
drivers/mtd/nand/Kconfig +12 -0
@@ -95,6 +95,18 @@ config NAND_MRVL_NFC Support for the PXA3xx NAND controller, present in Armada 370/XP and PXA3xx SoCs. +config NAND_STM32 + bool "Support for NAND controller on STM32MP SoCs" + depends on ARCH_STM32MP || COMPILE_TEST + select STM32_FMC2_EBI if ARCH_STM32MP + select RESET_CONTROLLER if ARCH_STM32MP + select RESET_SIMPLE if ARCH_STM32MP + help + Enables support for NAND Flash chips on SoCs containing the FMC2 + NAND controller. This controller is found on STM32MP SoCs. + The controller supports a maximum 8k page size and supports + a maximum 8-bit correction error per sector of 512 bytes. + config NAND_ATMEL bool prompt "Atmel (AT91SAM9xxx) NAND driver"
drivers/mtd/nand/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_NAND_IMX) += nand_imx.o obj-$(CONFIG_NAND_OMAP_GPMC) += nand_omap_gpmc.o nand_omap_bch_decoder.o obj-$(CONFIG_MTD_NAND_OMAP_ELM) += omap_elm.o obj-$(CONFIG_NAND_ORION) += nand_orion.o +obj-$(CONFIG_NAND_STM32) += stm32_fmc2_nand.o obj-$(CONFIG_NAND_MRVL_NFC) += nand_mrvl_nfc.o obj-$(CONFIG_NAND_ATMEL) += atmel/ obj-$(CONFIG_NAND_MXS) += nand_mxs.o
drivers/mtd/nand/stm32_fmc2_nand.c new file +1354 -0
1,354 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH 3/3 ARM: boards: Add MyirTech MYD-YA15XC-T development board support
In reply to Alexander ShiyanAdd basic support for the MyirTech MYD-YA15XC-T development board [1].
...
deep-probe: supported due to myir,myc-stm32mp15x
stm32mp-init: detected STM32MP151AAC Rev.Z
STM32 RCC reset reason POR (MP_RSTSR: 0x00000015)
Boot from SD...
psci psci.of: detected version 1.1
stpmic1-i2c stpmic10: PMIC Chip Version: 0x21
stm32-usbphyc [email protected]: registered rev:1.0nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdanand_base: Micron MT29F2G08ABAEAWPnand_base: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01nand_read_bbt: bad block at 0x000000d60000nand_read_bbt: bad block at 0x000000fa0000nand_read_bbt: bad block at 0x00000d460000stm32_sdmmc [email protected]: registered as mmc0
mmc0: detected SD card version 2.0
mmc0: registered mmc0stm32_sdmmc [email protected]: registered as mmc1
stm32-iwdg [email protected]: probed
Product name: MYC-YA151C-256N256D-65-I-T
Product serial: TW202103290400145
malloc space: 0xc7ef7a80 -> 0xcfdef4ff (size 127 MiB)
envfs: no envfs (magic mismatch) - envfs never written?
NOTICE: ubi0: scanning is finished
NOTICE: ubi0: registering /dev/nand0.system.ubi
NOTICE: ubi0: registering kernel as /dev/nand0.system.ubi.kernel
NOTICE: ubi0: registering root as /dev/nand0.system.ubi.root
NOTICE: ubi0: registering bbox as /dev/nand0.system.ubi.bbox
NOTICE: ubi0: attached mtd0 (name "nand0.system", size 237 MiB) to ubi0
NOTICE: ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
NOTICE: ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
NOTICE: ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
NOTICE: ubi0: good PEBs: 1895, bad PEBs: 5, corrupted PEBs: 0
NOTICE: ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
NOTICE: ubi0: max/mean erase counter: 1/0, WL threshold: 65536, image sequence number: 3389077539
NOTICE: ubi0: available PEBs: 529, total reserved PEBs: 1366, PEBs reserved for bad PEB handling: 35
Hit m for menu or any to stop autoboot: 2
barebox@MYC-YA151C-256N256D-65-I-T:/
...
[1] https://www.myirtech.com/list.asp?id=659
--- arch/arm/boards/Makefile | 1 + arch/arm/boards/myirtech-stm32/Makefile | 4 + arch/arm/boards/myirtech-stm32/board.c | 143 +++++++ arch/arm/boards/myirtech-stm32/lowlevel.c | 27 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp15x-myirtech-myc.dtsi | 351 +++++++++++++++++ arch/arm/dts/stm32mp15x-myirtech-myd.dts | 458 ++++++++++++++++++++++ arch/arm/mach-stm32mp/Kconfig | 7 + images/Makefile.stm32mp | 2 + 9 files changed, 994 insertions(+) create mode 100644 arch/arm/boards/myirtech-stm32/Makefile create mode 100644 arch/arm/boards/myirtech-stm32/board.c create mode 100644 arch/arm/boards/myirtech-stm32/lowlevel.c create mode 100644 arch/arm/dts/stm32mp15x-myirtech-myc.dtsi create mode 100644 arch/arm/dts/stm32mp15x-myirtech-myd.dts
arch/arm/boards/Makefile +1 -0
@@ -140,6 +140,7 @@ obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/ obj-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp15xx-dkx/ obj-$(CONFIG_MACH_STM32MP13XX_DK) += stm32mp13xx-dk/ obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/ +obj-$(CONFIG_MACH_MYIRTECH_STM32MP1) += myirtech-stm32/ obj-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp15x-ev1/ obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/ obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/
arch/arm/boards/myirtech-stm32/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +lwl-y += lowlevel.o +obj-y += board.o
arch/arm/boards/myirtech-stm32/board.c new file +143 -0
143 lines not on this page · raw message
arch/arm/boards/myirtech-stm32/lowlevel.c new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <common.h> +#include <mach/stm32mp/entry.h> +#include <debug_ll.h> + +extern char __dtb_z_stm32mp15x_myirtech_myd_start[]; + +static void setup_uart (void ) +{ +/* first stage has set up the UART, so nothing to do here */ +putc_ll ('>' ); +} + +ENTRY_FUNCTION(start_stm32mp15x_myir, r0, r1, r2) +{ +void *fdt; + +stm32mp_cpu_lowlevel_init (); + +if (IS_ENABLED (CONFIG_DEBUG_LL )) +setup_uart (); + + fdt = __dtb_z_stm32mp15x_myirtech_myd_start +get_runtime_offset (); + +stm32mp1_barebox_entry (fdt); +}
arch/arm/dts/Makefile +1 -0
@@ -143,6 +143,7 @@ lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o lwl-$(CONFIG_MACH_STM32MP13XX_DK) += stm32mp135f-dk.dtb.o lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o +lwl-$(CONFIG_MACH_MYIRTECH_STM32MP1) += stm32mp15x-myirtech-myd.dtb.o lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi new file +351 -0
351 lines not on this page · raw message
arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +458 -0
458 lines not on this page · raw message
arch/arm/mach-stm32mp/Kconfig +7 -0
@@ -29,6 +29,13 @@ config MACH_LXA_MC1 select ARCH_STM32MP157 bool "Linux Automation MC-1 board" +config MACH_MYIRTECH_STM32MP1 + bool "MYIR Tech Limited SOMs" + select ARCH_STM32MP157 + select MACHINE_ID + help + Say Y here if you are using a STM32MP15x based MYIR SOM + config MACH_SEEED_ODYSSEY select ARCH_STM32MP157 bool "Seeed Studio Odyssey"
images/Makefile.stm32mp +2 -0
@@ -36,6 +36,8 @@ $(call build_stm32mp_image, CONFIG_MACH_STM32MP15X_EV1, start_stm32mp15x_ev1, st $(call build_stm32mp_image, CONFIG_MACH_LXA_MC1, start_stm32mp157c_lxa_mc1, stm32mp157c-lxa-mc1) +$(call build_stm32mp_image, CONFIG_MACH_MYIRTECH_STM32MP1, start_stm32mp15x_myir, stm32mp15x-myir) + $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1a, prtt1a) $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1s, prtt1s) $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1c, prtt1c)
Signature · 1 line
2.39.1
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
Hello Alexander,
Thanks for your patch. A few comments below.
Quoted 103 lines · Alexander Shiyan
Add basic support for the MyirTech MYD-YA15XC-T development board [1].
...
deep-probe: supported due to myir,myc-stm32mp15x
stm32mp-init: detected STM32MP151AAC Rev.Z
STM32 RCC reset reason POR (MP_RSTSR:0x00000015)
Boot from SD...
psci psci.of: detected version 1.1
stpmic1-i2c stpmic10: PMIC Chip Version:0x21
stm32-usbphyc [email protected]: registered rev:1.0nand_base: device found, Manufacturer ID:0x2c, Chip ID:0xdanand_base: Micron MT29F2G08ABAEAWPnand_base: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Bad block table found at page 131008, version0x01
Bad block table found at page 130944, version0x01nand_read_bbt: bad block at0x000000d60000nand_read_bbt: bad block at0x000000fa0000nand_read_bbt: bad block at0x00000d460000stm32_sdmmc[email protected]: registered as mmc0
mmc0: detected SD card version 2.0
mmc0: registered mmc0stm32_sdmmc[email protected]: registered as mmc1
stm32-iwdg [email protected]: probed
Product name: MYC-YA151C-256N256D-65-I-T
Product serial: TW202103290400145
malloc space:0xc7ef7a80->0xcfdef4ff(size 127 MiB)
envfs: no envfs (magic mismatch) - envfs never written?
NOTICE: ubi0: scanning is finished
NOTICE: ubi0: registering/dev/nand0.system.ubi
NOTICE: ubi0: registering kernel as/dev/nand0.system.ubi.kernel
NOTICE: ubi0: registering root as/dev/nand0.system.ubi.root
NOTICE: ubi0: registering bbox as/dev/nand0.system.ubi.bbox
NOTICE: ubi0: attached mtd0 (name "nand0.system", size 237 MiB) to ubi0
NOTICE: ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
NOTICE: ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
NOTICE: ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
NOTICE: ubi0: good PEBs: 1895, bad PEBs: 5, corrupted PEBs: 0
NOTICE: ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
NOTICE: ubi0: max/mean erase counter: 1/0, WL threshold: 65536, image sequence number: 3389077539
NOTICE: ubi0: available PEBs: 529, total reserved PEBs: 1366, PEBs reserved for bad PEB handling: 35Hit m for menu or any to stop autoboot: 2
barebox@MYC-YA151C-256N256D-65-I-T:/
...[1] https://www.myirtech.com/list.asp?id=659
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/boards/Makefile | 1 + arch/arm/boards/myirtech-stm32/Makefile | 4 + arch/arm/boards/myirtech-stm32/board.c | 143 +++++++ arch/arm/boards/myirtech-stm32/lowlevel.c | 27 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/stm32mp15x-myirtech-myc.dtsi | 351 +++++++++++++++++ arch/arm/dts/stm32mp15x-myirtech-myd.dts | 458 ++++++++++++++++++++++ arch/arm/mach-stm32mp/Kconfig | 7 + images/Makefile.stm32mp | 2 + 9 files changed, 994 insertions(+) create mode 100644 arch/arm/boards/myirtech-stm32/Makefile create mode 100644 arch/arm/boards/myirtech-stm32/board.c create mode 100644 arch/arm/boards/myirtech-stm32/lowlevel.c create mode 100644 arch/arm/dts/stm32mp15x-myirtech-myc.dtsi create mode 100644 arch/arm/dts/stm32mp15x-myirtech-myd.dtsarch/arm/boards/Makefile +1
-0@@ -140,6 +140,7 @@ obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += solidrun-microsom/ obj-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp15xx-dkx/ obj-$(CONFIG_MACH_STM32MP13XX_DK) += stm32mp13xx-dk/ obj-$(CONFIG_MACH_LXA_MC1) += lxa-mc1/ +obj-$(CONFIG_MACH_MYIRTECH_STM32MP1) += myirtech-stm32/ obj-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp15x-ev1/ obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += technexion-pico-hobbit/ obj-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += technexion-wandboard/arch/arm/boards/myirtech-stm32/Makefile new file +4
-0@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +lwl-y += lowlevel.o +obj-y += board.oarch/arm/boards/myirtech-stm32/board.c new file +11
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <bootsource.h> +#include <common.h> +#include <deep-probe.h> +#include <envfs.h> +#include <environment.h> +#include <globalvar.h> +#include <init.h> +#include <machine_id.h> +#include <net.h>
arch/arm/boards/myirtech-stm32/board.c line 21
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+#include <of.h> +#include <mach/stm32mp/bbu.h> + +struct id_eeprom { +u8 hrcw_primary[0x10 ]; +u8 pn[64 ]; +u8 sn[64 ]; +u8 mac0[6 ]; +u8 mac1[6 ]; +} __packed;
You could describe this as nvmem-cells in the DT and you'd automatically get the MAC addresses assigned.
Quoted 17 lines
arch/arm/boards/myirtech-stm32/board.c new file +17
-0+ +static int stm32mp15x_myirtech_serial_fixup (struct device_node *root,void *unused) +{ +char *serial; + + serial =basprintf ("%s" ,getenv ("global.machine_id" )); +of_set_property (root,"serial-number" , serial,strlen (serial) +1 ,1 ); +free (serial); + +return 0 ; +} + +static int stm32mp15x_myirtech_eeprom_init (void ) +{ +struct id_eeprom eeprom; +struct cdev *cdev; +char str[64 ];
arch/arm/boards/myirtech-stm32/board.c line 48
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+int len; + +if (!of_machine_is_compatible ("myir,myc-stm32mp15x" )) +return 0 ; + + cdev =cdev_by_name ("eeprom0" ); +if (!cdev) { +pr_err ("Can't find EEPROM\n" ); +return -ENODEV ; + }
I think using nvmem cells would make the code less verbose.
Quoted 6 lines
arch/arm/boards/myirtech-stm32/board.c new file +6
-0+ +if (cdev_read (cdev, &eeprom,sizeof (eeprom),0 ,0 ) <0 ) { +pr_err ("Can't read EEPROM\n" ); +return -EIO ; + } +
arch/arm/boards/myirtech-stm32/board.c line 64
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+ len = (eeprom.pn[0 ] -'0' ); +if ((len <8 ) || (len >64 )) { +pr_err ("Unable to get product name\n" ); +return -EINVAL ; + } + +strncpy (str, &eeprom.pn[1 ], len); + str[len] ='\0' ; +pr_info ("Product name: %s\n" , str); +globalvar_add_simple ("model" , str);
barebox_set_model()?
arch/arm/boards/myirtech-stm32/board.c line 74
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+ + len = (eeprom.sn[0 ] -'0' ); +if ((len <8 ) || (len >64 )) { +pr_err ("Unable to get product serial\n" ); +return -EINVAL ; + } + +strncpy (str, &eeprom.sn[1 ], len); + str[len] ='\0' ; +pr_info ("Product serial: %s\n" , str);
Would barebox_set_serial_number() work for you?
arch/arm/boards/myirtech-stm32/board.c line 75
Quoted 1 line
arch/arm/boards/myirtech-stm32/board.c new file +1
-0+machine_id_set_hashable (str, len);
Any particular reason why not to just use the SoC serial?
arch/arm/boards/myirtech-stm32/board.c line 88
Quoted 13 lines
arch/arm/boards/myirtech-stm32/board.c new file +13
-0+of_register_fixup (stm32mp15x_myirtech_serial_fixup,NULL ); + +if (!is_valid_ether_addr (eeprom.mac0)) { +int i, j; + +/* Make fixed MAC-address based on serial number */ +memcpy (eeprom.mac0, str,sizeof (eeprom.mac0)); +for (i =sizeof (eeprom.mac0); i < len; i++) +for (j =0 ; j <sizeof (eeprom.mac0); j++) + eeprom.mac0[j] ^= str[i]; + } + +eth_register_ethaddr (0 , eeprom.mac0);
You could check if the nvmem cell exists and only do the fixup if it doesn't. Check Marco's recent Debix patches for an example of how to call nvmem from board code.
arch/arm/boards/myirtech-stm32/board.c line 92
Quoted 4 lines
arch/arm/boards/myirtech-stm32/board.c new file +4
-0+ +return 0 ; +} +of_populate_initcall (stm32mp15x_myirtech_eeprom_init);
Why can't this be moved into the probe function below? You may need to lookup the cdev device by alias though.
Quoted 22 lines
arch/arm/boards/myirtech-stm32/board.c new file +22
-0+static int stm32mp15x_myirtech_probe (struct device *dev) +{ +int instance =bootsource_get_instance (), def =-1 ; +const enum bootsource bs =bootsource_get (); + +barebox_set_hostname ("myir-stm32" ); + +switch (bs) { +case BOOTSOURCE_MMC : +if (instance ==0 ) { +of_device_enable_path ("/chosen/environment-sd" ); +pr_info ("Boot from SD...\n" ); + }else { +of_device_enable_path ("/chosen/environment-emmc" ); +pr_info ("Boot from eMMC...\n" ); + } + def = instance; +break ; +case BOOTSOURCE_NAND : +of_device_enable_path ("/chosen/environment-nand" ); +pr_info ("Boot from NAND...\n" ); + def =2 ;
arch/arm/boards/myirtech-stm32/board.c line 125
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+break ; +default : +return 0 ; + } + +stm32mp_bbu_mmc_register_handler ("sd" ,"/dev/mmc0.ssbl" , + (def ==0 ) ?BBU_HANDLER_FLAG_DEFAULT :0 ); + +stm32mp_bbu_mmc_register_handler ("emmc" ,"/dev/mmc1.ssbl" , + (def ==1 ) ?BBU_HANDLER_FLAG_DEFAULT :0 );
What version of TF-A do you use? New versions only support FIP, so stm32mp_bbu_mmc_fip_register() is what you actually want to use.
Quoted 40 lines
arch/arm/boards/myirtech-stm32/board.c new file +18
-0+ +//TODO: NAND + +return 0 ; +} + +static const struct of_device_id stm32mp15x_myirtech_of_match[] = { + { .compatible ="myir,myc-stm32mp15x" }, + { }, +}; +BAREBOX_DEEP_PROBE_ENABLE (stm32mp15x_myirtech_of_match); + +static struct driver stm32mp15x_myirtech_board_driver = { + .name ="board-myirtech-stm32" , + .probe = stm32mp15x_myirtech_probe, + .of_compatible = stm32mp15x_myirtech_of_match, +}; +device_platform_driver (stm32mp15x_myirtech_board_driver);arch/arm/boards/myirtech-stm32/lowlevel.c new file +16
-0@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <common.h> +#include <mach/stm32mp/entry.h> +#include <debug_ll.h> + +extern char __dtb_z_stm32mp15x_myirtech_myd_start[]; + +static void setup_uart (void ) +{ +/* first stage has set up the UART, so nothing to do here */ +putc_ll ('>' ); +} + +ENTRY_FUNCTION(start_stm32mp15x_myir, r0, r1, r2) +{
arch/arm/boards/myirtech-stm32/lowlevel.c line 26
Quoted 10 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +10
-0+void *fdt; + +stm32mp_cpu_lowlevel_init (); + +if (IS_ENABLED (CONFIG_DEBUG_LL )) +setup_uart (); + + fdt = __dtb_z_stm32mp15x_myirtech_myd_start +get_runtime_offset (); + +stm32mp1_barebox_entry (fdt);
Same question: Do you use an old TF-A or why do you need a specific entry point instead of barebox-stm32mp-generic-bl33.img?
Quoted 32 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +1
-0+}arch/arm/dts/Makefile +1
-0@@ -143,6 +143,7 @@ lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o lwl-$(CONFIG_MACH_STM32MP13XX_DK) += stm32mp135f-dk.dtb.o lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o +lwl-$(CONFIG_MACH_MYIRTECH_STM32MP1) += stm32mp15x-myirtech-myd.dtb.o lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o lwl-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.oarch/arm/dts/stm32mp15x-myirtech-myc.dtsi new file +13
-0@@ -0,0 +1,351 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* SPDX-FileCopyrightText: Alexander Shiyan, <[email protected]> */ + +#include <arm/stm32mp151.dtsi> +#include <arm/stm32mp15-pinctrl.dtsi> +#include <arm/stm32mp15xxac-pinctrl.dtsi> + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/leds/common.h> +#include <dt-bindings/mfd/st,stpmic1.h> + +/ { + model = "MYIR MYC-YA15XC-T";
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi line 23
Quoted 10 lines
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi new file +10
-0+ compatible = "myir,myc-stm32mp15x", "st,stm32mp151"; + + aliases { + i2c0 = &i2c1; + i2c1 = &i2c2; + i2c2 = &i2c3; + i2c3 = &i2c4; + i2c4 = &i2c5; + i2c5 = &i2c6; + };
You can add these to arch/arm/dts/stm32mp151.dtsi, so it's fixed for other boards as well.
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi line 28
Quoted 5 lines
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi new file +5
-0+ + memory@c0000000 { + device_type = "memory"; + reg = <0xc0000000 0x10000000>; + };
barebox will dynamically determine memory size and fix it up, so you can drop this node.
Quoted 364 lines
arch/arm/dts/stm32mp15x-myirtech-myc.dtsi new file +323
-0+ + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + mcuram2: mcuram2@10000000 { + compatible = "shared-dma-pool"; + reg = <0x10000000 0x40000>; + no-map; + }; + + vdev0vring0: vdev0vring0@10040000 { + compatible = "shared-dma-pool"; + reg = <0x10040000 0x1000>; + no-map; + }; + + vdev0vring1: vdev0vring1@10041000 { + compatible = "shared-dma-pool"; + reg = <0x10041000 0x1000>; + no-map; + }; + + vdev0buffer: vdev0buffer@10042000 { + compatible = "shared-dma-pool"; + reg = <0x10042000 0x4000>; + no-map; + }; + + mcuram: mcuram@30000000 { + compatible = "shared-dma-pool"; + reg = <0x30000000 0x40000>; + no-map; + }; + + retram: retram@38000000 { + compatible = "shared-dma-pool"; + reg = <0x38000000 0x10000>; + no-map; + }; + + optee: optee@0xde000000 { + reg = <0xde000000 0x02000000>; + no-map; + }; + }; + + vin_som: vin_som { + compatible = "regulator-fixed"; + regulator-name = "vin_som"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; + + leds: leds { + compatible = "gpio-leds"; + + led_cpu: led_cpu { + label = "som:cpu"; + color = <LED_COLOR_ID_BLUE>; + default-state = "off"; + function = LED_FUNCTION_CPU; + gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; + linux,default-trigger = LED_FUNCTION_CPU; + }; + }; +}; + +&bsec { + board_id: board_id@ec { + reg = <0xec 0x4>; + st,non-secure-otp; + }; +}; + +&cpu0 { + cpu-supply = <&vddcore>; +}; + +&dts { + status = "okay"; +}; + +&fmc { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&fmc_pins_a>; + pinctrl-1 = <&fmc_sleep_pins_a>; + status = "okay"; + + nand-controller@4,0 { + status = "okay"; + + nand@0 { + reg = <0>; + nand-on-flash-bbt; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + #address-cells = <1>; + #size-cells = <1>; + + nand_parts: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fsbl1"; + reg = <0x0 0x80000>; + }; + + partition@80000 { + label = "fsbl2"; + reg = <0x80000 0x80000>; + }; + + partition@100000 { + label = "matadata1"; + reg = <0x100000 0x80000>; + }; + + partition@180000 { + label = "matadata2"; + reg = <0x180000 0x80000>; + }; + + partition@200000 { + label = "fip-a1"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "fip-a2"; + reg = <0x600000 0x400000>; + }; + + partition@a00000 { + label = "fip-b1"; + reg = <0xa00000 0x400000>; + }; + + partition@e00000 { + label = "fip-b2"; + reg = <0xe00000 0x400000>; + }; + + partition@1200000 { + label = "system"; + reg = <0x01200000 0>; + }; + }; + }; + }; +}; + +&i2c4 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&i2c4_pins_a>; + pinctrl-1 = <&i2c4_sleep_pins_a>; + clock-frequency = <400000>; + status = "okay"; + + pmic: stpmic@33 { + compatible = "st,stpmic1"; + reg = <0x33>; + interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>; + interrupt-controller; + #interrupt-cells = <2>; + + regulators { + compatible = "st,stpmic1-regulators"; + buck1-supply = <&vin_som>; + buck2-supply = <&vin_som>; + buck3-supply = <&vin_som>; + buck4-supply = <&vin_som>; + ldo1-supply = <&v3v3>; + ldo4-supply = <&vin_som>; + vref_ddr-supply = <&vin_som>; + boost-supply = <&vin_som>; + 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>; + }; + + vdda: ldo1 { + regulator-name = "vdda"; + regulator-min-microvolt = <1700000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + vtt_ddr: ldo3 { + regulator-name = "vtt_ddr"; + regulator-always-on; + }; + + vdd_usb: ldo4 { + regulator-name = "vdd_usb"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vref_ddr: vref_ddr { + regulator-name = "vref_ddr"; + regulator-always-on; + regulator-over-current-protection; + }; + + bst_out: boost { + regulator-name = "bst_out"; + }; + + vbus_otg: pwr_sw1 { + regulator-name = "vbus_otg"; + regulator-active-discharge; + }; + + vbus_sw: pwr_sw2 { + regulator-name = "vbus_sw"; + regulator-active-discharge; + }; + }; + + onkey: onkey { + compatible = "st,stpmic1-onkey"; + interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>; + interrupt-names = "onkey-falling", "onkey-rising"; + power-off-time-sec = <10>; + }; + }; + + eeprom: eeprom@50 { + compatible = "atmel,24c32"; + reg = <0x50>; + pagesize = <32>; + num-addresses = <8>; + wp-gpios = <&gpioa 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + }; +}; + +&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>, <&ipcc 3>; + mbox-names = "vq0", "vq1", "shutdown", "detach"; + interrupt-parent = <&exti>; + interrupts = <68 IRQ_TYPE_EDGE_RISING>; + status = "okay"; +}; + +&pwr_regulators { + vdd-supply = <&vdd>; + vdd_3v3_usbfs-supply = <&vdd_usb>; +}; + +&rng1 { + status = "okay"; +}; + +&rtc { + status = "okay"; +}; + +&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,neg-edge; + bus-width = <8>; + vmmc-supply = <&v3v3>; + vqmmc-supply = <&vdd>; + mmc-ddr-3_3v; + status = "okay"; +};arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +35
-0@@ -0,0 +1,458 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* SPDX-FileCopyrightText: Alexander Shiyan, <[email protected]> */ + +/dts-v1/; + +#include "stm32mp15x-myirtech-myc.dtsi" + +#include <dt-bindings/net/qca-ar803x.h> + +/ { + model = "MYIR MYD-YA15XC-T"; + compatible = "myir,myd-stm32mp15x", "myir,myc-stm32mp15x", "st,stm32mp151"; + + aliases { + ethernet0 = ðernet0; + serial0 = &uart4; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm2 0 100000 0>; + brightness-levels = <0 255>; + num-interpolated-steps = <256>; + default-brightness-level = <255>; + }; + + panel: panel { + compatible = "panel-lvds"; + backlight = <&backlight>; + data-mapping = "vesa-24"; + enable-gpios = <&gpioi 3 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
arch/arm/dts/stm32mp15x-myirtech-myd.dts line 45
Quoted 10 lines
arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +10
-0+ power-supply = <&vdd_3v3>; + height-mm = <0>; + width-mm = <0>; + + port { + panel_in: endpoint { + remote-endpoint = <<dc_ep0_out>; + }; + }; + };
Do you intend to enable a boot splash? :>
I only tested the LTDC driver with parallel output.
Quoted 61 lines
arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +61
-0+ + vin: vin { + compatible = "regulator-fixed"; + regulator-name = "vin"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; + + vdd_3v3: vdd_3v3 { + compatible = "regulator-fixed"; + regulator-name = "vdd_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + vin-supply = <&v3v3>; + }; +}; + +&leds { + led_live: led_live { + label = "board:live"; + color = <LED_COLOR_ID_BLUE>; + default-state = "off"; + function = LED_FUNCTION_HEARTBEAT; + gpios = <&extgpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = LED_FUNCTION_HEARTBEAT; + panic-indicator; + }; +}; + +&vin_som { + vin-supply = <&vin>; +}; + +&i2c2 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&i2c2_pins &i2c2_pins_z>; + pinctrl-1 = <&i2c2_sleep_pins &i2c2_sleep_pins_z>; + clock-frequency = <400000>; + status = "okay"; + + extgpio: pcf8575@20 { + compatible = "nxp,pcf8575"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + }; + + typec: stusb1600@28 { + pinctrl-names = "default"; + pinctrl-0 = <&stusb1600_pins>; + compatible = "st,stusb1600"; + reg = <0x28>; + interrupt-parent = <&gpioa>; + interrupts = <10 IRQ_TYPE_EDGE_FALLING>; + vdd-supply = <&vin>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C";
arch/arm/dts/stm32mp15x-myirtech-myd.dts line 116
Quoted 10 lines
arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +10
-0+ power-role = "dual"; + power-opmode = "default"; + + port { + con_usbotg_hs_ep: endpoint { + remote-endpoint = <&usbotg_hs_ep>; + }; + }; + }; + };
FYI, there's a simple Type C driver framework now, so you could port the stusb1600 driver from Linux quite easily if you want to base decisions on whether the device is in device or host mode.
Quoted 373 lines
arch/arm/dts/stm32mp15x-myirtech-myd.dts new file +342
-0+ + rx8025: rtc@32 { + compatible = "epson,rx8025"; + reg = <0x32>; + }; +}; + +ðernet0 { + pinctrl-0 = <ðernet0_rgmii_pins_a>; + pinctrl-1 = <ðernet0_rgmii_sleep_pins_a>; + pinctrl-names = "default", "sleep"; + max-speed = <1000>; + phy-handle = <&phy0>; + phy-mode = "rgmii-id"; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + reset-gpios = <&gpiog 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; + reset-delay-us = <10000>; + reset-post-delay-us = <2000>; + + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@6 { + reg = <6>; + qca,clk-out-frequency = <125000000>; + qca,clk-out-strength = <AR803X_STRENGTH_FULL>; + }; + }; +}; + +<dc { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <<dc_pins>; + pinctrl-1 = <<dc_sleep_pins>; + status = "okay"; + + port { + ltdc_ep0_out: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_in>; + }; + }; +}; + +&sai1 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&sai1_pins>; + pinctrl-1 = <&sai1_sleep_pins>; + clocks = <&rcc SAI1>, <&rcc PLL3_Q>, <&rcc PLL3_R>; + clock-names = "pclk", "x8k", "x11k"; + status = "okay"; +}; + +&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>; + cd-gpios = <&gpioa 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + disable-wp; + st,neg-edge; + vmmc-supply = <&vdd>; + status = "okay"; +}; + +&spi5 { + pinctrl-names = "default"; + pinctrl-0 = <&spi5_pins>; + cs-gpios = <&gpioh 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&gpiof 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + status = "okay"; +}; + +&timers2 { + status = "okay"; + + pwm2: pwm { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&tim2_pwm_pins>; + pinctrl-1 = <&tim2_pwm_sleep_pins>; + status = "okay"; + }; +}; + +&uart4 { + pinctrl-names = "default", "sleep", "idle"; + pinctrl-0 = <&uart4_pins>; + pinctrl-1 = <&uart4_sleep_pins>; + pinctrl-2 = <&uart4_idle_pins>; + status = "okay"; +}; + +&usbh_ehci { + phys = <&usbphyc_port0>; + phy-names = "usb"; + status = "okay"; +}; + +&usbotg_hs { + phys = <&usbphyc_port1 0>; + phy-names = "usb2-phy"; + usb-role-switch; + vbus-supply = <&vbus_otg>; + status = "okay"; + + port { + usbotg_hs_ep: endpoint { + remote-endpoint = <&con_usbotg_hs_ep>; + }; + }; +}; + +&usbphyc { + status = "okay"; +}; + +&usbphyc_port0 { + phy-supply = <&vdd_usb>; + st,tune-hs-dc-level = <2>; + st,enable-fs-rftime-tuning; + st,enable-hs-rftime-reduction; + st,trim-hs-current = <15>; + st,trim-hs-impedance = <1>; + st,tune-squelch-level = <3>; + st,tune-hs-rx-offset = <2>; + st,no-lsfs-sc; + + connector { + compatible = "usb-a-connector"; + vbus-supply = <&vin>; + }; +}; + +&usbphyc_port1 { + phy-supply = <&vdd_usb>; + st,tune-hs-dc-level = <2>; + st,enable-fs-rftime-tuning; + st,enable-hs-rftime-reduction; + st,trim-hs-current = <15>; + st,trim-hs-impedance = <1>; + st,tune-squelch-level = <3>; + st,tune-hs-rx-offset = <2>; + st,no-lsfs-sc; +}; + +&pinctrl { + i2c2_pins: i2c2-0 { + pins { + pinmux = <STM32_PINMUX('H', 4, AF4)>; /* I2C2_SCL */ + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; + + i2c2_sleep_pins: i2c2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('H', 4, ANALOG)>; /* I2C2_SCL */ + }; + }; + + ltdc_pins: ltdc-0 { + pins { + pinmux = <STM32_PINMUX('G', 7, AF14)>, /* LCD_CLK */ + <STM32_PINMUX('I', 10, AF14)>, /* LCD_HSYNC */ + <STM32_PINMUX('I', 9, AF14)>, /* LCD_VSYNC */ + <STM32_PINMUX('E', 13, AF14)>, /* LCD_DE */ + <STM32_PINMUX('H', 2, AF14)>, /* LCD_R0 */ + <STM32_PINMUX('H', 3, AF14)>, /* LCD_R1 */ + <STM32_PINMUX('H', 8, AF14)>, /* LCD_R2 */ + <STM32_PINMUX('H', 9, AF14)>, /* LCD_R3 */ + <STM32_PINMUX('H', 10, AF14)>, /* LCD_R4 */ + <STM32_PINMUX('H', 11, AF14)>, /* LCD_R5 */ + <STM32_PINMUX('H', 12, AF14)>, /* LCD_R6 */ + <STM32_PINMUX('E', 15, AF14)>, /* LCD_R7 */ + <STM32_PINMUX('E', 14, AF14)>, /* LCD_G0 */ + <STM32_PINMUX('E', 6, AF14)>, /* LCD_G1 */ + <STM32_PINMUX('H', 13, AF14)>, /* LCD_G2 */ + <STM32_PINMUX('H', 14, AF14)>, /* LCD_G3 */ + <STM32_PINMUX('H', 15, AF14)>, /* LCD_G4 */ + <STM32_PINMUX('I', 0, AF14)>, /* LCD_G5 */ + <STM32_PINMUX('I', 1, AF14)>, /* LCD_G6 */ + <STM32_PINMUX('I', 2, AF14)>, /* LCD_G7 */ + <STM32_PINMUX('D', 9, AF14)>, /* LCD_B0 */ + <STM32_PINMUX('G', 12, AF14)>, /* LCD_B1 */ + <STM32_PINMUX('G', 10, AF14)>, /* LCD_B2 */ + <STM32_PINMUX('D', 10, AF14)>, /* LCD_B3 */ + <STM32_PINMUX('I', 4, AF14)>, /* LCD_B4 */ + <STM32_PINMUX('I', 5, AF14)>, /* LCD_B5 */ + <STM32_PINMUX('I', 6, AF14)>, /* LCD_B6 */ + <STM32_PINMUX('I', 7, AF14)>; /* LCD_B7 */ + bias-disable; + drive-push-pull; + slew-rate = <1>; + }; + }; + + ltdc_sleep_pins: ltdc-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 7, ANALOG)>, /* LCD_CLK */ + <STM32_PINMUX('I', 10, ANALOG)>, /* LCD_HSYNC */ + <STM32_PINMUX('I', 9, ANALOG)>, /* LCD_VSYNC */ + <STM32_PINMUX('E', 13, ANALOG)>, /* LCD_DE */ + <STM32_PINMUX('H', 2, ANALOG)>, /* LCD_R0 */ + <STM32_PINMUX('H', 3, ANALOG)>, /* LCD_R1 */ + <STM32_PINMUX('H', 8, ANALOG)>, /* LCD_R2 */ + <STM32_PINMUX('H', 9, ANALOG)>, /* LCD_R3 */ + <STM32_PINMUX('H', 10, ANALOG)>, /* LCD_R4 */ + <STM32_PINMUX('H', 11, ANALOG)>, /* LCD_R5 */ + <STM32_PINMUX('H', 12, ANALOG)>, /* LCD_R6 */ + <STM32_PINMUX('E', 15, ANALOG)>, /* LCD_R7 */ + <STM32_PINMUX('E', 14, ANALOG)>, /* LCD_G0 */ + <STM32_PINMUX('E', 6, ANALOG)>, /* LCD_G1 */ + <STM32_PINMUX('H', 13, ANALOG)>, /* LCD_G2 */ + <STM32_PINMUX('H', 14, ANALOG)>, /* LCD_G3 */ + <STM32_PINMUX('H', 15, ANALOG)>, /* LCD_G4 */ + <STM32_PINMUX('I', 0, ANALOG)>, /* LCD_G5 */ + <STM32_PINMUX('I', 1, ANALOG)>, /* LCD_G6 */ + <STM32_PINMUX('I', 2, ANALOG)>, /* LCD_G7 */ + <STM32_PINMUX('D', 9, ANALOG)>, /* LCD_B0 */ + <STM32_PINMUX('G', 12, ANALOG)>, /* LCD_B1 */ + <STM32_PINMUX('G', 10, ANALOG)>, /* LCD_B2 */ + <STM32_PINMUX('D', 10, ANALOG)>, /* LCD_B3 */ + <STM32_PINMUX('I', 4, ANALOG)>, /* LCD_B4 */ + <STM32_PINMUX('I', 5, ANALOG)>, /* LCD_B5 */ + <STM32_PINMUX('I', 6, ANALOG)>, /* LCD_B6 */ + <STM32_PINMUX('I', 7, ANALOG)>; /* LCD_B7 */ + }; + }; + + sai1_pins: sai1-0 { + pins1 { + pinmux = <STM32_PINMUX('B', 2, AF6)>, /* SAI1_SD_A */ + <STM32_PINMUX('F', 8, AF6)>, /* SAI1_SCK_B */ + <STM32_PINMUX('F', 9, AF6)>, /* SAI1_FS_B */ + <STM32_PINMUX('F', 7, AF6)>; /* SAI1_MCLK_B */ + slew-rate = <0>; + drive-push-pull; + bias-disable; + }; + pins2 { + pinmux = <STM32_PINMUX('F', 6, AF6)>; /* SAI1_SD_B */ + bias-disable; + }; + }; + + sai1_sleep_pins: sai1-sleep-0 { + pins { + pinmux = <STM32_PINMUX('B', 2, ANALOG)>, /* SAI1_SD_A */ + <STM32_PINMUX('F', 8, ANALOG)>, /* SAI1_SCK_B */ + <STM32_PINMUX('F', 9, ANALOG)>, /* SAI1_FS_B */ + <STM32_PINMUX('F', 7, ANALOG)>, /* SAI1_MCLK_B */ + <STM32_PINMUX('F', 6, ANALOG)>; /* SAI1_SD_B */ + }; + }; + + spi5_pins: spi5-0 { + pins { + pinmux = <STM32_PINMUX('H', 6, AF5)>, /* SPI5_SCK */ + <STM32_PINMUX('F', 11, AF5)>; /* SPI5_MOSI */ + bias-disable; + drive-push-pull; + slew-rate = <1>; + }; + pins2 { + pinmux = <STM32_PINMUX('H', 7, AF5)>; /* SPI5_MISO */ + bias-disable; + }; + }; + + stusb1600_pins: stusb1600-0 { + pins { + pinmux = <STM32_PINMUX('A', 10, ANALOG)>; /* STUSB1600 IRQ */ + bias-pull-up; + }; + }; + + tim2_pwm_pins: tim2-pwm-0 { + pins { + pinmux = <STM32_PINMUX('G', 8, AF1)>; /* TIM2_CH1 */ + bias-disable; + drive-push-pull; + slew-rate = <0>; + }; + }; + + tim2_pwm_sleep_pins: tim2-pwm-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 8, ANALOG)>; /* TIM2_CH1 */ + }; + }; + + uart4_pins: uart4-0 { + pins1 { + pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */ + bias-disable; + drive-push-pull; + slew-rate = <0>; + }; + pins2 { + pinmux = <STM32_PINMUX('A', 11, AF6)>; /* UART4_RX */ + bias-disable; + }; + }; + + uart4_idle_pins: uart4-idle-0 { + pins1 { + pinmux = <STM32_PINMUX('G', 11, ANALOG)>; /* UART4_TX */ + }; + pins2 { + pinmux = <STM32_PINMUX('A', 11, AF6)>; /* UART4_RX */ + bias-disable; + }; + }; + + uart4_sleep_pins: uart4-sleep-0 { + pins1 { + pinmux = <STM32_PINMUX('G', 11, ANALOG)>, /* UART4_TX */ + <STM32_PINMUX('A', 11, ANALOG)>; /* UART4_RX */ + }; + }; +}; + +&pinctrl_z { + i2c2_pins_z: i2c2-0 { + pins { + pinmux = <STM32_PINMUX('Z', 7, AF3)>; /* I2C2_SDA */ + bias-disable; + drive-open-drain; + slew-rate = <0>; + }; + }; + + i2c2_sleep_pins_z: i2c2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('Z', 7, ANALOG)>; /* I2C2_SDA */ + }; + }; +};arch/arm/mach-stm32mp/Kconfig +7
-0@@ -29,6 +29,13 @@ config MACH_LXA_MC1 select ARCH_STM32MP157 bool "Linux Automation MC-1 board" +config MACH_MYIRTECH_STM32MP1 + bool "MYIR Tech Limited SOMs" + select ARCH_STM32MP157 + select MACHINE_ID + help + Say Y here if you are using a STM32MP15x based MYIR SOM + config MACH_SEEED_ODYSSEY select ARCH_STM32MP157 bool "Seeed Studio Odyssey"images/Makefile.stm32mp +2
-0@@ -36,6 +36,8 @@ $(call build_stm32mp_image, CONFIG_MACH_STM32MP15X_EV1, start_stm32mp15x_ev1, st $(call build_stm32mp_image, CONFIG_MACH_LXA_MC1, start_stm32mp157c_lxa_mc1, stm32mp157c-lxa-mc1) +$(call build_stm32mp_image, CONFIG_MACH_MYIRTECH_STM32MP1, start_stm32mp15x_myir, stm32mp15x-myir) + $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1a, prtt1a) $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1s, prtt1s) $(call build_stm32mp_image, CONFIG_MACH_PROTONIC_STM32MP1, start_prtt1c, prtt1c)
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
Hello Ahmad.
Quoted 1 line
Thanks for your patch. A few comments below.
...
Quoted 7 lines
Quoted 7 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +7
-0+ENTRY_FUNCTION(start_stm32mp15x_myir, r0, r1, r2) +{ +void *fdt; + +stm32mp_cpu_lowlevel_init (); + +if (IS_ENABLED (CONFIG_DEBUG_LL ))
Quoted 8 lines
arch/arm/boards/myirtech-stm32/lowlevel.c line 26
Quoted 5 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +5
-0+setup_uart (); + + fdt = __dtb_z_stm32mp15x_myirtech_myd_start +get_runtime_offset (); + +stm32mp1_barebox_entry (fdt);Same question: Do you use an old TF-A or why do you need a specific entry point instead of barebox-stm32mp-generic-bl33.img?
Initially, I used the old version of TF-A, to facilitate the first start-up of the board.
Now I'm using new version and FIP, so yes, this piece of code can be removed.
Thanks for the comments on the patch, I'll rework some parts of the code.
2 Sascha: Is it possible to commit the first two parts of the patch now to minimize the overall work?
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
Hi Alexander,
Quoted 20 lines · Alexander Shiyan
Hello Ahmad.
Quoted 1 line
Thanks for your patch. A few comments below.
...
Quoted 7 lines
Quoted 7 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +7
-0+ENTRY_FUNCTION(start_stm32mp15x_myir, r0, r1, r2) +{ +void *fdt; + +stm32mp_cpu_lowlevel_init (); + +if (IS_ENABLED (CONFIG_DEBUG_LL ))Quoted 8 lines
arch/arm/boards/myirtech-stm32/lowlevel.c line 26
Quoted 5 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +5
-0+setup_uart (); + + fdt = __dtb_z_stm32mp15x_myirtech_myd_start +get_runtime_offset (); + +stm32mp1_barebox_entry (fdt);Same question: Do you use an old TF-A or why do you need a specific entry point instead of barebox-stm32mp-generic-bl33.img?
Quoted 8 lines
Initially, I used the old version of TF-A, to facilitate the first start-up of the board.
Now I'm using new version and FIP, so yes, this piece of code can be removed.Thanks for the comments on the patch, I'll rework some parts of the code.
2 Sascha: Is it possible to commit the first two parts of the patch now to minimize the overall work?
Just did that.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
In reply to Ahmad FatoumQuoted 10 lines
arch/arm/boards/myirtech-stm32/board.c line 21
Quoted 7 lines
arch/arm/boards/myirtech-stm32/board.c new file +7
-0+struct id_eeprom { +u8 hrcw_primary[0x10 ]; +u8 pn[64 ]; +u8 sn[64 ]; +u8 mac0[6 ]; +u8 mac1[6 ]; +} __packed;You could describe this as nvmem-cells in the DT and you'd automatically get the MAC addresses assigned.
...
Quoted 6 lines
Quoted 6 lines
arch/arm/boards/myirtech-stm32/board.c new file +6
-0+if (!is_valid_ether_addr (eeprom.mac0)) { +int i, j; + +/* Make fixed MAC-address based on serial number */ +memcpy (eeprom.mac0, str,sizeof (eeprom.mac0)); +for (i =sizeof (eeprom.mac0); i < len; i++)
Quoted 8 lines
arch/arm/boards/myirtech-stm32/board.c line 88
Quoted 5 lines
arch/arm/boards/myirtech-stm32/board.c new file +5
-0+for (j =0 ; j <sizeof (eeprom.mac0); j++) + eeprom.mac0[j] ^= str[i]; + } + +eth_register_ethaddr (0 , eeprom.mac0);You could check if the nvmem cell exists and only do the fixup if it doesn't. Check Marco's recent Debix patches for an example of how to call nvmem from board code.
I can't find a way to know if an MAC address that was automatically assigned via nvmem is valid.
So in this case we always need to use eth_register_ethaddr() manually?
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
Quoted 26 lines · Alexander Shiyan
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c line 21
Quoted 7 lines
arch/arm/boards/myirtech-stm32/board.c new file +7
-0+struct id_eeprom { +u8 hrcw_primary[0x10 ]; +u8 pn[64 ]; +u8 sn[64 ]; +u8 mac0[6 ]; +u8 mac1[6 ]; +} __packed;You could describe this as nvmem-cells in the DT and you'd automatically get the MAC addresses assigned.
...
Quoted 6 lines
Quoted 6 lines
arch/arm/boards/myirtech-stm32/board.c new file +6
-0+if (!is_valid_ether_addr (eeprom.mac0)) { +int i, j; + +/* Make fixed MAC-address based on serial number */ +memcpy (eeprom.mac0, str,sizeof (eeprom.mac0)); +for (i =sizeof (eeprom.mac0); i < len; i++)Quoted 8 lines
arch/arm/boards/myirtech-stm32/board.c line 88
Quoted 5 lines
arch/arm/boards/myirtech-stm32/board.c new file +5
-0+for (j =0 ; j <sizeof (eeprom.mac0); j++) + eeprom.mac0[j] ^= str[i]; + } + +eth_register_ethaddr (0 , eeprom.mac0);You could check if the nvmem cell exists and only do the fixup if it doesn't. Check Marco's recent Debix patches for an example of how to call nvmem from board code.
Quoted 3 lines
I can't find a way to know if an MAC address that was automatically assigned via nvmem is valid.
So in this case we always need to useeth_register_ethaddr()manually?
You could fetch the nvmem cell and verify it yourself before MAC address is assigned. What I'd like to have eventually is a Kconfig option to generate a MAC address out of the serial number automatically if one was set and if not, only then fall back to randomization.
I even have patches somewhere. Let me check.
Cheers,
Ahmad
Quoted 1 line
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
Quoted 31 lines · Ahmad Fatoum
Quoted 26 lines · Alexander Shiyan
Quoted 10 lines
arch/arm/boards/myirtech-stm32/board.c line 21
Quoted 7 lines
arch/arm/boards/myirtech-stm32/board.c new file +7
-0+struct id_eeprom { +u8 hrcw_primary[0x10 ]; +u8 pn[64 ]; +u8 sn[64 ]; +u8 mac0[6 ]; +u8 mac1[6 ]; +} __packed;You could describe this as nvmem-cells in the DT and you'd automatically get the MAC addresses assigned.
...
Quoted 6 lines
Quoted 6 lines
arch/arm/boards/myirtech-stm32/board.c new file +6
-0+if (!is_valid_ether_addr (eeprom.mac0)) { +int i, j; + +/* Make fixed MAC-address based on serial number */ +memcpy (eeprom.mac0, str,sizeof (eeprom.mac0)); +for (i =sizeof (eeprom.mac0); i < len; i++)Quoted 8 lines
arch/arm/boards/myirtech-stm32/board.c line 88
Quoted 5 lines
arch/arm/boards/myirtech-stm32/board.c new file +5
-0+for (j =0 ; j <sizeof (eeprom.mac0); j++) + eeprom.mac0[j] ^= str[i]; + } + +eth_register_ethaddr (0 , eeprom.mac0);You could check if the nvmem cell exists and only do the fixup if it doesn't. Check Marco's recent Debix patches for an example of how to call nvmem from board code.
Quoted 3 lines
I can't find a way to know if an MAC address that was automatically assigned via nvmem is valid.
So in this case we always need to useeth_register_ethaddr()manually?
Quoted 6 lines
You could fetch the nvmem cell and verify it yourself before MAC address is assigned. What I'd like to have eventually is a
Kconfigoption to generate a MAC address out of the serial number automatically if one was set and if not, only then fall back to randomization.I even have patches somewhere. Let me check.
I reworked them a bit and just sent them out. Looking forward to your feedback.
Quoted 6 lines
Cheers,
AhmadQuoted 1 line
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support
In reply to Ahmad FatoumHi,
Quoted 14 lines · Ahmad Fatoum
arch/arm/boards/myirtech-stm32/board.c line 74
Quoted 10 lines · Alexander Shiyan
arch/arm/boards/myirtech-stm32/board.c new file +10
-0+ + len = (eeprom.sn[0 ] -'0' ); +if ((len <8 ) || (len >64 )) { +pr_err ("Unable to get product serial\n" ); +return -EINVAL ; + } + +strncpy (str, &eeprom.sn[1 ], len); + str[len] ='\0' ; +pr_info ("Product serial: %s\n" , str);Would
barebox_set_serial_number()work for you?
Quoted 3 lines
arch/arm/boards/myirtech-stm32/board.c line 75
Quoted 1 line
arch/arm/boards/myirtech-stm32/board.c new file +1
-0+machine_id_set_hashable (str, len);Any particular reason why not to just use the SoC serial?
We had a discussion two years ago[1], where it turned out that the unique ID on STM32MP1 SoCs wasn't randomized, so it's probably better board vendors indeed set their own if that would have more entropy. The ugly thing about that is that the last call to machine_id_set_hasable wins, so I wanted to change it to be set in device tree instead, e.g.:
/chosen { barebox,machine-id-path = &bsec; }.
Alas I never sent a v2. Anyways, existing users will have to be grandfathered in, so it's fine for me if you choose to call machine_id_set_hashable from your board code.
[1]: https://lore.barebox.org/barebox/[email protected]/
Quoted 7 lines
Quoted 7 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +7
-0+ENTRY_FUNCTION(start_stm32mp15x_myir, r0, r1, r2) +{ +void *fdt; + +stm32mp_cpu_lowlevel_init (); + +if (IS_ENABLED (CONFIG_DEBUG_LL ))
Quoted 8 lines
arch/arm/boards/myirtech-stm32/lowlevel.c line 26
Quoted 5 lines
arch/arm/boards/myirtech-stm32/lowlevel.c new file +5
-0+setup_uart (); + + fdt = __dtb_z_stm32mp15x_myirtech_myd_start +get_runtime_offset (); + +stm32mp1_barebox_entry (fdt);Same question: Do you use an old TF-A or why do you need a specific entry point instead of barebox-stm32mp-generic-bl33.img?
Rethinking this, such an image is the only way to chainload barebox over the network. So you may want to keep it until barebox can boot FIP images..
Cheers,
Ahmad
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |