/* * Copyright 2016 * Kolja Windeler * * This file is widly based on the pocket chip overlay from * Maxime Ripard * Copyright 2016 Free Electrons * Copyright 2016 NextThing Co * https://github.com/NextThingCo/CHIP-dt-overlays/blob/master/nextthingco/dip-pocket-v73.dts * * * 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/; /plugin/; #include #include #include #include / { compatible = "nextthing,chip", "allwinner,sun5i-r8"; /* Enable our SDIO pins */ fragment@0 { target = <&pio>; __overlay__ { chip_sdio_pins: mmc2@42 { allwinner,pins = "PE4", "PE5", "PE6", "PE7", "PE8", "PE9"; allwinner,function = "mmc2"; allwinner,drive = ; allwinner,pull = ; }; chip_sdio_cd: mmc2_cd@0 { allwinner,pins = "PB3"; allwinner,function = "gpio_in"; allwinner,drive = ; allwinner,pull = ; }; chip_bl_en: chip_backlight_enable@0 { allwinner,pins = "PD18"; allwinner,function = "gpio_out"; allwinner,drive = ; allwinner,pull = ; }; }; }; /* Enable our SDIO device */ fragment@1 { target = <&mmc2 >; __overlay__ { vmmc-supply = <®_vcc3v3>; vqmmc-supply = <®_vcc3v3>; // everything below this like is default, but I'll set it to be sure pinctrl-names = "default"; compatible = "allwinner,sun5i-a13-mmc"; pinctrl-0 = <&chip_sdio_pins>, <&chip_sdio_cd>; cd-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; cd-inverted; // it is low active, but this is somehow wrong bus-width = <4>; clocks = <&ahb_gates 10>,<&mmc2_clk 0>,<&mmc2_clk 1>,<&mmc2_clk 2>; // and go! status = "okay"; }; }; /* Enable the PWM */ fragment@2 { target = <&pwm>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&pwm0_pins>; status = "okay"; }; }; /* And enable the backlight running on that PWM */ fragment@3 { target-path = "/"; __overlay__ { backlight: backlight { compatible = "pwm-backlight"; pwms = <&pwm 0 8000 1>; brightness-levels = <0 1 2 4 8 12 16 24 28 32 100>; default-brightness-level = <8>; pinctrl-names = "default"; pinctrl-0 = <&chip_bl_en>; enable-gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; }; }; }; /* Enable the touchscreen */ fragment@4 { target = <&rtp>; __overlay__ { /* touchscreen-inverted-x; */ /* touchscreen-inverted-y; */ allwinner,ts-attached; }; }; /* Enable our panel */ fragment@5 { target-path = "/"; __overlay__ { panel { #address-cells = <1>; #size-cells = <0>; compatible = "olimex,lcd-olinuxino-43-ts"; backlight = <&backlight>; port@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; panel_input: endpoint@0 { reg = <0>; remote-endpoint = <&tcon0_out_panel>; }; }; }; }; }; /* Link the TCON with the panel */ fragment@6 { target = <&tcon0_out>; __overlay__ { #address-cells = <1>; #size-cells = <0>; tcon0_out_panel: endpoint@0 { reg = <0>; remote-endpoint = <&panel_input>; }; }; }; /* Register the LCD pins with pinctrl */ fragment@7 { target = <&tcon0>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&lcd_rgb565_pins>; }; }; };