at91: sam9x60-curiosity: Misc improvements
Subsystems (2)
v2 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.
See notes on patches for specific changes from v1 to v2 and below for summary of the changes.
Greets
Alex
v1 -> v2:
- reworded some commit messages
- reenabled CONFIG_SYSRESET and CONFIG_SYSRESET_AT91
- split up LED patch in two new patches
Alexander Dahl (5):
configs: at91: sam9x60_curiosity: Sync both defconfig variants
configs: at91: sam9x60: Switch to new reset driver
ARM: dts: at91: sam9x60-curiosity: Sync LED nodes from Linux
board: sam9x60-curiosity: Let LED subsystem init leds if enabled
ARM: dts: at91: sam9x60-curiosity: Sync gpio button from Linux
.../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 | 2 + configs/sam9x60_curiosity_mmc_defconfig | 17 ++++++- configs/sam9x60ek_mmc_defconfig | 2 + configs/sam9x60ek_nandflash_defconfig | 2 + configs/sam9x60ek_qspiflash_defconfig | 2 + 8 files changed, 110 insertions(+), 1 deletion(-)
base-commit: 0498ff933813932ff057cdc314ab46df4a596d06
Signature · 1 line
2.30.2
PATCH v2 1/5 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.
The 'mem=128M' argument can be dropped from kernel command line, because it is redundant to memory node in dts in both Linux and U-Boot:
memory@20000000 {
reg = <0x20000000 0x8000000>;
};---
Notes:
v1 -> v2:
- reworded commit message
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
PATCH v2 2/5 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 by enabling the new driver in the relevant defconfigs. 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.
---
Notes:
v1 -> v2:
- re-enabled SYSRESET and SYSRESET_AT91
configs/sam9x60_curiosity_mmc1_defconfig | 2 ++ configs/sam9x60_curiosity_mmc_defconfig | 2 ++ configs/sam9x60ek_mmc_defconfig | 2 ++ configs/sam9x60ek_nandflash_defconfig | 2 ++ configs/sam9x60ek_qspiflash_defconfig | 2 ++ 5 files changed, 10 insertions(+)
configs/sam9x60_curiosity_mmc1_defconfig +2 -0
@@ -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,6 +80,7 @@ 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
configs/sam9x60_curiosity_mmc_defconfig +2 -0
@@ -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,6 +80,7 @@ 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
configs/sam9x60ek_mmc_defconfig +2 -0
@@ -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,6 +88,7 @@ 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
configs/sam9x60ek_nandflash_defconfig +2 -0
@@ -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,6 +90,7 @@ 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
configs/sam9x60ek_qspiflash_defconfig +2 -0
@@ -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,6 +89,7 @@ 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
Signature · 1 line
2.30.2
PATCH v2 3/5 ARM: dts: at91: sam9x60-curiosity: Sync LED nodes from Linux
In reply to Alexander DahlCopied as is from Linux Kernel release v6.4.
(dts file is still the same in Linux v6.5-rc7 but was moved to vendor sub-directories with v6.5-rc1.)
--- arch/arm/dts/at91-sam9x60_curiosity.dts | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
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 =
Signature · 1 line
2.30.2
PATCH v2 4/5 board: sam9x60-curiosity: Let LED subsystem init leds if enabled
In reply to Alexander DahlIf CONFIG_LED and CONFIG_LED_GPIO are enabled, it is not necessary to initialize the RGB LED on the board by manually setting hardcoded GPIOs anymore. Everything is well defined in dts and can be used like on boards of other vendors.
Keep the old behaviour as fallback, though.
With all this in place enabling CONFIG_CMD_LED gives us a working 'led' command on the U-Boot shell.
--- .../arm/dts/at91-sam9x60_curiosity-u-boot.dtsi | 18 ++++++++++++++++++ .../sam9x60_curiosity/sam9x60_curiosity.c | 18 ++++++++++++++++++ 2 files changed, 36 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 {
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
PATCH v2 5/5 ARM: dts: at91: sam9x60-curiosity: Sync gpio button from Linux
In reply to Alexander DahlCopied as is from Linux Kernel release v6.4.
(dts file is still the same in Linux v6.5-rc7 but was moved to vendor sub-directories with v6.5-rc1.)
Button works out of the box now if the following config options are
enabled: CONFIG_BUTTON, CONFIG_BUTTON_GPIO, CONFIG_CMD_BUTTON, CONFIG_DM_GPIO.
---
Notes:
v1 -> v2:
- reworded commit message
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
Quoted 7 lines · Alexander Dahl
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.
Quoted 6 lines
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.
It is appreciated by me, so thank you !
Applied to u-boot-at91/next
Quoted 31 lines
See notes on patches for specific changes from v1 to v2 and below for summary of the changes.
Greets
Alexv1 -> v2:
- reworded some commit messages
- reenabledCONFIG_SYSRESETandCONFIG_SYSRESET_AT91
- split up LED patch in two new patchesAlexander Dahl (5):
configs: at91:sam9x60_curiosity: Sync both defconfig variants
configs: at91: sam9x60: Switch to new reset driver
ARM: dts: at91: sam9x60-curiosity: Sync LED nodes from Linux
board: sam9x60-curiosity: Let LED subsystem init leds if enabled
ARM: dts: at91: sam9x60-curiosity: Sync gpio button from Linux.../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 | 2 + configs/sam9x60_curiosity_mmc_defconfig | 17 ++++++- configs/sam9x60ek_mmc_defconfig | 2 + configs/sam9x60ek_nandflash_defconfig | 2 + configs/sam9x60ek_qspiflash_defconfig | 2 + 8 files changed, 110 insertions(+), 1 deletion(-)base-commit:
0498ff933813932ff057cdc314ab46df4a596d06