diff --git a/arch/mips/boot/dts/ingenic/bits/gcw0-base.dtsi b/arch/mips/boot/dts/ingenic/bits/gcw0-base.dtsi new file mode 100644 index 00000000000000..789a718cfb87e5 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/bits/gcw0-base.dtsi @@ -0,0 +1,476 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "../jz4770.dtsi" + +#include +#include +#include +#include + +/ { + aliases { + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; + serial3 = &uart3; + }; + + memory: memory { + device_type = "memory"; + reg = <0x0 0x10000000>, + <0x30000000 0x10000000>; + }; + + chosen { + stdout-path = "serial2:57600n8"; + }; + + vcc: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vcc"; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + mmc1_power: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "mmc1_vcc"; + gpio = <&gpe 9 0>; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc>; + }; + + headphones_amp: analog-amplifier@0 { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpf 3 GPIO_ACTIVE_LOW>; + enable-delay-ms = <50>; + + VCC-supply = <&vcc>; + sound-name-prefix = "Headphones Amp"; + }; + + speaker_amp: analog-amplifier@1 { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpf 20 GPIO_ACTIVE_HIGH>; + + VCC-supply = <&vcc>; + sound-name-prefix = "Speaker Amp"; + }; + + sound_card: sound { + compatible = "simple-audio-card"; + + simple-audio-card,name = "gcw0-audio"; + simple-audio-card,format = "i2s"; + + simple-audio-card,hp-det-gpio = <&gpf 21 GPIO_ACTIVE_LOW>; + simple-audio-card,aux-devs = <&speaker_amp>, <&headphones_amp>; + + simple-audio-card,bitclock-master = <&dai_codec>; + simple-audio-card,frame-master = <&dai_codec>; + + dai_cpu: simple-audio-card,cpu { + sound-dai = <&aic>; + }; + + dai_codec: simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 1 40000 0>; + power-supply = <&vcc>; + + brightness-levels = <0 4 8 9 10 12 16 32 64 96 128 192 255>; + default-brightness-level = <8>; + + pinctrl-names = "init", "sleep", "default"; + pinctrl-0 = <&pins_pwm1_sleep>; + pinctrl-1 = <&pins_pwm1_sleep>; + pinctrl-2 = <&pins_pwm1>; + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + autorepeat; + + button@0 { + label = "D-pad up"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 21 GPIO_ACTIVE_LOW>; + }; + + button@1 { + label = "D-pad down"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 25 GPIO_ACTIVE_LOW>; + }; + + button@2 { + label = "D-pad left"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 23 GPIO_ACTIVE_LOW>; + }; + + button@3 { + label = "D-pad right"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 24 GPIO_ACTIVE_LOW>; + }; + + button@4 { + label = "Button A"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 29 GPIO_ACTIVE_LOW>; + }; + + button@5 { + label = "Button B"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 20 GPIO_ACTIVE_LOW>; + }; + + btn6: button@6 { + label = "Button X"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 27 GPIO_ACTIVE_LOW>; + }; + + btn7: button@7 { + label = "Button Y"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 28 GPIO_ACTIVE_LOW>; + }; + + btn8: button@8 { + label = "Left shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 20 GPIO_ACTIVE_LOW>; + }; + + btn9: button@9 { + label = "Right shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 26 GPIO_ACTIVE_LOW>; + }; + + button@10 { + label = "Start button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 21 GPIO_ACTIVE_LOW>; + }; + + button@11 { + label = "Select button"; + linux,code = ; + linux,can-disable; + /* + * This is the only button that is active high, + * since it doubles as BOOT_SEL1. + */ + gpios = <&gpd 18 GPIO_ACTIVE_HIGH>; + }; + + btn12: button@12 { + label = "Power button"; + linux,code = ; + linux,can-disable; + gpios = <&gpa 30 GPIO_ACTIVE_LOW>; + wakeup-source; + }; + }; + + /* + * SPI-over-GPIO, using the pins of the SSI0 controller. + * This is useful for the devices that require 3-wire communication, + * as the SSI controller in Ingenic SoCs does not support it. + */ + spi0_gpio: spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + sck-gpios = <&gpe 15 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpe 17 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpe 16 GPIO_ACTIVE_HIGH>; + num-chipselects = <1>; + }; + + usb_conn: connector { + compatible = "gpio-usb-b-connector", "usb-b-connector"; + label = "mini-USB"; + type = "mini"; + + /* + * USB OTG is not yet working reliably, the ID detection + * mechanism tends to fry easily for unknown reasons. + * Until this is fixed, disable OTG by not providing the + * ID GPIO to the driver. + */ + //id-gpios = <&gpf 18 GPIO_ACTIVE_LOW>; + + vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>; + vbus-supply = <&vcc>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_otg>; + + port { + usb_ep: endpoint { + remote-endpoint = <&usb_otg_ep>; + }; + }; + }; + + battery: battery { + compatible = "simple-battery"; + voltage-min-design-microvolt = <3400000>; + voltage-max-design-microvolt = <4200000>; + }; + + vdiv: voltage-divider { + compatible = "voltage-divider"; + #io-channel-cells = <0>; + + output-ohms = <332000>; + full-ohms = <1332000>; + + io-channels = <&adc INGENIC_ADC_BATTERY>; + }; + + pmu: pmu { + compatible = "ingenic,jz4770-battery", "ingenic,jz4740-battery"; + io-channels = <&vdiv>; + io-channel-names = "battery"; + monitored-battery = <&battery>; + + charger = <&usb_conn>; + power-supplies = <&usb_conn>; + }; + + joystick: joystick { + compatible = "adc-joystick"; + io-channels = <&adc INGENIC_ADC_TOUCH_XP>, + <&adc INGENIC_ADC_TOUCH_YP>; + #address-cells = <1>; + #size-cells = <0>; + + js_axis0: axis@0 { + reg = <0>; + linux,code = ; + abs-fuzz = <4>; + abs-flat = <200>; + }; + + js_axis1: axis@1 { + reg = <1>; + linux,code = ; + abs-fuzz = <4>; + abs-flat = <200>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led { + label = "power"; + gpios = <&gpb 30 GPIO_ACTIVE_LOW>; + default-state = "on"; + panic-indicator; + retain-state-suspended; + }; + }; + + cpu_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-444000000 { opp-hz = /bits/ 64 <444000000>; }; + opp-492000000 { opp-hz = /bits/ 64 <492000000>; }; + opp-600000000 { opp-hz = /bits/ 64 <600000000>; }; + opp-696000000 { opp-hz = /bits/ 64 <696000000>; }; + opp-792000000 { opp-hz = /bits/ 64 <792000000>; }; + opp-900000000 { opp-hz = /bits/ 64 <900000000>; }; + opp-996000000 { opp-hz = /bits/ 64 <996000000>; }; + opp-1092000000 { opp-hz = /bits/ 64 <1092000000>; }; + opp-1200000000 { opp-hz = /bits/ 64 <1200000000>; }; + }; +}; + +&ext { + clock-frequency = <12000000>; +}; + +&cpu0 { + operating-points-v2 = <&cpu_opp_table>; + + /* We use the main PLL as the CPU clock for the cpufreq driver. */ + clocks = <&cgu JZ4770_CLK_PLL0>; +}; + +&pinctrl { + pins_lcd: lcd { + function = "lcd"; + groups = "lcd-24bit"; + }; + + pins_uart2: uart2 { + function = "uart2"; + groups = "uart2-data"; + }; + + pins_mmc0: mmc0 { + function = "mmc0"; + groups = "mmc0-1bit-a", "mmc0-4bit-a"; + }; + + pins_mmc1: mmc1 { + function = "mmc1"; + groups = "mmc1-1bit-d", "mmc1-4bit-d"; + }; + + pins_otg: otg { + otg-vbus-pin { + function = "otg"; + groups = "otg-vbus"; + }; + + vbus-pin { + pins = "PB5"; + bias-disable; + }; + }; + + pwm1 { + pins_pwm1_sleep: pwm1-sleep { + pins = "PE1"; + output-low; + }; + + pins_pwm1: pwm1-default { + function = "pwm1"; + groups = "pwm1"; + }; + }; +}; + +&lcd { + pinctrl-names = "default"; + pinctrl-0 = <&pins_lcd>; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pins_uart2>; + + status = "okay"; +}; + +&cgu { + /* + * Put high-speed peripherals under PLL1, such that we can change the + * PLL0 frequency on demand without having to suspend peripherals. + * We use a rate of 432 MHz, which is the least common multiple of + * 27 MHz (required by TV encoder) and 48 MHz (required by USB host). + * Put the GPU under PLL0 since we want a higher frequency. + * Use the 32 kHz oscillator as the parent of the RTC for a higher + * precision. + */ + assigned-clocks = + <&cgu JZ4770_CLK_PLL1>, + <&cgu JZ4770_CLK_GPU>, + <&cgu JZ4770_CLK_RTC>, + <&cgu JZ4770_CLK_UHC>, + <&cgu JZ4770_CLK_LPCLK_MUX>, + <&cgu JZ4770_CLK_MMC0_MUX>, + <&cgu JZ4770_CLK_MMC1_MUX>; + assigned-clock-parents = + <0>, + <&cgu JZ4770_CLK_PLL0>, + <&cgu JZ4770_CLK_OSC32K>, + <&cgu JZ4770_CLK_PLL1>, + <&cgu JZ4770_CLK_PLL1>, + <&cgu JZ4770_CLK_PLL1>, + <&cgu JZ4770_CLK_PLL1>; + assigned-clock-rates = + <432000000>, + <600000000>; +}; + +&tcu { + /* + * 750 kHz for the system timer and clocksource, 12 MHz for the OST, + * and use RTC as the parent for the watchdog clock + */ + assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER2>, + <&tcu TCU_CLK_OST>, <&tcu TCU_CLK_WDT>; + assigned-clock-parents = <0>, <0>, <0>, <&cgu JZ4770_CLK_RTC>; + assigned-clock-rates = <750000>, <750000>, <12000000>; + + /* PWM1 is in use, so use channel #2 for the clocksource */ + ingenic,pwm-channels-mask = <0xfa>; +}; + +&usb_otg { + port { + usb_otg_ep: endpoint { + remote-endpoint = <&usb_ep>; + }; + }; +}; + +&otg_phy { + vcc-supply = <&vcc>; +}; + +&rtc { + clocks = <&cgu JZ4770_CLK_RTC>; + clock-names = "rtc"; + + system-power-controller; +}; + +&mmc0 { + status = "okay"; + + bus-width = <4>; + max-frequency = <50000000>; + vmmc-supply = <&vcc>; + non-removable; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_mmc0>; +}; + +&mmc1 { + status = "okay"; + + bus-width = <4>; + max-frequency = <50000000>; + cd-gpios = <&gpb 2 GPIO_ACTIVE_LOW>; + vmmc-supply = <&mmc1_power>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_mmc1>; +}; diff --git a/arch/mips/boot/dts/ingenic/gcw0.dts b/arch/mips/boot/dts/ingenic/gcw0.dts index fde9046041b91b..8a9e74327892ab 100644 --- a/arch/mips/boot/dts/ingenic/gcw0.dts +++ b/arch/mips/boot/dts/ingenic/gcw0.dts @@ -2,52 +2,12 @@ /dts-v1/; #include "jz4770.dtsi" -#include - -#include -#include -#include +#include "bits/gcw0-base.dtsi" / { compatible = "gcw,zero", "ingenic,jz4770"; model = "GCW Zero"; - aliases { - serial0 = &uart0; - serial1 = &uart1; - serial2 = &uart2; - serial3 = &uart3; - }; - - memory: memory { - device_type = "memory"; - reg = <0x0 0x10000000>, - <0x30000000 0x10000000>; - }; - - chosen { - stdout-path = "serial2:57600n8"; - }; - - vcc: regulator@0 { - compatible = "regulator-fixed"; - regulator-name = "vcc"; - - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - - mmc1_power: regulator@1 { - compatible = "regulator-fixed"; - regulator-name = "mmc1_vcc"; - gpio = <&gpe 9 0>; - - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - vin-supply = <&vcc>; - }; - usb_vbus: regulator@2 { compatible = "regulator-fixed"; regulator-name = "USB Power"; @@ -59,65 +19,7 @@ vin-supply = <&vcc>; }; - headphones_amp: analog-amplifier@0 { - compatible = "simple-audio-amplifier"; - enable-gpios = <&gpf 3 GPIO_ACTIVE_LOW>; - enable-delay-ms = <50>; - - VCC-supply = <&ldo5>; - sound-name-prefix = "Headphones Amp"; - }; - - speaker_amp: analog-amplifier@1 { - compatible = "simple-audio-amplifier"; - enable-gpios = <&gpf 20 GPIO_ACTIVE_HIGH>; - - VCC-supply = <&ldo5>; - sound-name-prefix = "Speaker Amp"; - }; - - sound { - compatible = "simple-audio-card"; - - simple-audio-card,name = "gcw0-audio"; - simple-audio-card,format = "i2s"; - - simple-audio-card,widgets = - "Speaker", "Speaker", - "Headphone", "Headphones", - "Microphone", "Built-in Mic"; - simple-audio-card,routing = - "Headphones Amp INL", "LHPOUT", - "Headphones Amp INR", "RHPOUT", - "Headphones", "Headphones Amp OUTL", - "Headphones", "Headphones Amp OUTR", - "Speaker Amp INL", "LOUT", - "Speaker Amp INR", "ROUT", - "Speaker", "Speaker Amp OUTL", - "Speaker", "Speaker Amp OUTR", - "LLINEIN", "Cap-less", - "RLINEIN", "Cap-less", - "Built-in Mic", "MICBIAS", - "MIC1P", "Built-in Mic", - "MIC1N", "Built-in Mic"; - simple-audio-card,pin-switches = "Speaker", "Headphones"; - - simple-audio-card,hp-det-gpio = <&gpf 21 GPIO_ACTIVE_LOW>; - simple-audio-card,aux-devs = <&speaker_amp>, <&headphones_amp>; - - simple-audio-card,bitclock-master = <&dai_codec>; - simple-audio-card,frame-master = <&dai_codec>; - - dai_cpu: simple-audio-card,cpu { - sound-dai = <&aic>; - }; - - dai_codec: simple-audio-card,codec { - sound-dai = <&codec>; - }; - }; - - rumble { + rumble: rumble { compatible = "pwm-vibrator"; pwms = <&pwm 4 2000000 0>; pwm-names = "enable"; @@ -126,130 +28,6 @@ pinctrl-0 = <&pins_pwm4>; }; - backlight: backlight { - compatible = "pwm-backlight"; - pwms = <&pwm 1 40000 0>; - power-supply = <&vcc>; - - brightness-levels = <0 16 32 48 64 80 96 112 128 - 144 160 176 192 208 224 240 255>; - default-brightness-level = <12>; - - pinctrl-names = "default"; - pinctrl-0 = <&pins_pwm1>; - }; - - gpio-keys { - compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; - - autorepeat; - - button@0 { - label = "D-pad up"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 21 GPIO_ACTIVE_LOW>; - }; - - button@1 { - label = "D-pad down"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 25 GPIO_ACTIVE_LOW>; - }; - - button@2 { - label = "D-pad left"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 23 GPIO_ACTIVE_LOW>; - }; - - button@3 { - label = "D-pad right"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 24 GPIO_ACTIVE_LOW>; - }; - - button@4 { - label = "Button A"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 29 GPIO_ACTIVE_LOW>; - }; - - button@5 { - label = "Button B"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 20 GPIO_ACTIVE_LOW>; - }; - - button@6 { - label = "Button Y"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 27 GPIO_ACTIVE_LOW>; - }; - - button@7 { - label = "Button X"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 28 GPIO_ACTIVE_LOW>; - }; - - button@8 { - label = "Left shoulder button"; - linux,code = ; - linux,can-disable; - gpios = <&gpb 20 GPIO_ACTIVE_LOW>; - }; - - button@9 { - label = "Right shoulder button"; - linux,code = ; - linux,can-disable; - gpios = <&gpe 26 GPIO_ACTIVE_LOW>; - }; - - button@10 { - label = "Start button"; - linux,code = ; - linux,can-disable; - gpios = <&gpb 21 GPIO_ACTIVE_LOW>; - }; - - button@11 { - label = "Select button"; - linux,code = ; - linux,can-disable; - /* - * This is the only button that is active high, - * since it doubles as BOOT_SEL1. - */ - gpios = <&gpd 18 GPIO_ACTIVE_HIGH>; - }; - - button@12 { - label = "Power slider"; - linux,code = ; - linux,can-disable; - gpios = <&gpa 30 GPIO_ACTIVE_LOW>; - wakeup-source; - }; - - button@13 { - label = "Power hold"; - linux,code = ; - linux,can-disable; - gpios = <&gpf 11 GPIO_ACTIVE_LOW>; - }; - }; - i2c3: i2c-controller@3 { compatible = "i2c-gpio"; #address-cells = <1>; @@ -338,78 +116,29 @@ scl-gpios = <&gpd 7 GPIO_ACTIVE_HIGH>; clock-frequency = <100000>; - /* HDMI (ITE IT6610) chip is on this I2C bus */ - status = "disabled"; - }; - - leds { - compatible = "gpio-leds"; - - led { - label = "power"; - gpios = <&gpb 30 GPIO_ACTIVE_LOW>; - default-state = "on"; - panic-indicator; - retain-state-suspended; - }; - }; - - spi { - compatible = "spi-gpio"; - #address-cells = <1>; - #size-cells = <0>; - - sck-gpios = <&gpe 15 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpe 17 GPIO_ACTIVE_HIGH>; - cs-gpios = <&gpe 16 GPIO_ACTIVE_HIGH>; - num-chipselects = <1>; + it6610: hdmi@4c { + compatible = "ite,it6610"; + reg = <0x4c>; - nt39016@0 { - compatible = "kingdisplay,kd035g6-54nt"; - reg = <0>; + interrupt-parent = <&gpf>; + interrupts = <12 0>; + interrupt-names = "irq"; - spi-max-frequency = <3125000>; - spi-3wire; + reset-gpios = <&gpe 6 GPIO_ACTIVE_LOW>; - reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pins_it6610>; - backlight = <&backlight>; - power-supply = <&ldo6>; + power-supply = <&ldo7>; port { - panel_input: endpoint { - remote-endpoint = <&panel_output>; + hdmi_input: endpoint { + remote-endpoint = <&hdmi_output>; }; }; }; }; - usb_conn: connector { - compatible = "gpio-usb-b-connector", "usb-b-connector"; - label = "mini-USB"; - type = "mini"; - - /* - * USB OTG is not yet working reliably, the ID detection - * mechanism tends to fry easily for unknown reasons. - * Until this is fixed, disable OTG by not providing the - * ID GPIO to the driver. - */ - //id-gpios = <&gpf 18 GPIO_ACTIVE_LOW>; - - vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>; - vbus-supply = <&otg_vbus>; - - pinctrl-names = "default"; - pinctrl-0 = <&pins_otg>; - - port { - usb_ep: endpoint { - remote-endpoint = <&usb_otg_ep>; - }; - }; - }; - dc_charger: dc-charger { compatible = "gpio-charger"; charger-type = "mains"; @@ -418,98 +147,109 @@ pinctrl-names = "default"; pinctrl-0 = <&pins_dc_charger>; }; +}; - battery: battery { - compatible = "simple-battery"; - voltage-min-design-microvolt = <3400000>; - voltage-max-design-microvolt = <4200000>; - }; +&headphones_amp { + VCC-supply = <&ldo5>; +}; - vdiv: voltage-divider { - compatible = "voltage-divider"; - #io-channel-cells = <0>; +&speaker_amp { + VCC-supply = <&ldo5>; +}; - output-ohms = <332000>; - full-ohms = <1332000>; +&sound_card { + simple-audio-card,widgets = + "Speaker", "Speaker", + "Headphone", "Headphones", + "Microphone", "Built-in Mic"; + simple-audio-card,routing = + "Headphones Amp INL", "LHPOUT", + "Headphones Amp INR", "RHPOUT", + "Headphones", "Headphones Amp OUTL", + "Headphones", "Headphones Amp OUTR", + "Speaker Amp INL", "LOUT", + "Speaker Amp INR", "ROUT", + "Speaker", "Speaker Amp OUTL", + "Speaker", "Speaker Amp OUTR", + "LLINEIN", "Cap-less", + "RLINEIN", "Cap-less", + "Built-in Mic", "MICBIAS", + "MIC1P", "Built-in Mic", + "MIC1N", "Built-in Mic"; + simple-audio-card,pin-switches = "Speaker", "Headphones"; +}; - io-channels = <&adc INGENIC_ADC_BATTERY>; - }; +&btn6 { + label = "Button Y"; +}; - pmu { - compatible = "ingenic,jz4770-battery", "ingenic,jz4740-battery"; - io-channels = <&vdiv>; - io-channel-names = "battery"; - monitored-battery = <&battery>; +&btn7 { + label = "Button X"; +}; - charger = <&act8600>; - power-supplies = <&act8600>, <&usb_conn>, <&dc_charger>; +&gpio_keys { + btn13: button@13 { + label = "Power hold"; + linux,code = ; + linux,can-disable; + gpios = <&gpf 11 GPIO_ACTIVE_LOW>; }; +}; - joystick { - compatible = "adc-joystick"; - io-channels = <&adc INGENIC_ADC_TOUCH_XP>, - <&adc INGENIC_ADC_TOUCH_YP>; - #address-cells = <1>; - #size-cells = <0>; +&spi0_gpio { + status = "okay"; - axis@0 { - reg = <0>; - linux,code = ; - abs-range = <3300 0>; - abs-fuzz = <4>; - abs-flat = <200>; - }; + panel: nt39016@0 { + compatible = "kingdisplay,kd035g6-54nt"; + reg = <0>; - axis@1 { - reg = <1>; - linux,code = ; - abs-range = <0 3300>; - abs-fuzz = <4>; - abs-flat = <200>; + spi-max-frequency = <3125000>; + spi-3wire; + + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + + backlight = <&backlight>; + power-supply = <&ldo6>; + + port { + panel_input: endpoint { + remote-endpoint = <&panel_output>; + }; }; }; }; -&ext { - clock-frequency = <12000000>; +&usb_conn { + vbus-supply = <&otg_vbus>; }; -&pinctrl { - pins_lcd: lcd { - function = "lcd"; - groups = "lcd-24bit"; - }; +&pmu { + charger = <&act8600>; + power-supplies = <&act8600>, <&usb_conn>, <&dc_charger>; +}; - pins_uart2: uart2 { - function = "uart2"; - groups = "uart2-data"; - }; +&js_axis0 { + abs-range = <3300 0>; +}; - pins_mmc0: mmc0 { - function = "mmc0"; - groups = "mmc0-1bit-a", "mmc0-4bit-a"; - }; +&js_axis1 { + abs-range = <0 3300>; +}; - pins_mmc1: mmc1 { - function = "mmc1"; - groups = "mmc1-1bit-d", "mmc1-4bit-d"; +&pinctrl { + pins_i2c0: i2c0 { + function = "i2c0"; + groups = "i2c0-data"; }; - pins_otg: otg { - otg-vbus-pin { - function = "otg"; - groups = "otg-vbus"; - }; - - vbus-pin { - pins = "PB5"; - bias-disable; - }; + pins_i2c1: i2c1 { + function = "i2c1"; + groups = "i2c1-data"; }; - pins_pwm1: pwm1 { - function = "pwm1"; - groups = "pwm1"; + pins_it6610: it6610 { + pins = "PF12"; + bias-pull-up; }; pins_pwm4: pwm4 { @@ -523,141 +263,63 @@ }; }; -&uart2 { - pinctrl-names = "default"; - pinctrl-0 = <&pins_uart2>; - - status = "okay"; -}; - -&cgu { - /* - * Put high-speed peripherals under PLL1, such that we can change the - * PLL0 frequency on demand without having to suspend peripherals. - * We use a rate of 432 MHz, which is the least common multiple of - * 27 MHz (required by TV encoder) and 48 MHz (required by USB host). - * Put the GPU under PLL0 since we want a higher frequency. - * Use the 32 kHz oscillator as the parent of the RTC for a higher - * precision. - */ - assigned-clocks = - <&cgu JZ4770_CLK_PLL1>, - <&cgu JZ4770_CLK_GPU>, - <&cgu JZ4770_CLK_RTC>, - <&cgu JZ4770_CLK_UHC>, - <&cgu JZ4770_CLK_LPCLK_MUX>, - <&cgu JZ4770_CLK_MMC0_MUX>, - <&cgu JZ4770_CLK_MMC1_MUX>; - assigned-clock-parents = - <0>, - <&cgu JZ4770_CLK_PLL0>, - <&cgu JZ4770_CLK_OSC32K>, - <&cgu JZ4770_CLK_PLL1>, - <&cgu JZ4770_CLK_PLL1>, - <&cgu JZ4770_CLK_PLL1>, - <&cgu JZ4770_CLK_PLL1>; - assigned-clock-rates = - <432000000>, - <600000000>; -}; - &uhc { /* The WiFi module is connected to the UHC. */ status = "okay"; }; -&tcu { - /* - * 750 kHz for the system timer and clocksource, 12 MHz for the OST, - * and use RTC as the parent for the watchdog clock - */ - assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER2>, - <&tcu TCU_CLK_OST>, <&tcu TCU_CLK_WDT>; - assigned-clock-parents = <0>, <0>, <0>, <&cgu JZ4770_CLK_RTC>; - assigned-clock-rates = <750000>, <750000>, <12000000>; - - /* PWM1 is in use, so use channel #2 for the clocksource */ - ingenic,pwm-channels-mask = <0xfa>; -}; - -&usb_otg { - port { - usb_otg_ep: endpoint { - remote-endpoint = <&usb_ep>; - }; - }; -}; - &otg_phy { vcc-supply = <&ldo5>; }; -&rtc { - clocks = <&cgu JZ4770_CLK_RTC>; - clock-names = "rtc"; +&i2c0 { + status = "okay"; - system-power-controller; -}; + pinctrl-names = "default"; + pinctrl-0 = <&pins_i2c0>; -&mmc0 { - status = "okay"; + clock-frequency = <400000>; /* 400 kHz */ - bus-width = <4>; - max-frequency = <48000000>; - vmmc-supply = <&vcc>; - non-removable; + radio: radio@11 { + compatible = "rda,rda5807"; + reg = <0x11>; - pinctrl-names = "default"; - pinctrl-0 = <&pins_mmc0>; + rda,lnan; + rda,lnap; + rda,analog-out; + + power-supply = <&ldo6>; + }; }; -&mmc1 { +&i2c1 { status = "okay"; - bus-width = <4>; - max-frequency = <48000000>; - cd-gpios = <&gpb 2 GPIO_ACTIVE_LOW>; - vmmc-supply = <&mmc1_power>; - pinctrl-names = "default"; - pinctrl-0 = <&pins_mmc1>; -}; + pinctrl-0 = <&pins_i2c1>; -&lcd { - pinctrl-names = "default"; - pinctrl-0 = <&pins_lcd>; + clock-frequency = <100000>; /* 100 kHz */ - ports { + accelerometer@15 { + compatible = "memsic,mxc6225"; + reg = <0x15>; + }; +}; + +&lcd_ports { + port@0 { #address-cells = <1>; #size-cells = <0>; + reg = <0>; - port@0 { - #address-cells = <1>; - #size-cells = <0>; + panel_output: endpoint@0 { reg = <0>; - - panel_output: endpoint@0 { - reg = <0>; - remote-endpoint = <&panel_input>; - }; - - /* TODO: endpoint #1 to HDMI chip */ + remote-endpoint = <&panel_input>; }; - port@8 { - reg = <8>; - - ipu_output: endpoint { - remote-endpoint = <&ipu_input>; - }; - }; - }; -}; - -&ipu { - port { - ipu_input: endpoint { - remote-endpoint = <&ipu_output>; + hdmi_output: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_input>; }; }; }; diff --git a/arch/mips/boot/dts/ingenic/jz4770.dtsi b/arch/mips/boot/dts/ingenic/jz4770.dtsi index 5187b090862afc..01b06b818f87d8 100644 --- a/arch/mips/boot/dts/ingenic/jz4770.dtsi +++ b/arch/mips/boot/dts/ingenic/jz4770.dtsi @@ -454,6 +454,19 @@ clocks = <&cgu JZ4770_CLK_LPCLK_MUX>; clock-names = "lcd_pclk"; + + lcd_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + port@8 { + reg = <8>; + + ipu_output: endpoint { + remote-endpoint = <&ipu_input>; + }; + }; + }; }; ipu: ipu@13080000 { @@ -465,6 +478,12 @@ clocks = <&cgu JZ4770_CLK_IPU>; clock-names = "ipu"; + + port { + ipu_input: endpoint { + remote-endpoint = <&ipu_output>; + }; + }; }; vpu: video-decoder@132a0000 { diff --git a/arch/mips/boot/dts/ingenic/pocketgo2.dts b/arch/mips/boot/dts/ingenic/pocketgo2.dts new file mode 100644 index 00000000000000..91690744dbc113 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/pocketgo2.dts @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "bits/gcw0-base.dtsi" + +/ { + compatible = "wolsen,pocketgo2", "ingenic,jz4770"; + model = "Wolsen PocketGo2/PlayGo"; + + panel { + compatible = "frida,frd350h54004"; + + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + + backlight = <&backlight>; + power-supply = <&vcc>; + + port { + panel_input: endpoint { + remote-endpoint = <&panel_output>; + }; + }; + }; +}; + +&gpio_keys { + btn13: button@13 { + label = "L2 shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpd 31 GPIO_ACTIVE_LOW>; + }; + + btn14: button@14 { + label = "R2 shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpf 10 GPIO_ACTIVE_LOW>; + }; + + btn15: button@15 { + label = "Volume+ button"; + linux,code = ; + linux,can-disable; + gpios = <&gpd 19 GPIO_ACTIVE_LOW>; + }; + + btn16: button@16 { + label = "Volume- button"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 13 GPIO_ACTIVE_LOW>; + }; + + btn17: button@17 { + label = "Menu button"; + linux,code = ; + linux,can-disable; + gpios = <&gpe 8 GPIO_ACTIVE_LOW>; + }; +}; + +&lcd_ports { + port@0 { + reg = <0>; + + panel_output: endpoint { + remote-endpoint = <&panel_input>; + }; + }; +}; diff --git a/arch/mips/boot/dts/ingenic/pocketgo2v2.dts b/arch/mips/boot/dts/ingenic/pocketgo2v2.dts new file mode 100644 index 00000000000000..f2959b5d652139 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/pocketgo2v2.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "pocketgo2.dts" + +/ { + compatible = "wolsen,pocketgo2v2", "ingenic,jz4770"; + model = "Wolsen PocketGo2/PlayGo Rev. 2"; +}; + +&sound_card { + simple-audio-card,widgets = + "Speaker", "Speaker", + "Headphone", "Headphones"; + simple-audio-card,routing = + "Headphones Amp INL", "LHPOUT", + "Headphones Amp INR", "RHPOUT", + "Headphones", "Headphones Amp OUTL", + "Headphones", "Headphones Amp OUTR", + "Speaker Amp INL", "Headphones Amp OUTL", + "Speaker Amp INR", "Headphones Amp OUTR", + "Speaker", "Speaker Amp OUTL", + "Speaker", "Speaker Amp OUTR"; + simple-audio-card,pin-switches = "Speaker"; +}; + +&joystick { + io-channels = <&adc INGENIC_ADC_TOUCH_YP>, + <&adc INGENIC_ADC_TOUCH_XP>; +}; + +&js_axis0 { + abs-range = <3000 200>; +}; + +&js_axis1 { + abs-range = <3000 200>; +}; diff --git a/arch/mips/boot/dts/ingenic/rg280m.dts b/arch/mips/boot/dts/ingenic/rg280m.dts new file mode 100644 index 00000000000000..04955d54ff0205 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/rg280m.dts @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "rg280v.dts" + +/ { + compatible = "ylm,rg280m", "ingenic,jz4770"; + model = "Anbernic RG-280M"; +}; + +&joystick { + status = "okay"; + + io-channels = <&adc INGENIC_ADC_TOUCH_YP>, + <&adc INGENIC_ADC_TOUCH_XP>; +}; + +&js_axis0 { + abs-range = <3000 200>; +}; + +&js_axis1 { + abs-range = <3000 200>; +}; + +&sound_card { + simple-audio-card,routing = + "Headphones Amp INL", "LHPOUT", + "Headphones Amp INR", "RHPOUT", + "Headphones", "Headphones Amp OUTL", + "Headphones", "Headphones Amp OUTR", + "Speaker Amp INL", "Headphones Amp OUTL", + "Speaker Amp INR", "Headphones Amp OUTR", + "Speaker", "Speaker Amp OUTL", + "Speaker", "Speaker Amp OUTR"; +}; + +&gpio_keys { + btn17: button@17 { + label = "L3 joystick button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 14 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/arch/mips/boot/dts/ingenic/rg280v.dts b/arch/mips/boot/dts/ingenic/rg280v.dts new file mode 100644 index 00000000000000..e8f478083d6094 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/rg280v.dts @@ -0,0 +1,119 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "bits/gcw0-base.dtsi" + +/ { + compatible = "ylm,rg280v", "ingenic,jz4770"; + model = "Anbernic RG-280V"; + + rumble: rumble { + compatible = "pwm-vibrator"; + pwms = <&pwm 4 2000000 0>; + pwm-names = "enable"; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_pwm4>; + }; +}; + +&joystick { + status = "disabled"; +}; + +&btn8 { + gpios = <&gpb 10 GPIO_ACTIVE_LOW>; +}; + +&gpio_keys { + btn13: button@13 { + label = "L2 shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 20 GPIO_ACTIVE_LOW>; + }; + + btn14: button@14 { + label = "R2 shoulder button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 11 GPIO_ACTIVE_LOW>; + }; + + btn15: button@15 { + label = "Volume+ button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 12 GPIO_ACTIVE_LOW>; + }; + + btn16: button@16 { + label = "Volume- button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 13 GPIO_ACTIVE_LOW>; + }; +}; + +&sound_card { + simple-audio-card,widgets = + "Speaker", "Speaker", + "Headphone", "Headphones"; + simple-audio-card,routing = + "Headphones Amp INL", "LHPOUT", + "Headphones Amp INR", "RHPOUT", + "Headphones", "Headphones Amp OUTL", + "Headphones", "Headphones Amp OUTR", + "Speaker Amp INL", "LOUT", + "Speaker Amp INR", "ROUT", + "Speaker", "Speaker Amp OUTL", + "Speaker", "Speaker Amp OUTR"; + simple-audio-card,pin-switches = "Speaker"; +}; + +&pinctrl { + pins_pwm4: pwm4 { + function = "pwm4"; + groups = "pwm4"; + }; +}; + +&spi0_gpio { + status = "okay"; + + panel: panel@0 { + compatible = "abt,y030xx067a"; + reg = <0>; + + spi-max-frequency = <3125000>; + spi-3wire; + + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + + backlight = <&backlight>; + power-supply = <&vcc>; + + port { + panel_input: endpoint { + remote-endpoint = <&panel_output>; + }; + }; + }; +}; + +&pins_lcd { + groups = "lcd-8bit"; +}; + +&lcd_ports { + lcd_port0: port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + panel_output: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_input>; + }; + }; +}; diff --git a/arch/mips/boot/dts/ingenic/rg300x.dts b/arch/mips/boot/dts/ingenic/rg300x.dts new file mode 100644 index 00000000000000..acbca552a2aabf --- /dev/null +++ b/arch/mips/boot/dts/ingenic/rg300x.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "rg350m.dts" + +#include + +/ { + compatible = "ylm,rg300x", "ingenic,jz4770"; + model = "Anbernic RG-300X"; +}; + +&panel { + compatible = "focaltech,gpt3"; +}; + +&btn17 { + status = "disabled"; +}; + +&btn18 { + status = "disabled"; +}; + +&joystick { + status = "disabled"; +}; diff --git a/arch/mips/boot/dts/ingenic/rg350.dts b/arch/mips/boot/dts/ingenic/rg350.dts new file mode 100644 index 00000000000000..4e618960fe1b0e --- /dev/null +++ b/arch/mips/boot/dts/ingenic/rg350.dts @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "rg350m.dts" + +/ { + compatible = "ylm,rg350", "ingenic,jz4770"; + model = "Anbernic RG-350"; + + panel { + compatible = "frida,frd350h54004"; + + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + + backlight = <&backlight>; + power-supply = <&vcc>; + + port { + frida_input: endpoint { + remote-endpoint = <&panel_output>; + }; + }; + }; +}; + +&panel { + status = "disabled"; +}; + +&spi0_gpio { + status = "disabled"; +}; + +/* Make ABT panel port a dummy to avoid DTC complaints */ +&panel_input { + remote-endpoint = <&panel_input>; +}; + +&panel_output { + remote-endpoint = <&frida_input>; +}; diff --git a/arch/mips/boot/dts/ingenic/rg350m.dts b/arch/mips/boot/dts/ingenic/rg350m.dts new file mode 100644 index 00000000000000..11c41e705e9540 --- /dev/null +++ b/arch/mips/boot/dts/ingenic/rg350m.dts @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "rg280m.dts" + +#include + +/ { + compatible = "ylm,rg350m", "ingenic,jz4770"; + model = "Anbernic RG-350M"; + + hdmi_power: regulator@3 { + compatible = "regulator-fixed"; + regulator-name = "hdmi_pwr"; + gpio = <&gpf 22 0>; + enable-active-high; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc>; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + label = "hdmi"; + + type = "c"; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi_connector_out>; + }; + }; + }; +}; + +&panel { + compatible = "leadtek,ltk035c5444t-spi"; +}; + +&pins_lcd { + groups = "lcd-24bit"; +}; + +&pinctrl { + pins_it66121: it66121 { + pins = "PF12"; + bias-pull-up; + }; +}; + +&gpio_keys { + btn18: button@18 { + label = "R3 joystick button"; + linux,code = ; + linux,can-disable; + gpios = <&gpb 15 GPIO_ACTIVE_LOW>; + }; +}; + +&joystick { + io-channels = <&adc INGENIC_ADC_TOUCH_YP>, + <&adc INGENIC_ADC_TOUCH_XP>, + <&adc INGENIC_ADC_TOUCH_YN>, + <&adc INGENIC_ADC_TOUCH_XN>; + + js_axis2: axis@2 { + reg = <2>; + linux,code = ; + abs-range = <200 3000>; + abs-fuzz = <4>; + abs-flat = <200>; + }; + + js_axis3: axis@3 { + reg = <3>; + linux,code = ; + abs-range = <200 3000>; + abs-fuzz = <4>; + abs-flat = <200>; + }; +}; + +&i2c0 { + status = "okay"; + + clock-frequency = <100000>; /* 100 kHz */ + + hdmi@4c { + compatible = "ite,it66121"; + reg = <0x4c>; + + interrupt-parent = <&gpf>; + interrupts = <12 IRQ_TYPE_EDGE_FALLING>; + interrupt-names = "irq"; + + reset-gpios = <&gpe 6 GPIO_ACTIVE_LOW>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_it66121>; + + vrf12-supply = <&hdmi_power>; + vcn33-supply = <&hdmi_power>; + vcn18-supply = <&hdmi_power>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + hdmi_input: endpoint { + bus-width = <24>; + remote-endpoint = <&hdmi_output>; + }; + }; + + port@1 { + reg = <1>; + + hdmi_connector_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + }; +}; + +&lcd_port0 { + hdmi_output: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_input>; + }; +};