diff options
author | Chuanhong Guo <gch981213@gmail.com> | 2019-08-04 22:13:45 +0800 |
---|---|---|
committer | Chuanhong Guo <gch981213@gmail.com> | 2019-08-08 21:00:59 +0800 |
commit | 4d5dae27419a6883484d0a051c653888d2042bca (patch) | |
tree | ce20ef29c1780f67d9634996c7ded9f8f124d111 /target/linux/ath79/dts | |
parent | 1d6368ee73a8a2c3ba1593fc4dd143f094f48520 (diff) | |
download | upstream-4d5dae27419a6883484d0a051c653888d2042bca.tar.gz upstream-4d5dae27419a6883484d0a051c653888d2042bca.tar.bz2 upstream-4d5dae27419a6883484d0a051c653888d2042bca.zip |
ath79: add support for PISEN WMB001N
Specifications:
- SoC: AR9341
- RAM: 64M
- Flash: 16M
- Ethernet: 1 * FE port
- WiFi: ar934x-wmac
- Sound: WM8918 DAC
1 * 3.5mm headphone jack
2 * RCA connectors for speakers
1 * SPDIF out
- USB: 1 * USB2.0 port
Flash instruction:
Upload generated factory image via vendor's web interface.
Notes:
A. Audio stuff:
1. Since AR934x, all pins for peripheral blocks can be mapped to
any available GPIOs. We currently don't have a PCM/I2S driver
for AR934x so pinmux for i2s and SPDIF are bound to i2c gpio
node. This should be moved into I2S node when a PCM/I2S driver
is available.
2. The i2c-gpio node is for WM8918. DT binding for it can't be added
currently due to a missing clock from I2S PLL.
B. Factory image:
Image contains a image header and a tar.gz archive.
1. Header: A 288 byte header that has nothing to do with appended
tarball. Format:
0x0-0x7 and 0x18-0x1F: magic values
0x20: Model number string
0xFC: Action string. It's either "update" or "backup"
0x11C: A 1 byte checksum. It's XOR result of 0x8-0x11B
Firmware doesn't care about the rest of the header as long as
checksum result is correct.
The same header is used for backup and update routines so the
magic values and model number can be obtained by generating a
backup bin and grab values from it.
2. Tarball: It contains two files named uImage and rootfs, which
will be flashed into corresponding mtd partition.
Writing a special utility that can only output a fixed binary
blob is overkill so factory image header is placed under
image/bin instead.
C. LED
The wifi led has "Wi-Fi" marked on the case but vendor's firmware
used it as system status indicator. I did the same in this device
support patch.
D. Firmware
Factory u-boot is built without 'savenv' support so it's impossible
to change kernel offset. A 2MB kernel partition won't be enough in
the future. OKLI loader is used here to migrate this problem:
1. add OKLI image magic support into uImage parser.
2. build an OKLI loader, compress it with lzma and add a normal
uImage header.
3. flash the loader to where the original kernel supposed to be.
4. create a uImage firmware using OKLI loader.
5. flash the created firmware to where rootfs supposed to be.
By doing so, u-boot will start OKLI loader, which will then load
the actual kernel at 0x20000.
The kernel partition is 2MB, which is too much for our loader.
To save this space, "mtd-concat" is used here:
1. create a 64K (1 erase block) partition for OKLI loader and
create another partition with the left space.
2. concatenate rootfs and this partition into a virtual flash.
3. use the virtual flash for firmware partition.
Currently OKLI loader is flashed with factory image only.
sysupgrade won't replace it. Since it only has one function
and it works for several years, its unlikely to have some bugs
that requires a replacement.
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/ath79/dts')
-rw-r--r-- | target/linux/ath79/dts/ar9341_pisen_wmb001n.dts | 225 |
1 files changed, 225 insertions, 0 deletions
diff --git a/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts new file mode 100644 index 0000000000..8029de5495 --- /dev/null +++ b/target/linux/ath79/dts/ar9341_pisen_wmb001n.dts @@ -0,0 +1,225 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> + +#include "ar9341.dtsi" + +/ { + model = "PISEN WMB001N"; + compatible = "pisen,wmb001n", "qca,ar9341"; + + aliases { + serial0 = &uart; + led-boot = &wifi; + led-failsafe = &wifi; + led-running = &wifi; + led-upgrade = &wifi; + }; + + i2c { + compatible = "i2c-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_i2c_gpio &pmx_i2s_spdif>; + + sda-gpios = <&gpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + /* + * Pull-up resistor for scl is missing on this board. + * Following settings trick i2c-gpio to use output mode + * instead of open-drain for scl. + */ + i2c-gpio,scl-output-only; + i2c-gpio,scl-open-drain; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + vol_down { + label = "volume down"; + linux,code = <KEY_VOLUMEDOWN>; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + vol_up { + label = "volume up"; + linux,code = <KEY_VOLUMEUP>; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + volume1 { + label = "wmb001n:blue:volume1"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + + volume2 { + label = "wmb001n:blue:volume2"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + volume3 { + label = "wmb001n:blue:volume3"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + + volume4 { + label = "wmb001n:blue:volume4"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + volume5 { + label = "wmb001n:blue:volume5"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + wifi: wifi { + label = "wmb001n:blue:wifi"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&fwpart1 &fwpart2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x0>; + label = "firmware"; + compatible = "openwrt,okli"; + }; + }; + }; +}; + +&pinmux { + pmx_i2c_gpio: pinmux_i2c_gpio { + pinctrl-single,bits = <0x10 0x0 0xff>, + <0x14 0x0 0xff>; + }; + + pmx_i2s_spdif: pinmux_i2s_spdif { + pinctrl-single,bits = <0x8 0x0e000000 0xff000000>, + <0xc 0x0f0c0d 0xffffff>, + <0x14 0x1900 0xff00>; + }; +}; + +&ref { + clock-frequency = <25000000>; +}; + +&uart { + status = "okay"; +}; + +&gpio { + status = "okay"; +}; + +&spi { + num-cs = <1>; + + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x0 0x10000>; + read-only; + }; + + partition@10000 { + label = "u-boot-env"; + reg = <0x10000 0x10000>; + read-only; + }; + + fwpart1: partition@20000 { + label = "fwpart1"; + reg = <0x20000 0xdc0000>; + }; + + partition@de0000 { + label = "loader"; + reg = <0xde0000 0x10000>; + }; + + fwpart2: partition@df0000 { + label = "fwpart2"; + reg = <0xdf0000 0x1f0000>; + }; + + partition@fe0000 { + label = "mib0"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +ð0 { + status = "okay"; + phy-handle = <&swphy4>; + mtd-mac-address = <&art 0x0>; +}; + +ð1 { + compatible = "syscon", "simple-mfd"; + status = "okay"; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <0>; + }; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; +}; |