mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
6be0da90a1
Removed upstreamed/solved elsewhere upstream: - 0001-MIPS-ralink-Add-rt3352-SPI_CS1-pinmux.patch - 0002-MIPS-pci-rt2880-set-pci-controller-of_node.patch - 0004-MIPS-ralink-add-MT7621-pcie-driver.patch - 0009-PCI-MIPS-enable-PCIe-on-MT7688.patch - 0025-pinctrl-ralink-add-pinctrl-driver.patch - 0028-GPIO-ralink-add-mt7621-gpio-controller.patch - 0043-spi-add-mt7621-support.patch - 0045-i2c-add-mt7621-driver.patch - 0047-DMA-ralink-add-rt2880-dma-engine.patch - 0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch - 0054-mtd-spi-nor-w25q256-respect-default-mode.patch - 0099-pci-mt7620.patch - 304-spi-nor-enable-4B-opcodes-for-mx25l25635f.patch Removed because of the new NAND driver: - 0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch - 0039-mtd-add-mt7621-nand-support.patch - 0040-nand-hack.patch Remove patch that no longer applies (needs rework): - 0034-NET-multi-phy-support.patch Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
98 lines
2.3 KiB
Diff
98 lines
2.3 KiB
Diff
--- a/drivers/misc/Makefile
|
|
+++ b/drivers/misc/Makefile
|
|
@@ -52,6 +52,7 @@ obj-$(CONFIG_ECHO) += echo/
|
|
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
|
|
obj-$(CONFIG_CXL_BASE) += cxl/
|
|
obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o
|
|
+obj-$(CONFIG_SOC_MT7620) += linkit.o
|
|
obj-$(CONFIG_OCXL) += ocxl/
|
|
obj-y += cardreader/
|
|
obj-$(CONFIG_PVPANIC) += pvpanic.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);
|