[source] ar71xx: add support for 8devices Rambutan development board

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 14:03:40 PDT 2017


pepe2k pushed a commit to source.git, branch master:
https://git.lede-project.org/68b5d34f69421264de6e5d77760fcc2bfe9ee687

commit 68b5d34f69421264de6e5d77760fcc2bfe9ee687
Author: Mantas Pucka <mantas at 8devices.com>
AuthorDate: Mon May 8 13:28:38 2017 +0300

    ar71xx: add support for 8devices Rambutan development board
    
    Rambutan is a Wifi module based on QCA9550/9557
    http://www.8devices.com/products/rambutan
    
    This commit adds basic support for Rambutan development kit
    
    Specification:
    - 720/600/200 MHz (CPU/DDR/AHB)
    - 128 MB of DDR2 RAM
    - 128 MB of NAND Flash
    - 1x 100Mbps Ethernet
    - 1x 1000Mbps Ethernet (PHY on dev-kit)
    - 1x Wifi radio 2x2 MIMO, dualband 2.4 and 5 GHz
    - 2x U.FL connectors on module, chip antennas on dev-kit
    - 1x miniPCIe slot
    - 1x USB2.0 host socket + 1x USB2.0 pins on 2.54mm header
    
    Flash instructions:
    Stock firmware is OpenWrt, so use:
     sysupgrade -n /tmp/lede-ar71xx-nand-rambutan-squashfs-sysupgrade.tar
    or upgarde from GUI (don't save config)
    Use factory image to flash from U-Boot:
     tftpboot 80060000 lede-ar71xx-nand-rambutan-squashfs-factory.ubi
     nand erase.part ubi
     nand write 80060000 ubi ${filesize}
    
    Signed-off-by: Mantas Pucka <mantas at 8devices.com>
    [split support in uboot-envtools package into a separate commit,
    fixed alphabetical order in lib/preinit/05_set_iface_mac_ar71xx]
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
---
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  3 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  3 +
 .../base-files/lib/preinit/05_set_iface_mac_ar71xx |  6 ++
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  2 +
 target/linux/ar71xx/config-4.4                     |  1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   | 10 +++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |  1 +
 .../ar71xx/files/arch/mips/ath79/mach-rambutan.c   | 90 ++++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |  1 +
 target/linux/ar71xx/image/nand.mk                  | 14 ++++
 target/linux/ar71xx/nand/config-default            |  1 +
 11 files changed, 132 insertions(+)

diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 945167b..4db1b14 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -74,6 +74,9 @@ case "$FIRMWARE" in
 		ath9k_eeprom_extract "caldata" 4096 2048
 		ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0)
 		;;
+	rambutan)
+		ath9k_eeprom_extract "art" 4096 2048
+		;;
 	z1)
 		. /lib/upgrade/nand.sh
 
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 92ee516..5c3b1a7 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -811,6 +811,9 @@ ar71xx_board_detect() {
 	*"R6100")
 		name="r6100"
 		;;
+	*"Rambutan"*)
+		name="rambutan"
+		;;
 	*"RE450")
 		name="re450"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
index 50f59de..277287d 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
+++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx
@@ -44,6 +44,12 @@ preinit_set_mac_address() {
 			mac_wan=$(mtd_get_mac_binary caldata 6)
 			[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
 			;;
+		rambutan)
+			mac_lan=$(mtd_get_mac_binary art 0)
+			[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
+			mac_wan=$(mtd_get_mac_binary art 6)
+			[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
+			;;
 		tew-632brp)
 			fetch_mac_from_mtd config lan_mac wan_mac
 			;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 5be678e..8ebdea3 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -521,6 +521,7 @@ platform_check_image() {
 	c-60|\
 	nbg6716|\
 	r6100|\
+	rambutan|\
 	wndr3700v4|\
 	wndr4300)
 		nand_do_platform_check $board $1
@@ -663,6 +664,7 @@ platform_pre_upgrade() {
 	c-60|\
 	nbg6716|\
 	r6100|\
+	rambutan|\
 	rb-411|\
 	rb-411u|\
 	rb-433|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 6d0941b..380254d 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -146,6 +146,7 @@ CONFIG_ATH79_MACH_PQI_AIR_PEN=y
 CONFIG_ATH79_MACH_QIHOO_C301=y
 CONFIG_ATH79_MACH_R602N=y
 CONFIG_ATH79_MACH_R6100=y
+# CONFIG_ATH79_MACH_RAMBUTAN is not set
 # CONFIG_ATH79_MACH_RB2011 is not set
 # CONFIG_ATH79_MACH_RB4XX is not set
 # CONFIG_ATH79_MACH_RB750 is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 7c3aa77..eb8219e 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1897,6 +1897,16 @@ config ATH79_MACH_LIMA
 	select ATH79_DEV_WMAC
 	select ATH79_DEV_ETH
 
+config ATH79_MACH_RAMBUTAN
+	bool "8devices Rambutan board"
+	select SOC_QCA955X
+	select ATH79_DEV_AP9X_PCI if PCI
+	select ATH79_DEV_ETH
+	select ATH79_DEV_GPIO_BUTTONS
+	select ATH79_DEV_NFC
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+
 config ATH79_MACH_CF_E316N_V2
 	bool "COMFAST CF-E316N v2 support"
 	select SOC_AR934X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 01ec133..f503002 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -137,6 +137,7 @@ obj-$(CONFIG_ATH79_MACH_MZK_W04NU)		+= mach-mzk-w04nu.o
 obj-$(CONFIG_ATH79_MACH_MZK_W300NH)		+= mach-mzk-w300nh.o
 obj-$(CONFIG_ATH79_MACH_NBG460N)		+= mach-nbg460n.o
 obj-$(CONFIG_ATH79_MACH_NBG6716)		+= mach-nbg6716.o
+obj-$(CONFIG_ATH79_MACH_RAMBUTAN)		+= mach-rambutan.o
 obj-$(CONFIG_ATH79_MACH_OM2P)			+= mach-om2p.o
 obj-$(CONFIG_ATH79_MACH_OM5P)			+= mach-om5p.o
 obj-$(CONFIG_ATH79_MACH_OM5P_AC)		+= mach-om5pac.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c
new file mode 100644
index 0000000..103aeb4
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c
@@ -0,0 +1,90 @@
+/*
+ *  8devices Rambutan board support
+ *
+ *  Copyright (C) 2017 Mantas Pucka <mantas at 8devices.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/pci.h>
+#include <linux/phy.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <linux/platform/ar934x_nfc.h>
+#include <linux/ar8216_platform.h>
+#include <linux/platform_data/phy-at803x.h>
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-spi.h"
+#include "dev-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+
+static struct at803x_platform_data rambutan_ar8032_data = {
+	.has_reset_gpio = 1,
+	.reset_gpio = 17,
+};
+
+static struct mdio_board_info rambutan_mdio0_info[] = {
+	{
+		.bus_id = "ag71xx-mdio.0",
+		.phy_addr = 0,
+		.platform_data = &rambutan_ar8032_data,
+	},
+};
+
+static struct at803x_platform_data rambutan_ar8033_data = {
+	.has_reset_gpio = 1,
+	.reset_gpio = 23,
+};
+
+static struct mdio_board_info rambutan_mdio1_info[] = {
+	{
+		.bus_id = "ag71xx-mdio.1",
+		.phy_addr = 0,
+		.platform_data = &rambutan_ar8033_data,
+	},
+};
+
+static void __init rambutan_setup(void)
+{
+	ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
+	ath79_register_nfc();
+	ath79_register_usb();
+	ath79_register_pci();
+	ath79_register_wmac_simple();
+
+	mdiobus_register_board_info(rambutan_mdio0_info,
+				    ARRAY_SIZE(rambutan_mdio0_info));
+	mdiobus_register_board_info(rambutan_mdio1_info,
+				    ARRAY_SIZE(rambutan_mdio1_info));
+	ath79_register_mdio(0, 0x0);
+	ath79_register_mdio(1, 0x0);
+
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+	ath79_eth0_data.phy_mask = BIT(0);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+	ath79_register_eth(0);
+
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+	ath79_eth1_data.phy_mask = BIT(0);
+	ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev;
+	ath79_eth1_pll_data.pll_1000 = 0x17000000;
+	ath79_eth1_pll_data.pll_10 = 0x1313;
+	ath79_register_eth(1);
+}
+
+MIPS_MACHINE(ATH79_MACH_RAMBUTAN, "RAMBUTAN", "8devices Rambutan board",
+	     rambutan_setup);
+
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 694470d..4f0ae32 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -155,6 +155,7 @@ enum ath79_mach_type {
 	ATH79_MACH_QIHOO_C301,			/* Qihoo 360 C301 */
 	ATH79_MACH_R602N,			/* P&W R602N */
 	ATH79_MACH_R6100,			/* NETGEAR R6100 */
+	ATH79_MACH_RAMBUTAN,			/* 8devices Rambutan */
 	ATH79_MACH_RB_2011G,			/* Mikrotik RouterBOARD 2011UAS-2HnD */
 	ATH79_MACH_RB_2011L,			/* Mikrotik RouterBOARD 2011L */
 	ATH79_MACH_RB_2011R5,			/* Mikrotik RouterBOARD 2011UiAS(-2Hnd) */
diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk
index 15e0809..dfe78c2 100644
--- a/target/linux/ar71xx/image/nand.mk
+++ b/target/linux/ar71xx/image/nand.mk
@@ -52,6 +52,20 @@ define Build/MerakiNAND-old
 	@mv $@.new $@
 endef
 
+define Device/rambutan
+  DEVICE_TITLE := 8devices Rambutan
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+  BOARDNAME = RAMBUTAN
+  BLOCKSIZE = 128KiB
+  MTDPARTS = ar934x-nfc:3M(u-boot)ro,2M(u-boot-env),1M(art),122M(ubi)
+  PAGESIZE := 2048
+  KERNEL_IN_UBI := 1
+  IMAGES := factory.ubi sysupgrade.tar
+  IMAGE/sysupgrade.tar := sysupgrade-tar
+  IMAGE/factory.ubi := append-ubi
+endef
+TARGET_DEVICES += rambutan
+
 define Device/z1
   DEVICE_TITLE := Meraki Z1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-spi-gpio kmod-ath9k kmod-owl-loader
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 1c5d0ba..9b57f90 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -106,6 +106,7 @@
 # CONFIG_ATH79_MACH_PQI_AIR_PEN is not set
 # CONFIG_ATH79_MACH_QIHOO_C301 is not set
 # CONFIG_ATH79_MACH_R602N is not set
+CONFIG_ATH79_MACH_RAMBUTAN=y
 # CONFIG_ATH79_MACH_RE450 is not set
 # CONFIG_ATH79_MACH_RW2458N is not set
 # CONFIG_ATH79_MACH_SC1750 is not set



More information about the lede-commits mailing list