ramips: add LinkIt Smart7688 support
Signed-off-by: John Crispin <blogic@openwrt.org> Backport of r47203 git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@47227 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
563f3a4cb7
commit
ebff32ce9e
|
@ -19,6 +19,8 @@ all0256n | \
|
|||
all5002)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
|
||||
linkits7688 | \
|
||||
wsr-600 | \
|
||||
wsr-1166 | \
|
||||
br6425)
|
||||
|
|
|
@ -45,6 +45,8 @@ ramips_setup_interfaces()
|
|||
|
||||
3g150b | \
|
||||
3g300m | \
|
||||
linkits7688 | \
|
||||
linkits7688d | \
|
||||
microwrt | \
|
||||
w150m | \
|
||||
zte-q7 | \
|
||||
|
@ -377,6 +379,11 @@ ramips_setup_macs()
|
|||
wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
|
||||
lan_mac=$wan_mac
|
||||
;;
|
||||
linkits7688 | \
|
||||
linkits7688d)
|
||||
wan_mac=$(mtd_get_mac_binary factory 4)
|
||||
lan_mac=$(mtd_get_mac_binary factory 46)
|
||||
;;
|
||||
*)
|
||||
lan_mac=$(cat /sys/class/net/eth0/address)
|
||||
wan_mac=$(macaddr_add "$lan_mac" 1)
|
||||
|
|
|
@ -418,6 +418,15 @@ ramips_board_detect() {
|
|||
*"Mediatek MT7628AN evaluation board")
|
||||
name="mt7628"
|
||||
;;
|
||||
*"MediaTek LinkIt Smart7688")
|
||||
linkit="$(dd bs=1 skip=1024 count=12 if=/dev/mtd2 2> /dev/null)"
|
||||
if [ "${linkit}" = "LINKITS7688D" ]; then
|
||||
name="linkits7688d"
|
||||
RAMIPS_MODEL="${machine} DUO"
|
||||
else
|
||||
name="linkits7688"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
name="generic"
|
||||
;;
|
||||
|
|
|
@ -60,6 +60,8 @@ platform_check_image() {
|
|||
ht-tm02 | \
|
||||
hw550-3g | \
|
||||
ip2202 | \
|
||||
linkits7688 | \
|
||||
linkits7688d | \
|
||||
m2m | \
|
||||
m3 | \
|
||||
m4 | \
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
/dts-v1/;
|
||||
|
||||
/include/ "mt7628an.dtsi"
|
||||
|
||||
/ {
|
||||
compatible = "mediatek,linkit", "mediatek,mt7628an-soc";
|
||||
model = "MediaTek LinkIt Smart7688";
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS2,57600";
|
||||
};
|
||||
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x8000000>;
|
||||
};
|
||||
|
||||
pinctrl {
|
||||
state_default: pinctrl0 {
|
||||
gpio {
|
||||
ralink,group = "gpio";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
perst {
|
||||
ralink,group = "perst";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
refclk {
|
||||
ralink,group = "refclk";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
i2s {
|
||||
ralink,group = "i2s";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
spis {
|
||||
ralink,group = "spis";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
wled_kn {
|
||||
ralink,group = "wled_kn";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
wled_an {
|
||||
ralink,group = "wled_an";
|
||||
ralink,function = "wled_an";
|
||||
};
|
||||
wdt {
|
||||
ralink,group = "wdt";
|
||||
ralink,function = "gpio";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
palmbus@10000000 {
|
||||
spi@b00 {
|
||||
status = "okay";
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
|
||||
|
||||
m25p80@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "mx25l25635e";
|
||||
reg = <0 0>;
|
||||
linux,modalias = "m25p80", "mx25l25635e";
|
||||
spi-max-frequency = <40000000>;
|
||||
m25p,chunked-io = <31>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0 0x30000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@30000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x30000 0x10000>;
|
||||
};
|
||||
|
||||
factory: partition@40000 {
|
||||
label = "factory";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@50000 {
|
||||
label = "firmware";
|
||||
reg = <0x50000 0x1fb0000>;
|
||||
};
|
||||
};
|
||||
|
||||
spidev@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "spidev";
|
||||
reg = <1 0>;
|
||||
spi-max-frequency = <40000000>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c@900 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
uart1@d00 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
uart2@e00 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
pwm@5000 {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
ethernet@10100000 {
|
||||
mtd-mac-address = <&factory 0x28>;
|
||||
};
|
||||
|
||||
sdhci@10130000 {
|
||||
status = "okay";
|
||||
mediatek,cd-high;
|
||||
// mediatek,cd-poll;
|
||||
};
|
||||
|
||||
bootstrap {
|
||||
compatible = "mediatek,linkit";
|
||||
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
gpio-leds {
|
||||
compatible = "gpio-leds";
|
||||
wifi {
|
||||
label = "mediatek:orange:wifi";
|
||||
gpios = <&wgpio 0 0>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
compatible = "gpio-keys-polled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
poll-interval = <20>;
|
||||
wps {
|
||||
label = "reset";
|
||||
gpios = <&gpio1 6 1>;
|
||||
linux,code = <0x211>;
|
||||
};
|
||||
};
|
||||
|
||||
wgpio: gpio-wifi {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
compatible = "mediatek,gpio-wifi";
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
|
||||
};
|
|
@ -201,6 +201,10 @@ ralink_default_fw_size_16M=16121856
|
|||
BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
|
||||
BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
|
||||
|
||||
ralink_default_fw_size_32M=33226752
|
||||
BuildFirmware/Default32M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_32M),$(4))
|
||||
BuildFirmware/Default32M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
|
||||
|
||||
# Build images for a custom sized flash layout
|
||||
# $(1) = squashfs/initramfs
|
||||
# $(2) = lowercase board name
|
||||
|
@ -982,6 +986,21 @@ define Image/Build/Profile/Default
|
|||
endef
|
||||
endif
|
||||
|
||||
|
||||
#
|
||||
# MT7688 Profiles
|
||||
#
|
||||
|
||||
Image/Build/Profile/MT7688=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
|
||||
Image/Build/Profile/LinkIt7688=$(call BuildFirmware/Default32M/$(1),$(1),LinkIt7688,LINKIT7688)
|
||||
|
||||
ifeq ($(SUBTARGET),mt7628)
|
||||
define Image/Build/Profile/Default
|
||||
$(call Image/Build/Profile/MT7688,$(1))
|
||||
$(call Image/Build/Profile/LinkIt7688,$(1))
|
||||
endef
|
||||
endif
|
||||
|
||||
ifndef TARGET_DEVICES
|
||||
#
|
||||
# Generic Targets - only needed for legacy image building code
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/LinkIt7688
|
||||
NAME:=LinkIt7688
|
||||
PACKAGES:=\
|
||||
kmod-usb-core kmod-usb2 kmod-usb-ohci \
|
||||
uboot-envtools kmod-ledtrig-netdev
|
||||
endef
|
||||
|
||||
define Profile/LinkIt7688/Description
|
||||
Default package set compatible with most boards.
|
||||
endef
|
||||
$(eval $(call Profile,LinkIt7688))
|
|
@ -0,0 +1,94 @@
|
|||
--- a/drivers/misc/Makefile
|
||||
+++ b/drivers/misc/Makefile
|
||||
@@ -56,3 +56,4 @@
|
||||
obj-$(CONFIG_ECHO) += echo/
|
||||
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
|
||||
obj-$(CONFIG_CXL_BASE) += cxl/
|
||||
+obj-$(CONFIG_SOC_MT7620) += linkit.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/misc/linkit.c
|
||||
@@ -0,0 +1,84 @@
|
||||
+/*
|
||||
+ * 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
|
||||
+ * publishhed by the Free Software Foundation.
|
||||
+ *
|
||||
+ * Copyright (C) 2015 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <linux/gpio.h>
|
||||
+
|
||||
+#define LINKIT_LATCH_GPIO 11
|
||||
+
|
||||
+struct linkit_hw_data {
|
||||
+ char board[16];
|
||||
+ char rev[16];
|
||||
+};
|
||||
+
|
||||
+static void sanify_string(char *s)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < 15; i++)
|
||||
+ if (s[i] <= 0x20)
|
||||
+ s[i] = '\0';
|
||||
+ s[15] = '\0';
|
||||
+}
|
||||
+
|
||||
+static int linkit_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct linkit_hw_data hw;
|
||||
+ struct mtd_info *mtd;
|
||||
+ size_t retlen;
|
||||
+ int ret;
|
||||
+
|
||||
+ mtd = get_mtd_device_nm("factory");
|
||||
+ if (IS_ERR(mtd))
|
||||
+ return PTR_ERR(mtd);
|
||||
+
|
||||
+ ret = mtd_read(mtd, 0x400, sizeof(hw), &retlen, (u_char *) &hw);
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ sanify_string(hw.board);
|
||||
+ sanify_string(hw.rev);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "Version : %s\n", hw.board);
|
||||
+ dev_info(&pdev->dev, "Revision : %s\n", hw.rev);
|
||||
+
|
||||
+ if (!strcmp(hw.board, "LINKITS7688")) {
|
||||
+ dev_info(&pdev->dev, "setting up bootstrap latch\n");
|
||||
+
|
||||
+ if (devm_gpio_request(&pdev->dev, LINKIT_LATCH_GPIO, "bootstrap")) {
|
||||
+ dev_err(&pdev->dev, "failed to setup bootstrap gpio\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ gpio_direction_output(LINKIT_LATCH_GPIO, 0);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id linkit_match[] = {
|
||||
+ { .compatible = "mediatek,linkit" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, linkit_match);
|
||||
+
|
||||
+static struct platform_driver linkit_driver = {
|
||||
+ .probe = linkit_probe,
|
||||
+ .driver = {
|
||||
+ .name = "mtk-linkit",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = linkit_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+int __init linkit_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&linkit_driver);
|
||||
+}
|
||||
+late_initcall_sync(linkit_init);
|
Loading…
Reference in New Issue