2022-06-28 13:37:37

by Ash Logan

[permalink] [raw]
Subject: [PATCH v3 02/12] powerpc: wiiu: device tree

Add a device tree source file for the Nintendo Wii U video game console.

Signed-off-by: Ash Logan <[email protected]>
Co-developed-by: Roberto Van Eeden <[email protected]>
Signed-off-by: Roberto Van Eeden <[email protected]>
Co-developed-by: Emmanuel Gil Peyrot <[email protected]>
Signed-off-by: Emmanuel Gil Peyrot <[email protected]>
---
v1->v2: Style and formatting changes suggested by Rob Herring.
License remains GPL-2.0 as the other powerpc dtses are the same, happy
to change if there is a different preferred default.
v2->v3: Re-added address-cells accidentally removed in v2.
Marked latte as a simple-bus, since it is.

arch/powerpc/boot/dts/wiiu.dts | 326 +++++++++++++++++++++++++++++++++
1 file changed, 326 insertions(+)
create mode 100644 arch/powerpc/boot/dts/wiiu.dts

diff --git a/arch/powerpc/boot/dts/wiiu.dts b/arch/powerpc/boot/dts/wiiu.dts
new file mode 100644
index 000000000000..44a5a1469095
--- /dev/null
+++ b/arch/powerpc/boot/dts/wiiu.dts
@@ -0,0 +1,326 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Nintendo Wii U Device Tree Source
+ *
+ * Copyright (C) 2022 The linux-wiiu Team
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ model = "nintendo,wiiu";
+ compatible = "nintendo,wiiu";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ chosen {
+ bootargs = "root=/dev/sda1 rootwait";
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x00000000 0x02000000 /* MEM1 - 32MiB */
+ 0x08000000 0x00300000 /* MEM0 - 3MiB */
+ 0x10000000 0x80000000>; /* MEM2 - 2GiB */
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* TODO: Add SMP */
+ PowerPC,espresso@0 {
+ device_type = "cpu";
+ reg = <0>;
+ clock-frequency = <1243125000>; /* 1.243125GHz */
+ bus-frequency = <248625000>; /* 248.625MHz core-to-bus 5x */
+ timebase-frequency = <62156250>; /* 1/4 of the bus clock */
+ i-cache-size = <32768>; /* 32K icache */
+ i-cache-line-size = <32>;
+ i-cache-block-size = <32>;
+ i-cache-sets = <128>;
+ d-cache-size = <32768>; /* 32K dcache */
+ d-cache-line-size = <32>;
+ d-cache-block-size = <32>;
+ d-cache-sets = <128>;
+ next-level-cache = <&L2_0>;
+ L2_0:l2-cache {
+ compatible = "cache";
+ cache-level = <2>;
+ cache-unified;
+ cache-size = <0x80000>; /* 512KB L2 */
+ cache-line-size = <64>;
+ cache-block-size = <32>;
+ cache-sets = <2048>;
+ };
+ };
+ };
+
+ latte {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "nintendo,latte", "simple-bus";
+ ranges = <0x0c000000 0x0c000000 0x00400000 /* Espresso-only registers */
+ 0x0d000000 0x0d000000 0x00200000 /* Latte AHB deivces */
+ 0x0d800000 0x0d800000 0x00800000>; /* Latte SoC registers */
+
+ latte_gpu: gpu@c200000 {
+ compatible = "nintendo,latte-gpu7";
+ reg = <0x0c200000 0x80000>;
+ interrupts = <2>;
+ interrupt-parent = <&espresso_pic>;
+ };
+
+ espresso_pic: pic@c000078 {
+ #interrupt-cells = <1>;
+ interrupt-controller;
+
+ compatible = "nintendo,espresso-pic";
+ reg = <0x0c000078 0x18>;
+ };
+
+ latte_dsp: dsp@c005000 {
+ compatible = "nintendo,latte-dsp";
+ reg = <0x0c005000 0x200>;
+ };
+
+ ehci_0: usb@d040000 {
+ compatible = "nintendo,latte-usb-ehci", "usb-ehci";
+ reg = <0x0d040000 0x100>;
+ interrupts = <4>;
+ interrupt-parent = <&latte_pic>;
+ big-endian-regs;
+ };
+
+ ohci_0_0: usb@d050000 {
+ compatible = "nintendo,latte-usb-ohci";
+ reg = <0x0d050000 0x100>;
+ interrupts = <5>;
+ interrupt-parent = <&latte_pic>;
+
+ big-endian-regs;
+ };
+
+ ohci_0_1: usb@d060000 {
+ compatible = "nintendo,latte-usb-ohci";
+ reg = <0x0d060000 0x100>;
+ interrupts = <6>;
+ interrupt-parent = <&latte_pic>;
+
+ big-endian-regs;
+ };
+
+ ehci_1: usb@d120000 {
+ compatible = "nintendo,latte-usb-ehci", "usb-ehci";
+ reg = <0x0d120000 0x100>;
+ interrupts = <16>;
+ interrupt-parent = <&latte_pic>;
+ big-endian-regs;
+ };
+
+ ohci_1_0: usb@d130000 {
+ compatible = "nintendo,latte-usb-ohci";
+ reg = <0x0d130000 0x100>;
+ interrupts = <35>;
+ interrupt-parent = <&latte_pic>;
+
+ big-endian-regs;
+ };
+
+ ehci_2: usb@d140000 {
+ compatible = "nintendo,latte-usb-ehci", "usb-ehci";
+ reg = <0x0d140000 0x100>;
+ interrupts = <36>;
+ interrupt-parent = <&latte_pic>;
+ big-endian-regs;
+ };
+
+ ohci_2_0: usb@d150000 {
+ compatible = "nintendo,latte-usb-ohci";
+ reg = <0x0d150000 0x100>;
+ interrupts = <37>;
+ interrupt-parent = <&latte_pic>;
+
+ big-endian-regs;
+ };
+
+ sdcard_0: sdhci@d070000 {
+ compatible = "nintendo,latte-sdhci","sdhci";
+ reg = <0x0d070000 0x200>;
+ interrupts = <7>;
+ interrupt-parent = <&latte_pic>;
+ };
+
+ wifi_0: sdhci@d080000 {
+ compatible = "nintendo,latte-sdhci","sdhci";
+ reg = <0x0d080000 0x200>;
+ interrupts = <8>;
+ interrupt-parent = <&latte_pic>;
+ };
+
+ legacy_ipc: ipc@d800000 {
+ compatible = "nintendo,latte-ipc", "nintendo,hollywood-ipc";
+ reg = <0x0d800000 0x10>;
+ interrupts = <30 31>;
+ interrupt-parent = <&latte_pic>;
+ };
+
+ latte_otp: otp@d8001ec {
+ compatible = "nintendo,latte-otp";
+ reg = <0x0d8001ec 0x8>;
+ };
+
+ sata: ahci@d160400 {
+ compatible = "nintendo,latte-ahci";
+ reg = <0x0d160400 0x808>;
+
+ interrupt-parent = <&latte_pic>;
+ interrupts = <38 28>;
+ };
+
+ latte_pic: pic@d800440 {
+ #interrupt-cells = <1>;
+ interrupt-controller;
+
+ compatible = "nintendo,latte-pic";
+ reg = <0x0d800440 0x30>;
+ interrupt-parent = <&espresso_pic>;
+ interrupts = <24>;
+ };
+
+ gpio: gpio@d8000c0 {
+ #gpio-cells = <2>;
+ compatible = "nintendo,latte-gpio", "nintendo,hollywood-gpio";
+
+ reg = <0x0d8000c0 0x40>;
+ gpio-controller;
+ /* TODO: There are actually 31 AHBALL GPIOs */
+ ngpios = <24>;
+
+ gpio-line-names =
+ "POWER", "DWIFI", "FAN", "DC_DC",
+ "", "Esp10WorkAround", "", "",
+ "PADPD", "", "EEP_CS", "EEP_CLK",
+ "EEP_MOSI", "EEP_MISO", "AVE_SCL", "AVE_SDA",
+ "DEBUG0", "DEBUG1", "DEBUG2", "DEBUG3",
+ "DEBUG4", "DEBUG5", "DEBUG6", "DEBUG7";
+
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ interrupts = <10>;
+ interrupt-parent = <&latte_pic>;
+ };
+
+ gpio2: gpio@d800520 {
+ #gpio-cells = <2>;
+ compatible = "nintendo,latte-gpio", "nintendo,hollywood-gpio";
+
+ reg = <0x0d800520 0x40>;
+ gpio-controller;
+ ngpios = <7>;
+
+ gpio-line-names =
+ "FANSPEED", "SMC_SCL", "SMC_SDA", "DC_DC2",
+ "AVE_INT", "", "AVE_RESET";
+
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ interrupts = <10>;
+ interrupt-parent = <&latte_pic>;
+ };
+ };
+
+ spi_gpio: spi-gpio {
+ compatible = "spi-gpio";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cs-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
+ gpio-sck = <&gpio 11 GPIO_ACTIVE_HIGH>;
+ gpio-mosi = <&gpio 12 GPIO_ACTIVE_HIGH>;
+ gpio-miso = <&gpio 13 GPIO_ACTIVE_HIGH>;
+ num-chipselects = <1>;
+
+ eeprom@0 {
+ compatible = "atmel,at93c66";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ spi-cs-high;
+ /* TODO: wiiubrew says this is 16-bit, but I only get the correct
+ * values in 8-bit...
+ */
+ data-size = <8>;
+ read-only;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* https://wiiubrew.org/wiki/Hardware/SEEPROM */
+ rng_seed: rng@12 { reg = <0x012 8>; };
+ ppc_pvr: pvr@20 { reg = <0x020 4>; };
+ seeprom_ver_str: sver-str@24 { reg = <0x024 6>; };
+ seeprom_ver: sver@2a { reg = <0x02A 2>; };
+ otp_ver: over@2c { reg = <0x02C 2>; };
+ otp_rev: orev@2e { reg = <0x02E 2>; };
+ otp_ver_str: over-str@30 { reg = <0x030 8>; };
+
+ bc_crc: bc-crc@38 { reg = <0x038 4>; };
+ bc_sz: bc-sz@3c { reg = <0x03C 2>; };
+ bc_ver: bc-ver@3e { reg = <0x03E 2>; };
+ bc_boardtype: boardtype@42 { reg = <0x042 2>; };
+ bc_boardrev: boardrev@44 { reg = <0x044 2>; };
+ bc_bootsource: bootsource@46 { reg = <0x046 2>; };
+ bc_ddr3size: ddr3size@48 { reg = <0x048 2>; };
+ bc_ddr3speed: ddr3speed@4a { reg = <0x04A 2>; };
+ bc_ppcclockmul: ppcclockmul@4c { reg = <0x04C 2>; };
+ bc_iopclockmul: iopclockmul@46 { reg = <0x04E 2>; };
+ bc_video1080p: video1080p@50 { reg = <0x050 2>; };
+ bc_ddr3vendor: ddr3vendor@52 { reg = <0x052 2>; };
+ bc_movpassivereset: movpassivereset@54 { reg = <0x054 2>; };
+ bc_syspllspd: syspllspd@56 { reg = <0x056 2>; };
+ bc_satadevice: satadevice@58 { reg = <0x058 2>; };
+ bc_consoletype: consoletype@5a { reg = <0x05A 2>; };
+ bc_deviceprescence: deviceprescence@5c { reg = <0x05C 2>; };
+
+ drive_key: drvkey@80 { reg = <0x080 16>; };
+ factory_key: fackey@90 { reg = <0x090 16>; };
+ shdd_key: shddkey@a0 { reg = <0x0A0 16>; };
+ usb_key_seed: usbkeyseed@b0 { reg = <0x0B0 16>; };
+ drive_key_flag: drvkeyf@c0 { reg = <0x0C0 2>; };
+ usb_key_flag: udbkeyf@c2 { reg = <0x0C2 2>; };
+ shdd_key_flag: shddkeyf@c4 { reg = <0x0C4 2>; };
+
+ sysprod_version: sp_ver@140 { reg = <0x140 4>; };
+ sysprod_eeprom_version: sp_ee_ver@144 { reg = <0x144 4>; };
+ sysprod_product_area: sp_parea@148 { reg = <0x148 4>; };
+ sysprod_game_region: sp_region@14c { reg = <0x14C 4>; };
+ sysprod_ntsc_pal: sp_ntscpal@150 { reg = <0x150 4>; };
+ sysprod_5ghz_country: sp_5ghz_c@154 { reg = <0x154 2>; };
+ sysprod_5ghz_country_rev: sp_5ghz_crev@156 { reg = <0x156 2>; };
+ sysprod_code: sp_code@158 { reg = <0x158 8>; };
+ sysprod_serial: sp_serial@160 { reg = <0x160 16>; };
+ sysprod_model: sp_model@170 { reg = <0x170 16>; };
+
+ prod_year: pyear@188 { reg = <0x188 2>; };
+ prod_date: pdate@18a { reg = <0x18A 2>; };
+ prod_time: ptime@18c { reg = <0x18C 2>; };
+
+ boot_params: boot_params@1c0 { reg = <0x1C0 48>; };
+ };
+ };
+
+ /* TODO make this gpio-keyed once hollywood-gpio supports interrupts */
+ gpio-keys-polled {
+ poll-interval = <50>;
+ compatible = "gpio-keys-polled";
+
+ power {
+ label = "Power Button";
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_POWER>;
+ };
+ };
+};
--
2.36.1


2022-06-29 10:25:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 02/12] powerpc: wiiu: device tree

On 28/06/2022 15:31, Ash Logan wrote:
> Add a device tree source file for the Nintendo Wii U video game console.
>
> Signed-off-by: Ash Logan <[email protected]>
> Co-developed-by: Roberto Van Eeden <[email protected]>
> Signed-off-by: Roberto Van Eeden <[email protected]>
> Co-developed-by: Emmanuel Gil Peyrot <[email protected]>
> Signed-off-by: Emmanuel Gil Peyrot <[email protected]>
> ---
> v1->v2: Style and formatting changes suggested by Rob Herring.
> License remains GPL-2.0 as the other powerpc dtses are the same, happy
> to change if there is a different preferred default.
> v2->v3: Re-added address-cells accidentally removed in v2.
> Marked latte as a simple-bus, since it is.

Thank you for your patch. There is something to discuss/improve.

>
> arch/powerpc/boot/dts/wiiu.dts | 326 +++++++++++++++++++++++++++++++++
> 1 file changed, 326 insertions(+)
> create mode 100644 arch/powerpc/boot/dts/wiiu.dts
>
> diff --git a/arch/powerpc/boot/dts/wiiu.dts b/arch/powerpc/boot/dts/wiiu.dts
> new file mode 100644
> index 000000000000..44a5a1469095
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/wiiu.dts
> @@ -0,0 +1,326 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Nintendo Wii U Device Tree Source
> + *
> + * Copyright (C) 2022 The linux-wiiu Team
> + */
> +
> +/dts-v1/;
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> + model = "nintendo,wiiu";

It's not compatible, but user-visible string, e.g. "Nintendo Wii U"

> + compatible = "nintendo,wiiu";
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + chosen {
> + bootargs = "root=/dev/sda1 rootwait";

This does not belong to shared DTS. No bootargs.

> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <0x00000000 0x02000000 /* MEM1 - 32MiB */
> + 0x08000000 0x00300000 /* MEM0 - 3MiB */
> + 0x10000000 0x80000000>; /* MEM2 - 2GiB */
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + /* TODO: Add SMP */
> + PowerPC,espresso@0 {

Node name should be generic, so "cpu". Unless something needs the
specific node name?

> + device_type = "cpu";
> + reg = <0>;
> + clock-frequency = <1243125000>; /* 1.243125GHz */
> + bus-frequency = <248625000>; /* 248.625MHz core-to-bus 5x */
> + timebase-frequency = <62156250>; /* 1/4 of the bus clock */
> + i-cache-size = <32768>; /* 32K icache */
> + i-cache-line-size = <32>;
> + i-cache-block-size = <32>;
> + i-cache-sets = <128>;
> + d-cache-size = <32768>; /* 32K dcache */
> + d-cache-line-size = <32>;
> + d-cache-block-size = <32>;
> + d-cache-sets = <128>;
> + next-level-cache = <&L2_0>;
> + L2_0:l2-cache {
> + compatible = "cache";
> + cache-level = <2>;
> + cache-unified;
> + cache-size = <0x80000>; /* 512KB L2 */
> + cache-line-size = <64>;
> + cache-block-size = <32>;
> + cache-sets = <2048>;
> + };
> + };
> + };
> +
> + latte {

Generic node names.

> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "nintendo,latte", "simple-bus";
> + ranges = <0x0c000000 0x0c000000 0x00400000 /* Espresso-only registers */
> + 0x0d000000 0x0d000000 0x00200000 /* Latte AHB deivces */
> + 0x0d800000 0x0d800000 0x00800000>; /* Latte SoC registers */
> +
> + latte_gpu: gpu@c200000 {
> + compatible = "nintendo,latte-gpu7";
> + reg = <0x0c200000 0x80000>;
> + interrupts = <2>;
> + interrupt-parent = <&espresso_pic>;
> + };
> +
> + espresso_pic: pic@c000078 {

interrupt-controller

> + #interrupt-cells = <1>;
> + interrupt-controller;
> +
> + compatible = "nintendo,espresso-pic";
> + reg = <0x0c000078 0x18>;
> + };
> +
> + latte_dsp: dsp@c005000 {
> + compatible = "nintendo,latte-dsp";
> + reg = <0x0c005000 0x200>;
> + };
> +
> + ehci_0: usb@d040000 {
> + compatible = "nintendo,latte-usb-ehci", "usb-ehci";
> + reg = <0x0d040000 0x100>;
> + interrupts = <4>;
> + interrupt-parent = <&latte_pic>;
> + big-endian-regs;
> + };
> +
> + ohci_0_0: usb@d050000 {
> + compatible = "nintendo,latte-usb-ohci";
> + reg = <0x0d050000 0x100>;
> + interrupts = <5>;
> + interrupt-parent = <&latte_pic>;
> +
> + big-endian-regs;
> + };
> +
> + ohci_0_1: usb@d060000 {
> + compatible = "nintendo,latte-usb-ohci";
> + reg = <0x0d060000 0x100>;
> + interrupts = <6>;
> + interrupt-parent = <&latte_pic>;
> +
> + big-endian-regs;
> + };
> +
> + ehci_1: usb@d120000 {
> + compatible = "nintendo,latte-usb-ehci", "usb-ehci";
> + reg = <0x0d120000 0x100>;
> + interrupts = <16>;
> + interrupt-parent = <&latte_pic>;
> + big-endian-regs;
> + };
> +
> + ohci_1_0: usb@d130000 {
> + compatible = "nintendo,latte-usb-ohci";
> + reg = <0x0d130000 0x100>;
> + interrupts = <35>;
> + interrupt-parent = <&latte_pic>;
> +
> + big-endian-regs;
> + };
> +
> + ehci_2: usb@d140000 {
> + compatible = "nintendo,latte-usb-ehci", "usb-ehci";
> + reg = <0x0d140000 0x100>;
> + interrupts = <36>;
> + interrupt-parent = <&latte_pic>;
> + big-endian-regs;
> + };
> +
> + ohci_2_0: usb@d150000 {
> + compatible = "nintendo,latte-usb-ohci";
> + reg = <0x0d150000 0x100>;
> + interrupts = <37>;
> + interrupt-parent = <&latte_pic>;
> +
> + big-endian-regs;
> + };
> +
> + sdcard_0: sdhci@d070000 {

mmc

> + compatible = "nintendo,latte-sdhci","sdhci";
> + reg = <0x0d070000 0x200>;
> + interrupts = <7>;
> + interrupt-parent = <&latte_pic>;
> + };
> +
> + wifi_0: sdhci@d080000 {

mmc

> + compatible = "nintendo,latte-sdhci","sdhci";
> + reg = <0x0d080000 0x200>;
> + interrupts = <8>;
> + interrupt-parent = <&latte_pic>;
> + };
> +
> + legacy_ipc: ipc@d800000 {
> + compatible = "nintendo,latte-ipc", "nintendo,hollywood-ipc";
> + reg = <0x0d800000 0x10>;
> + interrupts = <30 31>;
> + interrupt-parent = <&latte_pic>;
> + };
> +
> + latte_otp: otp@d8001ec {
> + compatible = "nintendo,latte-otp";
> + reg = <0x0d8001ec 0x8>;
> + };
> +
> + sata: ahci@d160400 {
> + compatible = "nintendo,latte-ahci";
> + reg = <0x0d160400 0x808>;
> +
> + interrupt-parent = <&latte_pic>;
> + interrupts = <38 28>;
> + };
> +
> + latte_pic: pic@d800440 {

interrupt-controller

> + #interrupt-cells = <1>;
> + interrupt-controller;
> +
> + compatible = "nintendo,latte-pic";
> + reg = <0x0d800440 0x30>;
> + interrupt-parent = <&espresso_pic>;
> + interrupts = <24>;
> + };
> +
> + gpio: gpio@d8000c0 {
> + #gpio-cells = <2>;
> + compatible = "nintendo,latte-gpio", "nintendo,hollywood-gpio";
> +
> + reg = <0x0d8000c0 0x40>;
> + gpio-controller;
> + /* TODO: There are actually 31 AHBALL GPIOs */
> + ngpios = <24>;
> +
> + gpio-line-names =
> + "POWER", "DWIFI", "FAN", "DC_DC",
> + "", "Esp10WorkAround", "", "",
> + "PADPD", "", "EEP_CS", "EEP_CLK",
> + "EEP_MOSI", "EEP_MISO", "AVE_SCL", "AVE_SDA",
> + "DEBUG0", "DEBUG1", "DEBUG2", "DEBUG3",
> + "DEBUG4", "DEBUG5", "DEBUG6", "DEBUG7";
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + interrupts = <10>;
> + interrupt-parent = <&latte_pic>;
> + };
> +
> + gpio2: gpio@d800520 {
> + #gpio-cells = <2>;
> + compatible = "nintendo,latte-gpio", "nintendo,hollywood-gpio";
> +
> + reg = <0x0d800520 0x40>;
> + gpio-controller;
> + ngpios = <7>;
> +
> + gpio-line-names =
> + "FANSPEED", "SMC_SCL", "SMC_SDA", "DC_DC2",
> + "AVE_INT", "", "AVE_RESET";
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> + interrupts = <10>;
> + interrupt-parent = <&latte_pic>;
> + };
> + };
> +
> + spi_gpio: spi-gpio {
> + compatible = "spi-gpio";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cs-gpios = <&gpio 10 GPIO_ACTIVE_HIGH>;
> + gpio-sck = <&gpio 11 GPIO_ACTIVE_HIGH>;
> + gpio-mosi = <&gpio 12 GPIO_ACTIVE_HIGH>;
> + gpio-miso = <&gpio 13 GPIO_ACTIVE_HIGH>;
> + num-chipselects = <1>;
> +
> + eeprom@0 {
> + compatible = "atmel,at93c66";
> + reg = <0>;
> + spi-max-frequency = <1000000>;
> + spi-cs-high;
> + /* TODO: wiiubrew says this is 16-bit, but I only get the correct
> + * values in 8-bit...
> + */
> + data-size = <8>;
> + read-only;
> +
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + /* https://wiiubrew.org/wiki/Hardware/SEEPROM */
> + rng_seed: rng@12 { reg = <0x012 8>; };
> + ppc_pvr: pvr@20 { reg = <0x020 4>; };
> + seeprom_ver_str: sver-str@24 { reg = <0x024 6>; };
> + seeprom_ver: sver@2a { reg = <0x02A 2>; };
> + otp_ver: over@2c { reg = <0x02C 2>; };
> + otp_rev: orev@2e { reg = <0x02E 2>; };
> + otp_ver_str: over-str@30 { reg = <0x030 8>; };
> +
> + bc_crc: bc-crc@38 { reg = <0x038 4>; };
> + bc_sz: bc-sz@3c { reg = <0x03C 2>; };
> + bc_ver: bc-ver@3e { reg = <0x03E 2>; };
> + bc_boardtype: boardtype@42 { reg = <0x042 2>; };
> + bc_boardrev: boardrev@44 { reg = <0x044 2>; };
> + bc_bootsource: bootsource@46 { reg = <0x046 2>; };
> + bc_ddr3size: ddr3size@48 { reg = <0x048 2>; };
> + bc_ddr3speed: ddr3speed@4a { reg = <0x04A 2>; };
> + bc_ppcclockmul: ppcclockmul@4c { reg = <0x04C 2>; };
> + bc_iopclockmul: iopclockmul@46 { reg = <0x04E 2>; };
> + bc_video1080p: video1080p@50 { reg = <0x050 2>; };
> + bc_ddr3vendor: ddr3vendor@52 { reg = <0x052 2>; };
> + bc_movpassivereset: movpassivereset@54 { reg = <0x054 2>; };
> + bc_syspllspd: syspllspd@56 { reg = <0x056 2>; };
> + bc_satadevice: satadevice@58 { reg = <0x058 2>; };
> + bc_consoletype: consoletype@5a { reg = <0x05A 2>; };
> + bc_deviceprescence: deviceprescence@5c { reg = <0x05C 2>; };
> +
> + drive_key: drvkey@80 { reg = <0x080 16>; };
> + factory_key: fackey@90 { reg = <0x090 16>; };
> + shdd_key: shddkey@a0 { reg = <0x0A0 16>; };
> + usb_key_seed: usbkeyseed@b0 { reg = <0x0B0 16>; };
> + drive_key_flag: drvkeyf@c0 { reg = <0x0C0 2>; };
> + usb_key_flag: udbkeyf@c2 { reg = <0x0C2 2>; };
> + shdd_key_flag: shddkeyf@c4 { reg = <0x0C4 2>; };
> +
> + sysprod_version: sp_ver@140 { reg = <0x140 4>; };
> + sysprod_eeprom_version: sp_ee_ver@144 { reg = <0x144 4>; };
> + sysprod_product_area: sp_parea@148 { reg = <0x148 4>; };
> + sysprod_game_region: sp_region@14c { reg = <0x14C 4>; };
> + sysprod_ntsc_pal: sp_ntscpal@150 { reg = <0x150 4>; };
> + sysprod_5ghz_country: sp_5ghz_c@154 { reg = <0x154 2>; };
> + sysprod_5ghz_country_rev: sp_5ghz_crev@156 { reg = <0x156 2>; };
> + sysprod_code: sp_code@158 { reg = <0x158 8>; };
> + sysprod_serial: sp_serial@160 { reg = <0x160 16>; };
> + sysprod_model: sp_model@170 { reg = <0x170 16>; };
> +
> + prod_year: pyear@188 { reg = <0x188 2>; };
> + prod_date: pdate@18a { reg = <0x18A 2>; };
> + prod_time: ptime@18c { reg = <0x18C 2>; };
> +
> + boot_params: boot_params@1c0 { reg = <0x1C0 48>; };
> + };
> + };
> +
> + /* TODO make this gpio-keyed once hollywood-gpio supports interrupts */
> + gpio-keys-polled {

gpio-keys

> + poll-interval = <50>;
> + compatible = "gpio-keys-polled";
> +
> + power {

key-power
(will be enforced by schema)

> + label = "Power Button";
> + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
> + linux,code = <KEY_POWER>;
> + };
> + };
> +};


Best regards,
Krzysztof

2022-06-29 16:32:08

by Segher Boessenkool

[permalink] [raw]
Subject: Re: [PATCH v3 02/12] powerpc: wiiu: device tree

On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote:
> On 28/06/2022 15:31, Ash Logan wrote:
> > + model = "nintendo,wiiu";
>
> It's not compatible, but user-visible string, e.g. "Nintendo Wii U"

The "model" property in OF is documented as:

---
“model” S
Standard property name to define a manufacturer’s model number.

prop-encoded-array:
Text string, encoded with encode-string.
A manufacturer-dependent string that generally specifies the model name
and number (including revision level) for this device. The format of the
text string is arbitrary, although in conventional usage the string
begins with the name of the device’s manufacturer as with the “name”
property.
Although there is no standard interpretation for the value of the
“model” property, a specific device driver might use it to learn, for
instance, the revision level of its particular device.

See also: property, model.

Used as: " XYZCO,1416-02" encode-string " model" property
---

> > + cpus {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + /* TODO: Add SMP */
> > + PowerPC,espresso@0 {
>
> Node name should be generic, so "cpu". Unless something needs the
> specific node name?

This is how most other PowerPC firmwares do it. The PowerPC processor
binding is older than the generic naming practice, so CPU nodes have
device_type "cpu" instead. This is a required property btw, with that
value. (There is no requirement on the names of the CPU nodes).

There is no added value in generic naming for CPU nodes anyway, since
you just find them as the children of the "/cpus" node :-)


Segher

2022-06-29 18:29:02

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 02/12] powerpc: wiiu: device tree

On 29/06/2022 18:13, Segher Boessenkool wrote:
> On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote:
>> On 28/06/2022 15:31, Ash Logan wrote:
>>> + model = "nintendo,wiiu";
>>
>> It's not compatible, but user-visible string, e.g. "Nintendo Wii U"
>
> The "model" property in OF is documented as:
>
> ---
> “model” S
> Standard property name to define a manufacturer’s model number.
>
> prop-encoded-array:
> Text string, encoded with encode-string.
> A manufacturer-dependent string that generally specifies the model name
> and number (including revision level) for this device. The format of the
> text string is arbitrary, although in conventional usage the string
> begins with the name of the device’s manufacturer as with the “name”
> property.
> Although there is no standard interpretation for the value of the
> “model” property, a specific device driver might use it to learn, for
> instance, the revision level of its particular device.
>
> See also: property, model.
>
> Used as: " XYZCO,1416-02" encode-string " model" property

Hm, surprising to duplicate the compatible, but OK.

> ---
>
>>> + cpus {
>>> + #address-cells = <1>;
>>> + #size-cells = <0>;
>>> +
>>> + /* TODO: Add SMP */
>>> + PowerPC,espresso@0 {
>>
>> Node name should be generic, so "cpu". Unless something needs the
>> specific node name?
>
> This is how most other PowerPC firmwares do it. The PowerPC processor
> binding is older than the generic naming practice, so CPU nodes have
> device_type "cpu" instead.

ePAPR 1.0 from 2008 explicitly asks for generic node names. So 4 years
before Nintento Wii U. Maybe earlier ePAPR-s were also asking for this,
no clue, don't have them.

> This is a required property btw, with that
> value. (There is no requirement on the names of the CPU nodes).

That's fine, I am not talking about property.

> There is no added value in generic naming for CPU nodes anyway, since
> you just find them as the children of the "/cpus" node :-)

There is because you might have there caches. It also makes code easier
to read.

Best regards,
Krzysztof

2022-06-29 20:40:14

by Segher Boessenkool

[permalink] [raw]
Subject: Re: [PATCH v3 02/12] powerpc: wiiu: device tree

On Wed, Jun 29, 2022 at 08:13:13PM +0200, Krzysztof Kozlowski wrote:
> On 29/06/2022 18:13, Segher Boessenkool wrote:
> > On Wed, Jun 29, 2022 at 11:58:18AM +0200, Krzysztof Kozlowski wrote:
> >>> + /* TODO: Add SMP */
> >>> + PowerPC,espresso@0 {
> >>
> >> Node name should be generic, so "cpu". Unless something needs the
> >> specific node name?
> >
> > This is how most other PowerPC firmwares do it. The PowerPC processor
> > binding is older than the generic naming practice, so CPU nodes have
> > device_type "cpu" instead.
>
> ePAPR 1.0 from 2008 explicitly asks for generic node names. So 4 years
> before Nintento Wii U. Maybe earlier ePAPR-s were also asking for this,
> no clue, don't have them.

The majority of PowerPC 750 systems long predate that. Many *current*
systems implement the PowerPC Processor Binding, too (not the epapr
thing, which is incompatible with the older standards!)

> > There is no added value in generic naming for CPU nodes anyway, since
> > you just find them as the children of the "/cpus" node :-)
>
> There is because you might have there caches. It also makes code easier
> to read.

In the processor binding the cache nodes were subnodes of cpu nodes or
other cache nodes. But in some server products you can have cache that
is enabled while the corresponding core is disabled; and also, not all
cache belongs to only one higher level anyway. This was modelled pretty
uncleanly, yup (cleaner would have been to have a /caches node as well
as /cpus, for example).

But on 750 you just have "l2-cache" subnodes, and all nodes in /cpus are
CPUs :-)


Segher