diff mbox

[U-Boot,1/8] kmp204x: Add support for the unit LEDs

Message ID 1398862909-17580-2-git-send-email-valentin.longchamp@keymile.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Valentin Longchamp April 30, 2014, 1:01 p.m. UTC
From: Stefan Bigler <stefan.bigler@keymile.com>

The unit LEDs are managed by the QRIO CPLD. This patch adds support for
accessing these LEDs in the QRIO.

The LEDs then are set to a correct boot state:
- UNIT-LED is red
- BOOT-LED is on.

Signed-off-by: Stefan Bigler <stefan.bigler@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---

 board/keymile/kmp204x/kmp204x.c |  3 +++
 board/keymile/kmp204x/kmp204x.h |  1 +
 board/keymile/kmp204x/qrio.c    | 14 ++++++++++++++
 3 files changed, 18 insertions(+)

Comments

York Sun April 30, 2014, 5:04 p.m. UTC | #1
On 04/30/2014 06:01 AM, Valentin Longchamp wrote:
> From: Stefan Bigler <stefan.bigler@keymile.com>

<snip>

> diff --git a/board/keymile/kmp204x/qrio.c b/board/keymile/kmp204x/qrio.c
> index 49f9aa2..11949f4 100644
> --- a/board/keymile/kmp204x/qrio.c
> +++ b/board/keymile/kmp204x/qrio.c
> @@ -144,3 +144,17 @@ void qrio_prstcfg(u8 bit, u8 mode)
>  
>  	out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
>  }
> +
> +#define CTRLH_OFF		0x02
> +#define CTRLH_WRL_BOOT		0x01
> +#define CTRLH_WRL_UNITRUN	0x02
> +
> +void qrio_set_leds(void)
> +{
> +	u8 ctrlh;
> +	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;

Please insert a blank line here.

> +	/* set UNIT LED to RED and BOOT LED to ON */
> +	ctrlh = in_8(qrio_base + CTRLH_OFF);
> +	ctrlh |= (CTRLH_WRL_BOOT | CTRLH_WRL_UNITRUN);
> +	out_8(qrio_base + CTRLH_OFF, ctrlh);
> +}
>
Valentin Longchamp May 1, 2014, 2 p.m. UTC | #2
Hi York,

On 04/30/2014 07:04 PM, York Sun wrote:
> On 04/30/2014 06:01 AM, Valentin Longchamp wrote:
>> From: Stefan Bigler <stefan.bigler@keymile.com>
> 
> <snip>
> 
>> diff --git a/board/keymile/kmp204x/qrio.c b/board/keymile/kmp204x/qrio.c
>> index 49f9aa2..11949f4 100644
>> --- a/board/keymile/kmp204x/qrio.c
>> +++ b/board/keymile/kmp204x/qrio.c
>> @@ -144,3 +144,17 @@ void qrio_prstcfg(u8 bit, u8 mode)
>>  
>>  	out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
>>  }
>> +
>> +#define CTRLH_OFF		0x02
>> +#define CTRLH_WRL_BOOT		0x01
>> +#define CTRLH_WRL_UNITRUN	0x02
>> +
>> +void qrio_set_leds(void)
>> +{
>> +	u8 ctrlh;
>> +	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
> 
> Please insert a blank line here.

OK, that's correct. Do you want me to resend the whole series or are the first 2
patches with the additional blank line OK ?

> 
>> +	/* set UNIT LED to RED and BOOT LED to ON */
>> +	ctrlh = in_8(qrio_base + CTRLH_OFF);
>> +	ctrlh |= (CTRLH_WRL_BOOT | CTRLH_WRL_UNITRUN);
>> +	out_8(qrio_base + CTRLH_OFF, ctrlh);
>> +}
>>
York Sun May 1, 2014, 3:47 p.m. UTC | #3
On 05/01/2014 07:00 AM, Valentin Longchamp wrote:
> Hi York,
> 
> On 04/30/2014 07:04 PM, York Sun wrote:
>> On 04/30/2014 06:01 AM, Valentin Longchamp wrote:
>>> From: Stefan Bigler <stefan.bigler@keymile.com>
>>
>> <snip>
>>
>>> diff --git a/board/keymile/kmp204x/qrio.c b/board/keymile/kmp204x/qrio.c
>>> index 49f9aa2..11949f4 100644
>>> --- a/board/keymile/kmp204x/qrio.c
>>> +++ b/board/keymile/kmp204x/qrio.c
>>> @@ -144,3 +144,17 @@ void qrio_prstcfg(u8 bit, u8 mode)
>>>  
>>>  	out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
>>>  }
>>> +
>>> +#define CTRLH_OFF		0x02
>>> +#define CTRLH_WRL_BOOT		0x01
>>> +#define CTRLH_WRL_UNITRUN	0x02
>>> +
>>> +void qrio_set_leds(void)
>>> +{
>>> +	u8 ctrlh;
>>> +	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
>>
>> Please insert a blank line here.
> 
> OK, that's correct. Do you want me to resend the whole series or are the first 2
> patches with the additional blank line OK ?
> 

For a simple change like this, you can do either way. Make sure to change the
subject prefix so it doesn't confuse me or anyone.

York
diff mbox

Patch

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 95a19cd..5fceedd 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -113,6 +113,9 @@  int board_early_init_r(void)
 	if (ret)
 		printf("error triggering PCIe FPGA config\n");
 
+	/* enable the Unit LED (red) & Boot LED (on) */
+	qrio_set_leds();
+
 	return ret;
 }
 
diff --git a/board/keymile/kmp204x/kmp204x.h b/board/keymile/kmp204x/kmp204x.h
index 0267596..34de27e 100644
--- a/board/keymile/kmp204x/kmp204x.h
+++ b/board/keymile/kmp204x/kmp204x.h
@@ -21,5 +21,6 @@  void qrio_gpio_direction_input(u8 port_off, u8 gpio_nr);
 
 void qrio_prst(u8 bit, bool en, bool wden);
 void qrio_prstcfg(u8 bit, u8 mode);
+void qrio_set_leds(void);
 
 void pci_of_setup(void *blob, bd_t *bd);
diff --git a/board/keymile/kmp204x/qrio.c b/board/keymile/kmp204x/qrio.c
index 49f9aa2..11949f4 100644
--- a/board/keymile/kmp204x/qrio.c
+++ b/board/keymile/kmp204x/qrio.c
@@ -144,3 +144,17 @@  void qrio_prstcfg(u8 bit, u8 mode)
 
 	out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
 }
+
+#define CTRLH_OFF		0x02
+#define CTRLH_WRL_BOOT		0x01
+#define CTRLH_WRL_UNITRUN	0x02
+
+void qrio_set_leds(void)
+{
+	u8 ctrlh;
+	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+	/* set UNIT LED to RED and BOOT LED to ON */
+	ctrlh = in_8(qrio_base + CTRLH_OFF);
+	ctrlh |= (CTRLH_WRL_BOOT | CTRLH_WRL_UNITRUN);
+	out_8(qrio_base + CTRLH_OFF, ctrlh);
+}