[source] ar71xx: add support for 8devices Lima board

LEDE Commits lede-commits at lists.infradead.org
Fri Feb 17 01:22:29 PST 2017


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/58fc50f1b088a4bf89b2ce355fc8a4cef3dffcd2

commit 58fc50f1b088a4bf89b2ce355fc8a4cef3dffcd2
Author: Karol Dudek <karoiz at sli.pl>
AuthorDate: Sun Feb 12 18:34:36 2017 +0100

    ar71xx: add support for 8devices Lima board
    
    Lima is a module for the (IoE) internet of everything applications,
    based on Qualcomm/Atheros QCA4531.
    
    Specification:
    
    - 650/600/216 MHz (CPU/DDR/AHB)
    - 64 MB of RAM (DDR2)
    - 32 MB of FLASH
    - 2T2R 2.4 GHz
    - 2x 10/100 Mbps Ethernet
    - USB 2.0 Host
    - PCIe
    - UART for serial console
    - 14x GPIO
    
    Flash instruction:
    1. Download lede-ar71xx-generic-lima-squashfs-sysupgrade.bin
    and rename it to 8dev_recovery.bin
    2. Binary file copy to USB stick and plug into slot USB
    3. Press S2 (reset) button
    4. Press and hold the S1 button by 5 seconds
    5. Wait ~40 seconds to complete recovery
    
    Tested on:
    
    - Lima development kit
    
    Signed-off-by: Karol Dudek <karoiz at sli.pl>
---
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  1 +
 target/linux/ar71xx/config-4.4                     |  1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   | 11 +++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |  1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-lima.c | 88 ++++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |  1 +
 target/linux/ar71xx/image/generic.mk               |  9 +++
 target/linux/ar71xx/mikrotik/config-default        |  1 +
 target/linux/ar71xx/nand/config-default            |  1 +
 10 files changed, 117 insertions(+)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index fc3a5dd..2ae4e11 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1262,6 +1262,9 @@ ar71xx_board_detect() {
 	"8devices Carambola2"*)
 		name="carambola2"
 		;;
+	"8devices Lima"*)
+		name="lima"
+		;;
 	*"Sitecom WLR-8100")
 		name="wlr8100"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index fa83db2..c2585b4 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -247,6 +247,7 @@ platform_check_image() {
 	hiwifi-hc6361|\
 	hornet-ub-x2|\
 	jwap230|\
+	lima|\
 	loco-m-xw|\
 	mzk-w04nu|\
 	mzk-w300nh|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index b9f80a5..d45c3c4 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -116,6 +116,7 @@ CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
 CONFIG_ATH79_MACH_JWAP003=y
 CONFIG_ATH79_MACH_JWAP230=y
+CONFIG_ATH79_MACH_LIMA=y
 CONFIG_ATH79_MACH_MC_MAC1200R=y
 CONFIG_ATH79_MACH_MR12=y
 CONFIG_ATH79_MACH_MR16=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 4c00ea5..44f754c 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1822,6 +1822,17 @@ config ATH79_MACH_CARAMBOLA2
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
 
+config ATH79_MACH_LIMA
+	bool "8devices Lima board"
+	select SOC_QCA953X
+	select ATH79_DEV_AP9X_PCI if PCI
+	select ATH79_DEV_GPIO_BUTTONS
+	select ATH79_DEV_M25P80
+	select ATH79_DEV_SPI
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+	select ATH79_DEV_ETH
+
 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 e0748b1..f402463 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -120,6 +120,7 @@ obj-$(CONFIG_ATH79_MACH_HORNET_UB)		+= mach-hornet-ub.o
 obj-$(CONFIG_ATH79_MACH_JA76PF)			+= mach-ja76pf.o
 obj-$(CONFIG_ATH79_MACH_JWAP003)		+= mach-jwap003.o
 obj-$(CONFIG_ATH79_MACH_JWAP230)		+= mach-jwap230.o
+obj-$(CONFIG_ATH79_MACH_LIMA)			+= mach-lima.o
 obj-$(CONFIG_ATH79_MACH_MC_MAC1200R)		+= mach-mc-mac1200r.o
 obj-$(CONFIG_ATH79_MACH_MR12)			+= mach-mr12.o
 obj-$(CONFIG_ATH79_MACH_MR16)			+= mach-mr16.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-lima.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-lima.c
new file mode 100644
index 0000000..9c784f7
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-lima.c
@@ -0,0 +1,88 @@
+/*
+ *  8devices Lima board support
+ *
+ *  Copyright (C) 2016 Mantas Pucka <mantas at 8devices.com>
+ *  Copyright (C) 2017 Karol Dudek <karoiz at sli.pl>
+ *
+ *  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/platform_device.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include <asm/mach-ath79/ath79.h>
+
+#include "common.h"
+#include "dev-ap9x-pci.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-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+
+#define LIMA_GPIO_BTN_1_DEFAULT		16
+#define LIMA_KEYS_POLL_INTERVAL		20	/* msecs */
+#define LIMA_KEYS_DEBOUNCE_INTERVAL	(3 * LIMA_KEYS_POLL_INTERVAL)
+
+#define LIMA_ETH_PHYS		(BIT(0) | BIT(1))
+
+#define LIMA_MAC0_OFFSET	0x0000
+#define LIMA_MAC1_OFFSET	0x0006
+
+#define LIMA_CALDATA_OFFSET	0x1000
+#define LIMA_WMAC_MAC_OFFSET	0x0800
+
+static struct gpio_keys_button lima_gpio_keys[] __initdata = {
+	{
+		.desc		= "button1",
+		.type		= EV_KEY,
+		.code		= BTN_1,
+		.debounce_interval = LIMA_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= LIMA_GPIO_BTN_1_DEFAULT,
+		.active_low	= 1,
+	}
+};
+
+static void __init lima_setup(void)
+{
+	u8 *art = (u8 *) KSEG1ADDR(0x1f080000);
+
+	ath79_register_m25p80(NULL);
+
+	ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(lima_gpio_keys),
+					lima_gpio_keys);
+
+	ath79_setup_ar933x_phy4_switch(true, true);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, art + LIMA_MAC0_OFFSET, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, art + LIMA_MAC1_OFFSET, 0);
+
+	ath79_register_mdio(0, ~LIMA_ETH_PHYS);
+
+	ath79_switch_data.phy4_mii_en = 1;
+
+	ath79_switch_data.phy_poll_mask |= BIT(0);
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+	ath79_eth1_data.duplex = DUPLEX_FULL;
+	ath79_eth1_data.phy_mask = BIT(1);
+	ath79_register_eth(1);
+
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+	ath79_eth0_data.duplex = DUPLEX_FULL;
+	ath79_eth0_data.speed = SPEED_100;
+	ath79_eth0_data.phy_mask = BIT(0);
+	ath79_register_eth(0);
+
+	ath79_register_wmac(art + LIMA_CALDATA_OFFSET,
+			art + LIMA_WMAC_MAC_OFFSET);
+	ath79_register_usb();
+	ath79_register_pci();
+}
+
+MIPS_MACHINE(ATH79_MACH_LIMA, "LIMA", "8devices Lima board", lima_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 69c848e..39a80fc 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -113,6 +113,7 @@ enum ath79_mach_type {
 	ATH79_MACH_JA76PF2,			/* jjPlus JA76PF2 */
 	ATH79_MACH_JWAP003,			/* jjPlus JWAP003 */
 	ATH79_MACH_JWAP230,			/* jjPlus JWAP230 */
+	ATH79_MACH_LIMA,			/* 8devices Lima */
 	ATH79_MACH_MC_MAC1200R,			/* MERCURY MAC1200R */
 	ATH79_MACH_MR12,			/* Cisco Meraki MR12 */
 	ATH79_MACH_MR16,			/* Cisco Meraki MR16 */
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 2384761..02f0747 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -161,6 +161,15 @@ define Device/gl-mifi
 endef
 TARGET_DEVICES += gl-mifi
 
+define Device/lima
+  DEVICE_TITLE := Lima board from 8Devices
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+  BOARDNAME = LIMA
+  IMAGE_SIZE = 15616k
+  MTDPARTS = spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,256k(art)ro,-(firmware)
+endef
+TARGET_DEVICES += lima
+
 define Device/mr12
   DEVICE_TITLE := Meraki MR12
   DEVICE_PACKAGES := kmod-spi-gpio
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index 62ff5a5..aa2cf3c 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -81,6 +81,7 @@
 # CONFIG_ATH79_MACH_JA76PF is not set
 # CONFIG_ATH79_MACH_JWAP003 is not set
 # CONFIG_ATH79_MACH_JWAP230 is not set
+# CONFIG_ATH79_MACH_LIMA is not set
 # CONFIG_ATH79_MACH_MC_MAC1200R is not set
 # CONFIG_ATH79_MACH_MR12 is not set
 # CONFIG_ATH79_MACH_MR16 is not set
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 3d3e256..14504a4 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -79,6 +79,7 @@
 # CONFIG_ATH79_MACH_JA76PF is not set
 # CONFIG_ATH79_MACH_JWAP003 is not set
 # CONFIG_ATH79_MACH_JWAP230 is not set
+# CONFIG_ATH79_MACH_LIMA is not set
 # CONFIG_ATH79_MACH_MC_MAC1200R is not set
 # CONFIG_ATH79_MACH_MR12 is not set
 # CONFIG_ATH79_MACH_MR16 is not set



More information about the lede-commits mailing list