* [PATCH V5 0/4] Add Anbernic RG-Nano
@ 2023-09-21 13:51 Chris Morgan
2023-09-21 13:51 ` [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm Chris Morgan
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Chris Morgan @ 2023-09-21 13:51 UTC (permalink / raw)
To: linux-sunxi
Cc: devicetree, mripard, uwu, samuel, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
From: Chris Morgan <macromorgan@hotmail.com>
Add support for the Anbernic RG-Nano handheld gaming device
Changes since V4:
- Rebased off main branch as some patches had been pulled into main.
- Re-enabled the internal RTC based on advice from maintainers.
- Removed "clocks" property from internal RTC based on advice from
- maintainers.
- Gave external RTC alias of rtc0 and internal RTC alias of rtc1 so
priority would be given to the external RTC. The external RTC keeps
accurate time, while the internal RTC lost 8 hours for me in a 24
hour period.
Changes since V3:
- Added PHY to the OHCI and EHCI nodes. Note that the PHY driver
currently forces the PHY to host mode always; a correction to
the PHY driver or removal of the phy values from the OHCI and EHCI
nodes are necessary to get otg mode working properly.
- Disabled SoC RTC in favor of external clock. The SoC RTC is not
set up correctly in hardware and runs fast, whereas the external RTC
keeps accurate time. This matches the BSP.
- Added labels to GPIO pins to aid in readability.
Changes since V2:
- Add display support.
- Add USB host support.
- Removed CPU frequency and voltage parameters, as CPU regulator may
be tied into additional areas that need further testing.
- Added regulator names back, as they appear to have been accidentally
dropped in v2.
- Updated notes to denote all hardware tested and working.
Changes since V1:
- Added additional pwm pin configs to sun8i-v3s.dtsi and removed
default config for pwm0 in lieu of defining it for each board.
- Noted in patch notes that additional hardware of UART debug port,
USB port (in gadget mode) also work, and that USB host mode does
not work.
- Identified GPIO responsible for enabling external speaker amplifier
and defined it, allowing onboard audio to work.
- Removed ac_power_supply node.
- Set regulator min and max values to the same value as defined in the
schematics.
- Removed definition for reg_ldo1. This regulator is hardware
configured so the value did not affect anything, however the driver
must be updated to support the correct value of 3.3v in this case.
- Removed usb0_id_det-gpios as I cannot confirm these are correct.
Chris Morgan (4):
arm: dts: sun8i: V3s: Add pinctrl for pwm
ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts
dt-bindings: arm: sunxi: add Anbernic RG-Nano
ARM: dts: sunxi: add support for Anbernic RG-Nano
.../devicetree/bindings/arm/sunxi.yaml | 5 +
arch/arm/boot/dts/allwinner/Makefile | 1 +
.../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi | 35 +++
4 files changed, 325 insertions(+)
create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm
2023-09-21 13:51 [PATCH V5 0/4] Add Anbernic RG-Nano Chris Morgan
@ 2023-09-21 13:51 ` Chris Morgan
2023-09-24 19:30 ` Jernej Škrabec
2023-09-21 13:51 ` [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts Chris Morgan
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Chris Morgan @ 2023-09-21 13:51 UTC (permalink / raw)
To: linux-sunxi
Cc: devicetree, mripard, uwu, samuel, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
From: Chris Morgan <macromorgan@hotmail.com>
Add pinctrl nodes for pwm0 and pwm1.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
index 3b9a282c2746..c87476ea31e2 100644
--- a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
@@ -414,6 +414,18 @@ mmc1_pins: mmc1-pins {
bias-pull-up;
};
+ /omit-if-no-ref/
+ pwm0_pin: pwm0-pin {
+ pins = "PB4";
+ function = "pwm0";
+ };
+
+ /omit-if-no-ref/
+ pwm1_pin: pwm1-pin {
+ pins = "PB5";
+ function = "pwm1";
+ };
+
spi0_pins: spi0-pins {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts
2023-09-21 13:51 [PATCH V5 0/4] Add Anbernic RG-Nano Chris Morgan
2023-09-21 13:51 ` [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm Chris Morgan
@ 2023-09-21 13:51 ` Chris Morgan
2023-09-24 19:30 ` Jernej Škrabec
2023-09-21 13:51 ` [PATCH V5 3/4] dt-bindings: arm: sunxi: add Anbernic RG-Nano Chris Morgan
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
3 siblings, 1 reply; 15+ messages in thread
From: Chris Morgan @ 2023-09-21 13:51 UTC (permalink / raw)
To: linux-sunxi
Cc: devicetree, mripard, uwu, samuel, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
From: Chris Morgan <macromorgan@hotmail.com>
Add the EHCI and OHCI controller to the Allwinner v3s to support using
USB in host mode.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
index c87476ea31e2..e8a04476b776 100644
--- a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
@@ -319,6 +319,29 @@ usbphy: phy@1c19400 {
#phy-cells = <1>;
};
+ ehci: usb@1c1a000 {
+ compatible = "allwinner,sun8i-v3s-ehci", "generic-ehci";
+ reg = <0x01c1a000 0x100>;
+ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>;
+ resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
+ phys = <&usbphy 0>;
+ phy-names = "usb";
+ status = "disabled";
+ };
+
+ ohci: usb@1c1a400 {
+ compatible = "allwinner,sun8i-v3s-ohci", "generic-ohci";
+ reg = <0x01c1a400 0x100>;
+ interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>,
+ <&ccu CLK_USB_OHCI0>;
+ resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
+ phys = <&usbphy 0>;
+ phy-names = "usb";
+ status = "disabled";
+ };
+
ccu: clock@1c20000 {
compatible = "allwinner,sun8i-v3s-ccu";
reg = <0x01c20000 0x400>;
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V5 3/4] dt-bindings: arm: sunxi: add Anbernic RG-Nano
2023-09-21 13:51 [PATCH V5 0/4] Add Anbernic RG-Nano Chris Morgan
2023-09-21 13:51 ` [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm Chris Morgan
2023-09-21 13:51 ` [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts Chris Morgan
@ 2023-09-21 13:51 ` Chris Morgan
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
3 siblings, 0 replies; 15+ messages in thread
From: Chris Morgan @ 2023-09-21 13:51 UTC (permalink / raw)
To: linux-sunxi
Cc: devicetree, mripard, uwu, samuel, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan,
Krzysztof Kozlowski
From: Chris Morgan <macromorgan@hotmail.com>
The Anbernic RG-Nano is a portable handheld console from Anbernic which
uses the Allwinner V3s SoC.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
Documentation/devicetree/bindings/arm/sunxi.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml b/Documentation/devicetree/bindings/arm/sunxi.yaml
index e4dd678f4212..1929a0a475fd 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.yaml
+++ b/Documentation/devicetree/bindings/arm/sunxi.yaml
@@ -51,6 +51,11 @@ properties:
- const: allwinner,parrot
- const: allwinner,sun8i-a33
+ - description: Anbernic RG-Nano
+ items:
+ - const: anbernic,rg-nano
+ - const: allwinner,sun8i-v3s
+
- description: Amarula A64 Relic
items:
- const: amarula,a64-relic
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-21 13:51 [PATCH V5 0/4] Add Anbernic RG-Nano Chris Morgan
` (2 preceding siblings ...)
2023-09-21 13:51 ` [PATCH V5 3/4] dt-bindings: arm: sunxi: add Anbernic RG-Nano Chris Morgan
@ 2023-09-21 13:51 ` Chris Morgan
2023-09-22 9:31 ` Andre Przywara
` (2 more replies)
3 siblings, 3 replies; 15+ messages in thread
From: Chris Morgan @ 2023-09-21 13:51 UTC (permalink / raw)
To: linux-sunxi
Cc: devicetree, mripard, uwu, samuel, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
From: Chris Morgan <macromorgan@hotmail.com>
The Anbernic RG-Nano is a small portable game device based on the
Allwinner V3s SoC. It has GPIO buttons on the face and side for
input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
OTG port, an SD card slot for booting, and 64MB of RAM included in the
SoC. There does not appear to be a crystal feeding the internal RTC so
it does not keep proper time (for me it ran 8 hours slow in a 24 hour
period). External RTC works just fine.
Working/Tested:
- SDMMC
- UART (for debugging)
- Buttons
- Charging/battery/PMIC
- Speaker
- RTC (external RTC)
- USB
- Display
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm/boot/dts/allwinner/Makefile | 1 +
.../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
2 files changed, 285 insertions(+)
create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
index eebb5a0c873a..2d26c3397f14 100644
--- a/arch/arm/boot/dts/allwinner/Makefile
+++ b/arch/arm/boot/dts/allwinner/Makefile
@@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
sun8i-t113s-mangopi-mq-r-t113.dtb \
sun8i-t3-cqa3t-bv3.dtb \
sun8i-v3-sl631-imx179.dtb \
+ sun8i-v3s-anbernic-rg-nano.dtb \
sun8i-v3s-licheepi-zero.dtb \
sun8i-v3s-licheepi-zero-dock.dtb \
sun8i-v40-bananapi-m2-berry.dtb
diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
new file mode 100644
index 000000000000..1a4429dc57b1
--- /dev/null
+++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
@@ -0,0 +1,284 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+#include <dt-bindings/input/linux-event-codes.h>
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+ model = "Anbernic RG Nano";
+ compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
+
+ aliases {
+ rtc0 = &pcf8563;
+ rtc1 = &rtc;
+ serial0 = &uart0;
+ };
+
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
+ default-brightness-level = <11>;
+ power-supply = <®_vcc5v0>;
+ pwms = <&pwm 0 40000 1>;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ gpio_keys: gpio-keys {
+ compatible = "gpio-keys";
+
+ button-a {
+ gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-A";
+ linux,code = <BTN_EAST>;
+ };
+
+ button-b {
+ gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-B";
+ linux,code = <BTN_SOUTH>;
+ };
+
+ button-down {
+ gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "DPAD-DOWN";
+ linux,code = <BTN_DPAD_DOWN>;
+ };
+
+ button-left {
+ gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "DPAD-LEFT";
+ linux,code = <BTN_DPAD_LEFT>;
+ };
+
+ button-right {
+ gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "DPAD-RIGHT";
+ linux,code = <BTN_DPAD_RIGHT>;
+ };
+
+ button-se {
+ gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-SELECT";
+ linux,code = <BTN_SELECT>;
+ };
+
+ button-st {
+ gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-START";
+ linux,code = <BTN_START>;
+ };
+
+ button-tl {
+ gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-L";
+ linux,code = <BTN_TL>;
+ };
+
+ button-tr {
+ gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-R";
+ linux,code = <BTN_TR>;
+ };
+
+ button-up {
+ gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "DPAD-UP";
+ linux,code = <BTN_DPAD_UP>;
+ };
+
+ button-x {
+ gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-X";
+ linux,code = <BTN_NORTH>;
+ };
+
+ button-y {
+ gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ label = "BTN-Y";
+ linux,code = <BTN_WEST>;
+ };
+ };
+};
+
+&codec {
+ allwinner,audio-routing = "Speaker", "HP",
+ "MIC1", "Mic",
+ "Mic", "HBIAS";
+ allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
+ status = "okay";
+};
+
+&ehci {
+ status = "okay";
+};
+
+&i2c0 {
+ status = "okay";
+
+ gpio_expander: gpio@20 {
+ compatible = "nxp,pcal6416";
+ reg = <0x20>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ #interrupt-cells = <2>;
+ interrupt-controller;
+ interrupt-parent = <&pio>;
+ interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
+ vcc-supply = <®_vcc3v3>;
+ };
+
+ axp209: pmic@34 {
+ reg = <0x34>;
+ interrupt-parent = <&pio>;
+ interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
+ };
+
+ pcf8563: rtc@51 {
+ compatible = "nxp,pcf8563";
+ reg = <0x51>;
+ };
+};
+
+#include "axp209.dtsi"
+
+&battery_power_supply {
+ status = "okay";
+};
+
+&mmc0 {
+ broken-cd;
+ bus-width = <4>;
+ disable-wp;
+ vmmc-supply = <®_vcc3v3>;
+ vqmmc-supply = <®_vcc3v3>;
+ status = "okay";
+};
+
+&ohci {
+ status = "okay";
+};
+
+&pio {
+ vcc-pb-supply = <®_vcc3v3>;
+ vcc-pc-supply = <®_vcc3v3>;
+ vcc-pf-supply = <®_vcc3v3>;
+ vcc-pg-supply = <®_vcc3v3>;
+
+ spi0_no_miso_pins: spi0-no-miso-pins {
+ pins = "PC1", "PC2", "PC3";
+ function = "spi0";
+ };
+};
+
+&pwm {
+ pinctrl-0 = <&pwm0_pin>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
+®_dcdc2 {
+ regulator-always-on;
+ regulator-max-microvolt = <1250000>;
+ regulator-min-microvolt = <1250000>;
+ regulator-name = "vdd-cpu";
+};
+
+/* DCDC3 wired into every 3.3v input that isn't the RTC. */
+®_dcdc3 {
+ regulator-always-on;
+ regulator-max-microvolt = <3300000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-name = "vcc-io";
+};
+
+/*
+ * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
+ * software modified. Note that setting voltage here to 3.3v for accuracy
+ * sake causes an issue with the driver that causes it to fail to probe
+ * because of a voltage constraint in the driver.
+ */
+®_ldo1 {
+ regulator-always-on;
+ regulator-name = "vcc-rtc";
+};
+
+/* LDO2 wired into VCC-PLL and audio codec. */
+®_ldo2 {
+ regulator-always-on;
+ regulator-max-microvolt = <3000000>;
+ regulator-min-microvolt = <3000000>;
+ regulator-name = "vcc-pll";
+};
+
+/* LDO3, LDO4, and LDO5 unused. */
+®_ldo3 {
+ status = "disabled";
+};
+
+®_ldo4 {
+ status = "disabled";
+};
+
+/*
+ * Force the driver to use internal oscillator by removing clocks
+ * property.
+ */
+&rtc {
+ /delete-property/ clocks;
+};
+
+&spi0 {
+ pinctrl-0 = <&spi0_no_miso_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ display@0 {
+ compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
+ reg = <0>;
+ backlight = <&backlight>;
+ dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
+ reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
+ spi-max-frequency = <100000000>;
+
+ height-mm = <39>;
+ width-mm = <39>;
+
+ /* Set hb-porch to compensate for non-visible area */
+ panel-timing {
+ hactive = <240>;
+ vactive = <240>;
+ hback-porch = <80>;
+ vback-porch = <0>;
+ clock-frequency = <0>;
+ hfront-porch = <0>;
+ hsync-len = <0>;
+ vfront-porch = <0>;
+ vsync-len = <0>;
+ };
+ };
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_pb_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&usb_otg {
+ dr_mode = "otg";
+ status = "okay";
+};
+
+&usb_power_supply {
+ status = "okay";
+};
+
+&usbphy {
+ usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
+ status = "okay";
+};
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
@ 2023-09-22 9:31 ` Andre Przywara
2023-09-22 9:32 ` Icenowy Zheng
2023-09-24 19:33 ` Jernej Škrabec
2023-09-27 20:28 ` Samuel Holland
2 siblings, 1 reply; 15+ messages in thread
From: Andre Przywara @ 2023-09-22 9:31 UTC (permalink / raw)
To: Chris Morgan
Cc: linux-sunxi, devicetree, mripard, uwu, samuel, jernej.skrabec,
wens, conor+dt, krzysztof.kozlowski+dt, robh+dt, Chris Morgan
On Thu, 21 Sep 2023 08:51:36 -0500
Chris Morgan <macroalpha82@gmail.com> wrote:
Hi,
> From: Chris Morgan <macromorgan@hotmail.com>
>
> The Anbernic RG-Nano is a small portable game device based on the
> Allwinner V3s SoC. It has GPIO buttons on the face and side for
> input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> OTG port, an SD card slot for booting, and 64MB of RAM included in the
> SoC. There does not appear to be a crystal feeding the internal RTC so
> it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> period). External RTC works just fine.
That whole situation is still a bit odd: why is there an external RTC to
begin with? And did they really save on the 32KHz oscillator, in favour of
attaching a whole I2C RTC chip? Maybe something is off with the V3 RTC in
general, and just nobody noticed or cared so far?
Anyways, I think the DT is fine now, I see all the comments addressed, and
dtc and dt-validate are happy:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> Working/Tested:
> - SDMMC
> - UART (for debugging)
> - Buttons
> - Charging/battery/PMIC
> - Speaker
> - RTC (external RTC)
> - USB
> - Display
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
> arch/arm/boot/dts/allwinner/Makefile | 1 +
> .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> 2 files changed, 285 insertions(+)
> create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
>
> diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> index eebb5a0c873a..2d26c3397f14 100644
> --- a/arch/arm/boot/dts/allwinner/Makefile
> +++ b/arch/arm/boot/dts/allwinner/Makefile
> @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> sun8i-t113s-mangopi-mq-r-t113.dtb \
> sun8i-t3-cqa3t-bv3.dtb \
> sun8i-v3-sl631-imx179.dtb \
> + sun8i-v3s-anbernic-rg-nano.dtb \
> sun8i-v3s-licheepi-zero.dtb \
> sun8i-v3s-licheepi-zero-dock.dtb \
> sun8i-v40-bananapi-m2-berry.dtb
> diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> new file mode 100644
> index 000000000000..1a4429dc57b1
> --- /dev/null
> +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> @@ -0,0 +1,284 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +
> +/dts-v1/;
> +#include <dt-bindings/input/linux-event-codes.h>
> +#include "sun8i-v3s.dtsi"
> +#include "sunxi-common-regulators.dtsi"
> +
> +/ {
> + model = "Anbernic RG Nano";
> + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> +
> + aliases {
> + rtc0 = &pcf8563;
> + rtc1 = &rtc;
> + serial0 = &uart0;
> + };
> +
> + backlight: backlight {
> + compatible = "pwm-backlight";
> + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> + default-brightness-level = <11>;
> + power-supply = <®_vcc5v0>;
> + pwms = <&pwm 0 40000 1>;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +
> + gpio_keys: gpio-keys {
> + compatible = "gpio-keys";
> +
> + button-a {
> + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-A";
> + linux,code = <BTN_EAST>;
> + };
> +
> + button-b {
> + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-B";
> + linux,code = <BTN_SOUTH>;
> + };
> +
> + button-down {
> + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-DOWN";
> + linux,code = <BTN_DPAD_DOWN>;
> + };
> +
> + button-left {
> + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-LEFT";
> + linux,code = <BTN_DPAD_LEFT>;
> + };
> +
> + button-right {
> + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-RIGHT";
> + linux,code = <BTN_DPAD_RIGHT>;
> + };
> +
> + button-se {
> + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-SELECT";
> + linux,code = <BTN_SELECT>;
> + };
> +
> + button-st {
> + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-START";
> + linux,code = <BTN_START>;
> + };
> +
> + button-tl {
> + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-L";
> + linux,code = <BTN_TL>;
> + };
> +
> + button-tr {
> + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-R";
> + linux,code = <BTN_TR>;
> + };
> +
> + button-up {
> + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-UP";
> + linux,code = <BTN_DPAD_UP>;
> + };
> +
> + button-x {
> + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-X";
> + linux,code = <BTN_NORTH>;
> + };
> +
> + button-y {
> + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-Y";
> + linux,code = <BTN_WEST>;
> + };
> + };
> +};
> +
> +&codec {
> + allwinner,audio-routing = "Speaker", "HP",
> + "MIC1", "Mic",
> + "Mic", "HBIAS";
> + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> + status = "okay";
> +};
> +
> +&ehci {
> + status = "okay";
> +};
> +
> +&i2c0 {
> + status = "okay";
> +
> + gpio_expander: gpio@20 {
> + compatible = "nxp,pcal6416";
> + reg = <0x20>;
> + gpio-controller;
> + #gpio-cells = <2>;
> + #interrupt-cells = <2>;
> + interrupt-controller;
> + interrupt-parent = <&pio>;
> + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> + vcc-supply = <®_vcc3v3>;
> + };
> +
> + axp209: pmic@34 {
> + reg = <0x34>;
> + interrupt-parent = <&pio>;
> + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> + };
> +
> + pcf8563: rtc@51 {
> + compatible = "nxp,pcf8563";
> + reg = <0x51>;
> + };
> +};
> +
> +#include "axp209.dtsi"
> +
> +&battery_power_supply {
> + status = "okay";
> +};
> +
> +&mmc0 {
> + broken-cd;
> + bus-width = <4>;
> + disable-wp;
> + vmmc-supply = <®_vcc3v3>;
> + vqmmc-supply = <®_vcc3v3>;
> + status = "okay";
> +};
> +
> +&ohci {
> + status = "okay";
> +};
> +
> +&pio {
> + vcc-pb-supply = <®_vcc3v3>;
> + vcc-pc-supply = <®_vcc3v3>;
> + vcc-pf-supply = <®_vcc3v3>;
> + vcc-pg-supply = <®_vcc3v3>;
> +
> + spi0_no_miso_pins: spi0-no-miso-pins {
> + pins = "PC1", "PC2", "PC3";
> + function = "spi0";
> + };
> +};
> +
> +&pwm {
> + pinctrl-0 = <&pwm0_pin>;
> + pinctrl-names = "default";
> + status = "okay";
> +};
> +
> +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> +®_dcdc2 {
> + regulator-always-on;
> + regulator-max-microvolt = <1250000>;
> + regulator-min-microvolt = <1250000>;
> + regulator-name = "vdd-cpu";
> +};
> +
> +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> +®_dcdc3 {
> + regulator-always-on;
> + regulator-max-microvolt = <3300000>;
> + regulator-min-microvolt = <3300000>;
> + regulator-name = "vcc-io";
> +};
> +
> +/*
> + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> + * software modified. Note that setting voltage here to 3.3v for accuracy
> + * sake causes an issue with the driver that causes it to fail to probe
> + * because of a voltage constraint in the driver.
> + */
> +®_ldo1 {
> + regulator-always-on;
> + regulator-name = "vcc-rtc";
> +};
> +
> +/* LDO2 wired into VCC-PLL and audio codec. */
> +®_ldo2 {
> + regulator-always-on;
> + regulator-max-microvolt = <3000000>;
> + regulator-min-microvolt = <3000000>;
> + regulator-name = "vcc-pll";
> +};
> +
> +/* LDO3, LDO4, and LDO5 unused. */
> +®_ldo3 {
> + status = "disabled";
> +};
> +
> +®_ldo4 {
> + status = "disabled";
> +};
> +
> +/*
> + * Force the driver to use internal oscillator by removing clocks
> + * property.
> + */
> +&rtc {
> + /delete-property/ clocks;
> +};
> +
> +&spi0 {
> + pinctrl-0 = <&spi0_no_miso_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +
> + display@0 {
> + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> + reg = <0>;
> + backlight = <&backlight>;
> + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> + spi-max-frequency = <100000000>;
> +
> + height-mm = <39>;
> + width-mm = <39>;
> +
> + /* Set hb-porch to compensate for non-visible area */
> + panel-timing {
> + hactive = <240>;
> + vactive = <240>;
> + hback-porch = <80>;
> + vback-porch = <0>;
> + clock-frequency = <0>;
> + hfront-porch = <0>;
> + hsync-len = <0>;
> + vfront-porch = <0>;
> + vsync-len = <0>;
> + };
> + };
> +};
> +
> +&uart0 {
> + pinctrl-0 = <&uart0_pb_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +};
> +
> +&usb_otg {
> + dr_mode = "otg";
> + status = "okay";
> +};
> +
> +&usb_power_supply {
> + status = "okay";
> +};
> +
> +&usbphy {
> + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> + status = "okay";
> +};
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-22 9:31 ` Andre Przywara
@ 2023-09-22 9:32 ` Icenowy Zheng
0 siblings, 0 replies; 15+ messages in thread
From: Icenowy Zheng @ 2023-09-22 9:32 UTC (permalink / raw)
To: Andre Przywara, Chris Morgan
Cc: linux-sunxi, devicetree, mripard, samuel, jernej.skrabec, wens,
conor+dt, krzysztof.kozlowski+dt, robh+dt, Chris Morgan
在 2023-09-22星期五的 10:31 +0100,Andre Przywara写道:
> On Thu, 21 Sep 2023 08:51:36 -0500
> Chris Morgan <macroalpha82@gmail.com> wrote:
>
> Hi,
>
> > From: Chris Morgan <macromorgan@hotmail.com>
> >
> > The Anbernic RG-Nano is a small portable game device based on the
> > Allwinner V3s SoC. It has GPIO buttons on the face and side for
> > input, a single mono speaker, a 240x240 SPI controlled display, a
> > USB-C
> > OTG port, an SD card slot for booting, and 64MB of RAM included in
> > the
> > SoC. There does not appear to be a crystal feeding the internal RTC
> > so
> > it does not keep proper time (for me it ran 8 hours slow in a 24
> > hour
> > period). External RTC works just fine.
>
> That whole situation is still a bit odd: why is there an external RTC
> to
> begin with? And did they really save on the 32KHz oscillator, in
> favour of
> attaching a whole I2C RTC chip? Maybe something is off with the V3
> RTC in
> general, and just nobody noticed or cared so far?
I think the leakage is a little high, not so suitable for long-time
work.
> Anyways, I think the DT is fine now, I see all the comments
> addressed, and
> dtc and dt-validate are happy:
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
>
> Cheers,
> Andre
>
> > Working/Tested:
> > - SDMMC
> > - UART (for debugging)
> > - Buttons
> > - Charging/battery/PMIC
> > - Speaker
> > - RTC (external RTC)
> > - USB
> > - Display
> >
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > ---
> > arch/arm/boot/dts/allwinner/Makefile | 1 +
> > .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284
> > ++++++++++++++++++
> > 2 files changed, 285 insertions(+)
> > create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-
> > rg-nano.dts
> >
> > diff --git a/arch/arm/boot/dts/allwinner/Makefile
> > b/arch/arm/boot/dts/allwinner/Makefile
> > index eebb5a0c873a..2d26c3397f14 100644
> > --- a/arch/arm/boot/dts/allwinner/Makefile
> > +++ b/arch/arm/boot/dts/allwinner/Makefile
> > @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> > sun8i-t113s-mangopi-mq-r-t113.dtb \
> > sun8i-t3-cqa3t-bv3.dtb \
> > sun8i-v3-sl631-imx179.dtb \
> > + sun8i-v3s-anbernic-rg-nano.dtb \
> > sun8i-v3s-licheepi-zero.dtb \
> > sun8i-v3s-licheepi-zero-dock.dtb \
> > sun8i-v40-bananapi-m2-berry.dtb
> > diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-
> > nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-
> > nano.dts
> > new file mode 100644
> > index 000000000000..1a4429dc57b1
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > @@ -0,0 +1,284 @@
> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > +
> > +/dts-v1/;
> > +#include <dt-bindings/input/linux-event-codes.h>
> > +#include "sun8i-v3s.dtsi"
> > +#include "sunxi-common-regulators.dtsi"
> > +
> > +/ {
> > + model = "Anbernic RG Nano";
> > + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> > +
> > + aliases {
> > + rtc0 = &pcf8563;
> > + rtc1 = &rtc;
> > + serial0 = &uart0;
> > + };
> > +
> > + backlight: backlight {
> > + compatible = "pwm-backlight";
> > + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80
> > 100>;
> > + default-brightness-level = <11>;
> > + power-supply = <®_vcc5v0>;
> > + pwms = <&pwm 0 40000 1>;
> > + };
> > +
> > + chosen {
> > + stdout-path = "serial0:115200n8";
> > + };
> > +
> > + gpio_keys: gpio-keys {
> > + compatible = "gpio-keys";
> > +
> > + button-a {
> > + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-A";
> > + linux,code = <BTN_EAST>;
> > + };
> > +
> > + button-b {
> > + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-B";
> > + linux,code = <BTN_SOUTH>;
> > + };
> > +
> > + button-down {
> > + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "DPAD-DOWN";
> > + linux,code = <BTN_DPAD_DOWN>;
> > + };
> > +
> > + button-left {
> > + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "DPAD-LEFT";
> > + linux,code = <BTN_DPAD_LEFT>;
> > + };
> > +
> > + button-right {
> > + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "DPAD-RIGHT";
> > + linux,code = <BTN_DPAD_RIGHT>;
> > + };
> > +
> > + button-se {
> > + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-SELECT";
> > + linux,code = <BTN_SELECT>;
> > + };
> > +
> > + button-st {
> > + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-START";
> > + linux,code = <BTN_START>;
> > + };
> > +
> > + button-tl {
> > + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-L";
> > + linux,code = <BTN_TL>;
> > + };
> > +
> > + button-tr {
> > + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-R";
> > + linux,code = <BTN_TR>;
> > + };
> > +
> > + button-up {
> > + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "DPAD-UP";
> > + linux,code = <BTN_DPAD_UP>;
> > + };
> > +
> > + button-x {
> > + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-X";
> > + linux,code = <BTN_NORTH>;
> > + };
> > +
> > + button-y {
> > + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW
> > | GPIO_PULL_UP)>;
> > + label = "BTN-Y";
> > + linux,code = <BTN_WEST>;
> > + };
> > + };
> > +};
> > +
> > +&codec {
> > + allwinner,audio-routing = "Speaker", "HP",
> > + "MIC1", "Mic",
> > + "Mic", "HBIAS";
> > + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH |
> > GPIO_PULL_UP)>; /* PF6 */
> > + status = "okay";
> > +};
> > +
> > +&ehci {
> > + status = "okay";
> > +};
> > +
> > +&i2c0 {
> > + status = "okay";
> > +
> > + gpio_expander: gpio@20 {
> > + compatible = "nxp,pcal6416";
> > + reg = <0x20>;
> > + gpio-controller;
> > + #gpio-cells = <2>;
> > + #interrupt-cells = <2>;
> > + interrupt-controller;
> > + interrupt-parent = <&pio>;
> > + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3
> > */
> > + vcc-supply = <®_vcc3v3>;
> > + };
> > +
> > + axp209: pmic@34 {
> > + reg = <0x34>;
> > + interrupt-parent = <&pio>;
> > + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /*
> > PB5/EINT5 */
> > + };
> > +
> > + pcf8563: rtc@51 {
> > + compatible = "nxp,pcf8563";
> > + reg = <0x51>;
> > + };
> > +};
> > +
> > +#include "axp209.dtsi"
> > +
> > +&battery_power_supply {
> > + status = "okay";
> > +};
> > +
> > +&mmc0 {
> > + broken-cd;
> > + bus-width = <4>;
> > + disable-wp;
> > + vmmc-supply = <®_vcc3v3>;
> > + vqmmc-supply = <®_vcc3v3>;
> > + status = "okay";
> > +};
> > +
> > +&ohci {
> > + status = "okay";
> > +};
> > +
> > +&pio {
> > + vcc-pb-supply = <®_vcc3v3>;
> > + vcc-pc-supply = <®_vcc3v3>;
> > + vcc-pf-supply = <®_vcc3v3>;
> > + vcc-pg-supply = <®_vcc3v3>;
> > +
> > + spi0_no_miso_pins: spi0-no-miso-pins {
> > + pins = "PC1", "PC2", "PC3";
> > + function = "spi0";
> > + };
> > +};
> > +
> > +&pwm {
> > + pinctrl-0 = <&pwm0_pin>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +};
> > +
> > +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> > +®_dcdc2 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <1250000>;
> > + regulator-min-microvolt = <1250000>;
> > + regulator-name = "vdd-cpu";
> > +};
> > +
> > +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> > +®_dcdc3 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <3300000>;
> > + regulator-min-microvolt = <3300000>;
> > + regulator-name = "vcc-io";
> > +};
> > +
> > +/*
> > + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot
> > be
> > + * software modified. Note that setting voltage here to 3.3v for
> > accuracy
> > + * sake causes an issue with the driver that causes it to fail to
> > probe
> > + * because of a voltage constraint in the driver.
> > + */
> > +®_ldo1 {
> > + regulator-always-on;
> > + regulator-name = "vcc-rtc";
> > +};
> > +
> > +/* LDO2 wired into VCC-PLL and audio codec. */
> > +®_ldo2 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <3000000>;
> > + regulator-min-microvolt = <3000000>;
> > + regulator-name = "vcc-pll";
> > +};
> > +
> > +/* LDO3, LDO4, and LDO5 unused. */
> > +®_ldo3 {
> > + status = "disabled";
> > +};
> > +
> > +®_ldo4 {
> > + status = "disabled";
> > +};
> > +
> > +/*
> > + * Force the driver to use internal oscillator by removing clocks
> > + * property.
> > + */
> > +&rtc {
> > + /delete-property/ clocks;
> > +};
> > +
> > +&spi0 {
> > + pinctrl-0 = <&spi0_no_miso_pins>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +
> > + display@0 {
> > + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> > + reg = <0>;
> > + backlight = <&backlight>;
> > + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> > + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2
> > */
> > + spi-max-frequency = <100000000>;
> > +
> > + height-mm = <39>;
> > + width-mm = <39>;
> > +
> > + /* Set hb-porch to compensate for non-visible area
> > */
> > + panel-timing {
> > + hactive = <240>;
> > + vactive = <240>;
> > + hback-porch = <80>;
> > + vback-porch = <0>;
> > + clock-frequency = <0>;
> > + hfront-porch = <0>;
> > + hsync-len = <0>;
> > + vfront-porch = <0>;
> > + vsync-len = <0>;
> > + };
> > + };
> > +};
> > +
> > +&uart0 {
> > + pinctrl-0 = <&uart0_pb_pins>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +};
> > +
> > +&usb_otg {
> > + dr_mode = "otg";
> > + status = "okay";
> > +};
> > +
> > +&usb_power_supply {
> > + status = "okay";
> > +};
> > +
> > +&usbphy {
> > + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW |
> > GPIO_PULL_UP)>; /* PG5 */
> > + status = "okay";
> > +};
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm
2023-09-21 13:51 ` [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm Chris Morgan
@ 2023-09-24 19:30 ` Jernej Škrabec
0 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-09-24 19:30 UTC (permalink / raw)
To: linux-sunxi, Chris Morgan
Cc: devicetree, mripard, uwu, samuel, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
Dne četrtek, 21. september 2023 ob 15:51:33 CEST je Chris Morgan napisal(a):
> From: Chris Morgan <macromorgan@hotmail.com>
>
> Add pinctrl nodes for pwm0 and pwm1.
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> index 3b9a282c2746..c87476ea31e2 100644
> --- a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> @@ -414,6 +414,18 @@ mmc1_pins: mmc1-pins {
> bias-pull-up;
> };
>
> + /omit-if-no-ref/
> + pwm0_pin: pwm0-pin {
> + pins = "PB4";
> + function = "pwm0";
> + };
> +
> + /omit-if-no-ref/
> + pwm1_pin: pwm1-pin {
> + pins = "PB5";
> + function = "pwm1";
> + };
> +
> spi0_pins: spi0-pins {
> pins = "PC0", "PC1", "PC2", "PC3";
> function = "spi0";
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts
2023-09-21 13:51 ` [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts Chris Morgan
@ 2023-09-24 19:30 ` Jernej Škrabec
0 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-09-24 19:30 UTC (permalink / raw)
To: linux-sunxi, Chris Morgan
Cc: devicetree, mripard, uwu, samuel, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
Dne četrtek, 21. september 2023 ob 15:51:34 CEST je Chris Morgan napisal(a):
> From: Chris Morgan <macromorgan@hotmail.com>
>
> Add the EHCI and OHCI controller to the Allwinner v3s to support using
> USB in host mode.
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi | 23 ++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> index c87476ea31e2..e8a04476b776 100644
> --- a/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s.dtsi
> @@ -319,6 +319,29 @@ usbphy: phy@1c19400 {
> #phy-cells = <1>;
> };
>
> + ehci: usb@1c1a000 {
> + compatible = "allwinner,sun8i-v3s-ehci", "generic-ehci";
> + reg = <0x01c1a000 0x100>;
> + interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>;
> + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
> + phys = <&usbphy 0>;
> + phy-names = "usb";
> + status = "disabled";
> + };
> +
> + ohci: usb@1c1a400 {
> + compatible = "allwinner,sun8i-v3s-ohci", "generic-ohci";
> + reg = <0x01c1a400 0x100>;
> + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>,
> + <&ccu CLK_USB_OHCI0>;
> + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
> + phys = <&usbphy 0>;
> + phy-names = "usb";
> + status = "disabled";
> + };
> +
> ccu: clock@1c20000 {
> compatible = "allwinner,sun8i-v3s-ccu";
> reg = <0x01c20000 0x400>;
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
2023-09-22 9:31 ` Andre Przywara
@ 2023-09-24 19:33 ` Jernej Škrabec
2023-09-25 15:00 ` Chris Morgan
2023-09-27 20:28 ` Samuel Holland
2 siblings, 1 reply; 15+ messages in thread
From: Jernej Škrabec @ 2023-09-24 19:33 UTC (permalink / raw)
To: linux-sunxi, Chris Morgan
Cc: devicetree, mripard, uwu, samuel, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
Dne četrtek, 21. september 2023 ob 15:51:36 CEST je Chris Morgan napisal(a):
> From: Chris Morgan <macromorgan@hotmail.com>
>
> The Anbernic RG-Nano is a small portable game device based on the
> Allwinner V3s SoC. It has GPIO buttons on the face and side for
> input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> OTG port, an SD card slot for booting, and 64MB of RAM included in the
> SoC. There does not appear to be a crystal feeding the internal RTC so
> it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> period). External RTC works just fine.
>
> Working/Tested:
> - SDMMC
> - UART (for debugging)
> - Buttons
> - Charging/battery/PMIC
> - Speaker
> - RTC (external RTC)
> - USB
> - Display
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
> arch/arm/boot/dts/allwinner/Makefile | 1 +
> .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> 2 files changed, 285 insertions(+)
> create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
>
> diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> index eebb5a0c873a..2d26c3397f14 100644
> --- a/arch/arm/boot/dts/allwinner/Makefile
> +++ b/arch/arm/boot/dts/allwinner/Makefile
> @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> sun8i-t113s-mangopi-mq-r-t113.dtb \
> sun8i-t3-cqa3t-bv3.dtb \
> sun8i-v3-sl631-imx179.dtb \
> + sun8i-v3s-anbernic-rg-nano.dtb \
> sun8i-v3s-licheepi-zero.dtb \
> sun8i-v3s-licheepi-zero-dock.dtb \
> sun8i-v40-bananapi-m2-berry.dtb
> diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> new file mode 100644
> index 000000000000..1a4429dc57b1
> --- /dev/null
> +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> @@ -0,0 +1,284 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +
> +/dts-v1/;
> +#include <dt-bindings/input/linux-event-codes.h>
> +#include "sun8i-v3s.dtsi"
> +#include "sunxi-common-regulators.dtsi"
> +
> +/ {
> + model = "Anbernic RG Nano";
> + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> +
> + aliases {
> + rtc0 = &pcf8563;
> + rtc1 = &rtc;
> + serial0 = &uart0;
> + };
> +
> + backlight: backlight {
> + compatible = "pwm-backlight";
> + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> + default-brightness-level = <11>;
> + power-supply = <®_vcc5v0>;
> + pwms = <&pwm 0 40000 1>;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +
> + gpio_keys: gpio-keys {
> + compatible = "gpio-keys";
> +
> + button-a {
> + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-A";
> + linux,code = <BTN_EAST>;
> + };
> +
> + button-b {
> + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-B";
> + linux,code = <BTN_SOUTH>;
> + };
> +
> + button-down {
> + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-DOWN";
> + linux,code = <BTN_DPAD_DOWN>;
> + };
> +
> + button-left {
> + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-LEFT";
> + linux,code = <BTN_DPAD_LEFT>;
> + };
> +
> + button-right {
> + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-RIGHT";
> + linux,code = <BTN_DPAD_RIGHT>;
> + };
> +
> + button-se {
> + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-SELECT";
> + linux,code = <BTN_SELECT>;
> + };
> +
> + button-st {
> + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-START";
> + linux,code = <BTN_START>;
> + };
> +
> + button-tl {
> + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-L";
> + linux,code = <BTN_TL>;
> + };
> +
> + button-tr {
> + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-R";
> + linux,code = <BTN_TR>;
> + };
> +
> + button-up {
> + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "DPAD-UP";
> + linux,code = <BTN_DPAD_UP>;
> + };
> +
> + button-x {
> + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-X";
> + linux,code = <BTN_NORTH>;
> + };
> +
> + button-y {
> + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + label = "BTN-Y";
> + linux,code = <BTN_WEST>;
> + };
> + };
> +};
> +
> +&codec {
> + allwinner,audio-routing = "Speaker", "HP",
> + "MIC1", "Mic",
> + "Mic", "HBIAS";
> + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> + status = "okay";
> +};
> +
> +&ehci {
> + status = "okay";
> +};
> +
> +&i2c0 {
> + status = "okay";
> +
> + gpio_expander: gpio@20 {
> + compatible = "nxp,pcal6416";
> + reg = <0x20>;
> + gpio-controller;
> + #gpio-cells = <2>;
> + #interrupt-cells = <2>;
> + interrupt-controller;
> + interrupt-parent = <&pio>;
> + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> + vcc-supply = <®_vcc3v3>;
> + };
> +
> + axp209: pmic@34 {
> + reg = <0x34>;
> + interrupt-parent = <&pio>;
> + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> + };
> +
> + pcf8563: rtc@51 {
> + compatible = "nxp,pcf8563";
> + reg = <0x51>;
> + };
> +};
> +
> +#include "axp209.dtsi"
> +
> +&battery_power_supply {
> + status = "okay";
> +};
> +
> +&mmc0 {
> + broken-cd;
> + bus-width = <4>;
> + disable-wp;
> + vmmc-supply = <®_vcc3v3>;
> + vqmmc-supply = <®_vcc3v3>;
> + status = "okay";
> +};
> +
> +&ohci {
> + status = "okay";
> +};
> +
> +&pio {
> + vcc-pb-supply = <®_vcc3v3>;
> + vcc-pc-supply = <®_vcc3v3>;
> + vcc-pf-supply = <®_vcc3v3>;
> + vcc-pg-supply = <®_vcc3v3>;
> +
> + spi0_no_miso_pins: spi0-no-miso-pins {
> + pins = "PC1", "PC2", "PC3";
> + function = "spi0";
> + };
> +};
> +
> +&pwm {
> + pinctrl-0 = <&pwm0_pin>;
> + pinctrl-names = "default";
> + status = "okay";
> +};
> +
> +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> +®_dcdc2 {
> + regulator-always-on;
> + regulator-max-microvolt = <1250000>;
> + regulator-min-microvolt = <1250000>;
> + regulator-name = "vdd-cpu";
> +};
> +
> +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> +®_dcdc3 {
> + regulator-always-on;
> + regulator-max-microvolt = <3300000>;
> + regulator-min-microvolt = <3300000>;
> + regulator-name = "vcc-io";
> +};
> +
> +/*
> + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> + * software modified. Note that setting voltage here to 3.3v for accuracy
> + * sake causes an issue with the driver that causes it to fail to probe
> + * because of a voltage constraint in the driver.
> + */
Can you please remove any mention of drivers everywhere? DT is OS and
thus driver independent.
Once fixed:
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> +®_ldo1 {
> + regulator-always-on;
> + regulator-name = "vcc-rtc";
> +};
> +
> +/* LDO2 wired into VCC-PLL and audio codec. */
> +®_ldo2 {
> + regulator-always-on;
> + regulator-max-microvolt = <3000000>;
> + regulator-min-microvolt = <3000000>;
> + regulator-name = "vcc-pll";
> +};
> +
> +/* LDO3, LDO4, and LDO5 unused. */
> +®_ldo3 {
> + status = "disabled";
> +};
> +
> +®_ldo4 {
> + status = "disabled";
> +};
> +
> +/*
> + * Force the driver to use internal oscillator by removing clocks
> + * property.
> + */
> +&rtc {
> + /delete-property/ clocks;
> +};
> +
> +&spi0 {
> + pinctrl-0 = <&spi0_no_miso_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +
> + display@0 {
> + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> + reg = <0>;
> + backlight = <&backlight>;
> + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> + spi-max-frequency = <100000000>;
> +
> + height-mm = <39>;
> + width-mm = <39>;
> +
> + /* Set hb-porch to compensate for non-visible area */
> + panel-timing {
> + hactive = <240>;
> + vactive = <240>;
> + hback-porch = <80>;
> + vback-porch = <0>;
> + clock-frequency = <0>;
> + hfront-porch = <0>;
> + hsync-len = <0>;
> + vfront-porch = <0>;
> + vsync-len = <0>;
> + };
> + };
> +};
> +
> +&uart0 {
> + pinctrl-0 = <&uart0_pb_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +};
> +
> +&usb_otg {
> + dr_mode = "otg";
> + status = "okay";
> +};
> +
> +&usb_power_supply {
> + status = "okay";
> +};
> +
> +&usbphy {
> + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> + status = "okay";
> +};
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-24 19:33 ` Jernej Škrabec
@ 2023-09-25 15:00 ` Chris Morgan
2023-09-25 16:00 ` Jernej Škrabec
0 siblings, 1 reply; 15+ messages in thread
From: Chris Morgan @ 2023-09-25 15:00 UTC (permalink / raw)
To: Jernej Škrabec
Cc: linux-sunxi, Chris Morgan, devicetree, mripard, uwu, samuel, wens,
conor+dt, krzysztof.kozlowski+dt, robh+dt, andre.przywara
On Sun, Sep 24, 2023 at 09:33:53PM +0200, Jernej Škrabec wrote:
> Dne četrtek, 21. september 2023 ob 15:51:36 CEST je Chris Morgan napisal(a):
> > From: Chris Morgan <macromorgan@hotmail.com>
> >
> > The Anbernic RG-Nano is a small portable game device based on the
> > Allwinner V3s SoC. It has GPIO buttons on the face and side for
> > input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> > OTG port, an SD card slot for booting, and 64MB of RAM included in the
> > SoC. There does not appear to be a crystal feeding the internal RTC so
> > it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> > period). External RTC works just fine.
> >
> > Working/Tested:
> > - SDMMC
> > - UART (for debugging)
> > - Buttons
> > - Charging/battery/PMIC
> > - Speaker
> > - RTC (external RTC)
> > - USB
> > - Display
> >
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > ---
> > arch/arm/boot/dts/allwinner/Makefile | 1 +
> > .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> > 2 files changed, 285 insertions(+)
> > create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> >
> > diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> > index eebb5a0c873a..2d26c3397f14 100644
> > --- a/arch/arm/boot/dts/allwinner/Makefile
> > +++ b/arch/arm/boot/dts/allwinner/Makefile
> > @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> > sun8i-t113s-mangopi-mq-r-t113.dtb \
> > sun8i-t3-cqa3t-bv3.dtb \
> > sun8i-v3-sl631-imx179.dtb \
> > + sun8i-v3s-anbernic-rg-nano.dtb \
> > sun8i-v3s-licheepi-zero.dtb \
> > sun8i-v3s-licheepi-zero-dock.dtb \
> > sun8i-v40-bananapi-m2-berry.dtb
> > diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > new file mode 100644
> > index 000000000000..1a4429dc57b1
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > @@ -0,0 +1,284 @@
> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > +
> > +/dts-v1/;
> > +#include <dt-bindings/input/linux-event-codes.h>
> > +#include "sun8i-v3s.dtsi"
> > +#include "sunxi-common-regulators.dtsi"
> > +
> > +/ {
> > + model = "Anbernic RG Nano";
> > + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> > +
> > + aliases {
> > + rtc0 = &pcf8563;
> > + rtc1 = &rtc;
> > + serial0 = &uart0;
> > + };
> > +
> > + backlight: backlight {
> > + compatible = "pwm-backlight";
> > + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> > + default-brightness-level = <11>;
> > + power-supply = <®_vcc5v0>;
> > + pwms = <&pwm 0 40000 1>;
> > + };
> > +
> > + chosen {
> > + stdout-path = "serial0:115200n8";
> > + };
> > +
> > + gpio_keys: gpio-keys {
> > + compatible = "gpio-keys";
> > +
> > + button-a {
> > + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-A";
> > + linux,code = <BTN_EAST>;
> > + };
> > +
> > + button-b {
> > + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-B";
> > + linux,code = <BTN_SOUTH>;
> > + };
> > +
> > + button-down {
> > + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "DPAD-DOWN";
> > + linux,code = <BTN_DPAD_DOWN>;
> > + };
> > +
> > + button-left {
> > + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "DPAD-LEFT";
> > + linux,code = <BTN_DPAD_LEFT>;
> > + };
> > +
> > + button-right {
> > + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "DPAD-RIGHT";
> > + linux,code = <BTN_DPAD_RIGHT>;
> > + };
> > +
> > + button-se {
> > + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-SELECT";
> > + linux,code = <BTN_SELECT>;
> > + };
> > +
> > + button-st {
> > + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-START";
> > + linux,code = <BTN_START>;
> > + };
> > +
> > + button-tl {
> > + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-L";
> > + linux,code = <BTN_TL>;
> > + };
> > +
> > + button-tr {
> > + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-R";
> > + linux,code = <BTN_TR>;
> > + };
> > +
> > + button-up {
> > + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "DPAD-UP";
> > + linux,code = <BTN_DPAD_UP>;
> > + };
> > +
> > + button-x {
> > + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-X";
> > + linux,code = <BTN_NORTH>;
> > + };
> > +
> > + button-y {
> > + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > + label = "BTN-Y";
> > + linux,code = <BTN_WEST>;
> > + };
> > + };
> > +};
> > +
> > +&codec {
> > + allwinner,audio-routing = "Speaker", "HP",
> > + "MIC1", "Mic",
> > + "Mic", "HBIAS";
> > + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> > + status = "okay";
> > +};
> > +
> > +&ehci {
> > + status = "okay";
> > +};
> > +
> > +&i2c0 {
> > + status = "okay";
> > +
> > + gpio_expander: gpio@20 {
> > + compatible = "nxp,pcal6416";
> > + reg = <0x20>;
> > + gpio-controller;
> > + #gpio-cells = <2>;
> > + #interrupt-cells = <2>;
> > + interrupt-controller;
> > + interrupt-parent = <&pio>;
> > + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> > + vcc-supply = <®_vcc3v3>;
> > + };
> > +
> > + axp209: pmic@34 {
> > + reg = <0x34>;
> > + interrupt-parent = <&pio>;
> > + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> > + };
> > +
> > + pcf8563: rtc@51 {
> > + compatible = "nxp,pcf8563";
> > + reg = <0x51>;
> > + };
> > +};
> > +
> > +#include "axp209.dtsi"
> > +
> > +&battery_power_supply {
> > + status = "okay";
> > +};
> > +
> > +&mmc0 {
> > + broken-cd;
> > + bus-width = <4>;
> > + disable-wp;
> > + vmmc-supply = <®_vcc3v3>;
> > + vqmmc-supply = <®_vcc3v3>;
> > + status = "okay";
> > +};
> > +
> > +&ohci {
> > + status = "okay";
> > +};
> > +
> > +&pio {
> > + vcc-pb-supply = <®_vcc3v3>;
> > + vcc-pc-supply = <®_vcc3v3>;
> > + vcc-pf-supply = <®_vcc3v3>;
> > + vcc-pg-supply = <®_vcc3v3>;
> > +
> > + spi0_no_miso_pins: spi0-no-miso-pins {
> > + pins = "PC1", "PC2", "PC3";
> > + function = "spi0";
> > + };
> > +};
> > +
> > +&pwm {
> > + pinctrl-0 = <&pwm0_pin>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +};
> > +
> > +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> > +®_dcdc2 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <1250000>;
> > + regulator-min-microvolt = <1250000>;
> > + regulator-name = "vdd-cpu";
> > +};
> > +
> > +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> > +®_dcdc3 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <3300000>;
> > + regulator-min-microvolt = <3300000>;
> > + regulator-name = "vcc-io";
> > +};
> > +
> > +/*
> > + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> > + * software modified. Note that setting voltage here to 3.3v for accuracy
> > + * sake causes an issue with the driver that causes it to fail to probe
> > + * because of a voltage constraint in the driver.
> > + */
>
> Can you please remove any mention of drivers everywhere? DT is OS and
> thus driver independent.
>
> Once fixed:
> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
This note was added due to prior comments because in this very specific
case we're working around a driver issue. Sadly if I accurately
describe the hardware the PMIC and devices that depend on it will fail
to probe (the hardware is 3.3v, but here it's set as 1.3v).
https://lore.kernel.org/linux-sunxi/20230629203410.660eb9a4@slackpad.lan/
Thank you,
Chris
>
> Best regards,
> Jernej
>
> > +®_ldo1 {
> > + regulator-always-on;
> > + regulator-name = "vcc-rtc";
> > +};
> > +
> > +/* LDO2 wired into VCC-PLL and audio codec. */
> > +®_ldo2 {
> > + regulator-always-on;
> > + regulator-max-microvolt = <3000000>;
> > + regulator-min-microvolt = <3000000>;
> > + regulator-name = "vcc-pll";
> > +};
> > +
> > +/* LDO3, LDO4, and LDO5 unused. */
> > +®_ldo3 {
> > + status = "disabled";
> > +};
> > +
> > +®_ldo4 {
> > + status = "disabled";
> > +};
> > +
> > +/*
> > + * Force the driver to use internal oscillator by removing clocks
> > + * property.
> > + */
> > +&rtc {
> > + /delete-property/ clocks;
> > +};
> > +
> > +&spi0 {
> > + pinctrl-0 = <&spi0_no_miso_pins>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +
> > + display@0 {
> > + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> > + reg = <0>;
> > + backlight = <&backlight>;
> > + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> > + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> > + spi-max-frequency = <100000000>;
> > +
> > + height-mm = <39>;
> > + width-mm = <39>;
> > +
> > + /* Set hb-porch to compensate for non-visible area */
> > + panel-timing {
> > + hactive = <240>;
> > + vactive = <240>;
> > + hback-porch = <80>;
> > + vback-porch = <0>;
> > + clock-frequency = <0>;
> > + hfront-porch = <0>;
> > + hsync-len = <0>;
> > + vfront-porch = <0>;
> > + vsync-len = <0>;
> > + };
> > + };
> > +};
> > +
> > +&uart0 {
> > + pinctrl-0 = <&uart0_pb_pins>;
> > + pinctrl-names = "default";
> > + status = "okay";
> > +};
> > +
> > +&usb_otg {
> > + dr_mode = "otg";
> > + status = "okay";
> > +};
> > +
> > +&usb_power_supply {
> > + status = "okay";
> > +};
> > +
> > +&usbphy {
> > + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> > + status = "okay";
> > +};
> >
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-25 15:00 ` Chris Morgan
@ 2023-09-25 16:00 ` Jernej Škrabec
2023-09-27 14:14 ` Chris Morgan
0 siblings, 1 reply; 15+ messages in thread
From: Jernej Škrabec @ 2023-09-25 16:00 UTC (permalink / raw)
To: Chris Morgan
Cc: linux-sunxi, Chris Morgan, devicetree, mripard, uwu, samuel, wens,
conor+dt, krzysztof.kozlowski+dt, robh+dt, andre.przywara
Dne ponedeljek, 25. september 2023 ob 17:00:33 CEST je Chris Morgan napisal(a):
> On Sun, Sep 24, 2023 at 09:33:53PM +0200, Jernej Škrabec wrote:
> > Dne četrtek, 21. september 2023 ob 15:51:36 CEST je Chris Morgan napisal(a):
> > > From: Chris Morgan <macromorgan@hotmail.com>
> > >
> > > The Anbernic RG-Nano is a small portable game device based on the
> > > Allwinner V3s SoC. It has GPIO buttons on the face and side for
> > > input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> > > OTG port, an SD card slot for booting, and 64MB of RAM included in the
> > > SoC. There does not appear to be a crystal feeding the internal RTC so
> > > it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> > > period). External RTC works just fine.
> > >
> > > Working/Tested:
> > > - SDMMC
> > > - UART (for debugging)
> > > - Buttons
> > > - Charging/battery/PMIC
> > > - Speaker
> > > - RTC (external RTC)
> > > - USB
> > > - Display
> > >
> > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > > ---
> > > arch/arm/boot/dts/allwinner/Makefile | 1 +
> > > .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> > > 2 files changed, 285 insertions(+)
> > > create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > >
> > > diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> > > index eebb5a0c873a..2d26c3397f14 100644
> > > --- a/arch/arm/boot/dts/allwinner/Makefile
> > > +++ b/arch/arm/boot/dts/allwinner/Makefile
> > > @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> > > sun8i-t113s-mangopi-mq-r-t113.dtb \
> > > sun8i-t3-cqa3t-bv3.dtb \
> > > sun8i-v3-sl631-imx179.dtb \
> > > + sun8i-v3s-anbernic-rg-nano.dtb \
> > > sun8i-v3s-licheepi-zero.dtb \
> > > sun8i-v3s-licheepi-zero-dock.dtb \
> > > sun8i-v40-bananapi-m2-berry.dtb
> > > diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > new file mode 100644
> > > index 000000000000..1a4429dc57b1
> > > --- /dev/null
> > > +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > @@ -0,0 +1,284 @@
> > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > > +
> > > +/dts-v1/;
> > > +#include <dt-bindings/input/linux-event-codes.h>
> > > +#include "sun8i-v3s.dtsi"
> > > +#include "sunxi-common-regulators.dtsi"
> > > +
> > > +/ {
> > > + model = "Anbernic RG Nano";
> > > + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> > > +
> > > + aliases {
> > > + rtc0 = &pcf8563;
> > > + rtc1 = &rtc;
> > > + serial0 = &uart0;
> > > + };
> > > +
> > > + backlight: backlight {
> > > + compatible = "pwm-backlight";
> > > + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> > > + default-brightness-level = <11>;
> > > + power-supply = <®_vcc5v0>;
> > > + pwms = <&pwm 0 40000 1>;
> > > + };
> > > +
> > > + chosen {
> > > + stdout-path = "serial0:115200n8";
> > > + };
> > > +
> > > + gpio_keys: gpio-keys {
> > > + compatible = "gpio-keys";
> > > +
> > > + button-a {
> > > + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-A";
> > > + linux,code = <BTN_EAST>;
> > > + };
> > > +
> > > + button-b {
> > > + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-B";
> > > + linux,code = <BTN_SOUTH>;
> > > + };
> > > +
> > > + button-down {
> > > + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "DPAD-DOWN";
> > > + linux,code = <BTN_DPAD_DOWN>;
> > > + };
> > > +
> > > + button-left {
> > > + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "DPAD-LEFT";
> > > + linux,code = <BTN_DPAD_LEFT>;
> > > + };
> > > +
> > > + button-right {
> > > + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "DPAD-RIGHT";
> > > + linux,code = <BTN_DPAD_RIGHT>;
> > > + };
> > > +
> > > + button-se {
> > > + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-SELECT";
> > > + linux,code = <BTN_SELECT>;
> > > + };
> > > +
> > > + button-st {
> > > + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-START";
> > > + linux,code = <BTN_START>;
> > > + };
> > > +
> > > + button-tl {
> > > + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-L";
> > > + linux,code = <BTN_TL>;
> > > + };
> > > +
> > > + button-tr {
> > > + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-R";
> > > + linux,code = <BTN_TR>;
> > > + };
> > > +
> > > + button-up {
> > > + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "DPAD-UP";
> > > + linux,code = <BTN_DPAD_UP>;
> > > + };
> > > +
> > > + button-x {
> > > + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-X";
> > > + linux,code = <BTN_NORTH>;
> > > + };
> > > +
> > > + button-y {
> > > + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > + label = "BTN-Y";
> > > + linux,code = <BTN_WEST>;
> > > + };
> > > + };
> > > +};
> > > +
> > > +&codec {
> > > + allwinner,audio-routing = "Speaker", "HP",
> > > + "MIC1", "Mic",
> > > + "Mic", "HBIAS";
> > > + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> > > + status = "okay";
> > > +};
> > > +
> > > +&ehci {
> > > + status = "okay";
> > > +};
> > > +
> > > +&i2c0 {
> > > + status = "okay";
> > > +
> > > + gpio_expander: gpio@20 {
> > > + compatible = "nxp,pcal6416";
> > > + reg = <0x20>;
> > > + gpio-controller;
> > > + #gpio-cells = <2>;
> > > + #interrupt-cells = <2>;
> > > + interrupt-controller;
> > > + interrupt-parent = <&pio>;
> > > + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> > > + vcc-supply = <®_vcc3v3>;
> > > + };
> > > +
> > > + axp209: pmic@34 {
> > > + reg = <0x34>;
> > > + interrupt-parent = <&pio>;
> > > + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> > > + };
> > > +
> > > + pcf8563: rtc@51 {
> > > + compatible = "nxp,pcf8563";
> > > + reg = <0x51>;
> > > + };
> > > +};
> > > +
> > > +#include "axp209.dtsi"
> > > +
> > > +&battery_power_supply {
> > > + status = "okay";
> > > +};
> > > +
> > > +&mmc0 {
> > > + broken-cd;
> > > + bus-width = <4>;
> > > + disable-wp;
> > > + vmmc-supply = <®_vcc3v3>;
> > > + vqmmc-supply = <®_vcc3v3>;
> > > + status = "okay";
> > > +};
> > > +
> > > +&ohci {
> > > + status = "okay";
> > > +};
> > > +
> > > +&pio {
> > > + vcc-pb-supply = <®_vcc3v3>;
> > > + vcc-pc-supply = <®_vcc3v3>;
> > > + vcc-pf-supply = <®_vcc3v3>;
> > > + vcc-pg-supply = <®_vcc3v3>;
> > > +
> > > + spi0_no_miso_pins: spi0-no-miso-pins {
> > > + pins = "PC1", "PC2", "PC3";
> > > + function = "spi0";
> > > + };
> > > +};
> > > +
> > > +&pwm {
> > > + pinctrl-0 = <&pwm0_pin>;
> > > + pinctrl-names = "default";
> > > + status = "okay";
> > > +};
> > > +
> > > +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> > > +®_dcdc2 {
> > > + regulator-always-on;
> > > + regulator-max-microvolt = <1250000>;
> > > + regulator-min-microvolt = <1250000>;
> > > + regulator-name = "vdd-cpu";
> > > +};
> > > +
> > > +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> > > +®_dcdc3 {
> > > + regulator-always-on;
> > > + regulator-max-microvolt = <3300000>;
> > > + regulator-min-microvolt = <3300000>;
> > > + regulator-name = "vcc-io";
> > > +};
> > > +
> > > +/*
> > > + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> > > + * software modified. Note that setting voltage here to 3.3v for accuracy
> > > + * sake causes an issue with the driver that causes it to fail to probe
> > > + * because of a voltage constraint in the driver.
> > > + */
> >
> > Can you please remove any mention of drivers everywhere? DT is OS and
> > thus driver independent.
> >
> > Once fixed:
> > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
>
> This note was added due to prior comments because in this very specific
> case we're working around a driver issue. Sadly if I accurately
> describe the hardware the PMIC and devices that depend on it will fail
> to probe (the hardware is 3.3v, but here it's set as 1.3v).
>
> https://lore.kernel.org/linux-sunxi/20230629203410.660eb9a4@slackpad.lan/
Sorry, I should follow conversation more closely. Procedure in such cases
is to fix driver first and then submit proper DT file. While DT files
reside in Linux source, they are often used by diferent projects, like
U-Boot or FreeBSD, so we can't make hacks just because Linux driver doesn't
work.
>
> Thank you,
> Chris
>
> >
> > Best regards,
> > Jernej
> >
> > > +®_ldo1 {
> > > + regulator-always-on;
> > > + regulator-name = "vcc-rtc";
> > > +};
> > > +
> > > +/* LDO2 wired into VCC-PLL and audio codec. */
> > > +®_ldo2 {
> > > + regulator-always-on;
> > > + regulator-max-microvolt = <3000000>;
> > > + regulator-min-microvolt = <3000000>;
> > > + regulator-name = "vcc-pll";
> > > +};
> > > +
> > > +/* LDO3, LDO4, and LDO5 unused. */
> > > +®_ldo3 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +®_ldo4 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +/*
> > > + * Force the driver to use internal oscillator by removing clocks
> > > + * property.
> > > + */
This should be reworded to avoid mentioning driver. Like: "RTC uses
internal oscillator".
Best regards,
Jernej
> > > +&rtc {
> > > + /delete-property/ clocks;
> > > +};
> > > +
> > > +&spi0 {
> > > + pinctrl-0 = <&spi0_no_miso_pins>;
> > > + pinctrl-names = "default";
> > > + status = "okay";
> > > +
> > > + display@0 {
> > > + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> > > + reg = <0>;
> > > + backlight = <&backlight>;
> > > + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> > > + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> > > + spi-max-frequency = <100000000>;
> > > +
> > > + height-mm = <39>;
> > > + width-mm = <39>;
> > > +
> > > + /* Set hb-porch to compensate for non-visible area */
> > > + panel-timing {
> > > + hactive = <240>;
> > > + vactive = <240>;
> > > + hback-porch = <80>;
> > > + vback-porch = <0>;
> > > + clock-frequency = <0>;
> > > + hfront-porch = <0>;
> > > + hsync-len = <0>;
> > > + vfront-porch = <0>;
> > > + vsync-len = <0>;
> > > + };
> > > + };
> > > +};
> > > +
> > > +&uart0 {
> > > + pinctrl-0 = <&uart0_pb_pins>;
> > > + pinctrl-names = "default";
> > > + status = "okay";
> > > +};
> > > +
> > > +&usb_otg {
> > > + dr_mode = "otg";
> > > + status = "okay";
> > > +};
> > > +
> > > +&usb_power_supply {
> > > + status = "okay";
> > > +};
> > > +
> > > +&usbphy {
> > > + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> > > + status = "okay";
> > > +};
> > >
> >
> >
> >
> >
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-25 16:00 ` Jernej Škrabec
@ 2023-09-27 14:14 ` Chris Morgan
2023-09-27 17:53 ` Jernej Škrabec
0 siblings, 1 reply; 15+ messages in thread
From: Chris Morgan @ 2023-09-27 14:14 UTC (permalink / raw)
To: Jernej Škrabec
Cc: linux-sunxi, Chris Morgan, devicetree, mripard, uwu, samuel, wens,
conor+dt, krzysztof.kozlowski+dt, robh+dt, andre.przywara
On Mon, Sep 25, 2023 at 06:00:46PM +0200, Jernej Škrabec wrote:
> Dne ponedeljek, 25. september 2023 ob 17:00:33 CEST je Chris Morgan napisal(a):
> > On Sun, Sep 24, 2023 at 09:33:53PM +0200, Jernej Škrabec wrote:
> > > Dne četrtek, 21. september 2023 ob 15:51:36 CEST je Chris Morgan napisal(a):
> > > > From: Chris Morgan <macromorgan@hotmail.com>
> > > >
> > > > The Anbernic RG-Nano is a small portable game device based on the
> > > > Allwinner V3s SoC. It has GPIO buttons on the face and side for
> > > > input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> > > > OTG port, an SD card slot for booting, and 64MB of RAM included in the
> > > > SoC. There does not appear to be a crystal feeding the internal RTC so
> > > > it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> > > > period). External RTC works just fine.
> > > >
> > > > Working/Tested:
> > > > - SDMMC
> > > > - UART (for debugging)
> > > > - Buttons
> > > > - Charging/battery/PMIC
> > > > - Speaker
> > > > - RTC (external RTC)
> > > > - USB
> > > > - Display
> > > >
> > > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > > > ---
> > > > arch/arm/boot/dts/allwinner/Makefile | 1 +
> > > > .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> > > > 2 files changed, 285 insertions(+)
> > > > create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > >
> > > > diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> > > > index eebb5a0c873a..2d26c3397f14 100644
> > > > --- a/arch/arm/boot/dts/allwinner/Makefile
> > > > +++ b/arch/arm/boot/dts/allwinner/Makefile
> > > > @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> > > > sun8i-t113s-mangopi-mq-r-t113.dtb \
> > > > sun8i-t3-cqa3t-bv3.dtb \
> > > > sun8i-v3-sl631-imx179.dtb \
> > > > + sun8i-v3s-anbernic-rg-nano.dtb \
> > > > sun8i-v3s-licheepi-zero.dtb \
> > > > sun8i-v3s-licheepi-zero-dock.dtb \
> > > > sun8i-v40-bananapi-m2-berry.dtb
> > > > diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > > new file mode 100644
> > > > index 000000000000..1a4429dc57b1
> > > > --- /dev/null
> > > > +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > > @@ -0,0 +1,284 @@
> > > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > > > +
> > > > +/dts-v1/;
> > > > +#include <dt-bindings/input/linux-event-codes.h>
> > > > +#include "sun8i-v3s.dtsi"
> > > > +#include "sunxi-common-regulators.dtsi"
> > > > +
> > > > +/ {
> > > > + model = "Anbernic RG Nano";
> > > > + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> > > > +
> > > > + aliases {
> > > > + rtc0 = &pcf8563;
> > > > + rtc1 = &rtc;
> > > > + serial0 = &uart0;
> > > > + };
> > > > +
> > > > + backlight: backlight {
> > > > + compatible = "pwm-backlight";
> > > > + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> > > > + default-brightness-level = <11>;
> > > > + power-supply = <®_vcc5v0>;
> > > > + pwms = <&pwm 0 40000 1>;
> > > > + };
> > > > +
> > > > + chosen {
> > > > + stdout-path = "serial0:115200n8";
> > > > + };
> > > > +
> > > > + gpio_keys: gpio-keys {
> > > > + compatible = "gpio-keys";
> > > > +
> > > > + button-a {
> > > > + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-A";
> > > > + linux,code = <BTN_EAST>;
> > > > + };
> > > > +
> > > > + button-b {
> > > > + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-B";
> > > > + linux,code = <BTN_SOUTH>;
> > > > + };
> > > > +
> > > > + button-down {
> > > > + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "DPAD-DOWN";
> > > > + linux,code = <BTN_DPAD_DOWN>;
> > > > + };
> > > > +
> > > > + button-left {
> > > > + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "DPAD-LEFT";
> > > > + linux,code = <BTN_DPAD_LEFT>;
> > > > + };
> > > > +
> > > > + button-right {
> > > > + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "DPAD-RIGHT";
> > > > + linux,code = <BTN_DPAD_RIGHT>;
> > > > + };
> > > > +
> > > > + button-se {
> > > > + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-SELECT";
> > > > + linux,code = <BTN_SELECT>;
> > > > + };
> > > > +
> > > > + button-st {
> > > > + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-START";
> > > > + linux,code = <BTN_START>;
> > > > + };
> > > > +
> > > > + button-tl {
> > > > + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-L";
> > > > + linux,code = <BTN_TL>;
> > > > + };
> > > > +
> > > > + button-tr {
> > > > + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-R";
> > > > + linux,code = <BTN_TR>;
> > > > + };
> > > > +
> > > > + button-up {
> > > > + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "DPAD-UP";
> > > > + linux,code = <BTN_DPAD_UP>;
> > > > + };
> > > > +
> > > > + button-x {
> > > > + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-X";
> > > > + linux,code = <BTN_NORTH>;
> > > > + };
> > > > +
> > > > + button-y {
> > > > + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > + label = "BTN-Y";
> > > > + linux,code = <BTN_WEST>;
> > > > + };
> > > > + };
> > > > +};
> > > > +
> > > > +&codec {
> > > > + allwinner,audio-routing = "Speaker", "HP",
> > > > + "MIC1", "Mic",
> > > > + "Mic", "HBIAS";
> > > > + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&ehci {
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&i2c0 {
> > > > + status = "okay";
> > > > +
> > > > + gpio_expander: gpio@20 {
> > > > + compatible = "nxp,pcal6416";
> > > > + reg = <0x20>;
> > > > + gpio-controller;
> > > > + #gpio-cells = <2>;
> > > > + #interrupt-cells = <2>;
> > > > + interrupt-controller;
> > > > + interrupt-parent = <&pio>;
> > > > + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> > > > + vcc-supply = <®_vcc3v3>;
> > > > + };
> > > > +
> > > > + axp209: pmic@34 {
> > > > + reg = <0x34>;
> > > > + interrupt-parent = <&pio>;
> > > > + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> > > > + };
> > > > +
> > > > + pcf8563: rtc@51 {
> > > > + compatible = "nxp,pcf8563";
> > > > + reg = <0x51>;
> > > > + };
> > > > +};
> > > > +
> > > > +#include "axp209.dtsi"
> > > > +
> > > > +&battery_power_supply {
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&mmc0 {
> > > > + broken-cd;
> > > > + bus-width = <4>;
> > > > + disable-wp;
> > > > + vmmc-supply = <®_vcc3v3>;
> > > > + vqmmc-supply = <®_vcc3v3>;
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&ohci {
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&pio {
> > > > + vcc-pb-supply = <®_vcc3v3>;
> > > > + vcc-pc-supply = <®_vcc3v3>;
> > > > + vcc-pf-supply = <®_vcc3v3>;
> > > > + vcc-pg-supply = <®_vcc3v3>;
> > > > +
> > > > + spi0_no_miso_pins: spi0-no-miso-pins {
> > > > + pins = "PC1", "PC2", "PC3";
> > > > + function = "spi0";
> > > > + };
> > > > +};
> > > > +
> > > > +&pwm {
> > > > + pinctrl-0 = <&pwm0_pin>;
> > > > + pinctrl-names = "default";
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> > > > +®_dcdc2 {
> > > > + regulator-always-on;
> > > > + regulator-max-microvolt = <1250000>;
> > > > + regulator-min-microvolt = <1250000>;
> > > > + regulator-name = "vdd-cpu";
> > > > +};
> > > > +
> > > > +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> > > > +®_dcdc3 {
> > > > + regulator-always-on;
> > > > + regulator-max-microvolt = <3300000>;
> > > > + regulator-min-microvolt = <3300000>;
> > > > + regulator-name = "vcc-io";
> > > > +};
> > > > +
> > > > +/*
> > > > + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> > > > + * software modified. Note that setting voltage here to 3.3v for accuracy
> > > > + * sake causes an issue with the driver that causes it to fail to probe
> > > > + * because of a voltage constraint in the driver.
> > > > + */
> > >
> > > Can you please remove any mention of drivers everywhere? DT is OS and
> > > thus driver independent.
> > >
> > > Once fixed:
> > > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> >
> > This note was added due to prior comments because in this very specific
> > case we're working around a driver issue. Sadly if I accurately
> > describe the hardware the PMIC and devices that depend on it will fail
> > to probe (the hardware is 3.3v, but here it's set as 1.3v).
> >
> > https://lore.kernel.org/linux-sunxi/20230629203410.660eb9a4@slackpad.lan/
>
> Sorry, I should follow conversation more closely. Procedure in such cases
> is to fix driver first and then submit proper DT file. While DT files
> reside in Linux source, they are often used by diferent projects, like
> U-Boot or FreeBSD, so we can't make hacks just because Linux driver doesn't
> work.
I'll drop all but the note that "LDO1 is wired into RTC and voltage is
hard wired at 3.3v". That accurately describes the hardware, so will
that work?
>
> >
> > Thank you,
> > Chris
> >
> > >
> > > Best regards,
> > > Jernej
> > >
> > > > +®_ldo1 {
> > > > + regulator-always-on;
> > > > + regulator-name = "vcc-rtc";
> > > > +};
> > > > +
> > > > +/* LDO2 wired into VCC-PLL and audio codec. */
> > > > +®_ldo2 {
> > > > + regulator-always-on;
> > > > + regulator-max-microvolt = <3000000>;
> > > > + regulator-min-microvolt = <3000000>;
> > > > + regulator-name = "vcc-pll";
> > > > +};
> > > > +
> > > > +/* LDO3, LDO4, and LDO5 unused. */
> > > > +®_ldo3 {
> > > > + status = "disabled";
> > > > +};
> > > > +
> > > > +®_ldo4 {
> > > > + status = "disabled";
> > > > +};
> > > > +
> > > > +/*
> > > > + * Force the driver to use internal oscillator by removing clocks
> > > > + * property.
> > > > + */
>
> This should be reworded to avoid mentioning driver. Like: "RTC uses
> internal oscillator".
>
> Best regards,
> Jernej
>
You got it.
> > > > +&rtc {
> > > > + /delete-property/ clocks;
> > > > +};
> > > > +
> > > > +&spi0 {
> > > > + pinctrl-0 = <&spi0_no_miso_pins>;
> > > > + pinctrl-names = "default";
> > > > + status = "okay";
> > > > +
> > > > + display@0 {
> > > > + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> > > > + reg = <0>;
> > > > + backlight = <&backlight>;
> > > > + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> > > > + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> > > > + spi-max-frequency = <100000000>;
> > > > +
> > > > + height-mm = <39>;
> > > > + width-mm = <39>;
> > > > +
> > > > + /* Set hb-porch to compensate for non-visible area */
> > > > + panel-timing {
> > > > + hactive = <240>;
> > > > + vactive = <240>;
> > > > + hback-porch = <80>;
> > > > + vback-porch = <0>;
> > > > + clock-frequency = <0>;
> > > > + hfront-porch = <0>;
> > > > + hsync-len = <0>;
> > > > + vfront-porch = <0>;
> > > > + vsync-len = <0>;
> > > > + };
> > > > + };
> > > > +};
> > > > +
> > > > +&uart0 {
> > > > + pinctrl-0 = <&uart0_pb_pins>;
> > > > + pinctrl-names = "default";
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&usb_otg {
> > > > + dr_mode = "otg";
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&usb_power_supply {
> > > > + status = "okay";
> > > > +};
> > > > +
> > > > +&usbphy {
> > > > + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> > > > + status = "okay";
> > > > +};
> > > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
Thank you,
Chris
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-27 14:14 ` Chris Morgan
@ 2023-09-27 17:53 ` Jernej Škrabec
0 siblings, 0 replies; 15+ messages in thread
From: Jernej Škrabec @ 2023-09-27 17:53 UTC (permalink / raw)
To: Chris Morgan
Cc: linux-sunxi, Chris Morgan, devicetree, mripard, uwu, samuel, wens,
conor+dt, krzysztof.kozlowski+dt, robh+dt, andre.przywara
Dne sreda, 27. september 2023 ob 16:14:03 CEST je Chris Morgan napisal(a):
> On Mon, Sep 25, 2023 at 06:00:46PM +0200, Jernej Škrabec wrote:
> > Dne ponedeljek, 25. september 2023 ob 17:00:33 CEST je Chris Morgan napisal(a):
> > > On Sun, Sep 24, 2023 at 09:33:53PM +0200, Jernej Škrabec wrote:
> > > > Dne četrtek, 21. september 2023 ob 15:51:36 CEST je Chris Morgan napisal(a):
> > > > > From: Chris Morgan <macromorgan@hotmail.com>
> > > > >
> > > > > The Anbernic RG-Nano is a small portable game device based on the
> > > > > Allwinner V3s SoC. It has GPIO buttons on the face and side for
> > > > > input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> > > > > OTG port, an SD card slot for booting, and 64MB of RAM included in the
> > > > > SoC. There does not appear to be a crystal feeding the internal RTC so
> > > > > it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> > > > > period). External RTC works just fine.
> > > > >
> > > > > Working/Tested:
> > > > > - SDMMC
> > > > > - UART (for debugging)
> > > > > - Buttons
> > > > > - Charging/battery/PMIC
> > > > > - Speaker
> > > > > - RTC (external RTC)
> > > > > - USB
> > > > > - Display
> > > > >
> > > > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > > > > ---
> > > > > arch/arm/boot/dts/allwinner/Makefile | 1 +
> > > > > .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> > > > > 2 files changed, 285 insertions(+)
> > > > > create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > > >
> > > > > diff --git a/arch/arm/boot/dts/allwinner/Makefile b/arch/arm/boot/dts/allwinner/Makefile
> > > > > index eebb5a0c873a..2d26c3397f14 100644
> > > > > --- a/arch/arm/boot/dts/allwinner/Makefile
> > > > > +++ b/arch/arm/boot/dts/allwinner/Makefile
> > > > > @@ -256,6 +256,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
> > > > > sun8i-t113s-mangopi-mq-r-t113.dtb \
> > > > > sun8i-t3-cqa3t-bv3.dtb \
> > > > > sun8i-v3-sl631-imx179.dtb \
> > > > > + sun8i-v3s-anbernic-rg-nano.dtb \
> > > > > sun8i-v3s-licheepi-zero.dtb \
> > > > > sun8i-v3s-licheepi-zero-dock.dtb \
> > > > > sun8i-v40-bananapi-m2-berry.dtb
> > > > > diff --git a/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > > > new file mode 100644
> > > > > index 000000000000..1a4429dc57b1
> > > > > --- /dev/null
> > > > > +++ b/arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
> > > > > @@ -0,0 +1,284 @@
> > > > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > > > > +
> > > > > +/dts-v1/;
> > > > > +#include <dt-bindings/input/linux-event-codes.h>
> > > > > +#include "sun8i-v3s.dtsi"
> > > > > +#include "sunxi-common-regulators.dtsi"
> > > > > +
> > > > > +/ {
> > > > > + model = "Anbernic RG Nano";
> > > > > + compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
> > > > > +
> > > > > + aliases {
> > > > > + rtc0 = &pcf8563;
> > > > > + rtc1 = &rtc;
> > > > > + serial0 = &uart0;
> > > > > + };
> > > > > +
> > > > > + backlight: backlight {
> > > > > + compatible = "pwm-backlight";
> > > > > + brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
> > > > > + default-brightness-level = <11>;
> > > > > + power-supply = <®_vcc5v0>;
> > > > > + pwms = <&pwm 0 40000 1>;
> > > > > + };
> > > > > +
> > > > > + chosen {
> > > > > + stdout-path = "serial0:115200n8";
> > > > > + };
> > > > > +
> > > > > + gpio_keys: gpio-keys {
> > > > > + compatible = "gpio-keys";
> > > > > +
> > > > > + button-a {
> > > > > + gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-A";
> > > > > + linux,code = <BTN_EAST>;
> > > > > + };
> > > > > +
> > > > > + button-b {
> > > > > + gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-B";
> > > > > + linux,code = <BTN_SOUTH>;
> > > > > + };
> > > > > +
> > > > > + button-down {
> > > > > + gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "DPAD-DOWN";
> > > > > + linux,code = <BTN_DPAD_DOWN>;
> > > > > + };
> > > > > +
> > > > > + button-left {
> > > > > + gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "DPAD-LEFT";
> > > > > + linux,code = <BTN_DPAD_LEFT>;
> > > > > + };
> > > > > +
> > > > > + button-right {
> > > > > + gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "DPAD-RIGHT";
> > > > > + linux,code = <BTN_DPAD_RIGHT>;
> > > > > + };
> > > > > +
> > > > > + button-se {
> > > > > + gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-SELECT";
> > > > > + linux,code = <BTN_SELECT>;
> > > > > + };
> > > > > +
> > > > > + button-st {
> > > > > + gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-START";
> > > > > + linux,code = <BTN_START>;
> > > > > + };
> > > > > +
> > > > > + button-tl {
> > > > > + gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-L";
> > > > > + linux,code = <BTN_TL>;
> > > > > + };
> > > > > +
> > > > > + button-tr {
> > > > > + gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-R";
> > > > > + linux,code = <BTN_TR>;
> > > > > + };
> > > > > +
> > > > > + button-up {
> > > > > + gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "DPAD-UP";
> > > > > + linux,code = <BTN_DPAD_UP>;
> > > > > + };
> > > > > +
> > > > > + button-x {
> > > > > + gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-X";
> > > > > + linux,code = <BTN_NORTH>;
> > > > > + };
> > > > > +
> > > > > + button-y {
> > > > > + gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> > > > > + label = "BTN-Y";
> > > > > + linux,code = <BTN_WEST>;
> > > > > + };
> > > > > + };
> > > > > +};
> > > > > +
> > > > > +&codec {
> > > > > + allwinner,audio-routing = "Speaker", "HP",
> > > > > + "MIC1", "Mic",
> > > > > + "Mic", "HBIAS";
> > > > > + allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&ehci {
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&i2c0 {
> > > > > + status = "okay";
> > > > > +
> > > > > + gpio_expander: gpio@20 {
> > > > > + compatible = "nxp,pcal6416";
> > > > > + reg = <0x20>;
> > > > > + gpio-controller;
> > > > > + #gpio-cells = <2>;
> > > > > + #interrupt-cells = <2>;
> > > > > + interrupt-controller;
> > > > > + interrupt-parent = <&pio>;
> > > > > + interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
> > > > > + vcc-supply = <®_vcc3v3>;
> > > > > + };
> > > > > +
> > > > > + axp209: pmic@34 {
> > > > > + reg = <0x34>;
> > > > > + interrupt-parent = <&pio>;
> > > > > + interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
> > > > > + };
> > > > > +
> > > > > + pcf8563: rtc@51 {
> > > > > + compatible = "nxp,pcf8563";
> > > > > + reg = <0x51>;
> > > > > + };
> > > > > +};
> > > > > +
> > > > > +#include "axp209.dtsi"
> > > > > +
> > > > > +&battery_power_supply {
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&mmc0 {
> > > > > + broken-cd;
> > > > > + bus-width = <4>;
> > > > > + disable-wp;
> > > > > + vmmc-supply = <®_vcc3v3>;
> > > > > + vqmmc-supply = <®_vcc3v3>;
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&ohci {
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&pio {
> > > > > + vcc-pb-supply = <®_vcc3v3>;
> > > > > + vcc-pc-supply = <®_vcc3v3>;
> > > > > + vcc-pf-supply = <®_vcc3v3>;
> > > > > + vcc-pg-supply = <®_vcc3v3>;
> > > > > +
> > > > > + spi0_no_miso_pins: spi0-no-miso-pins {
> > > > > + pins = "PC1", "PC2", "PC3";
> > > > > + function = "spi0";
> > > > > + };
> > > > > +};
> > > > > +
> > > > > +&pwm {
> > > > > + pinctrl-0 = <&pwm0_pin>;
> > > > > + pinctrl-names = "default";
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
> > > > > +®_dcdc2 {
> > > > > + regulator-always-on;
> > > > > + regulator-max-microvolt = <1250000>;
> > > > > + regulator-min-microvolt = <1250000>;
> > > > > + regulator-name = "vdd-cpu";
> > > > > +};
> > > > > +
> > > > > +/* DCDC3 wired into every 3.3v input that isn't the RTC. */
> > > > > +®_dcdc3 {
> > > > > + regulator-always-on;
> > > > > + regulator-max-microvolt = <3300000>;
> > > > > + regulator-min-microvolt = <3300000>;
> > > > > + regulator-name = "vcc-io";
> > > > > +};
> > > > > +
> > > > > +/*
> > > > > + * LDO1 wired into RTC, voltage is hard-wired at 3.3v and cannot be
> > > > > + * software modified. Note that setting voltage here to 3.3v for accuracy
> > > > > + * sake causes an issue with the driver that causes it to fail to probe
> > > > > + * because of a voltage constraint in the driver.
> > > > > + */
> > > >
> > > > Can you please remove any mention of drivers everywhere? DT is OS and
> > > > thus driver independent.
> > > >
> > > > Once fixed:
> > > > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> > >
> > > This note was added due to prior comments because in this very specific
> > > case we're working around a driver issue. Sadly if I accurately
> > > describe the hardware the PMIC and devices that depend on it will fail
> > > to probe (the hardware is 3.3v, but here it's set as 1.3v).
> > >
> > > https://lore.kernel.org/linux-sunxi/20230629203410.660eb9a4@slackpad.lan/
> >
> > Sorry, I should follow conversation more closely. Procedure in such cases
> > is to fix driver first and then submit proper DT file. While DT files
> > reside in Linux source, they are often used by diferent projects, like
> > U-Boot or FreeBSD, so we can't make hacks just because Linux driver doesn't
> > work.
>
> I'll drop all but the note that "LDO1 is wired into RTC and voltage is
> hard wired at 3.3v". That accurately describes the hardware, so will
> that work?
OK.
Best regards,
Jernej
>
> >
> > >
> > > Thank you,
> > > Chris
> > >
> > > >
> > > > Best regards,
> > > > Jernej
> > > >
> > > > > +®_ldo1 {
> > > > > + regulator-always-on;
> > > > > + regulator-name = "vcc-rtc";
> > > > > +};
> > > > > +
> > > > > +/* LDO2 wired into VCC-PLL and audio codec. */
> > > > > +®_ldo2 {
> > > > > + regulator-always-on;
> > > > > + regulator-max-microvolt = <3000000>;
> > > > > + regulator-min-microvolt = <3000000>;
> > > > > + regulator-name = "vcc-pll";
> > > > > +};
> > > > > +
> > > > > +/* LDO3, LDO4, and LDO5 unused. */
> > > > > +®_ldo3 {
> > > > > + status = "disabled";
> > > > > +};
> > > > > +
> > > > > +®_ldo4 {
> > > > > + status = "disabled";
> > > > > +};
> > > > > +
> > > > > +/*
> > > > > + * Force the driver to use internal oscillator by removing clocks
> > > > > + * property.
> > > > > + */
> >
> > This should be reworded to avoid mentioning driver. Like: "RTC uses
> > internal oscillator".
> >
> > Best regards,
> > Jernej
> >
>
> You got it.
>
> > > > > +&rtc {
> > > > > + /delete-property/ clocks;
> > > > > +};
> > > > > +
> > > > > +&spi0 {
> > > > > + pinctrl-0 = <&spi0_no_miso_pins>;
> > > > > + pinctrl-names = "default";
> > > > > + status = "okay";
> > > > > +
> > > > > + display@0 {
> > > > > + compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
> > > > > + reg = <0>;
> > > > > + backlight = <&backlight>;
> > > > > + dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
> > > > > + reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
> > > > > + spi-max-frequency = <100000000>;
> > > > > +
> > > > > + height-mm = <39>;
> > > > > + width-mm = <39>;
> > > > > +
> > > > > + /* Set hb-porch to compensate for non-visible area */
> > > > > + panel-timing {
> > > > > + hactive = <240>;
> > > > > + vactive = <240>;
> > > > > + hback-porch = <80>;
> > > > > + vback-porch = <0>;
> > > > > + clock-frequency = <0>;
> > > > > + hfront-porch = <0>;
> > > > > + hsync-len = <0>;
> > > > > + vfront-porch = <0>;
> > > > > + vsync-len = <0>;
> > > > > + };
> > > > > + };
> > > > > +};
> > > > > +
> > > > > +&uart0 {
> > > > > + pinctrl-0 = <&uart0_pb_pins>;
> > > > > + pinctrl-names = "default";
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&usb_otg {
> > > > > + dr_mode = "otg";
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&usb_power_supply {
> > > > > + status = "okay";
> > > > > +};
> > > > > +
> > > > > +&usbphy {
> > > > > + usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
> > > > > + status = "okay";
> > > > > +};
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
>
> Thank you,
> Chris
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH V5 4/4] ARM: dts: sunxi: add support for Anbernic RG-Nano
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
2023-09-22 9:31 ` Andre Przywara
2023-09-24 19:33 ` Jernej Škrabec
@ 2023-09-27 20:28 ` Samuel Holland
2 siblings, 0 replies; 15+ messages in thread
From: Samuel Holland @ 2023-09-27 20:28 UTC (permalink / raw)
To: Chris Morgan, linux-sunxi
Cc: devicetree, mripard, uwu, jernej.skrabec, wens, conor+dt,
krzysztof.kozlowski+dt, robh+dt, andre.przywara, Chris Morgan
On 9/21/23 08:51, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
>
> The Anbernic RG-Nano is a small portable game device based on the
> Allwinner V3s SoC. It has GPIO buttons on the face and side for
> input, a single mono speaker, a 240x240 SPI controlled display, a USB-C
> OTG port, an SD card slot for booting, and 64MB of RAM included in the
> SoC. There does not appear to be a crystal feeding the internal RTC so
> it does not keep proper time (for me it ran 8 hours slow in a 24 hour
> period). External RTC works just fine.
>
> Working/Tested:
> - SDMMC
> - UART (for debugging)
> - Buttons
> - Charging/battery/PMIC
> - Speaker
> - RTC (external RTC)
> - USB
> - Display
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
> arch/arm/boot/dts/allwinner/Makefile | 1 +
> .../allwinner/sun8i-v3s-anbernic-rg-nano.dts | 284 ++++++++++++++++++
> 2 files changed, 285 insertions(+)
> create mode 100644 arch/arm/boot/dts/allwinner/sun8i-v3s-anbernic-rg-nano.dts
Reviewed-by: Samuel Holland <samuel@sholland.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2023-09-27 20:28 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-21 13:51 [PATCH V5 0/4] Add Anbernic RG-Nano Chris Morgan
2023-09-21 13:51 ` [PATCH V5 1/4] arm: dts: sun8i: V3s: Add pinctrl for pwm Chris Morgan
2023-09-24 19:30 ` Jernej Škrabec
2023-09-21 13:51 ` [PATCH V5 2/4] ARM: dts: sun8i: v3s: add EHCI and OHCI to v3s dts Chris Morgan
2023-09-24 19:30 ` Jernej Škrabec
2023-09-21 13:51 ` [PATCH V5 3/4] dt-bindings: arm: sunxi: add Anbernic RG-Nano Chris Morgan
2023-09-21 13:51 ` [PATCH V5 4/4] ARM: dts: sunxi: add support for " Chris Morgan
2023-09-22 9:31 ` Andre Przywara
2023-09-22 9:32 ` Icenowy Zheng
2023-09-24 19:33 ` Jernej Škrabec
2023-09-25 15:00 ` Chris Morgan
2023-09-25 16:00 ` Jernej Škrabec
2023-09-27 14:14 ` Chris Morgan
2023-09-27 17:53 ` Jernej Škrabec
2023-09-27 20:28 ` Samuel Holland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).