diff mbox

[2/3] ARM64: dts: amlogic: add Hardkernel ODROID-C2

Message ID 1458758013-11890-2-git-send-email-khilman@baylibre.com
State New
Headers show

Commit Message

Kevin Hilman March 23, 2016, 6:33 p.m. UTC
Add minimal DT files for the Hardkernel ODROID-C2 board based on the
Amlogic S905/GXBB SoC.

Used the other gxbb boards from Andreas Färber as a starting point.

Cc: Andreas Färber <afaerber@suse.de>
Cc: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
 arch/arm64/boot/dts/amlogic/Makefile               |  1 +
 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 65 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts

Comments

Arnd Bergmann March 24, 2016, 12:58 p.m. UTC | #1
On Wednesday 23 March 2016 11:33:32 Kevin Hilman wrote:
> +/ {
> +       compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
> +       model = "Hardkernel ODROID-C2";
> +       
> +       chosen {
> +               stdout-path = "serial0:115200n8";
> +       };
> +
> +       memory@0 {
> +               device_type = "memory";
> +               reg = <0x0 0x0 0x0 0x80000000>;
> +       };
> +};
> +
> +&uart_AO {
> +       status = "okay";
> +};
> 

Shouldn't this also add the serial0 alias?

It seems that the .dtsi file accidentally sets an alias to a disabled
device, which isn't really valid. Can you fix that when adding the
.dts?

	Arnd
Andreas Färber March 24, 2016, 4:57 p.m. UTC | #2
Am 24.03.2016 um 13:58 schrieb Arnd Bergmann:
> On Wednesday 23 March 2016 11:33:32 Kevin Hilman wrote:
>> +/ {
>> +       compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
>> +       model = "Hardkernel ODROID-C2";
>> +       
>> +       chosen {
>> +               stdout-path = "serial0:115200n8";
>> +       };
>> +
>> +       memory@0 {
>> +               device_type = "memory";
>> +               reg = <0x0 0x0 0x0 0x80000000>;
>> +       };
>> +};
>> +
>> +&uart_AO {
>> +       status = "okay";
>> +};
>>
> 
> Shouldn't this also add the serial0 alias?
> 
> It seems that the .dtsi file accidentally sets an alias to a disabled
> device, which isn't really valid. Can you fix that when adding the
> .dts?

Hm, would it be any better to not disable either of the serials and
leave the aliases in the .dtsi?

Regards,
Andreas
Kevin Hilman March 24, 2016, 5:16 p.m. UTC | #3
On Thu, Mar 24, 2016 at 9:57 AM, Andreas Färber <afaerber@suse.de> wrote:
>
> Am 24.03.2016 um 13:58 schrieb Arnd Bergmann:
> > On Wednesday 23 March 2016 11:33:32 Kevin Hilman wrote:
> >> +/ {
> >> +       compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
> >> +       model = "Hardkernel ODROID-C2";
> >> +
> >> +       chosen {
> >> +               stdout-path = "serial0:115200n8";
> >> +       };
> >> +
> >> +       memory@0 {
> >> +               device_type = "memory";
> >> +               reg = <0x0 0x0 0x0 0x80000000>;
> >> +       };
> >> +};
> >> +
> >> +&uart_AO {
> >> +       status = "okay";
> >> +};
> >>
> >
> > Shouldn't this also add the serial0 alias?
> >
> > It seems that the .dtsi file accidentally sets an alias to a disabled
> > device, which isn't really valid. Can you fix that when adding the
> > .dts?
>
> Hm, would it be any better to not disable either of the serials and
> leave the aliases in the .dtsi?

I'm going to respin, moving the aliases that are actually into the
.dts that use them, and dropping the unused/disabled serial1.

Kevin
Andreas Färber March 24, 2016, 5:26 p.m. UTC | #4
Am 24.03.2016 um 18:16 schrieb Kevin Hilman:
> On Thu, Mar 24, 2016 at 9:57 AM, Andreas Färber <afaerber@suse.de> wrote:
>> Am 24.03.2016 um 13:58 schrieb Arnd Bergmann:
>>> On Wednesday 23 March 2016 11:33:32 Kevin Hilman wrote:
>>>> +/ {
>>>> +       compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
>>>> +       model = "Hardkernel ODROID-C2";
>>>> +
>>>> +       chosen {
>>>> +               stdout-path = "serial0:115200n8";
>>>> +       };
>>>> +
>>>> +       memory@0 {
>>>> +               device_type = "memory";
>>>> +               reg = <0x0 0x0 0x0 0x80000000>;
>>>> +       };
>>>> +};
>>>> +
>>>> +&uart_AO {
>>>> +       status = "okay";
>>>> +};
>>>>
>>>
>>> Shouldn't this also add the serial0 alias?
>>>
>>> It seems that the .dtsi file accidentally sets an alias to a disabled
>>> device, which isn't really valid. Can you fix that when adding the
>>> .dts?
>>
>> Hm, would it be any better to not disable either of the serials and
>> leave the aliases in the .dtsi?
> 
> I'm going to respin, moving the aliases that are actually into the
> .dts that use them, and dropping the unused/disabled serial1.

Carlo and me both agreed to that approach.

However @Arnd, I still don't understand how an alias to a disabled
device hurts? It was not accidental on my part. And I'm pretty sure on
my PowerMac's OpenFirmware I had aliases to disk devices not connected.

Using an alias to a disabled device should be no different from using
the full path to a disabled device. We don't prevent the latter, so why
the former?

If the serial node is disabled, the meson_uart driver won't probe and
won't look up its alias. Who else uses it apart from stdout-path?

The order was intentionally always AO (always-on) bus first, and there
are just two UARTs I'm aware of.

Regards,
Andreas
Arnd Bergmann March 24, 2016, 7:53 p.m. UTC | #5
On Thursday 24 March 2016 18:26:18 Andreas Färber wrote:
> 
> However @Arnd, I still don't understand how an alias to a disabled
> device hurts? It was not accidental on my part. And I'm pretty sure on
> my PowerMac's OpenFirmware I had aliases to disk devices not connected.
> 
> Using an alias to a disabled device should be no different from using
> the full path to a disabled device. We don't prevent the latter, so why
> the former?
> 
> If the serial node is disabled, the meson_uart driver won't probe and
> won't look up its alias. Who else uses it apart from stdout-path?
> 
> The order was intentionally always AO (always-on) bus first, and there
> are just two UARTs I'm aware of.

The aliases are supposed to reflect the numbering that is used on
the board, and in most cases the SoC supports more UARTS than
the board does, and not every board uses the same ones, so it's
easier to always define the serial aliases in the .dts file and
only list the ones that are actually wired up on the board.

With the disks in your example, the aliases would reflect the
number of the connector, whether there is something on it or not,
so that makes a lot of sense too.

	Arnd
diff mbox

Patch

diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index eb672f38f89e..a595752459e8 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -1,3 +1,4 @@ 
+dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-odroidc2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-pro.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-meta.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-telos.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
new file mode 100644
index 000000000000..b229dbc985a3
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -0,0 +1,65 @@ 
+/*
+ * Copyright (c) 2016 Andreas Färber
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Kevin Hilman <khilman@kernel.org>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This library is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb.dtsi"
+
+/ {
+	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
+	model = "Hardkernel ODROID-C2";
+	
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x80000000>;
+	};
+};
+
+&uart_AO {
+	status = "okay";
+};