all5002)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;;
+linkits7688 | \
wsr-600 | \
wsr-1166 | \
br6425)
dcs-930|\
dcs-930l-b1|\
ht-tm02|\
+ linkits7688 | \
+ linkits7688d | \
microwrt|\
ncs601w|\
w150m|\
ht-tm02)
lan_mac=$(cat /sys/class/net/eth0/address)
;;
+ linkits7688 | \
+ linkits7688d)
+ wan_mac=$(mtd_get_mac_binary factory 4)
+ lan_mac=$(mtd_get_mac_binary factory 46)
+ ;;
m3|\
m4|\
x5|\
*"M4")
name="m4"
;;
+ *"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
+ ;;
*"Memory 2 Move")
name="m2m"
;;
ht-tm02|\
hw550-3g|\
ip2202|\
+ linkits7688|\
+ linkits7688d|\
m2m|\
m3|\
m4|\
--- /dev/null
+/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;
+ };
+
+ 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 {
+ compatible = "mediatek,gpio-wifi";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+};
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
#
Image/Build/Profile/mt7688=$(call BuildFirmware/Default16M/$(1),$(1),mt7688,MT7688)
+Image/Build/Profile/LinkIt7688=$(call BuildFirmware/Default32M/$(1),$(1),LinkIt7688,LINKIT7688)
ifeq ($(SUBTARGET),mt7688)
define Image/Build/Profile/Default
$(call Image/Build/Profile/mt7688,$(1))
+ $(call Image/Build/Profile/LinkIt7688,$(1))
endef
endif
CONFIG_IRQ_INTC=y
CONFIG_IRQ_WORK=y
CONFIG_LIBFDT=y
+CONFIG_LINKIT_BOOTSTRAP=y
CONFIG_MDIO_BOARDINFO=y
CONFIG_MIPS=y
CONFIG_MIPS_FPU_EMULATOR=y
CONFIG_PINCTRL_RT2880=y
# CONFIG_PINCTRL_SINGLE is not set
# CONFIG_PREEMPT_RCU is not set
+CONFIG_PWM=y
+# CONFIG_PWM_FSL_FTM is not set
+CONFIG_PWM_MEDIATEK=y
+CONFIG_PWM_SYSFS=y
CONFIG_RALINK=y
# CONFIG_RALINK_WDT is not set
# CONFIG_RCU_STALL_COMMON is not set
# CONFIG_SOC_RT288X is not set
# CONFIG_SOC_RT305X is not set
# CONFIG_SOC_RT3883 is not set
+# CONFIG_SND_MT76XX_SOC_MT7620 is not set
+CONFIG_SND_MT76XX_SOC_MT7628=y
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_MT7621=y
# CONFIG_SPI_RT2880 is not set
+CONFIG_SPI_SPIDEV=y
CONFIG_SWCONFIG=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
Default package set compatible with most boards.
endef
$(eval $(call Profile,mt7688))
+
+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 LinkIt Smart7688 dev board.
+endef
+$(eval $(call Profile,LinkIt7688))
--- /dev/null
+--- 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);