mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/6] raspberry-pi: add leds support
Date: Tue, 13 Jan 2015 11:58:40 +0400	[thread overview]
Message-ID: <20150113115840.3309f5fa5a331549eac9d028@gmail.com> (raw)
In-Reply-To: <1421130376-32428-2-git-send-email-plagnioj@jcrosoft.com>

On Tue, 13 Jan 2015 07:26:12 +0100
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:

I have planned to switch raspberry pi to device tree support as Linux does.

IMHO POWER LED is not GPIO controlable, please see these schematics

   http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf
   http://www.raspberrypi.org/documentation/hardware/raspberrypi/schematics/Raspberry-Pi-B-Plus-V1.2-Schematics.pdf


> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/boards/raspberry-pi/rpi.c | 55 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
> index ae1e92a..7d866cc 100644
> --- a/arch/arm/boards/raspberry-pi/rpi.c
> +++ b/arch/arm/boards/raspberry-pi/rpi.c
> @@ -21,6 +21,8 @@
>  #include <linux/clkdev.h>
>  #include <envfs.h>
>  #include <malloc.h>
> +#include <gpio.h>
> +#include <led.h>
>  #include <asm/armlinux.h>
>  #include <generated/mach-types.h>
>  
> @@ -87,6 +89,49 @@ static int rpi_register_clkdev(u32 clock_id, const char *name)
>  }
>  
>  
> +static struct gpio_led leds[] = {
> +	{
> +		.gpio	= -EINVAL,
> +		.led	= {
> +			.name = "ACT",
> +		},
> +	}, {
> +		.gpio	= -EINVAL,
> +		.led	= {
> +			.name = "PWR",
> +		},
> +	},
> +};
> +
> +static void rpi_add_led(void)
> +{
> +	int i;
> +	struct gpio_led *l;
> +
> +	for (i = 0; i < ARRAY_SIZE(leds); i++) {
> +		l = &leds[i];
> +
> +		if (gpio_is_valid(l->gpio))
> +			led_gpio_register(l);
> +	}
> +
> +	l = &leds[0];
> +	if (gpio_is_valid(l->gpio))
> +		led_set_trigger(LED_TRIGGER_HEARTBEAT, &l->led);
> +}
> +
> +static void rpi_b_plus_init(void)
> +{
> +	leds[0].gpio = 47;
> +	leds[1].gpio = 35;
> +}
> +
> +static void rpi_b_init(void)
> +{
> +	leds[0].gpio = 16;
> +	leds[0].active_low = 1;
> +}
> +
>  #define RPI_MODEL(_id, _name, _init)	\
>  	[_id] = {				\
>  		.name			= _name,\
> @@ -160,6 +205,15 @@ unknown_rev:
>  	barebox_set_model("RaspberryPi (BCM2835/ARM1176JZF-S)");
>  }
>  
> +static void rpi_model_init(void)
> +{
> +	rpi_set_usbethaddr();
> +	if (models[rpi_board_rev].init) {
> +		models[rpi_board_rev].init();
> +		rpi_add_led();
> +	}
> +}
> +
>  static int rpi_mem_init(void)
>  {
>  	u32 size = 0;
> @@ -220,6 +274,7 @@ static int rpi_env_init(void)
>  
>  static int rpi_devices_init(void)
>  {
> +	rpi_model_init();
>  	bcm2835_register_mci();
>  	bcm2835_register_fb();
>  	armlinux_set_architecture(MACH_TYPE_BCM2708);
> -- 
> 2.1.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-01-13  7:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  6:24 [PATCH 0/6] raspberry-pi: updates Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26 ` [PATCH 1/6] raspberry-pi: add board model detection Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26   ` [PATCH 2/6] raspberry-pi: add leds support Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  7:58     ` Antony Pavlov [this message]
2015-01-13  8:15       ` Jean-Christophe PLAGNIOL-VILLARD
2015-01-13 10:11         ` Antony Pavlov
2015-01-14  6:26           ` Sascha Hauer
2015-01-13  6:26   ` [PATCH 3/6] amba: pl011: add support for regulator Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26   ` [PATCH 4/6] driver: add postcore_platform_driver Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26   ` [PATCH 5/6] regulator: allow to use it with non DT device Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:26   ` [PATCH 6/6] regulator: add bcm2835 driver Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:31 [PATCH 0/6 v2] raspberry-pi: updates Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33 ` [PATCH 1/6] raspberry-pi: add board model detection Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  6:33   ` [PATCH 2/6] raspberry-pi: add leds support Jean-Christophe PLAGNIOL-VILLARD
2015-01-18 22:08     ` Antony Pavlov
2015-01-19  7:51       ` Sascha Hauer
2015-01-19  7:58         ` Antony Pavlov
2015-01-19  7:59           ` Sascha Hauer
2015-01-19 12:16       ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150113115840.3309f5fa5a331549eac9d028@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox