[OpenWrt-Devel] [PATCH] [CC] ramips: Setup missing gpio exports and fine-tune the memory model number.

John Clark inindev at gmail.com
Tue Jan 19 22:26:35 EST 2016


GPIO Changes
~~~~~~~~~~~~
The HLK-RM04 uses i2c and the top half of the uartf port for gpio. HiLink has labeled the RT5350 gpio1 pin as gpio0 on the device pinout, so it seems to make sense to export it as "hlk-rm04:gpio0" to avoid confusing it with the microcontroller's designation.

  gpio   gpio0     gpio0  (pin 10, reset)

  i2c    i2c_sd    gpio1  (pin 8, hlk-rm04:gpio0)
  i2c    i2c_sclk  gpio2  (pin 9, hlk-rm04:gpio1)

  uartf  dtr_n     gpio11 (no pinout)
  uartf  dcd_n     gpio12 (no pinout)
  uartf  dsr_n     gpio13 (no pinout)
  uartf  rin       gpio14 (pin 25, wps)

reference:
  http://www.hlktech.net/product_detail.php?ProId=39
  http://cdn.sparkfun.com/datasheets/Wireless/WiFi/RT5350.pdf

Also note that there is no gpio to control the power led, so remove the incorrect mapping.

Memory Model Number (trivial)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The dts file references memory chips gd25q64 and s25fl064k, neither of which seem to have ever been used for the HiLink HLK-RM04. While it only causes a nag message in the kernel log, why not change it to the w25q32 which is commonly found on these devices.
[    0.230000] m25p80 spi32766.0: w25q32 (4096 Kbytes)

Signed-off-by: John Clark <inindev at gmail.com>
---
 target/linux/ramips/dts/HLKRM04.dts | 45 +++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/target/linux/ramips/dts/HLKRM04.dts b/target/linux/ramips/dts/HLKRM04.dts
index 13597dc..3c206b9 100644
--- a/target/linux/ramips/dts/HLKRM04.dts
+++ b/target/linux/ramips/dts/HLKRM04.dts
@@ -18,6 +18,7 @@
 	palmbus at 10000000 {
 		uart at 500 {
 			status = "okay";
+			pinctrl-0;
 		};
 
 		spi at b00 {
@@ -25,9 +26,9 @@
 			m25p80 at 0 {
 				#address-cells = <1>;
 				#size-cells = <1>;
-				compatible = "gd25q64";
+				compatible = "w25q32";
 				reg = <0 0>;
-				linux,modalias = "m25p80", "s25fl064k";
+				linux,modalias = "m25p80", "w25q32";
 				spi-max-frequency = <10000000>;
 
 				partition at 0 {
@@ -59,9 +60,13 @@
 	pinctrl {
 		state_default: pinctrl0 {
 			gpio {
-				ralink,group = "jtag";
+				ralink,group = "jtag", "i2c";
 				ralink,function = "gpio";
 			};
+			uartf_gpio {
+				ralink,group = "uartf";
+				ralink,function = "gpio uartf";
+			};
 		};
 	};
 
@@ -81,23 +86,39 @@
 		status = "okay";
 	};
 
+	gpio-export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		/* I2C */
+		gpio1 {
+			/* I2C_I2C_SD */
+			gpio-export,name = "hlk-rm04:gpio0";
+			gpio-export,direction_may_change = <1>;
+			gpios = <&gpio0 1 0>;
+		};
+		gpio2 {
+			/* I2C_I2C_SCLK */
+			gpio-export,name = "hlk-rm04:gpio1";
+			gpio-export,direction_may_change = <1>;
+			gpios = <&gpio0 2 0>;
+		};
+	};
+
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
 		#size-cells = <0>;
 		poll-interval = <20>;
-		wps {
+		reset {
 			label = "reset";
-			gpios = <&gpio0 14 1>;
+			gpios = <&gpio0 0 1>;
 			linux,code = <0x198>;
 		};
-	};
-
-	gpio-leds {
-		compatible = "gpio-leds";
-		power {
-			label = "hlk-rm04:red:power";
-			gpios = <&gpio0 0 1>;
+		wps {
+			label = "wps";
+			gpios = <&gpio0 14 1>;
+			linux,code = <0x211>;
 		};
 	};
 };
-- 
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list