diff mbox

[LEDE-DEV] ramips: Improve Sanlinking D240 config

Message ID 20170302105555.14926-1-kristian.evensen@gmail.com
State Superseded
Headers show

Commit Message

Kristian Evensen March 2, 2017, 10:55 a.m. UTC
* The left most mini-PCIe (USB) slot (the one attached to SIM2) can be
power-cycled by setting GPIO 0 to high/low. I have no strong opinion on the
name, but since the slot can be used for other things than modems I went for
usb2.

* The D240 only needs the MT76x2 module, so update makefile to reflect this.
Note that until the default mt7620 target is updated, then kmod-mt76 (and thus
kmod-mt7603) will be selected by default.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
---
 target/linux/ramips/dts/D240.dts    | 14 ++++++++++++++
 target/linux/ramips/image/mt7620.mk |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Piotr Dymacz March 2, 2017, 11:39 a.m. UTC | #1
Hi Kristian,

2017-03-02 11:55 GMT+01:00 Kristian Evensen <kristian.evensen@gmail.com>:
> * The left most mini-PCIe (USB) slot (the one attached to SIM2) can be
> power-cycled by setting GPIO 0 to high/low. I have no strong opinion on the
> name, but since the slot can be used for other things than modems I went for
> usb2.
[...]

What about "power_mpcieX" (or something similar), where X is 1 or 2,
depending on what is printed on the PCB (I wasn't able to find hi-res
photo)?
Take a look at other examples:

grep -rn "gpio-export.*power" target/linux/ramips/dts/
target/linux/ramips/dts/HC5861.dts:43:        gpio-export,name = "usbpower";
target/linux/ramips/dts/HC5861.dts:49:        gpio-export,name = "sdpower";
target/linux/ramips/dts/PBR-M1.dts:78:        gpio-export,name = "power_usb2";
target/linux/ramips/dts/PBR-M1.dts:84:        gpio-export,name = "power_usb3";
target/linux/ramips/dts/PBR-M1.dts:90:        gpio-export,name = "power_sata";
target/linux/ramips/dts/WNDR3700V5.dts:63:    gpio-export,name = "usbpower";
target/linux/ramips/dts/TINY-AC.dts:49:        gpio-export,name = "usbpower";
target/linux/ramips/dts/ArcherMR200.dts:92:    gpio-export,name = "power_usb1";
target/linux/ramips/dts/HC5XXX.dtsi:28:        gpio-export,name = "usbpower";
target/linux/ramips/dts/Newifi-D1.dts:56:    gpio-export,name = "usb2power";
target/linux/ramips/dts/Newifi-D1.dts:62:    gpio-export,name = "usb3power";

---
Cheers,
Piotr
Kristian Evensen March 2, 2017, 11:46 a.m. UTC | #2
Hi,

On Thu, Mar 2, 2017 at 12:39 PM, Piotr Dymacz <pepe2k@gmail.com> wrote:
> What about "power_mpcieX" (or something similar), where X is 1 or 2,
> depending on what is printed on the PCB (I wasn't able to find hi-res
> photo)?

Good idea and thanks for the pointer. There does not seem to be any
easy-to-find value or id printed on the PCB. However, in some material
I was sent from Sanlinking then the slot that can be power-cycled is
referred to as mini PCIe 2, so I will rename the slot to power_mpcie_2
and send a v2.

-Kristian
Piotr Dymacz March 2, 2017, 12:15 p.m. UTC | #3
Hi Kristian,

2017-03-02 12:46 GMT+01:00 Kristian Evensen <kristian.evensen@gmail.com>:
> Hi,
>
> On Thu, Mar 2, 2017 at 12:39 PM, Piotr Dymacz <pepe2k@gmail.com> wrote:
>> What about "power_mpcieX" (or something similar), where X is 1 or 2,
>> depending on what is printed on the PCB (I wasn't able to find hi-res
>> photo)?
>
> Good idea and thanks for the pointer. There does not seem to be any
> easy-to-find value or id printed on the PCB. However, in some material
> I was sent from Sanlinking then the slot that can be power-cycled is
> referred to as mini PCIe 2, so I will rename the slot to power_mpcie_2
> and send a v2.

OK, I think you can also drop the comment with new gpio name.

---
Cheers,
Piotr
diff mbox

Patch

diff --git a/target/linux/ramips/dts/D240.dts b/target/linux/ramips/dts/D240.dts
index ef45d38..4abf7f5 100644
--- a/target/linux/ramips/dts/D240.dts
+++ b/target/linux/ramips/dts/D240.dts
@@ -46,6 +46,20 @@ 
 		bootargs = "console=ttyS0,115200";
 	};
 
+	gpio-export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+		/*
+		 * The modem ("usb port") connected with the SIM2 slot can be power
+		 * controlled by setting gpio 0 to high/low.
+		 */
+		usb2 {
+			gpio-export,name = "usb2";
+			gpio-export,output = <GPIO_ACTIVE_LOW>;
+			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
 	gpio-leds {
 		compatible = "gpio-leds";
 
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 4a76ab3..0410a9a 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -471,6 +471,6 @@  define Device/d240
   DTS := D240
   IMAGE_SIZE := $(ralink_default_fw_size_16M)
   DEVICE_TITLE := Sanlinking Technologies D240
-  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76-core kmod-mt76x2 kmod-sdhci-mt7620
 endef
 TARGET_DEVICES += d240