at91: sam9x60-curiosity: Misc improvements
Subsystems (2)
cover at91: sam9x60-curiosity: Misc improvements
Hei hei,
while working with the sam9x60-curiosity board I noticed some things still have rough edges on U-Boot shell for that device. With these patches (and some more config options enabled), the following commands now work as expected: reset, led, button.
The whole series is based on atmel/next.
Note: some things here might be useful to implement for other Microchip boards. However I currently only have this one board, and I'm not sure if this is a direction appreciated by Microchip? So you might see all this as suggestion.
Greets
Alex
Alexander Dahl (4):
configs: at91: sam9x60_curiosity: Sync both defconfig variants
configs: at91: sam9x60: Switch to new reset driver
at91: sam9x60-curiosity: Add proper LED support
ARM: dts: at91: sam9x60-curiosity: Add user button support
.../dts/at91-sam9x60_curiosity-u-boot.dtsi | 18 +++++++ arch/arm/dts/at91-sam9x60_curiosity.dts | 50 +++++++++++++++++++ .../sam9x60_curiosity/sam9x60_curiosity.c | 18 +++++++ configs/sam9x60_curiosity_mmc1_defconfig | 4 +- configs/sam9x60_curiosity_mmc_defconfig | 15 +++++- configs/sam9x60ek_mmc_defconfig | 4 +- configs/sam9x60ek_nandflash_defconfig | 4 +- configs/sam9x60ek_qspiflash_defconfig | 4 +- 8 files changed, 108 insertions(+), 9 deletions(-)
base-commit: 87d1cac49d265ead979ff75bda36c45fa9025193
Signature · 1 line
2.30.2
PATCH 1/4 configs: at91: sam9x60_curiosity: Sync both defconfig variants
The board has two SD card slots and we have two defconfigs for booting from either the first (micro SD) named 'sam9x60_curiosity_mmc_defconfig' or the second (full size SD) named 'sam9x60_curiosity_mmc1_defconfig'. For comparable Microchip boards (sama5d27-som1-ek, sama5d29-curiosity, sama7g5ek) with two card slots the defconfigs only differ in BOOTARGS, BOOTCOMMAND, and ENV_FAT_DEVICE_AND_PART and the same should be the case for sam9x60_curiosity.
Here the 'mmc1' config has more options enabled to support the raw NAND flash populated on the board, so the 'mmc' config (for mmc0) was adapted by enabling additional options, instead of removing options from mmc1.
--- configs/sam9x60_curiosity_mmc_defconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
configs/sam9x60_curiosity_mmc_defconfig +14 -1
@@ -23,7 +23,7 @@ CONFIG_FIT=y CONFIG_SD_BOOT=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait" +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait" CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" CONFIG_SYS_CONSOLE_IS_IN_ENV=y
@@ -38,6 +38,8 @@ CONFIG_CMD_DM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_NAND=y +CONFIG_CMD_NAND_TRIMFFS=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y
@@ -50,6 +52,8 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y
@@ -60,10 +64,17 @@ CONFIG_CPU=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y +CONFIG_ATMEL_EBI=y +CONFIG_MFD_ATMEL_SMC=y CONFIG_I2C_EEPROM=y CONFIG_MICROCHIP_FLEXCOM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_MTD_RAW_NAND=y +CONFIG_DM_NAND_ATMEL=y +CONFIG_SYS_NAND_ONFI_DETECTION=y CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y
@@ -71,6 +82,8 @@ CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y
Signature · 1 line
2.30.2
Re: [PATCH 1/4] configs: at91: sam9x60_curiosity: Sync both defconfig variants
Hi Alexander,
Quoted 7 lines · Alexander Dahl
The board has two SD card slots and we have two defconfigs for booting from either the first (micro SD) named '
sam9x60_curiosity_mmc_defconfig' or the second (full size SD) named 'sam9x60_curiosity_mmc1_defconfig'. For comparable Microchip boards (sama5d27-som1-ek, sama5d29-curiosity, sama7g5ek) with two card slots the defconfigs only differ in BOOTARGS, BOOTCOMMAND, andENV_FAT_DEVICE_AND_PARTand the same should be the case forsam9x60_curiosity.
To shed some light on this: the defconfigs for different at91 boards should differ only in terms of *where the env is stored*, but all the drivers should be available in all defconfigs.
The where it boots from sometimes is not related to the name of the defconfig, because e.g. we have board_qspiflash_defconfigs, which store the env in the qspi flash, but do not boot Linux from it, main reason is that the QSPI flash is very small (8 Mbytes e.g.) Most boards have a simple boot example from the same media as where the env is stored, but it's not always the case as seen above.
Quoted 15 lines
Here the 'mmc1' config has more options enabled to support the raw NAND flash populated on the board, so the 'mmc' config (for mmc0) was adapted by enabling additional options, instead of removing options from mmc1.
Signed-off-by Alexander Dahl <[email protected]>--- configs/sam9x60_curiosity_mmc_defconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)configs/sam9x60_curiosity_mmc_defconfig +0
-0
configs/sam9x60_curiosity_mmc_defconfig CONFIG_FIT=y · line 26
Quoted 5 lines
configs/sam9x60_curiosity_mmc_defconfig +1
-1@@ -23,7 +23,7 @@ CONFIG_FIT=y CONFIG_SD_BOOT=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait" +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
Have you checked the Linux DT if the memory is 128M hence the mem=128M is redundant ?
Quoted 48 lines
configs/sam9x60_curiosity_mmc_defconfig +13
-0CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" CONFIG_SYS_CONSOLE_IS_IN_ENV=y@@ -38,6 +38,8 @@ CONFIG_CMD_DM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_NAND=y +CONFIG_CMD_NAND_TRIMFFS=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y@@ -50,6 +52,8 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y@@ -60,10 +64,17 @@ CONFIG_CPU=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y +CONFIG_ATMEL_EBI=y +CONFIG_MFD_ATMEL_SMC=y CONFIG_I2C_EEPROM=y CONFIG_MICROCHIP_FLEXCOM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_MTD_RAW_NAND=y +CONFIG_DM_NAND_ATMEL=y +CONFIG_SYS_NAND_ONFI_DETECTION=y CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y@@ -71,6 +82,8 @@ CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y
Re: [PATCH 1/4] configs: at91: sam9x60_curiosity: Sync both defconfig variants
Hello Eugen,
thanks for your review, my comments below …
Am Wed, Aug 16, 2023 at 03:46:09PM +0300 schrieb Eugen Hristev:
Quoted 11 lines
Hi Alexander,
Quoted 7 lines · Alexander Dahl
The board has two SD card slots and we have two defconfigs for booting from either the first (micro SD) named '
sam9x60_curiosity_mmc_defconfig' or the second (full size SD) named 'sam9x60_curiosity_mmc1_defconfig'. For comparable Microchip boards (sama5d27-som1-ek, sama5d29-curiosity, sama7g5ek) with two card slots the defconfigs only differ in BOOTARGS, BOOTCOMMAND, andENV_FAT_DEVICE_AND_PARTand the same should be the case forsam9x60_curiosity.
Quoted 9 lines
To shed some light on this: the defconfigs for different at91 boards should differ only in terms of *where the env is stored*, but all the drivers should be available in all defconfigs.
Thewhere it boots fromsometimes is not related to the name of the defconfig, because e.g. we haveboard_qspiflash_defconfigs, which store the env in the qspi flash, but do not boot Linux from it, main reason is that the QSPI flash is very small (8 Mbytes e.g.)
Most boards have a simple boot example from the same media as where the env is stored, but it's not always the case as seen above.
Nice to know.
Quoted 9 lines
Quoted 9 lines
Here the 'mmc1' config has more options enabled to support the raw NAND flash populated on the board, so the 'mmc' config (for mmc0) was adapted by enabling additional options, instead of removing options from mmc1.
Signed-off-by Alexander Dahl <[email protected]>--- configs/sam9x60_curiosity_mmc_defconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
Quoted 13 lines
configs/sam9x60_curiosity_mmc_defconfig CONFIG_FIT=y · line 26
Quoted 10 lines
configs/sam9x60_curiosity_mmc_defconfig +1
-1@@ -23,7 +23,7 @@ CONFIG_FIT=y CONFIG_SD_BOOT=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait" +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"Have you checked the Linux DT if the memory is 128M hence the
mem=128Mis redundant ?
In Linux v6.4 the node looks like this:
27 memory@20000000 {
28 reg = <0x20000000 0x8000000>;
29 };
The 0x8000000 are equal to 134217728 aka 128M, so that cmdline arg is redundant. The sam9x60_curiosity_mmc1_defconfig also does not have it. I'll add a note on this to the commit message in v2 of the series.
Greets
Alex
Quoted 49 lines
Quoted 48 lines
configs/sam9x60_curiosity_mmc_defconfig +13
-0CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000" CONFIG_SYS_CONSOLE_IS_IN_ENV=y@@ -38,6 +38,8 @@ CONFIG_CMD_DM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_NAND=y +CONFIG_CMD_NAND_TRIMFFS=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y CONFIG_BOOTP_BOOTFILESIZE=y@@ -50,6 +52,8 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_REGMAP=y +CONFIG_SYSCON=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y@@ -60,10 +64,17 @@ CONFIG_CPU=y CONFIG_AT91_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_AT91=y +CONFIG_ATMEL_EBI=y +CONFIG_MFD_ATMEL_SMC=y CONFIG_I2C_EEPROM=y CONFIG_MICROCHIP_FLEXCOM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_MTD_RAW_NAND=y +CONFIG_DM_NAND_ATMEL=y +CONFIG_SYS_NAND_ONFI_DETECTION=y CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y@@ -71,6 +82,8 @@ CONFIG_PINCTRL_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y
PATCH 2/4 configs: at91: sam9x60: Switch to new reset driver
In reply to Alexander DahlSince commit 61040097a9d1 ("reset: at91: Add reset driver for basic assert/deassert operations") the compatible "microchip,sam9x60-rstc" for the sam9x60 reset controller in sam9x60.dtsi is not handled by CONFIG_SYSRESET_AT91 anymore, but by CONFIG_RESET_AT91 now. This resulted in the following error message, when trying to reset from U-Boot shell:
U-Boot> reset
resetting ...
System reset not supported on this platform
### ERROR ### Please RESET the board ###
Fixed with the switch to the new driver. Tested on sam9x60-curiosity board. Defconfigs for sam9x60ek adapted in the same way, but without testing. These should be all sam9x60 boards affected in U-Boot here.
--- configs/sam9x60_curiosity_mmc1_defconfig | 4 ++-- configs/sam9x60_curiosity_mmc_defconfig | 4 ++-- configs/sam9x60ek_mmc_defconfig | 4 ++-- configs/sam9x60ek_nandflash_defconfig | 4 ++-- configs/sam9x60ek_qspiflash_defconfig | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
configs/sam9x60_curiosity_mmc1_defconfig +2 -2
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y
configs/sam9x60_curiosity_mmc_defconfig +2 -2
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=y
configs/sam9x60ek_mmc_defconfig +2 -2
@@ -15,6 +15,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -87,14 +88,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
configs/sam9x60ek_nandflash_defconfig +2 -2
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -89,14 +90,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
configs/sam9x60ek_qspiflash_defconfig +2 -2
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -88,14 +89,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
Signature · 1 line
2.30.2
Re: [PATCH 2/4] configs: at91: sam9x60: Switch to new reset driver
Hi Alexander,
Quoted 7 lines · Alexander Dahl
Since commit
61040097a9d1("reset: at91: Add reset driver for basic assert/deassert operations") the compatible "microchip,sam9x60-rstc" for the sam9x60 reset controller insam9x60.dtsiis not handled byCONFIG_SYSRESET_AT91anymore, but byCONFIG_RESET_AT91now. This resulted in the following error message, when trying to reset from U-Boot shell:
Quoted 8 lines
U-Boot> reset
resetting ...
System reset not supported on this platform
### ERROR ### Please RESET the board ###Fixed with the switch to the new driver. Tested on sam9x60-curiosity board. Defconfigs for sam9x60ek adapted in the same way, but without testing. These should be all sam9x60 boards affected in U-Boot here.
From what I remember from the top of my head, it makes sense to use the new reset driver, however, you should not remove the old SYSRESET driver, because that driver handles different kind of resets on the SoC and PHYs. Can you double check that?
Quoted 144 lines
Signed-off-by Alexander Dahl <[email protected]>--- configs/sam9x60_curiosity_mmc1_defconfig | 4 ++-- configs/sam9x60_curiosity_mmc_defconfig | 4 ++-- configs/sam9x60ek_mmc_defconfig | 4 ++-- configs/sam9x60ek_nandflash_defconfig | 4 ++-- configs/sam9x60ek_qspiflash_defconfig | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)configs/sam9x60_curiosity_mmc1_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60_curiosity_mmc_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_mmc_defconfig +2
-2@@ -15,6 +15,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -87,14 +88,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_nandflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -89,14 +90,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_qspiflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -88,14 +89,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
Re: [PATCH 2/4] configs: at91: sam9x60: Switch to new reset driver
Hei hei,
Am Wed, Aug 16, 2023 at 03:48:25PM +0300 schrieb Eugen Hristev:
Quoted 16 lines
Hi Alexander,
Quoted 12 lines · Alexander Dahl
Since commit
61040097a9d1("reset: at91: Add reset driver for basic assert/deassert operations") the compatible "microchip,sam9x60-rstc" for the sam9x60 reset controller insam9x60.dtsiis not handled byCONFIG_SYSRESET_AT91anymore, but byCONFIG_RESET_AT91now. This resulted in the following error message, when trying to reset from U-Boot shell:U-Boot> reset
resetting ...
System reset not supported on this platform
### ERROR ### Please RESET the board ###
Quoted 8 lines
Quoted 3 lines
Fixed with the switch to the new driver. Tested on sam9x60-curiosity board. Defconfigs for sam9x60ek adapted in the same way, but without testing. These should be all sam9x60 boards affected in U-Boot here.
From what I remember from the top of my head, it makes sense to use the new reset driver, however, you should not remove the old SYSRESET driver, because that driver handles different kind of resets on the SoC and PHYs. Can you double check that?
Had a look into it and TBH it's very confusing to me. I found no help in documentation. There are two different uclass which from the outside seem to do the same thing. The Kconfig help texts do not explain what the purpose is of one over the other. As a user this creates very bad user experience: Do I need one or the other or both?
Then there's CONFIG_SYSRESET_CMD_RESET which implicates there are more than one possible implementations for cmd 'reset' … but which is the right one. The help text does not explain.
I though sysreset is old and reset is new and assumed things get migrated like in other subsystems. But here it seems we have two entangled subsystems where one hooks into the other (as reset_at91 does).
So, I can of course _just_ enable CONFIG_RESET_AT91 and hope for the best here, keeping SYSRESET_CMD_RESET as is … but it would be very nice if someone else could explain the what and why in help texts and documentation!
Greets
Alex
P.S.: I would have added sysreset or reset subsystem maintainer to Cc, but according to MAINTAINERS there is none.
Quoted 144 lines
Quoted 143 lines
Signed-off-by Alexander Dahl <[email protected]>--- configs/sam9x60_curiosity_mmc1_defconfig | 4 ++-- configs/sam9x60_curiosity_mmc_defconfig | 4 ++-- configs/sam9x60ek_mmc_defconfig | 4 ++-- configs/sam9x60ek_nandflash_defconfig | 4 ++-- configs/sam9x60ek_qspiflash_defconfig | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)configs/sam9x60_curiosity_mmc1_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60_curiosity_mmc_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_mmc_defconfig +2
-2@@ -15,6 +15,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -87,14 +88,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_nandflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -89,14 +90,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_qspiflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -88,14 +89,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
Re: [PATCH 2/4] configs: at91: sam9x60: Switch to new reset driver
Quoted 28 lines · Alexander Dahl
Hei hei,
Am Wed, Aug 16, 2023 at 03:48:25PM +0300 schrieb Eugen Hristev:
Quoted 16 lines
Hi Alexander,
Quoted 12 lines · Alexander Dahl
Since commit
61040097a9d1("reset: at91: Add reset driver for basic assert/deassert operations") the compatible "microchip,sam9x60-rstc" for the sam9x60 reset controller insam9x60.dtsiis not handled byCONFIG_SYSRESET_AT91anymore, but byCONFIG_RESET_AT91now. This resulted in the following error message, when trying to reset from U-Boot shell:U-Boot> reset
resetting ...
System reset not supported on this platform
### ERROR ### Please RESET the board ###Quoted 8 lines
Quoted 3 lines
Fixed with the switch to the new driver. Tested on sam9x60-curiosity board. Defconfigs for sam9x60ek adapted in the same way, but without testing. These should be all sam9x60 boards affected in U-Boot here.
From what I remember from the top of my head, it makes sense to use the new
reset driver, however, you should not remove the old SYSRESET driver, because that driver handles different kind of resets on the SoC and PHYs. Can you double check that?
Quoted 5 lines
Had a look into it and TBH it's very confusing to me. I found no help in documentation. There are two different uclass which from the outside seem to do the same thing. The
Kconfighelp texts do not explain what the purpose is of one over the other. As a user this creates very bad user experience: Do I need one or the other or both?
Maybe I can shed some light into it.
U-boot, unlike Linux, is a bit more modular in a few aspects, as in this RESET vs SYSRESET case.
From my understanding, RESET is used to reset the board and SYSRESET for general reset purposes: reset a PHY, reset something else, etc.
DT-bindings are done by Linux guys, and in Linux, we have a single driver for all above (it's similar with PINCTRL and GPIO, one linux driver, but two different u-boot UCLASS), so we have just one compatible, but U-boot needs to probe two drivers to achieve all the wanted functionality ! And we are forced to use the bindings from Linux (little rant), so just one U-boot driver is bound to the compatible at boot time. Then, the second driver, has to be manually bound by the first driver, and it does not have a compatible into it.
I think some of the stuff I explained(poorly) should be readable from this patch https://lists.denx.de/pipermail/u-boot/2022-December/501618.html
To simply answer your question, you would need both.
Quoted 165 lines
Then there's
CONFIG_SYSRESET_CMD_RESETwhich implicates there are more than one possible implementations for cmd 'reset' … but which is the right one. The help text does not explain.I though sysreset is old and reset is new and assumed things get migrated like in other subsystems. But here it seems we have two entangled subsystems where one hooks into the other (as
reset_at91does).So, I can of course _just_ enable
CONFIG_RESET_AT91and hope for the best here, keepingSYSRESET_CMD_RESETas is … but it would be very nice if someone else could explain the what and why in help texts and documentation!Greets
Alex
P.S.: I would have added sysreset or reset subsystem maintainer to Cc, but according toMAINTAINERSthere is none.Quoted 144 lines
Quoted 143 lines
Signed-off-by Alexander Dahl <[email protected]>--- configs/sam9x60_curiosity_mmc1_defconfig | 4 ++-- configs/sam9x60_curiosity_mmc_defconfig | 4 ++-- configs/sam9x60ek_mmc_defconfig | 4 ++-- configs/sam9x60ek_nandflash_defconfig | 4 ++-- configs/sam9x60ek_qspiflash_defconfig | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)configs/sam9x60_curiosity_mmc1_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60_curiosity_mmc_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -79,11 +80,10 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_MCHP_PIT64B_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_mmc_defconfig +2
-2@@ -15,6 +15,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -87,14 +88,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_nandflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -89,14 +90,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=yconfigs/sam9x60ek_qspiflash_defconfig +2
-2@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek" CONFIG_SYS_PROMPT="U-Boot> " CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y CONFIG_DEBUG_UART_BASE=0xfffff200 CONFIG_DEBUG_UART_CLOCK=200000000 CONFIG_DEBUG_UART_BOARD_INIT=y@@ -88,14 +89,13 @@ CONFIG_PHY_MICREL=y CONFIG_MACB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91=y +CONFIG_RESET_AT91=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y -CONFIG_SYSRESET=y -CONFIG_SYSRESET_AT91=y CONFIG_TIMER=y CONFIG_ATMEL_PIT_TIMER=y CONFIG_W1=y
PATCH 3/4 at91: sam9x60-curiosity: Add proper LED support
In reply to Alexander DahlCopied dts pieces from Linux Kernel. Support is optional for now, to make it work the following options have to be enabled: CONFIG_LED, CONFIG_LED_GPIO, CONFIG_CMD_LED.
--- .../dts/at91-sam9x60_curiosity-u-boot.dtsi | 18 +++++++++++ arch/arm/dts/at91-sam9x60_curiosity.dts | 30 +++++++++++++++++++ .../sam9x60_curiosity/sam9x60_curiosity.c | 18 +++++++++++ 3 files changed, 66 insertions(+)
arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi +18 -0
@@ -20,6 +20,24 @@ chosen { bootph-all; }; + + config { + u-boot,boot-led = "blue"; + }; + + leds { + led-red { + default-state = "off"; + }; + + led-green { + default-state = "off"; + }; + + led-blue { + default-state = "off"; + }; + }; }; &clk32 {
arch/arm/dts/at91-sam9x60_curiosity.dts +30 -0
@@ -33,6 +33,28 @@ }; }; + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpio_leds>; + + led-red { + label = "red"; + gpios = <&pioD 17 GPIO_ACTIVE_HIGH>; + }; + + led-green { + label = "green"; + gpios = <&pioD 19 GPIO_ACTIVE_HIGH>; + }; + + led-blue { + label = "blue"; + gpios = <&pioD 21 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + onewire_tm: onewire { gpios = <&pioD 14 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";
@@ -167,6 +189,14 @@ }; }; + leds { + pinctrl_gpio_leds: gpio-leds { + atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + nand { pinctrl_nand_oe_we: nand-oe-we-0 { atmel,pins =
board/atmel/sam9x60_curiosity/sam9x60_curiosity.c +18 -0
@@ -9,6 +9,7 @@#include <debug_uart.h> #include <fdtdec.h> #include <init.h> +#include <led.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_rstc.h> #include <asm/arch/at91_sfr.h>
@@ -18,6 +19,7 @@#include <asm/global_data.h> #include <asm/io.h> #include <asm/mach-types.h> +#include <dm/ofnode.h> extern void at91_pda_detect (void );
@@ -27,9 +29,25 @@ void at91_prepare_cpu_var(void);static void board_leds_init (void ) { +#if CONFIG_IS_ENABLED (LED ) +const char *led_name; +struct udevice *dev; +int ret; + + led_name =ofnode_conf_read_str ("u-boot,boot-led" ); +if (!led_name) +return ; + + ret =led_get_by_label (led_name, &dev); +if (ret) +return ; + +led_set_state (dev,LEDST_ON ); +#else at91_set_pio_output (AT91_PIO_PORTD ,17 ,0 );/* LED RED */ at91_set_pio_output (AT91_PIO_PORTD ,19 ,0 );/* LED GREEN */ at91_set_pio_output (AT91_PIO_PORTD ,21 ,1 );/* LED BLUE */ +#endif }int board_late_init (void )
Signature · 1 line
2.30.2
Re: [PATCH 3/4] at91: sam9x60-curiosity: Add proper LED support
Hi Alexander,
Quoted 9 lines · Alexander Dahl
Copied dts pieces from Linux Kernel. Support is optional for now, to make it work the following options have to be enabled:
CONFIG_LED,CONFIG_LED_GPIO,CONFIG_CMD_LED.Signed-off-by Alexander Dahl <[email protected]>--- .../dts/at91-sam9x60_curiosity-u-boot.dtsi | 18 +++++++++++ arch/arm/dts/at91-sam9x60_curiosity.dts | 30 +++++++++++++++++++ .../sam9x60_curiosity/sam9x60_curiosity.c | 18 +++++++++++
Can you please split the DT changes from the C file changes, namely if you bring changes from Linux, add them in a sync commit indicating the commit from Linux, and the changes to the board in a separate patch.
Thanks !
Quoted 125 lines
3 files changed, 66 insertions(+)arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi +18
-0@@ -20,6 +20,24 @@ chosen { bootph-all; }; + + config { + u-boot,boot-led = "blue"; + }; + + leds { + led-red { + default-state = "off"; + }; + + led-green { + default-state = "off"; + }; + + led-blue { + default-state = "off"; + }; + }; }; &clk32 {arch/arm/dts/at91-sam9x60_curiosity.dts +30
-0@@ -33,6 +33,28 @@ }; }; + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpio_leds>; + + led-red { + label = "red"; + gpios = <&pioD 17 GPIO_ACTIVE_HIGH>; + }; + + led-green { + label = "green"; + gpios = <&pioD 19 GPIO_ACTIVE_HIGH>; + }; + + led-blue { + label = "blue"; + gpios = <&pioD 21 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + onewire_tm: onewire { gpios = <&pioD 14 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";@@ -167,6 +189,14 @@ }; }; + leds { + pinctrl_gpio_leds: gpio-leds { + atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + nand { pinctrl_nand_oe_we: nand-oe-we-0 { atmel,pins =board/atmel/sam9x60_curiosity/sam9x60_curiosity.c +18
-0@@ -9,6 +9,7 @@#include <debug_uart.h> #include <fdtdec.h> #include <init.h> +#include <led.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_rstc.h> #include <asm/arch/at91_sfr.h> @@ -18,6 +19,7 @@#include <asm/global_data.h> #include <asm/io.h> #include <asm/mach-types.h> +#include <dm/ofnode.h> extern void at91_pda_detect (void );@@ -27,9 +29,25 @@ void at91_prepare_cpu_var(void);static void board_leds_init (void ) { +#if CONFIG_IS_ENABLED (LED ) +const char *led_name; +struct udevice *dev; +int ret; + + led_name =ofnode_conf_read_str ("u-boot,boot-led" ); +if (!led_name) +return ; + + ret =led_get_by_label (led_name, &dev); +if (ret) +return ; + +led_set_state (dev,LEDST_ON ); +#else at91_set_pio_output (AT91_PIO_PORTD ,17 ,0 );/* LED RED */ at91_set_pio_output (AT91_PIO_PORTD ,19 ,0 );/* LED GREEN */ at91_set_pio_output (AT91_PIO_PORTD ,21 ,1 );/* LED BLUE */ +#endif }int board_late_init (void )
Re: [PATCH 3/4] at91: sam9x60-curiosity: Add proper LED support
Hello Eugen,
Am Wed, Aug 16, 2023 at 03:49:54PM +0300 schrieb Eugen Hristev:
Quoted 13 lines
Hi Alexander,
Quoted 9 lines · Alexander Dahl
Copied dts pieces from Linux Kernel. Support is optional for now, to make it work the following options have to be enabled:
CONFIG_LED,CONFIG_LED_GPIO,CONFIG_CMD_LED.Signed-off-by Alexander Dahl <[email protected]>--- .../dts/at91-sam9x60_curiosity-u-boot.dtsi | 18 +++++++++++ arch/arm/dts/at91-sam9x60_curiosity.dts | 30 +++++++++++++++++++ .../sam9x60_curiosity/sam9x60_curiosity.c | 18 +++++++++++
Quoted 3 lines
Can you please split the DT changes from the C file changes, namely if you bring changes from Linux, add them in a sync commit indicating the commit from Linux, and the changes to the board in a separate patch.
Yes, I can do that in v2 of the series.
FWIW this LED stuff and the button stuff from patch 4 is taken from Linux v6.4 and it has not changed in Linux master since (which is currently at v6.5-rc6-36-g4853c74bd7ab).
Greets
Alex
Quoted 122 lines
Thanks !
Quoted 118 lines
3 files changed, 66 insertions(+)arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi +18
-0@@ -20,6 +20,24 @@ chosen { bootph-all; }; + + config { + u-boot,boot-led = "blue"; + }; + + leds { + led-red { + default-state = "off"; + }; + + led-green { + default-state = "off"; + }; + + led-blue { + default-state = "off"; + }; + }; }; &clk32 {arch/arm/dts/at91-sam9x60_curiosity.dts +30
-0@@ -33,6 +33,28 @@ }; }; + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpio_leds>; + + led-red { + label = "red"; + gpios = <&pioD 17 GPIO_ACTIVE_HIGH>; + }; + + led-green { + label = "green"; + gpios = <&pioD 19 GPIO_ACTIVE_HIGH>; + }; + + led-blue { + label = "blue"; + gpios = <&pioD 21 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "heartbeat"; + }; + }; + onewire_tm: onewire { gpios = <&pioD 14 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";@@ -167,6 +189,14 @@ }; }; + leds { + pinctrl_gpio_leds: gpio-leds { + atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_NONE + AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + nand { pinctrl_nand_oe_we: nand-oe-we-0 { atmel,pins =board/atmel/sam9x60_curiosity/sam9x60_curiosity.c +18
-0@@ -9,6 +9,7 @@#include <debug_uart.h> #include <fdtdec.h> #include <init.h> +#include <led.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_rstc.h> #include <asm/arch/at91_sfr.h> @@ -18,6 +19,7 @@#include <asm/global_data.h> #include <asm/io.h> #include <asm/mach-types.h> +#include <dm/ofnode.h> extern void at91_pda_detect (void );@@ -27,9 +29,25 @@ void at91_prepare_cpu_var(void);static void board_leds_init (void ) { +#if CONFIG_IS_ENABLED (LED ) +const char *led_name; +struct udevice *dev; +int ret; + + led_name =ofnode_conf_read_str ("u-boot,boot-led" ); +if (!led_name) +return ; + + ret =led_get_by_label (led_name, &dev); +if (ret) +return ; + +led_set_state (dev,LEDST_ON ); +#else at91_set_pio_output (AT91_PIO_PORTD ,17 ,0 );/* LED RED */ at91_set_pio_output (AT91_PIO_PORTD ,19 ,0 );/* LED GREEN */ at91_set_pio_output (AT91_PIO_PORTD ,21 ,1 );/* LED BLUE */ +#endif }int board_late_init (void )
PATCH 4/4 ARM: dts: at91: sam9x60-curiosity: Add user button support
In reply to Alexander DahlCopied as is from Linux Kernel. Works out of the box if the following config options are enabled: CONFIG_BUTTON, CONFIG_BUTTON_GPIO, CONFIG_CMD_BUTTON, CONFIG_DM_GPIO.
--- arch/arm/dts/at91-sam9x60_curiosity.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm/dts/at91-sam9x60_curiosity.dts +20 -0
@@ -7,6 +7,7 @@ * Author: Durai Manickam KR <[email protected]> */ /dts-v1/; +#include <dt-bindings/input/input.h> #include <dt-bindings/mfd/atmel-flexcom.h> #include "sam9x60.dtsi"
@@ -33,6 +34,19 @@ }; }; + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_key_gpio_default>; + + button-user { + label = "PB_USER"; + gpios = <&pioA 29 GPIO_ACTIVE_LOW>; + linux,code = <KEY_PROG1>; + wakeup-source; + }; + }; + leds { compatible = "gpio-leds"; pinctrl-names = "default";
@@ -189,6 +203,12 @@ }; }; + gpio-keys { + pinctrl_key_gpio_default: pinctrl-key-gpio { + atmel,pins = <AT91_PIOA 29 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + leds { pinctrl_gpio_leds: gpio-leds { atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
Signature · 1 line
2.30.2
Re: [PATCH 4/4] ARM: dts: at91: sam9x60-curiosity: Add user button support
Hi Alexander,
Quoted 3 lines · Alexander Dahl
Copied as is from Linux Kernel. Works out of the box if the following config options are enabled:
CONFIG_BUTTON,CONFIG_BUTTON_GPIO,CONFIG_CMD_BUTTON,CONFIG_DM_GPIO.
Can you please indicate the Linux commit which was picked, thanks !
Eugen
Quoted 51 lines
Signed-off-by Alexander Dahl <[email protected]>--- arch/arm/dts/at91-sam9x60_curiosity.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)arch/arm/dts/at91-sam9x60_curiosity.dts +20
-0@@ -7,6 +7,7 @@ * Author: Durai Manickam KR <[email protected]> */ /dts-v1/; +#include <dt-bindings/input/input.h> #include <dt-bindings/mfd/atmel-flexcom.h> #include "sam9x60.dtsi"@@ -33,6 +34,19 @@ }; }; + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_key_gpio_default>; + + button-user { + label = "PB_USER"; + gpios = <&pioA 29 GPIO_ACTIVE_LOW>; + linux,code = <KEY_PROG1>; + wakeup-source; + }; + }; + leds { compatible = "gpio-leds"; pinctrl-names = "default";@@ -189,6 +203,12 @@ }; }; + gpio-keys { + pinctrl_key_gpio_default: pinctrl-key-gpio { + atmel,pins = <AT91_PIOA 29 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; + }; + }; + leds { pinctrl_gpio_leds: gpio-leds { atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE