* [U-Boot] [PATCH] lsxl: support power switch
@ 2012-07-30 20:47 Michael Walle
2012-07-31 5:59 ` Prafulla Wadaskar
0 siblings, 1 reply; 7+ messages in thread
From: Michael Walle @ 2012-07-30 20:47 UTC (permalink / raw)
To: u-boot
This patch restores the Linkstation's original behaviour when powering off.
Once the (soft) power switch is turned off, linux will reboot and the
bootloader turns off HDD and USB power. Then it loops as long as the switch
is in the off position, before continuing the boot process again.
Additionally, this patch fixes the board function set_led(LED_OFF).
Signed-off-by: Michael Walle <michael@walle.cc>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
---
board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index fe15511..b3f31d6 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -158,7 +158,7 @@ static void set_led(int state)
{
switch (state) {
case LED_OFF:
- __set_led(0, 0, 0, 0, 0, 0);
+ __set_led(0, 0, 0, 1, 1, 1);
break;
case LED_ALARM_ON:
__set_led(0, 0, 0, 0, 1, 1);
@@ -192,6 +192,25 @@ int board_init(void)
}
#ifdef CONFIG_MISC_INIT_R
+static void check_power_switch(void)
+{
+ if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
+ /* turn off HDD and USB power */
+ kw_gpio_set_value(GPIO_HDD_POWER, 0);
+ kw_gpio_set_value(GPIO_USB_VBUS, 0);
+ set_led(LED_OFF);
+
+ /* loop until released */
+ while (kw_gpio_get_value(GPIO_POWER_SWITCH))
+ ;
+
+ /* turn power on again */
+ kw_gpio_set_value(GPIO_HDD_POWER, 1);
+ kw_gpio_set_value(GPIO_USB_VBUS, 1);
+ set_led(LED_POWER_BLINKING);
+ }
+}
+
void check_enetaddr(void)
{
uchar enetaddr[6];
@@ -261,6 +280,7 @@ static void check_push_button(void)
int misc_init_r(void)
{
+ check_power_switch();
check_enetaddr();
check_push_button();
--
1.7.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-30 20:47 [U-Boot] [PATCH] lsxl: support power switch Michael Walle
@ 2012-07-31 5:59 ` Prafulla Wadaskar
2012-07-31 10:52 ` Michael Walle
0 siblings, 1 reply; 7+ messages in thread
From: Prafulla Wadaskar @ 2012-07-31 5:59 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: 31 July 2012 02:17
> To: u-boot at lists.denx.de
> Cc: Michael Walle; Prafulla Wadaskar
> Subject: [PATCH] lsxl: support power switch
>
> This patch restores the Linkstation's original behaviour when powering
> off.
> Once the (soft) power switch is turned off, linux will reboot and the
> bootloader turns off HDD and USB power. Then it loops as long as the
> switch
> is in the off position, before continuing the boot process again.
>
> Additionally, this patch fixes the board function set_led(LED_OFF).
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> ---
> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
> 1 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
> index fe15511..b3f31d6 100644
> --- a/board/buffalo/lsxl/lsxl.c
> +++ b/board/buffalo/lsxl/lsxl.c
> @@ -158,7 +158,7 @@ static void set_led(int state)
> {
> switch (state) {
> case LED_OFF:
> - __set_led(0, 0, 0, 0, 0, 0);
> + __set_led(0, 0, 0, 1, 1, 1);
> break;
> case LED_ALARM_ON:
> __set_led(0, 0, 0, 0, 1, 1);
> @@ -192,6 +192,25 @@ int board_init(void)
> }
>
> #ifdef CONFIG_MISC_INIT_R
> +static void check_power_switch(void)
> +{
> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> + /* turn off HDD and USB power */
> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> + set_led(LED_OFF);
> +
> + /* loop until released */
> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> + ;
Please avoid infinite loop, may you introduce timeout?
> +
> + /* turn power on again */
> + kw_gpio_set_value(GPIO_HDD_POWER, 1);
> + kw_gpio_set_value(GPIO_USB_VBUS, 1);
> + set_led(LED_POWER_BLINKING);
> + }
> +}
> +
> void check_enetaddr(void)
> {
> uchar enetaddr[6];
> @@ -261,6 +280,7 @@ static void check_push_button(void)
>
> int misc_init_r(void)
> {
> + check_power_switch();
> check_enetaddr();
> check_push_button();
Ack for rest of the code.
Regards...
Prafulla . . .
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-31 5:59 ` Prafulla Wadaskar
@ 2012-07-31 10:52 ` Michael Walle
2012-07-31 11:12 ` Prafulla Wadaskar
0 siblings, 1 reply; 7+ messages in thread
From: Michael Walle @ 2012-07-31 10:52 UTC (permalink / raw)
To: u-boot
On Tue, July 31, 2012 07:59, Prafulla Wadaskar wrote:
>
>
>> -----Original Message-----
>> From: Michael Walle [mailto:michael at walle.cc]
>> Sent: 31 July 2012 02:17
>> To: u-boot at lists.denx.de
>> Cc: Michael Walle; Prafulla Wadaskar
>> Subject: [PATCH] lsxl: support power switch
>>
>> This patch restores the Linkstation's original behaviour when powering
>> off.
>> Once the (soft) power switch is turned off, linux will reboot and the
>> bootloader turns off HDD and USB power. Then it loops as long as the
>> switch
>> is in the off position, before continuing the boot process again.
>>
>> Additionally, this patch fixes the board function set_led(LED_OFF).
>>
>> Signed-off-by: Michael Walle <michael@walle.cc>
>> Cc: Prafulla Wadaskar <prafulla@marvell.com>
>> ---
>> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
>> 1 files changed, 21 insertions(+), 1 deletions(-)
>>
>> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
>> index fe15511..b3f31d6 100644
>> --- a/board/buffalo/lsxl/lsxl.c
>> +++ b/board/buffalo/lsxl/lsxl.c
>> @@ -158,7 +158,7 @@ static void set_led(int state)
>> {
>> switch (state) {
>> case LED_OFF:
>> - __set_led(0, 0, 0, 0, 0, 0);
>> + __set_led(0, 0, 0, 1, 1, 1);
>> break;
>> case LED_ALARM_ON:
>> __set_led(0, 0, 0, 0, 1, 1);
>> @@ -192,6 +192,25 @@ int board_init(void)
>> }
>>
>> #ifdef CONFIG_MISC_INIT_R
>> +static void check_power_switch(void)
>> +{
>> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
>> + /* turn off HDD and USB power */
>> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
>> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
>> + set_led(LED_OFF);
>> +
>> + /* loop until released */
>> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
>> + ;
>
> Please avoid infinite loop, may you introduce timeout?
actually, thats the use case, to loop indefinitely ;) See the commit
message. The GPIO is a switch not a button. As long as it is switched to
"Power Off" uboot should loop.
>
>> +
>> + /* turn power on again */
>> + kw_gpio_set_value(GPIO_HDD_POWER, 1);
>> + kw_gpio_set_value(GPIO_USB_VBUS, 1);
>> + set_led(LED_POWER_BLINKING);
>> + }
>> +}
>> +
>> void check_enetaddr(void)
>> {
>> uchar enetaddr[6];
>> @@ -261,6 +280,7 @@ static void check_push_button(void)
>>
>> int misc_init_r(void)
>> {
>> + check_power_switch();
>> check_enetaddr();
>> check_push_button();
>
> Ack for rest of the code.
Thanks for the review.
--
michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-31 10:52 ` Michael Walle
@ 2012-07-31 11:12 ` Prafulla Wadaskar
2012-07-31 20:27 ` Michael Walle
0 siblings, 1 reply; 7+ messages in thread
From: Prafulla Wadaskar @ 2012-07-31 11:12 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: 31 July 2012 16:22
> To: Prafulla Wadaskar
> Cc: Michael Walle; u-boot at lists.denx.de
> Subject: RE: [PATCH] lsxl: support power switch
>
> On Tue, July 31, 2012 07:59, Prafulla Wadaskar wrote:
> >
> >
> >> -----Original Message-----
> >> From: Michael Walle [mailto:michael at walle.cc]
> >> Sent: 31 July 2012 02:17
> >> To: u-boot at lists.denx.de
> >> Cc: Michael Walle; Prafulla Wadaskar
> >> Subject: [PATCH] lsxl: support power switch
> >>
> >> This patch restores the Linkstation's original behaviour when
> powering
> >> off.
> >> Once the (soft) power switch is turned off, linux will reboot and
> the
> >> bootloader turns off HDD and USB power. Then it loops as long as
> the
> >> switch
> >> is in the off position, before continuing the boot process again.
> >>
> >> Additionally, this patch fixes the board function set_led(LED_OFF).
> >>
> >> Signed-off-by: Michael Walle <michael@walle.cc>
> >> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> >> ---
> >> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
> >> 1 files changed, 21 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
> >> index fe15511..b3f31d6 100644
> >> --- a/board/buffalo/lsxl/lsxl.c
> >> +++ b/board/buffalo/lsxl/lsxl.c
> >> @@ -158,7 +158,7 @@ static void set_led(int state)
> >> {
> >> switch (state) {
> >> case LED_OFF:
> >> - __set_led(0, 0, 0, 0, 0, 0);
> >> + __set_led(0, 0, 0, 1, 1, 1);
> >> break;
> >> case LED_ALARM_ON:
> >> __set_led(0, 0, 0, 0, 1, 1);
> >> @@ -192,6 +192,25 @@ int board_init(void)
> >> }
> >>
> >> #ifdef CONFIG_MISC_INIT_R
> >> +static void check_power_switch(void)
> >> +{
> >> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> >> + /* turn off HDD and USB power */
> >> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> >> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> >> + set_led(LED_OFF);
> >> +
> >> + /* loop until released */
> >> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> >> + ;
> >
> > Please avoid infinite loop, may you introduce timeout?
>
> actually, thats the use case, to loop indefinitely ;) See the commit
> message. The GPIO is a switch not a button. As long as it is switched
> to
> "Power Off" uboot should loop.
Okay got it.
Ack for this patch.
Regards...
Prafulla . . .
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-31 11:12 ` Prafulla Wadaskar
@ 2012-07-31 20:27 ` Michael Walle
2012-08-01 7:28 ` Prafulla Wadaskar
2012-09-03 9:02 ` Prafulla Wadaskar
0 siblings, 2 replies; 7+ messages in thread
From: Michael Walle @ 2012-07-31 20:27 UTC (permalink / raw)
To: u-boot
Am Dienstag 31 Juli 2012, 13:12:19 schrieb Prafulla Wadaskar:
> > -----Original Message-----
> > From: Michael Walle [mailto:michael at walle.cc]
> > Sent: 31 July 2012 16:22
> > To: Prafulla Wadaskar
> > Cc: Michael Walle; u-boot at lists.denx.de
> > Subject: RE: [PATCH] lsxl: support power switch
> >
> > On Tue, July 31, 2012 07:59, Prafulla Wadaskar wrote:
> > >> -----Original Message-----
> > >> From: Michael Walle [mailto:michael at walle.cc]
> > >> Sent: 31 July 2012 02:17
> > >> To: u-boot at lists.denx.de
> > >> Cc: Michael Walle; Prafulla Wadaskar
> > >> Subject: [PATCH] lsxl: support power switch
> > >>
> > >> This patch restores the Linkstation's original behaviour when
> >
> > powering
> >
> > >> off.
> > >> Once the (soft) power switch is turned off, linux will reboot and
> >
> > the
> >
> > >> bootloader turns off HDD and USB power. Then it loops as long as
> >
> > the
> >
> > >> switch
> > >> is in the off position, before continuing the boot process again.
> > >>
> > >> Additionally, this patch fixes the board function set_led(LED_OFF).
> > >>
> > >> Signed-off-by: Michael Walle <michael@walle.cc>
> > >> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > >> ---
> > >>
> > >> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
> > >> 1 files changed, 21 insertions(+), 1 deletions(-)
> > >>
> > >> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
> > >> index fe15511..b3f31d6 100644
> > >> --- a/board/buffalo/lsxl/lsxl.c
> > >> +++ b/board/buffalo/lsxl/lsxl.c
> > >> @@ -158,7 +158,7 @@ static void set_led(int state)
> > >>
> > >> {
> > >>
> > >> switch (state) {
> > >>
> > >> case LED_OFF:
> > >> - __set_led(0, 0, 0, 0, 0, 0);
> > >> + __set_led(0, 0, 0, 1, 1, 1);
> > >>
> > >> break;
> > >>
> > >> case LED_ALARM_ON:
> > >> __set_led(0, 0, 0, 0, 1, 1);
> > >>
> > >> @@ -192,6 +192,25 @@ int board_init(void)
> > >>
> > >> }
> > >>
> > >> #ifdef CONFIG_MISC_INIT_R
> > >>
> > >> +static void check_power_switch(void)
> > >> +{
> > >> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> > >> + /* turn off HDD and USB power */
> > >> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> > >> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> > >> + set_led(LED_OFF);
> > >> +
> > >> + /* loop until released */
> > >> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> > >> + ;
> > >
> > > Please avoid infinite loop, may you introduce timeout?
> >
> > actually, thats the use case, to loop indefinitely ;) See the commit
> > message. The GPIO is a switch not a button. As long as it is switched
> > to
> > "Power Off" uboot should loop.
>
> Okay got it.
> Ack for this patch.
ok thanks, can you apply it to your repository?
--
michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-31 20:27 ` Michael Walle
@ 2012-08-01 7:28 ` Prafulla Wadaskar
2012-09-03 9:02 ` Prafulla Wadaskar
1 sibling, 0 replies; 7+ messages in thread
From: Prafulla Wadaskar @ 2012-08-01 7:28 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: 01 August 2012 01:58
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de
> Subject: Re: [PATCH] lsxl: support power switch
>
> Am Dienstag 31 Juli 2012, 13:12:19 schrieb Prafulla Wadaskar:
> > > -----Original Message-----
> > > From: Michael Walle [mailto:michael at walle.cc]
> > > Sent: 31 July 2012 16:22
> > > To: Prafulla Wadaskar
> > > Cc: Michael Walle; u-boot at lists.denx.de
> > > Subject: RE: [PATCH] lsxl: support power switch
> > >
> > > On Tue, July 31, 2012 07:59, Prafulla Wadaskar wrote:
> > > >> -----Original Message-----
> > > >> From: Michael Walle [mailto:michael at walle.cc]
> > > >> Sent: 31 July 2012 02:17
> > > >> To: u-boot at lists.denx.de
> > > >> Cc: Michael Walle; Prafulla Wadaskar
> > > >> Subject: [PATCH] lsxl: support power switch
> > > >>
> > > >> This patch restores the Linkstation's original behaviour when
> > >
> > > powering
> > >
> > > >> off.
> > > >> Once the (soft) power switch is turned off, linux will reboot
> and
> > >
> > > the
> > >
> > > >> bootloader turns off HDD and USB power. Then it loops as long
> as
> > >
> > > the
> > >
> > > >> switch
> > > >> is in the off position, before continuing the boot process
> again.
> > > >>
> > > >> Additionally, this patch fixes the board function
> set_led(LED_OFF).
> > > >>
> > > >> Signed-off-by: Michael Walle <michael@walle.cc>
> > > >> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > > >> ---
> > > >>
> > > >> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
> > > >> 1 files changed, 21 insertions(+), 1 deletions(-)
> > > >>
> > > >> diff --git a/board/buffalo/lsxl/lsxl.c
> b/board/buffalo/lsxl/lsxl.c
> > > >> index fe15511..b3f31d6 100644
> > > >> --- a/board/buffalo/lsxl/lsxl.c
> > > >> +++ b/board/buffalo/lsxl/lsxl.c
> > > >> @@ -158,7 +158,7 @@ static void set_led(int state)
> > > >>
> > > >> {
> > > >>
> > > >> switch (state) {
> > > >>
> > > >> case LED_OFF:
> > > >> - __set_led(0, 0, 0, 0, 0, 0);
> > > >> + __set_led(0, 0, 0, 1, 1, 1);
> > > >>
> > > >> break;
> > > >>
> > > >> case LED_ALARM_ON:
> > > >> __set_led(0, 0, 0, 0, 1, 1);
> > > >>
> > > >> @@ -192,6 +192,25 @@ int board_init(void)
> > > >>
> > > >> }
> > > >>
> > > >> #ifdef CONFIG_MISC_INIT_R
> > > >>
> > > >> +static void check_power_switch(void)
> > > >> +{
> > > >> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> > > >> + /* turn off HDD and USB power */
> > > >> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> > > >> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> > > >> + set_led(LED_OFF);
> > > >> +
> > > >> + /* loop until released */
> > > >> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> > > >> + ;
> > > >
> > > > Please avoid infinite loop, may you introduce timeout?
> > >
> > > actually, thats the use case, to loop indefinitely ;) See the
> commit
> > > message. The GPIO is a switch not a button. As long as it is
> switched
> > > to
> > > "Power Off" uboot should loop.
> >
> > Okay got it.
> > Ack for this patch.
>
> ok thanks, can you apply it to your repository?
>
Sure..
Regards...
Prafulla . . .
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] lsxl: support power switch
2012-07-31 20:27 ` Michael Walle
2012-08-01 7:28 ` Prafulla Wadaskar
@ 2012-09-03 9:02 ` Prafulla Wadaskar
1 sibling, 0 replies; 7+ messages in thread
From: Prafulla Wadaskar @ 2012-09-03 9:02 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: Prafulla Wadaskar
> Sent: 01 August 2012 12:58
> To: 'Michael Walle'
> Cc: u-boot at lists.denx.de
> Subject: RE: [PATCH] lsxl: support power switch
>
>
>
> > -----Original Message-----
> > From: Michael Walle [mailto:michael at walle.cc]
> > Sent: 01 August 2012 01:58
> > To: Prafulla Wadaskar
> > Cc: u-boot at lists.denx.de
> > Subject: Re: [PATCH] lsxl: support power switch
> >
> > Am Dienstag 31 Juli 2012, 13:12:19 schrieb Prafulla Wadaskar:
> > > > -----Original Message-----
> > > > From: Michael Walle [mailto:michael at walle.cc]
> > > > Sent: 31 July 2012 16:22
> > > > To: Prafulla Wadaskar
> > > > Cc: Michael Walle; u-boot at lists.denx.de
> > > > Subject: RE: [PATCH] lsxl: support power switch
> > > >
> > > > On Tue, July 31, 2012 07:59, Prafulla Wadaskar wrote:
> > > > >> -----Original Message-----
> > > > >> From: Michael Walle [mailto:michael at walle.cc]
> > > > >> Sent: 31 July 2012 02:17
> > > > >> To: u-boot at lists.denx.de
> > > > >> Cc: Michael Walle; Prafulla Wadaskar
> > > > >> Subject: [PATCH] lsxl: support power switch
> > > > >>
> > > > >> This patch restores the Linkstation's original behaviour when
> > > >
> > > > powering
> > > >
> > > > >> off.
> > > > >> Once the (soft) power switch is turned off, linux will reboot
> > and
> > > >
> > > > the
> > > >
> > > > >> bootloader turns off HDD and USB power. Then it loops as long
> > as
> > > >
> > > > the
> > > >
> > > > >> switch
> > > > >> is in the off position, before continuing the boot process
> > again.
> > > > >>
> > > > >> Additionally, this patch fixes the board function
> > set_led(LED_OFF).
> > > > >>
> > > > >> Signed-off-by: Michael Walle <michael@walle.cc>
> > > > >> Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > > > >> ---
> > > > >>
> > > > >> board/buffalo/lsxl/lsxl.c | 22 +++++++++++++++++++++-
> > > > >> 1 files changed, 21 insertions(+), 1 deletions(-)
> > > > >>
> > > > >> diff --git a/board/buffalo/lsxl/lsxl.c
> > b/board/buffalo/lsxl/lsxl.c
> > > > >> index fe15511..b3f31d6 100644
> > > > >> --- a/board/buffalo/lsxl/lsxl.c
> > > > >> +++ b/board/buffalo/lsxl/lsxl.c
> > > > >> @@ -158,7 +158,7 @@ static void set_led(int state)
> > > > >>
> > > > >> {
> > > > >>
> > > > >> switch (state) {
> > > > >>
> > > > >> case LED_OFF:
> > > > >> - __set_led(0, 0, 0, 0, 0, 0);
> > > > >> + __set_led(0, 0, 0, 1, 1, 1);
> > > > >>
> > > > >> break;
> > > > >>
> > > > >> case LED_ALARM_ON:
> > > > >> __set_led(0, 0, 0, 0, 1, 1);
> > > > >>
> > > > >> @@ -192,6 +192,25 @@ int board_init(void)
> > > > >>
> > > > >> }
> > > > >>
> > > > >> #ifdef CONFIG_MISC_INIT_R
> > > > >>
> > > > >> +static void check_power_switch(void)
> > > > >> +{
> > > > >> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> > > > >> + /* turn off HDD and USB power */
> > > > >> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> > > > >> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> > > > >> + set_led(LED_OFF);
> > > > >> +
> > > > >> + /* loop until released */
> > > > >> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> > > > >> + ;
> > > > >
> > > > > Please avoid infinite loop, may you introduce timeout?
> > > >
> > > > actually, thats the use case, to loop indefinitely ;) See the
> > commit
> > > > message. The GPIO is a switch not a button. As long as it is
> > switched
> > > > to
> > > > "Power Off" uboot should loop.
> > >
> > > Okay got it.
> > > Ack for this patch.
> >
> > ok thanks, can you apply it to your repository?
> >
>
> Sure..
Applied to u-boot-marvell.git master branch
Regards...
Prafulla . . .
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-09-03 9:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30 20:47 [U-Boot] [PATCH] lsxl: support power switch Michael Walle
2012-07-31 5:59 ` Prafulla Wadaskar
2012-07-31 10:52 ` Michael Walle
2012-07-31 11:12 ` Prafulla Wadaskar
2012-07-31 20:27 ` Michael Walle
2012-08-01 7:28 ` Prafulla Wadaskar
2012-09-03 9:02 ` Prafulla Wadaskar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox