diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 7a72fc636a7a..fa7ad973969c 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1267,6 +1267,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-h3-zeropi.dtb \ sun8i-h3-emlid-neutis-n5h3-devboard.dtb \ sun8i-r16-bananapi-m2m.dtb \ + sun8i-r16-clockworkpi-cpi3.dtb \ + sun8i-r16-clockworkpi-cpi3-hdmi.dtb \ sun8i-r16-nintendo-nes-classic.dtb \ sun8i-r16-nintendo-super-nes-classic.dtb \ sun8i-r16-parrot.dtb \ diff --git a/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts new file mode 100644 index 000000000000..e2c15df25b30 --- /dev/null +++ b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2018 Clockwork + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Clockwork CPI3"; + compatible = "clockwork,clockworkpi-cpi3", "allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + mmc0 = &mmc0; + mmc1 = &mmc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + + led1 { + label = "led1"; + gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; /* PB7 */ + }; + }; + + wifi_pwrseq: wifi_pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ + }; + + rfkill_gpio: rfkill_gpio { + compatible = "rfkill_gpio"; + type = "bluetooth"; + pinctrl-names = "default"; + pinctrl-0 = <&bt_control_pin>; + reset-gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + shutdown-gpio = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ + }; + + panel { + compatible = "clockwork,cpi3-hdmi"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + rgb_input: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon0_out_rgb>; + }; + }; + }; + }; +}; + +&codec { + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_i2s_pins>; + status = "okay"; +}; + +&dai { + status = "okay"; +}; + +&sound { + simple-audio-card,routing = + "AIF2 ADCL Stereo Mux", "AIF2 ADCL", + "AIF1 DA0L", "AIF1 DA0L Stereo Mux", + "AIF2 ADCR Stereo Mux", "AIF2 ADCR", + "AIF1 DA0R", "AIF1 DA0R Stereo Mux"; + + status = "okay"; +}; + +&link_codec { + sound-dai = <&codec 1>; +}; + +&de { + status = "okay"; +}; + +&tcon0 { + status = "okay"; +}; + +&tcon0_out { + tcon0_out_rgb: endpoint@0 { + reg = <0>; + remote-endpoint = <&rgb_input>; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>; + vmmc-supply = <®_dcdc1>; + cd-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 */ + bus-width = <4>; + status = "okay"; +}; + +&mmc1 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc1_pg_pins>, <&wifi_reset_pin>; + vmmc-supply = <®_aldo1>; + mmc-pwrseq = <&wifi_pwrseq>; + bus-width = <4>; + non-removable; + keep-power-in-suspend; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&pio { + mmc0_cd_pin: mmc0_cd_pin@0 { + pins = "PB3"; + function = "gpio_in"; + bias-pull-up; + }; + + hdmi_i2s_pins: hdmi_i2s_pins@0 { + pins = "PB4", "PB5", "PB6"; + function = "aif2"; + }; + + led_pins: led_pins@0 { + pins = "PB7"; + function = "gpio_out"; + }; +}; + +&r_pio { + usb1_vbus_pin: usb1_vbus_pin@0 { + pins = "PL2"; + function = "gpio_out"; + }; + + usb0_id_det: usb0_id_detect_pin@0 { + pins = "PL4"; + function = "gpio_in"; + bias-pull-up; + }; + + wifi_reset_pin: wifi_reset_pin@0 { + pins = "PL6"; + function = "gpio_out"; + }; + + bt_control_pin: bt_control_pin@0 { + pins = "PL8", "PL10"; + function = "gpio_out"; + }; +}; + +&r_rsb { + status = "okay"; + + axp22x: pmic@3a3 { + compatible = "x-powers,axp223"; + reg = <0x3a3>; + interrupt-parent = <&r_intc>; + interrupts = ; + drivevbus-supply = <®_vcc5v0>; + x-powers,drive-vbus-en; + }; +}; + +#include "axp223.dtsi" + +®_aldo1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-io"; +}; + +®_aldo2 { + regulator-always-on; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + regulator-name = "vdd-dll"; +}; + +®_aldo3 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-pll-avcc"; +}; + +®_dc5ldo { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-cpus"; +}; + +®_dcdc1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-3v0"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-sys"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc5 { + regulator-always-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vcc-dram"; +}; + +®_dldo1 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi0"; +}; + +®_dldo2 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi1"; +}; + +®_dldo3 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-amp"; +}; + +®_dldo4 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 AND dldo4 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi2"; +}; + +®_drivevbus { + regulator-name = "usb0-vbus"; + status = "okay"; +}; + +®_eldo1 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-hdmi"; +}; + +®_usb1_vbus { + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ + status = "okay"; +}; + +&battery_power_supply { + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pb_pins>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; + status = "okay"; +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usb_power_supply { + status = "okay"; +}; + +&usbphy { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&usb0_id_det>; + usb0_vbus-supply = <®_drivevbus>; + usb0_id_det-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ + usb0_vbus_power-supply = <&usb_power_supply>; + usb1_vbus-supply = <®_usb1_vbus>; +}; diff --git a/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts new file mode 100644 index 000000000000..a3e04b8adf8d --- /dev/null +++ b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2018 Clockwork + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Clockwork CPI3"; + compatible = "clockwork,clockworkpi-cpi3", "allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + mmc0 = &mmc0; + mmc1 = &mmc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + + led1 { + label = "led1"; + gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; /* PB7 */ + }; + }; + + wifi_pwrseq: wifi_pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ + }; + + rfkill_gpio: rfkill_gpio { + compatible = "rfkill_gpio"; + type = "bluetooth"; + pinctrl-names = "default"; + pinctrl-0 = <&bt_control_pin>; + reset-gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + shutdown-gpio = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ + }; + + backlight { + compatible = "ocp8178-backlight"; + pinctrl-names = "default"; + pinctrl-0 = <&backlight_control_pin>; + backlight-control-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ + default-brightness = <5>; + }; + + lcd { + compatible = "kd027-lcd"; + pinctrl-names = "default"; + pinctrl-0 = <&lcd_control_pin>; + lcd-rst-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */ + lcd-cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */ + lcd-sck-gpios = <&pio 2 2 GPIO_ACTIVE_HIGH>; /* PC2 */ + lcd-sda-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */ + init-seq = /bits/ 8 <0x2b 0x01 0x00 0x07 0x0c 0x27 0x16 0x04>; + suspend-seq = /bits/ 8 <0x2b 0x00>; + resume-seq = /bits/ 8 <0x2b 0x01>; + }; + + panel { + compatible = "clockwork,cpi3-lcd"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + rgb_input: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon0_out_rgb>; + }; + }; + }; + }; +}; + +&codec { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + +&sound { + status = "okay"; +}; + +&codec_analog { + pinctrl-names = "default"; + pinctrl-0 = <&speaker_amplifier_pin>; + speaker-amplifier-gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>; /* PL3 */ + interrupts = ; +}; + +&de { + status = "okay"; +}; + +&tcon0 { + status = "okay"; +}; + +&tcon0_out { + tcon0_out_rgb: endpoint@0 { + reg = <0>; + remote-endpoint = <&rgb_input>; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>; + vmmc-supply = <®_dcdc1>; + cd-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 */ + bus-width = <4>; + status = "okay"; +}; + +&mmc1 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc1_pg_pins>, <&wifi_reset_pin>; + vmmc-supply = <®_aldo1>; + mmc-pwrseq = <&wifi_pwrseq>; + bus-width = <4>; + non-removable; + keep-power-in-suspend; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&pio { + mmc0_cd_pin: mmc0_cd_pin@0 { + pins = "PB3"; + function = "gpio_in"; + bias-pull-up; + }; + + led_pins: led_pins@0 { + pins = "PB7"; + function = "gpio_out"; + }; + + lcd_control_pin: lcd_control_pin@0 { + pins = "PB2", "PC0", "PC2", "PC3"; + function = "gpio_out"; + }; + + backlight_control_pin: backlight_control_pin@0 { + pins = "PH1"; + function = "gpio_out"; + }; +}; + +&r_pio { + usb1_vbus_pin: usb1_vbus_pin@0 { + pins = "PL2"; + function = "gpio_out"; + }; + + speaker_amplifier_pin: speaker_amplifier_pin@0 { + pins = "PL3"; + function = "gpio_out"; + }; + + usb0_id_det: usb0_id_detect_pin@0 { + pins = "PL4"; + function = "gpio_in"; + bias-pull-up; + }; + + wifi_reset_pin: wifi_reset_pin@0 { + pins = "PL6"; + function = "gpio_out"; + }; + + bt_control_pin: bt_control_pin@0 { + pins = "PL8", "PL10"; + function = "gpio_out"; + }; +}; + +&r_rsb { + status = "okay"; + + axp22x: pmic@3a3 { + compatible = "x-powers,axp223"; + reg = <0x3a3>; + interrupt-parent = <&r_intc>; + interrupts = ; + drivevbus-supply = <®_vcc5v0>; + x-powers,drive-vbus-en; + }; +}; + +#include "axp223.dtsi" + +®_aldo1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-io"; +}; + +®_aldo2 { + regulator-always-on; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + regulator-name = "vdd-dll"; +}; + +®_aldo3 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-pll-avcc"; +}; + +®_dc5ldo { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-cpus"; +}; + +®_dcdc1 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc-3v0"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-name = "vdd-sys"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc5 { + regulator-always-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vcc-dram"; +}; + +®_dldo1 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi0"; +}; + +®_dldo2 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi1"; +}; + +®_dldo3 { + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-amp"; +}; + +®_dldo4 { + /* + * TODO: WiFi chip needs dldo1 AND dldo2 AND dldo4 to be on to be powered. + * Remove next line once it is possible to sync two regulators. + */ + regulator-always-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi2"; +}; + +®_drivevbus { + regulator-name = "usb0-vbus"; + status = "okay"; +}; + +®_usb1_vbus { + pinctrl-names = "default"; + pinctrl-0 = <&usb1_vbus_pin>; + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ + status = "okay"; +}; + +&battery_power_supply { + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pb_pins>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; + status = "okay"; +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usb_power_supply { + status = "okay"; +}; + +&usbphy { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&usb0_id_det>; + usb0_vbus-supply = <®_drivevbus>; + usb0_id_det-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ + usb0_vbus_power-supply = <&usb_power_supply>; + usb1_vbus-supply = <®_usb1_vbus>; +};