summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRosen Penev2024-10-22 00:14:41 +0000
committerRobert Marko2024-10-30 10:11:07 +0000
commita6a44f94bf8ccae8c7843ac3db2d606b961976c2 (patch)
treea6a5a869dc19300d7dbc47740f49dd9b211e5e86
parentcbefc64cb33cc693fb551111021e95eb976b51bb (diff)
downloadopenwrt-a6a44f94bf8ccae8c7843ac3db2d606b961976c2.tar.gz
ramips: linkit: replace driver with gpio-hog
It does the same thing minus a few dmesg prints. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/16788 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts15
-rw-r--r--target/linux/ramips/patches-6.6/855-linkit_bootstrap.patch97
2 files changed, 9 insertions, 103 deletions
diff --git a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
index fdce5cbec5..34ef15eca0 100644
--- a/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
+++ b/target/linux/ramips/dts/mt7628an_mediatek_linkit-smart-7688.dts
@@ -22,12 +22,6 @@
serial0 = &uart2;
};
- bootstrap {
- compatible = "mediatek,linkit";
-
- status = "okay";
- };
-
leds {
compatible = "gpio-leds";
@@ -144,6 +138,15 @@
};
};
+&gpio {
+ bootstrap {
+ gpio-hog;
+ line-name = "bootstrap";
+ output-low;
+ gpios = <11 GPIO_ACTIVE_LOW>;
+ };
+};
+
&i2c {
status = "okay";
};
diff --git a/target/linux/ramips/patches-6.6/855-linkit_bootstrap.patch b/target/linux/ramips/patches-6.6/855-linkit_bootstrap.patch
deleted file mode 100644
index 16eaf619a0..0000000000
--- a/target/linux/ramips/patches-6.6/855-linkit_bootstrap.patch
+++ /dev/null
@@ -1,97 +0,0 @@
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -52,6 +52,7 @@ obj-$(CONFIG_ECHO) += echo/
- obj-$(CONFIG_CXL_BASE) += cxl/
- obj-$(CONFIG_DW_XDATA_PCIE) += dw-xdata-pcie.o
- obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o
-+obj-$(CONFIG_SOC_MT7620) += linkit.o
- obj-$(CONFIG_OCXL) += ocxl/
- obj-$(CONFIG_BCM_VK) += bcm-vk/
- obj-y += cardreader/
---- /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);