[1/2] arm64: juno: Add APB registers and LEDs using syscon

Message ID 1424866589-2988-1-git-send-email-linus.walleij@linaro.org
State New
Headers show

Commit Message

Linus Walleij Feb. 25, 2015, 12:16 p.m.
This defines the Juno "APB system registers" as a syscon device,
and all the LEDs controlled by the APB system registers right
below it using the syscon LEDs driver on top of syscon. Define
LED0 for heartbeat, LED1 for MMC0 activity and the following
four LEDs indicating CPU activity using the Linux-specific
DT bindings for triggers.

This is the pattern and same drivers as used on the legacy
platform device trees for the ARM Integrators and the RealView
PB1176.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm64/boot/dts/arm/juno-motherboard.dtsi | 68 +++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

Comments

Linus Walleij Feb. 27, 2015, 1:07 p.m. | #1
On Wed, Feb 25, 2015 at 4:11 PM, Liviu Dudau <Liviu.Dudau@arm.com> wrote:
> On Wed, Feb 25, 2015 at 03:00:23PM +0000, Will Deacon wrote:
>> On Wed, Feb 25, 2015 at 02:47:56PM +0000, Liviu Dudau wrote:
>> > On Wed, Feb 25, 2015 at 01:55:12PM +0000, Will Deacon wrote:
>> > > On Wed, Feb 25, 2015 at 12:16:29PM +0000, Linus Walleij wrote:
>> > > > This defines the Juno "APB system registers" as a syscon device,
>> > > > and all the LEDs controlled by the APB system registers right
>> > > > below it using the syscon LEDs driver on top of syscon. Define
>> > > > LED0 for heartbeat, LED1 for MMC0 activity and the following
>> > > > four LEDs indicating CPU activity using the Linux-specific
>> > > > DT bindings for triggers.
>> > > >
>> > > > This is the pattern and same drivers as used on the legacy
>> > > > platform device trees for the ARM Integrators and the RealView
>> > > > PB1176.
>> > >
>> > > Stupid question, but where are these LEDs located on the platform? I tried
>> > > enabling this, but all it seemed to do was make hackbench slightly slower :)
>> >
>> > http://infocenter.arm.com/help/topic/com.arm.doc.ddi0524c/deb1353593789871.html
>> >
>> > Section 1.3, look at the left hand side, above the user push buttons.
>>
>> Right, so these LEDs are *inside* the case. Is that really something worth
>> enabling for defconfig?
>
> Depends on the case :) You might have a nice cutout in the plastic of the VExpress
> box, or have your own custom acrylic box.

Of course I take off the lid, who doesn't want to see the nice electronics.
This is analogous to using some other naked ARM reference design
like the Versatile or the RealView PB1176 where you can just put your
fingers on the board if you like.

> Maybe Linus can explain to us why he thinks this functionality is useful given
> that quite a lot of people tend to use the Juno boards inside the original boxes
> for fear of ESD accidents.

Wut? Ask the guy who designed the box.

Notice that the SD card slot is *ALSO* inside the box, do you mean we
should then also delete the uSD card support added in
commit 71f867ec130e3cc8e692366fdf8941ded27c727e
by yourself because the SD card slot is not reachable?
Notice that to access that card slot you even have to remove the
nice blue ARM boilerplate.

The board is obviously designed to be reachable and the top part
of the case is obviously designed to be taken off by professional
users.

Yours,
Linus Walleij
Linus Walleij March 7, 2015, 10:24 p.m. | #2
On Fri, Feb 27, 2015 at 3:06 PM, Liviu Dudau <Liviu.Dudau@arm.com> wrote:
> On Fri, Feb 27, 2015 at 01:07:42PM +0000, Linus Walleij wrote:

>> Notice that the SD card slot is *ALSO* inside the box, do you mean we
>> should then also delete the uSD card support added in
>> commit 71f867ec130e3cc8e692366fdf8941ded27c727e
>> by yourself because the SD card slot is not reachable?
>> Notice that to access that card slot you even have to remove the
>> nice blue ARM boilerplate.
>
> That's not my view. I have a mobile phone with an uSD card slot, but I have to take
> the cover off (and the battery) to access it. It doesn't mean I should not be able
> to use it from kernel side because of that, only that the designer of the phone
> (and of the Juno board + box by extension) did not expect people to use it with
> covers off all the time.
>
> <virtual-tongue-in-cheek-on>
> I fail to see why you need to remove the SD card all the time. Surely opening
> the case once to put the uSD card in is enough? ;)
> </virtual-tongue-in-cheek-on>
>
>>
>> The board is obviously designed to be reachable and the top part
>> of the case is obviously designed to be taken off by professional
>> users.
>
> I'm mostly on your side, Linus, I was just looking for more use cases. Like I've said,
> most of our customers seem to keep the case closed (or at least that is what they tell
> us :) ) so I'm looking for explanations on how you use the LEDs (visual debugging for
> big-LITTLE was how Lorenzo was using them on TC2 for example).

OK now I feel bad and maybe I was not in such a good mood that day.

The LEDs I added are really useful on the other ARM reference designs,
the heartbeat gives a sign that the system is alive even if your console is
not working and that's what I appreaciate a lot about it (the
heartbeat intensity
also indicates system load).

The MMC read/write LED is as useful as the hard disk activity LED on
some older PCs, kinda nice if you want to know something is going on.

The rest of the LEDs show which CPU cores are active. This was the
original use of the LEDs on the RealView PB11MPcore and it was
appreciated by the multicore developers who could see the different
CPUs being busy with tasks.

LEDs on development boards are real nice, simply, and I think also
some deployed ARM64 server systems will have them.

Yours,
Linus Walleij
Jon Medhurst (Tixy) March 9, 2015, 4:17 p.m. | #3
On Mon, 2015-03-09 at 10:31 +0000, Sudeep Holla wrote:
> 
> On 27/02/15 14:06, Liviu Dudau wrote:
> > On Fri, Feb 27, 2015 at 01:07:42PM +0000, Linus Walleij wrote:
> >> On Wed, Feb 25, 2015 at 4:11 PM, Liviu Dudau <Liviu.Dudau@arm.com> wrote:
> 
> [...]
> 
> > I'm mostly on your side, Linus, I was just looking for more use cases. Like I've said,
> > most of our customers seem to keep the case closed (or at least that is what they tell
> > us :) ) so I'm looking for explanations on how you use the LEDs (visual debugging for
> > big-LITTLE was how Lorenzo was using them on TC2 for example).
> >
> 
> Just to clarify:
> 
> IIUC all VExpress platforms has these LEDs on the motherboard. The one
> you are referring is on the TC2 core-tile which are completely
> controlled by the firmware. The main advantage of that was to know if
> the OSPM request is accepted by the firmware.
> 
> But the LEDs being referred here are under OS control and gives only the
> OS view of the state which is good enough but not exactly what we had on
> TC2.

Well, when a TC2 CoreTile is plugged into the Versatile Express
motherboard you get those LEDs as well and can see what the OS thinks is
the state of the CPU's. I've found this useful in the past for debugging
problems caused by a mismatch between the OS's and firmware's view of
the world.

Patch

diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi
index c138b95a8356..08d32d6dd955 100644
--- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi
+++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi
@@ -66,6 +66,74 @@ 
 				#size-cells = <1>;
 				ranges = <0 3 0 0x200000>;
 
+				apbregs@010000 {
+					compatible = "syscon";
+					reg = <0x010000 0x1000>;
+
+					led@08.0 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x01>;
+						label = "vexpress:0";
+						linux,default-trigger = "heartbeat";
+						default-state = "on";
+					};
+					led@08.1 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x02>;
+						label = "vexpress:1";
+						linux,default-trigger = "mmc0";
+						default-state = "off";
+					};
+					led@08.2 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x04>;
+						label = "vexpress:2";
+						linux,default-trigger = "cpu0";
+						default-state = "off";
+					};
+					led@08.3 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x08>;
+						label = "vexpress:3";
+						linux,default-trigger = "cpu1";
+						default-state = "off";
+					};
+					led@08.4 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x10>;
+						label = "vexpress:4";
+						linux,default-trigger = "cpu2";
+						default-state = "off";
+					};
+					led@08.5 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x20>;
+						label = "vexpress:5";
+						linux,default-trigger = "cpu3";
+						default-state = "off";
+					};
+					led@08.6 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x40>;
+						label = "vexpress:6";
+						default-state = "off";
+					};
+					led@08.7 {
+						compatible = "register-bit-led";
+						offset = <0x08>;
+						mask = <0x80>;
+						label = "vexpress:7";
+						default-state = "off";
+					};
+				};
+
 				mmci@050000 {
 					compatible = "arm,pl180", "arm,primecell";
 					reg = <0x050000 0x1000>;