Hello Eugen,

Am Wed, Aug 16, 2023 at 03:49:54PM +0300 schrieb Eugen Hristev:
> Hi Alexander,
> 
> On 8/9/23 17:16, Alexander Dahl wrote:
> > 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 <a...@thorsis.com>
> > ---
> >   .../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.

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

> 
> Thanks !
> 
> >   3 files changed, 66 insertions(+)
> > 
> > diff --git a/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi 
> > b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
> > index a1b76e94d1..dd4623311c 100644
> > --- a/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
> > +++ b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
> > @@ -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 {
> > diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts 
> > b/arch/arm/dts/at91-sam9x60_curiosity.dts
> > index 2547b4527c..244cacfe1b 100644
> > --- a/arch/arm/dts/at91-sam9x60_curiosity.dts
> > +++ b/arch/arm/dts/at91-sam9x60_curiosity.dts
> > @@ -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 =
> > diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c 
> > b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> > index 0fe0de9fde..f53d359404 100644
> > --- a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> > +++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> > @@ -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)
> 

Reply via email to