Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Add basic support for the TL-WR1043ND version 1

Add a DTS for TL-WR1043ND version 1 and allow to have it built in the
kernel to circumvent the broken u-boot found on these boards.
Currently only the UART, LEDs and buttons are supported.

Signed-off-by: Alban Bedel <albeu@free.fr>
Cc: linux-mips@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Alban Bedel and committed by
Ralf Baechle
a5fcc652 9db8e9bc

+269
+12
arch/mips/ath79/Kconfig
··· 71 71 Say 'Y' here if you want your kernel to support the 72 72 Ubiquiti Networks XM (rev 1.0) board. 73 73 74 + choice 75 + prompt "Build a DTB in the kernel" 76 + optional 77 + help 78 + Select a devicetree that should be built into the kernel. 79 + 80 + config DTB_TL_WR1043ND_V1 81 + bool "TL-WR1043ND Version 1" 82 + select BUILTIN_DTB 83 + select SOC_AR913X 84 + endchoice 85 + 74 86 endmenu 75 87 76 88 config SOC_AR71XX
+1
arch/mips/boot/dts/Makefile
··· 4 4 dts-dirs += lantiq 5 5 dts-dirs += mti 6 6 dts-dirs += netlogic 7 + dts-dirs += qca 7 8 dts-dirs += ralink 8 9 9 10 obj-y := $(addsuffix /, $(dts-dirs))
+11
arch/mips/boot/dts/qca/Makefile
··· 1 + # All DTBs 2 + dtb-$(CONFIG_ATH79) += ar9132_tl_wr1043nd_v1.dtb 3 + 4 + # Select a DTB to build in the kernel 5 + obj-$(CONFIG_DTB_TL_WR1043ND_V1) += ar9132_tl_wr1043nd_v1.dtb.o 6 + 7 + # Force kbuild to make empty built-in.o if necessary 8 + obj- += dummy.o 9 + 10 + always := $(dtb-y) 11 + clean-files := *.dtb *.dtb.S
+133
arch/mips/boot/dts/qca/ar9132.dtsi
··· 1 + / { 2 + compatible = "qca,ar9132"; 3 + 4 + #address-cells = <1>; 5 + #size-cells = <1>; 6 + 7 + cpus { 8 + #address-cells = <1>; 9 + #size-cells = <0>; 10 + 11 + cpu@0 { 12 + device_type = "cpu"; 13 + compatible = "mips,mips24Kc"; 14 + reg = <0>; 15 + }; 16 + }; 17 + 18 + cpuintc: interrupt-controller { 19 + compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc"; 20 + 21 + interrupt-controller; 22 + #interrupt-cells = <1>; 23 + 24 + qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; 25 + qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, 26 + <&ddr_ctrl 0>, <&ddr_ctrl 1>; 27 + }; 28 + 29 + ahb { 30 + compatible = "simple-bus"; 31 + ranges; 32 + 33 + #address-cells = <1>; 34 + #size-cells = <1>; 35 + 36 + interrupt-parent = <&cpuintc>; 37 + 38 + apb { 39 + compatible = "simple-bus"; 40 + ranges; 41 + 42 + #address-cells = <1>; 43 + #size-cells = <1>; 44 + 45 + interrupt-parent = <&miscintc>; 46 + 47 + ddr_ctrl: memory-controller@18000000 { 48 + compatible = "qca,ar9132-ddr-controller", 49 + "qca,ar7240-ddr-controller"; 50 + reg = <0x18000000 0x100>; 51 + 52 + #qca,ddr-wb-channel-cells = <1>; 53 + }; 54 + 55 + uart@18020000 { 56 + compatible = "ns8250"; 57 + reg = <0x18020000 0x20>; 58 + interrupts = <3>; 59 + 60 + clocks = <&pll 2>; 61 + clock-names = "uart"; 62 + 63 + reg-io-width = <4>; 64 + reg-shift = <2>; 65 + no-loopback-test; 66 + 67 + status = "disabled"; 68 + }; 69 + 70 + gpio: gpio@18040000 { 71 + compatible = "qca,ar9132-gpio", 72 + "qca,ar7100-gpio"; 73 + reg = <0x18040000 0x30>; 74 + interrupts = <2>; 75 + 76 + ngpios = <22>; 77 + 78 + gpio-controller; 79 + #gpio-cells = <2>; 80 + 81 + interrupt-controller; 82 + #interrupt-cells = <2>; 83 + }; 84 + 85 + pll: pll-controller@18050000 { 86 + compatible = "qca,ar9132-ppl", 87 + "qca,ar9130-pll"; 88 + reg = <0x18050000 0x20>; 89 + 90 + clock-names = "ref"; 91 + /* The board must provides the ref clock */ 92 + 93 + #clock-cells = <1>; 94 + clock-output-names = "cpu", "ddr", "ahb"; 95 + }; 96 + 97 + wdt@18060008 { 98 + compatible = "qca,ar7130-wdt"; 99 + reg = <0x18060008 0x8>; 100 + 101 + interrupts = <4>; 102 + 103 + clocks = <&pll 2>; 104 + clock-names = "wdt"; 105 + }; 106 + 107 + miscintc: interrupt-controller@18060010 { 108 + compatible = "qca,ar9132-misc-intc", 109 + "qca,ar7100-misc-intc"; 110 + reg = <0x18060010 0x4>; 111 + 112 + interrupt-parent = <&cpuintc>; 113 + interrupts = <6>; 114 + 115 + interrupt-controller; 116 + #interrupt-cells = <1>; 117 + }; 118 + }; 119 + 120 + spi@1f000000 { 121 + compatible = "qca,ar9132-spi", "qca,ar7100-spi"; 122 + reg = <0x1f000000 0x10>; 123 + 124 + clocks = <&pll 2>; 125 + clock-names = "ahb"; 126 + 127 + status = "disabled"; 128 + 129 + #address-cells = <1>; 130 + #size-cells = <0>; 131 + }; 132 + }; 133 + };
+112
arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
··· 1 + /dts-v1/; 2 + 3 + #include <dt-bindings/gpio/gpio.h> 4 + #include <dt-bindings/input/input.h> 5 + 6 + #include "ar9132.dtsi" 7 + 8 + / { 9 + compatible = "tplink,tl-wr1043nd-v1", "qca,ar9132"; 10 + model = "TP-Link TL-WR1043ND Version 1"; 11 + 12 + alias { 13 + serial0 = "/ahb/apb/uart@18020000"; 14 + }; 15 + 16 + memory@0 { 17 + device_type = "memory"; 18 + reg = <0x0 0x2000000>; 19 + }; 20 + 21 + extosc: oscillator { 22 + compatible = "fixed-clock"; 23 + #clock-cells = <0>; 24 + clock-frequency = <40000000>; 25 + }; 26 + 27 + ahb { 28 + apb { 29 + uart@18020000 { 30 + status = "okay"; 31 + }; 32 + 33 + pll-controller@18050000 { 34 + clocks = <&extosc>; 35 + }; 36 + }; 37 + 38 + spi@1f000000 { 39 + status = "okay"; 40 + num-cs = <1>; 41 + 42 + flash@0 { 43 + #address-cells = <1>; 44 + #size-cells = <1>; 45 + compatible = "s25sl064a"; 46 + reg = <0>; 47 + spi-max-frequency = <25000000>; 48 + 49 + partition@0 { 50 + label = "u-boot"; 51 + reg = <0x000000 0x020000>; 52 + }; 53 + 54 + partition@1 { 55 + label = "firmware"; 56 + reg = <0x020000 0x7D0000>; 57 + }; 58 + 59 + partition@2 { 60 + label = "art"; 61 + reg = <0x7F0000 0x010000>; 62 + read-only; 63 + }; 64 + }; 65 + }; 66 + }; 67 + 68 + gpio-keys { 69 + compatible = "gpio-keys-polled"; 70 + #address-cells = <1>; 71 + #size-cells = <0>; 72 + 73 + poll-interval = <20>; 74 + button@0 { 75 + label = "reset"; 76 + linux,code = <KEY_RESTART>; 77 + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; 78 + debounce-interval = <60>; 79 + }; 80 + 81 + button@1 { 82 + label = "qss"; 83 + linux,code = <KEY_WPS_BUTTON>; 84 + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; 85 + debounce-interval = <60>; 86 + }; 87 + }; 88 + 89 + leds { 90 + compatible = "gpio-leds"; 91 + led@0 { 92 + label = "tp-link:green:usb"; 93 + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; 94 + }; 95 + 96 + led@1 { 97 + label = "tp-link:green:system"; 98 + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; 99 + linux,default-trigger = "heartbeat"; 100 + }; 101 + 102 + led@2 { 103 + label = "tp-link:green:qss"; 104 + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; 105 + }; 106 + 107 + led@3 { 108 + label = "tp-link:green:wlan"; 109 + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; 110 + }; 111 + }; 112 + };