From patchwork Fri Aug 12 22:03:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rask Ingemann Lambertsen X-Patchwork-Id: 9288651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2920160574 for ; Thu, 18 Aug 2016 21:20:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1812B290DD for ; Thu, 18 Aug 2016 21:20:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B60C290E7; Thu, 18 Aug 2016 21:20:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=2.0 tests=BAYES_00, DATE_IN_PAST_96_XX, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4CE58290DD for ; Thu, 18 Aug 2016 21:20:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1baUiI-0007NB-Oy; Thu, 18 Aug 2016 21:18:58 +0000 Received: from [2a00:7660:ca7:0:b36f:364:4f94:9e6c] (helo=draco-aw80.localdomain) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1baUhu-00078K-Tj for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2016 21:18:39 +0000 Received: by draco-aw80.localdomain (Postfix, from userid 0) id D13FD3778; Thu, 18 Aug 2016 21:18:00 +0000 (UTC) Message-Id: <84fee68ae2ae47b16d2f4071d4ec3bc9a0451f8d.1471553094.git.ccc94453@vip.cybercity.dk> In-Reply-To: <54da74da3f60ede0bf8fb789ffee584703e81a29.1471553094.git.ccc94453@vip.cybercity.dk> References: <54da74da3f60ede0bf8fb789ffee584703e81a29.1471553094.git.ccc94453@vip.cybercity.dk> From: Rask Ingemann Lambertsen Date: Sat, 13 Aug 2016 00:03:57 +0200 Subject: [PATCH v3 3/3] ARM: dts: sun9i: Initial support for the Sunchip CX-A99 board To: Rob Herring , Mark Rutland , Russell King , Maxime Ripard , Chen-Yu Tsai X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160818_141835_409233_B9B91070 X-CRM114-Status: GOOD ( 21.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Suncip CX-A99 board is found in at least four brands of TV boxes. It features an Allwinner A80 SOC, with either 2 GiB DDR3 DRAM and 16 GB eMMC or 4 GiB DDR3 DRAM and 32 GB eMMC, as well as several support chips for Ethernet, wireless networking, video output, SATA and power management. For details, see the linux-sunxi page about the board . This patch only adds support for the SD and eMMC storage, real-time clock, USB 2.0 ports (and by extension the SATA port), the UART port and the LEDs. All of this relies on the bootloader to leave those parts powered up, as I'm still working on a driver for the AXP808 PMIC. Signed-off-by: Rask Ingemann Lambertsen --- Although the vendor U-Boot lets you boot the kernel on one of the Cortex-A15 cores, the kernel gpio-regulator driver currently glitches the GPIO lines to the OZ80120 regulator such that the system crashes during startup. This part needs further work to be useful. The driver for the AC100 real-time clock is found in Lee Jones' MFD branch git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ib-mfd-rtc-v4.9 and is not essential for using the board. Changes in v3: None. Changes in v2: Fixed formatting and style issues found by scripts/checkpatch.pl. arch/arm/boot/dts/Makefile | 3 +- arch/arm/boot/dts/sun9i-a80-cx-a99.dts | 259 +++++++++++++++++++++++++++++++++ 2 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/sun9i-a80-cx-a99.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 6b3bdb6..8b77a53 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -796,7 +796,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-r16-parrot.dtb dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ - sun9i-a80-cubieboard4.dtb + sun9i-a80-cubieboard4.dtb \ + sun9i-a80-cx-a99.dtb dtb-$(CONFIG_ARCH_TANGO) += \ tango4-vantage-1172.dtb dtb-$(CONFIG_ARCH_TEGRA_2x_SOC) += \ diff --git a/arch/arm/boot/dts/sun9i-a80-cx-a99.dts b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts new file mode 100644 index 0000000..a60934b --- /dev/null +++ b/arch/arm/boot/dts/sun9i-a80-cx-a99.dts @@ -0,0 +1,259 @@ +/* + * sun9i-a80-cx-a99.dts - Device Tree file for the Sunchip CX-A99 board. + * + * Copyright (C) 2016 Rask Ingemann Lamberten + * + * 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. + */ + +/* The Sunchip CX-A99 board is found in several similar Android TV box + * products, such as: + * + * Instabox Fantasy A8 (no external antenna) + * Jesurun CS-Q8 (ships with larger remote control) + * Jesurun Maxone + * Rikomagic (RKM) MK80/MK80LE + * Tronsmart Draco AW80 Meta/Telos + * + * See for more information. + */ + +/dts-v1/; +#include "sun9i-a80.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Sunchip CX-A99"; + compatible = "sunchip,cx-a99", "allwinner,sun9i-a80"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins_cx_a99>; + + blue { + gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>; /* PG10 */ + label = "cx-a99:blue:normal"; + default-state = "on"; + }; + + red { + gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */ + label = "cx-a99:red:standby"; + }; + }; + + /* Power supply for the four Cortex-A15 cores. */ + reg_vdd_cpub: oz80120 { + compatible = "regulator-gpio"; + regulator-name = "vdd-cpub"; + + regulator-boot-on; + regulator-always-on; + regulator-type = "voltage"; + regulator-min-microvolt = < 800000>; + regulator-max-microvolt = <1100000>; + + pinctrl-names = "default"; + pinctrl-0 = <&vdd_cpub_r_pins_cx_a99>; + enable-gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ + enable-active-high; + gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>, /* PL3 */ + <&r_pio 0 4 GPIO_ACTIVE_HIGH>, /* PL4 */ + <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ + /* There appears to be an external pull-up on PL3. */ + gpios-states = <1 0 0>; + states = < 750000 0x7 + 800000 0x3 + 850000 0x5 + 900000 0x1 + 950000 0x6 + 1000000 0x2 + 1100000 0x4 + 1200000 0x0>; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci2 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin_cx_a99>; + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + cd-gpios = <&pio 7 17 GPIO_ACTIVE_LOW>; /* PH17 */ + status = "okay"; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_8bit_pins>; + vmmc-supply = <®_vcc3v3>; + bus-width = <8>; + non-removable; + status = "okay"; +}; + +&osc32k { + clocks = <&ac100_rtc 0>; +}; + +&pio { + led_pins_cx_a99: led-pins { + allwinner,pins = "PG10", "PG11"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; + + mmc0_cd_pin_cx_a99: mmc0_cd { + allwinner,pins = "PH17"; + allwinner,function = "gpio_in"; + allwinner,pull = ; + }; +}; + +/* Each GPIO controls VBUS for a port on the GL850G hub connected to ehci0; + * PL7 for port 1, the USB connector closest to the 12 V power connector, and + * PL8 for port 2, the USB connector next to the (micro)SD card slot. + * Note: The regulators are not chained like this in reality, but + * regulator-fixed doesn't support a gpio list, and allwinner,sun9i-a80-usb-phy + * doesn't support more than one supply, so this will have to do (for now). + */ +®_usb1_vbus { + pinctrl-0 = <&usb1_vbus_r_pin_cx_a99>; + gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */ + status = "okay"; +}; + +®_usb2_vbus { + pinctrl-0 = <&usb2_vbus_r_pin_cx_a99>; + gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + vin-supply = <®_usb1_vbus>; + status = "okay"; +}; + +&r_ir { + status = "okay"; +}; + +&r_pio { + usb1_vbus_r_pin_cx_a99: usb0_vbus_pin { + allwinner,pins = "PL7"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; + + usb2_vbus_r_pin_cx_a99: usb1_vbus_pin { + allwinner,pins = "PL8"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; + + vdd_cpub_r_pins_cx_a99: regulator_r_pins { + allwinner,pins = "PL2", "PL3", "PL4", "PL5"; + allwinner,function = "gpio_out"; + allwinner,drive = ; + allwinner,pull = ; + }; +}; + +&r_rsb { + status = "okay"; + + ac100: codec@e89 { + compatible = "x-powers,ac100"; + reg = <0xe89>; + + ac100_codec: codec { + compatible = "x-powers,ac100-codec"; + interrupt-parent = <&r_pio>; + interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */ + #clock-cells = <0>; + clock-output-names = "4M_adda"; + }; + + ac100_rtc: rtc { + compatible = "x-powers,ac100-rtc"; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + clocks = <&ac100_codec>; + #clock-cells = <1>; + clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc"; + }; + }; +}; + +/* 5-pin connector opposite of the SD card slot: + * 1 = GND (pointed to by small triangle), 2 = GND, 3 = 3.3 V, 4 = RX, 5 = TX. + */ +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins_a>; + status = "okay"; +}; + +/* The port has two V_bus supplies. See workaround at reg_usb1_vbus. */ +&usbphy1 { + phy-supply = <®_usb2_vbus>; + status = "okay"; +}; + +&usbphy3 { + status = "okay"; +};