[PATCH 1/3] ramips: add support for the RT6855A SoC

Chuanhong Guo gch981213 at gmail.com
Wed Dec 23 22:09:02 EST 2020


Hi!

On Thu, Dec 24, 2020 at 12:51 AM Rafaël Carré <funman at videolan.org> wrote:
>
> Add Linksys WAP300N target

Please separate device support from target addition, and check
your device support against our wiki checklist:
https://openwrt.org/docs/guide-developer/device-support-policies

>
> Signed-off-by: Rafaël Carré <funman at videolan.org>
> ---
>  target/linux/ramips/Makefile                  |    2 +-
>  target/linux/ramips/dts/rt6855.dtsi           |   93 +
>  .../ramips/dts/rt6855a_linksys_wap300n.dts    |   18 +
>  target/linux/ramips/image/Makefile            |    1 +
>  target/linux/ramips/image/rt6855a.mk          |   15 +
>  .../rt6855a/base-files/etc/board.d/01_leds    |   12 +
>  .../rt6855a/base-files/etc/board.d/02_network |   11 +
>  .../base-files/etc/board.d/03_gpio_switches   |   11 +
>  target/linux/ramips/rt6855a/config-5.4        | 2266 +++++++++++++++++
>  .../ramips/rt6855a/profiles/00-default.mk     |   17 +
>  target/linux/ramips/rt6855a/target.mk         |   15 +
>  11 files changed, 2460 insertions(+), 1 deletion(-)
>  create mode 100644 target/linux/ramips/dts/rt6855.dtsi
>  create mode 100644 target/linux/ramips/dts/rt6855a_linksys_wap300n.dts
>  create mode 100644 target/linux/ramips/image/rt6855a.mk
>  create mode 100755 target/linux/ramips/rt6855a/base-files/etc/board.d/01_leds
>  create mode 100755 target/linux/ramips/rt6855a/base-files/etc/board.d/02_network
>  create mode 100755 target/linux/ramips/rt6855a/base-files/etc/board.d/03_gpio_switches
>  create mode 100644 target/linux/ramips/rt6855a/config-5.4
>  create mode 100644 target/linux/ramips/rt6855a/profiles/00-default.mk
>  create mode 100644 target/linux/ramips/rt6855a/target.mk
>
> diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
> index c3d118b2ab..f03118c1aa 100644
> --- a/target/linux/ramips/Makefile
> +++ b/target/linux/ramips/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>  ARCH:=mipsel
>  BOARD:=ramips
>  BOARDNAME:=MediaTek Ralink MIPS
> -SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883
> +SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883 rt6855a
>  FEATURES:=squashfs gpio
>
>  KERNEL_PATCHVER:=5.4
> diff --git a/target/linux/ramips/dts/rt6855.dtsi b/target/linux/ramips/dts/rt6855.dtsi
> new file mode 100644
> index 0000000000..4ff9460256
> --- /dev/null
> +++ b/target/linux/ramips/dts/rt6855.dtsi
> @@ -0,0 +1,93 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/ {
> +       #address-cells = <1>;
> +       #size-cells = <1>;
> +       compatible = "ralink,rt6855-soc";
> +
> +       cpus {
> +               cpu at 0 {
> +                       compatible = "mips,mips34Kc";
> +               };
> +       };
> +
> +       cpuintc: cpuintc {
> +               #address-cells = <0>;
> +               #interrupt-cells = <1>;
> +               interrupt-controller;
> +               compatible = "mti,cpu-interrupt-controller";
> +       };
> +
> +       palmbus at 1fb00000 {
> +               compatible = "palmbus";
> +               reg = <0x1fb00000 0xe0000>;
> +               ranges = <0x0 0x1fb00000 0x100000>;
> +
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +
> +               sysc at 0 {
> +                       compatible = "ralink,rt6855-sysc";
> +                       reg = <0x0 0x100>;
> +               };
> +
> +               intc: intc at 40000 {
> +                       compatible = "ralink,rt6855-intc";
> +                       reg = <0x40000 0x100>;
> +
> +                       interrupt-controller;
> +                       #interrupt-cells = <1>;
> +
> +                       interrupt-parent = <&cpuintc>;
> +               };
> +
> +               memc at 300 {
> +                       compatible = "ralink,rt6855-memc", "ralink,rt3050-memc";
> +                       reg = <0x300 0x100>;
> +               };
> +
> +               watchdog at f0100 {
> +                       compatible = "ralink,rt6855-wdt";
> +                       reg = <0xf0100 0x10>;
> +               };
> +
> +               uart: uart at f0000 {
> +                       compatible = "ns8250";
> +                       reg = <0xf0000 0x30>;
> +                       interrupts = <0>;
> +
> +                       clock-frequency = <921600>;
> +
> +                       reg-io-width = <4>;
> +                       reg-shift = <2>;
> +                       no-loopback-test;
> +
> +                       status = "okay";
> +
> +                       interrupt-parent = <&intc>;
> +               };
> +
> +               gdma: gdma at 30000 {
> +                       compatible = "ralink,gdma-rt2880";
> +                       reg = <0x30000 0x100>;
> +               };
> +
> +        ethernet: ethernet at 50000{
> +            compatible = "ralink,rt6855-eth";

This doesn't match your compatible string choice in the ethernet driver.

> +            reg = <0x50000 0x10000>;
> +
> +            interrupt-parent = <&intc>;
> +            interrupts = <21>;
> +
> +            mediatek,switch = <&esw>;
> +        };
> +
> +        esw: esw at 60000 {
> +            compatible = "ralink,rt3050-esw";
> +            reg = <0x60000 0x8000>;
> +
> +            interrupt-parent = <&intc>;
> +            interrupts = <15>;
> +        };
> +
> +       };
> +};
> diff --git a/target/linux/ramips/dts/rt6855a_linksys_wap300n.dts b/target/linux/ramips/dts/rt6855a_linksys_wap300n.dts
> new file mode 100644
> index 0000000000..d923946c4a
> --- /dev/null
> +++ b/target/linux/ramips/dts/rt6855a_linksys_wap300n.dts
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +
> +/include/ "rt6855.dtsi"
> +
> +/ {
> +       compatible = "ralink,rt6855-soc";
> +       model = "Linksys WAP300n";
> +
> +       memory at 0 {
> +               device_type = "memory";
> +               reg = <0x20000 0x3fe0000>;
> +       };
> +
> +       chosen {
> +               bootargs = "console=ttyS0,57600";
> +       };
> +};

Seems incomplete?

> diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
> index 4274c24884..8c916c072b 100644
> --- a/target/linux/ramips/image/Makefile
> +++ b/target/linux/ramips/image/Makefile
> @@ -17,6 +17,7 @@ DEVICE_VARS += SERCOMM_PAD JCG_MAXSIZE
>  loadaddr-y := 0x80000000
>  loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
>  loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
> +loadaddr-$(CONFIG_TARGET_ramips_rt6855a) := 0x80020000
>
>  ldrplatform-y := ralink
>  ldrplatform-$(CONFIG_TARGET_ramips_mt7621) := mt7621
> diff --git a/target/linux/ramips/image/rt6855a.mk b/target/linux/ramips/image/rt6855a.mk
> new file mode 100644
> index 0000000000..8e622ce55e
> --- /dev/null
> +++ b/target/linux/ramips/image/rt6855a.mk
> @@ -0,0 +1,15 @@
> +#
> +# RT6855A Profiles
> +#
> +
> +DEVICE_VARS += DLINK_ROM_ID DLINK_FAMILY_MEMBER DLINK_FIRMWARE_SIZE DLINK_IMAGE_OFFSET

These variables aren't used by the image recipes you defined
below. This linke can be dropped entirely.

> +
> +define Device/linksys_wap300n
> +  SOC := rt6855a
> +  IMAGE_SIZE := 7936k
> +  DEVICE_VENDOR := Linksys
> +  DEVICE_MODEL := WAP300N
> +  DEVICE_PACKAGES:= kmod-rt2800-pci
> +  SUPPORTED_DEVICES += wap300n

This SUPPORTED_DEVICES you see in other image makefile
is for sysupgrade compatibility from OpenWrt 18.06.
You don't need this for a new device.

> +endef
> +TARGET_DEVICES += linksys_wap300n
> diff --git a/target/linux/ramips/rt6855a/base-files/etc/board.d/01_leds b/target/linux/ramips/rt6855a/base-files/etc/board.d/01_leds
> new file mode 100755
> index 0000000000..b3acaa5410
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/base-files/etc/board.d/01_leds

Add a case for $board in these board.d scripts like what's done in
other targets.

> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +. /lib/functions/leds.sh
> +. /lib/functions/uci-defaults.sh
> +
> +board=$(board_name)
> +
> +board_config_update
> +
> +board_config_flush
> +
> +exit 0
> diff --git a/target/linux/ramips/rt6855a/base-files/etc/board.d/02_network b/target/linux/ramips/rt6855a/base-files/etc/board.d/02_network
> new file mode 100755
> index 0000000000..af223209c8
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/base-files/etc/board.d/02_network
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +. /lib/functions.sh
> +. /lib/functions/uci-defaults.sh
> +. /lib/functions/system.sh
> +
> +board_config_update
> +ucidef_set_interface_lan "eth0"
> +board_config_flush
> +
> +exit 0
> diff --git a/target/linux/ramips/rt6855a/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/rt6855a/base-files/etc/board.d/03_gpio_switches
> new file mode 100755
> index 0000000000..69a5f27a95
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/base-files/etc/board.d/03_gpio_switches
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +. /lib/functions/uci-defaults.sh
> +
> +board_config_update
> +
> +board=$(board_name)
> +
> +board_config_flush
> +
> +exit 0
> diff --git a/target/linux/ramips/rt6855a/config-5.4 b/target/linux/ramips/rt6855a/config-5.4
> new file mode 100644
> index 0000000000..77ac7af2c0
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/config-5.4
> @@ -0,0 +1,2266 @@
> +#
> +# Automatically generated file; DO NOT EDIT.
> +# Linux/mips 5.4.85 Kernel Configuration
> +#

OpenWrt buildroot has scripts to deal with kernel configs.
You should use make kernel_menuconfig and exit the config menu
to get this config file refreshed. (Common options defined in kernel
packages and target/linux/generic will be remobed by kconfig scripts.)

> [...]
> diff --git a/target/linux/ramips/rt6855a/profiles/00-default.mk b/target/linux/ramips/rt6855a/profiles/00-default.mk
> new file mode 100644
> index 0000000000..c0706254c7
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/profiles/00-default.mk
> @@ -0,0 +1,17 @@
> +#
> +# Copyright (C) 2011 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +define Profile/Default
> +       NAME:=Default Profile
> +       PRIORITY:=1
> +       PACKAGES:=
> +endef
> +
> +define Profile/Default/Description
> +       Default package set compatible with most boards.
> +endef
> +$(eval $(call Profile,Default))
> diff --git a/target/linux/ramips/rt6855a/target.mk b/target/linux/ramips/rt6855a/target.mk
> new file mode 100644
> index 0000000000..0efedf4fde
> --- /dev/null
> +++ b/target/linux/ramips/rt6855a/target.mk
> @@ -0,0 +1,15 @@
> +#
> +# Copyright (C) 2009 OpenWrt.org
> +#
> +
> +SUBTARGET:=rt6855a
> +BOARDNAME:=RT6855A based boards
> +FEATURES+=ramdisk pci
> +CPU_TYPE:=34kc
> +
> +DEFAULT_PACKAGES += wpad-basic-wolfssl swconfig
> +
> +define Target/Description
> +       Build firmware images for Ralink RT6855A based boards.
> +endef
> +

-- 
Regards,
Chuanhong Guo



More information about the openwrt-devel mailing list