From 0e81968ee8def1d477f12d1eeb63f485c551463e Mon Sep 17 00:00:00 2001 From: "Marty E. Plummer" Date: Tue, 29 May 2018 03:02:59 -0500 Subject: [PATCH] ath79: add initial nand support for gl-ar300m Signed-off-by: Marty E. Plummer --- target/linux/ath79/Makefile | 2 +- .../ath79/dts/qca9533_glinet_ar300m_nand.dts | 67 +++++++++++++++++++ target/linux/ath79/image/Makefile | 3 + target/linux/ath79/image/nand.mk | 13 ++++ target/linux/ath79/nand/config-default | 14 ++++ .../linux/ath79/nand/profiles/00-default.mk | 18 +++++ target/linux/ath79/nand/target.mk | 7 ++ 7 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9533_glinet_ar300m_nand.dts create mode 100644 target/linux/ath79/image/nand.mk create mode 100644 target/linux/ath79/nand/config-default create mode 100644 target/linux/ath79/nand/profiles/00-default.mk create mode 100644 target/linux/ath79/nand/target.mk diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index 6add24a72a..2d8ca7efdb 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -4,7 +4,7 @@ ARCH:=mips BOARD:=ath79 BOARDNAME:=Atheros ATH79 (DTS) CPU_TYPE:=24kc -SUBTARGETS:=generic tiny +SUBTARGETS:=generic nand tiny FEATURES:=ramdisk source-only diff --git a/target/linux/ath79/dts/qca9533_glinet_ar300m_nand.dts b/target/linux/ath79/dts/qca9533_glinet_ar300m_nand.dts new file mode 100644 index 0000000000..c1c4493a22 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_glinet_ar300m_nand.dts @@ -0,0 +1,67 @@ +/dts-v1/; + +#include "qca9533_glinet_ar300m.dtsi" + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128", "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@1 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@2 { + label = "reserved"; + reg = <0x050000 0xfa0000>; + }; + + art: partition@3 { + label = "art"; + reg = <0xff0000 0x010000>; + }; + }; + }; + + flash@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spinand,mt29f"; + reg = <1>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x000000 0x0200000>; + }; + + partition@1 { + label = "ubi"; + reg = <0x200000 0x7e00000>; + }; + }; + }; +}; diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 34dd819610..f4c0c1e3a5 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -71,6 +71,9 @@ include ./generic.mk include ./generic-tp-link.mk include ./generic-ubnt.mk endif +ifeq ($(SUBTARGET),nand) +include ./nand.mk +endif ifeq ($(SUBTARGET),tiny) include ./tiny-tp-link.mk endif diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk new file mode 100644 index 0000000000..979afd2b2b --- /dev/null +++ b/target/linux/ath79/image/nand.mk @@ -0,0 +1,13 @@ +define Device/glinet_ar300m_nand + ATH_SOC := qca9533 + DEVICE_TITLE := GL-AR300M (NAND) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-usb-ledtrig-usbport + KERNEL_SIZE := 2048k + BLOCKSIZE := 128k + PAGESIZE := 2048 + VID_HDR_OFFSET := 512 + IMAGES := factory.ubi sysupgrade.tar + IMAGE/sysupgrade.tar := sysupgrade-tar + IMAGE/factory.ubi := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi +endef +TARGET_DEVICES += glinet_ar300m_nand diff --git a/target/linux/ath79/nand/config-default b/target/linux/ath79/nand/config-default new file mode 100644 index 0000000000..738c29c9b1 --- /dev/null +++ b/target/linux/ath79/nand/config-default @@ -0,0 +1,14 @@ +CONFIG_BCH=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_BCH=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_ECC_BCH=y +CONFIG_MTD_SPINAND_MT29F=y +CONFIG_MTD_SPINAND_ONDIEECC=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_BLOCK is not set +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +# CONFIG_UBIFS_FS is not set diff --git a/target/linux/ath79/nand/profiles/00-default.mk b/target/linux/ath79/nand/profiles/00-default.mk new file mode 100644 index 0000000000..06ab790389 --- /dev/null +++ b/target/linux/ath79/nand/profiles/00-default.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2009 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 + PACKAGES:= \ + kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport + PRIORITY := 1 +endef + +define Profile/Default/Description + Default package set compatible with most boards. +endef +$(eval $(call Profile,Default)) diff --git a/target/linux/ath79/nand/target.mk b/target/linux/ath79/nand/target.mk new file mode 100644 index 0000000000..a53603d27b --- /dev/null +++ b/target/linux/ath79/nand/target.mk @@ -0,0 +1,7 @@ +BOARDNAME := Generic devices with NAND flash +FEATURES += squashfs nand rtc + +define Target/Description + Build firmware for Atheros AR71xx/AR913x based boards with + NAND flash, e.g. Netgear WNDR4300. +endef -- 2.30.2