[PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support

2018-05-06 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer <ey...@ti.com>
---
Changes since V1:
 - Fix wlcore node number to @2
 - Capialaize ARM in subject line.

 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+

[PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support

2018-05-06 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer 
---
Changes since V1:
 - Fix wlcore node number to @2
 - Capialaize ARM in subject line.

 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+  

[PATCH] arm: dts: am437x-sk-evm: add wilink8 support

2018-05-01 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer <ey...@ti.com>
---
 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_tx

[PATCH] arm: dts: am437x-sk-evm: add wilink8 support

2018-05-01 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer 
---
 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_txd.uart1_txd */
+

[tiL4.14-CON PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support

2018-05-01 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer <ey...@ti.com>
---
 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_tx

[tiL4.14-CON PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support

2018-05-01 Thread Eyal Reizer
enable mmc3 used for wlan and uart1 used for bluetooth
configure the gpios used for wlan and bluetooth controls
add fixed voltage regulator used for wlan power control

Signed-off-by: Eyal Reizer 
---
 arch/arm/boot/dts/am437x-sk-evm.dts | 115 
 1 file changed, 115 insertions(+)

diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts 
b/arch/arm/boot/dts/am437x-sk-evm.dts
index 16d9db0..afffdb1 100644
--- a/arch/arm/boot/dts/am437x-sk-evm.dts
+++ b/arch/arm/boot/dts/am437x-sk-evm.dts
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "TI AM437x SK EVM";
@@ -158,6 +159,22 @@
};
};
};
+
+   vmmcwl_fixed: fixedregulator-mmcwl {
+   /*
+* WL_EN is not SDIO standard compliant. It is an out of band
+* signal and hard to be dealt with in a standard way by the
+* SDIO core driver.
+* So modelling the WL_EN line as a regulator was a natural
+* choice as the MMC core already deals with MMC supplies.
+*/
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcwl_fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   gpio = < 8 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
 };
 
 _pinmux {
@@ -424,6 +441,62 @@
AM4372_IOPAD(0xac4, PIN_OUTPUT | MUX_MODE0) /* 
usb0_drvvbus.usb0_drvvbus */
>;
};
+
+   mmc3_pins_default: pinmux_mmc3_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | MUX_MODE3) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   mmc3_pins_sleep: pinmux_mmc3_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD21) cam1_data2.mmc2_clk */
+   AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE22) cam1_data3.mmc2_cmd */
+   AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD22) cam1_data4.mmc2_dat0 */
+   AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE23) cam1_data5.mmc2_dat1 */
+   AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AD23) cam1_data6.mmc2_dat2 */
+   AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | MUX_MODE7) /* 
(AE24) cam1_data7.mmc2_dat3 */
+   >;
+   };
+
+   wlan_pins_default: pinmux_wlan_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   wlan_pins_sleep: pinmux_wlan_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data8.gpio4_8 WL_EN */
+   AM4372_IOPAD(0x9e4, PIN_INPUT | WAKEUP_ENABLE | 
MUX_MODE7)  /* cam1_wen.gpio4_13 WL_IRQ */
+   >;
+   };
+
+   uart1_bt_pins_default: pinmux_uart1_bt_pins_default {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0)  
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_txd.uart1_txd */
+   AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)   
/* uart1_ctsn.uart1_ctsn */
+   AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
/* uart1_rtsn.uart1_rtsn */
+   AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* cam1_data9.gpio4_7 BT_EN */
+   >;
+   };
+
+   uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep {
+   pinctrl-single,pins = <
+   AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_rxd.uart1_rxd */
+   AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
/* uart1_txd.uart1_txd */
+

[PATCH v2] wlcore: sdio: allow pm to handle sdio power

2018-04-25 Thread Eyal Reizer
pm_runtime handles sdio power on and power off transitions.
An old workaround for trying to control the power explicitly from the
driver was in fact causing failures on suspend/resume as the mmc layer
already power the module on resume.

In case of resume pm_runtime_get sync returns a positive device's usage
count causing the driver to try an re-initialize an already initialized
device. This was causing sdio bus failure on resume.

Remove this manual power on/off sequence as it is in-fact not needed.

Signed-off-by: Eyal Reizer <ey...@ti.com>
Acked-by: Tony Lindgren <t...@atomide.com>
---
 drivers/net/wireless/ti/wlcore/sdio.c | 27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index 1f727ba..6dbe61d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
struct mmc_card *card = func->card;
 
ret = pm_runtime_get_sync(>dev);
-   if (ret) {
-   /*
-* Runtime PM might be temporarily disabled, or the device
-* might have a positive reference counter. Make sure it is
-* really powered on.
-*/
-   ret = mmc_power_restore_host(card->host);
-   if (ret < 0) {
-   pm_runtime_put_sync(>dev);
-   goto out;
-   }
+   if (ret < 0) {
+   pm_runtime_put_noidle(>dev);
+   dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
+   __func__, ret);
+   goto out;
}
 
sdio_claim_host(func);
@@ -178,7 +172,6 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
 
 static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
 {
-   int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
 
@@ -186,16 +179,8 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue 
*glue)
sdio_disable_func(func);
sdio_release_host(func);
 
-   /* Power off the card manually in case it wasn't powered off above */
-   ret = mmc_power_save_host(card->host);
-   if (ret < 0)
-   goto out;
-
/* Let runtime PM know the card is powered off */
-   pm_runtime_put_sync(>dev);
-
-out:
-   return ret;
+   return pm_runtime_put_sync(>dev);
 }
 
 static int wl12xx_sdio_set_power(struct device *child, bool enable)
-- 
2.7.4



[PATCH v2] wlcore: sdio: allow pm to handle sdio power

2018-04-25 Thread Eyal Reizer
pm_runtime handles sdio power on and power off transitions.
An old workaround for trying to control the power explicitly from the
driver was in fact causing failures on suspend/resume as the mmc layer
already power the module on resume.

In case of resume pm_runtime_get sync returns a positive device's usage
count causing the driver to try an re-initialize an already initialized
device. This was causing sdio bus failure on resume.

Remove this manual power on/off sequence as it is in-fact not needed.

Signed-off-by: Eyal Reizer 
Acked-by: Tony Lindgren 
---
 drivers/net/wireless/ti/wlcore/sdio.c | 27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index 1f727ba..6dbe61d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
struct mmc_card *card = func->card;
 
ret = pm_runtime_get_sync(>dev);
-   if (ret) {
-   /*
-* Runtime PM might be temporarily disabled, or the device
-* might have a positive reference counter. Make sure it is
-* really powered on.
-*/
-   ret = mmc_power_restore_host(card->host);
-   if (ret < 0) {
-   pm_runtime_put_sync(>dev);
-   goto out;
-   }
+   if (ret < 0) {
+   pm_runtime_put_noidle(>dev);
+   dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
+   __func__, ret);
+   goto out;
}
 
sdio_claim_host(func);
@@ -178,7 +172,6 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
 
 static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
 {
-   int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
 
@@ -186,16 +179,8 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue 
*glue)
sdio_disable_func(func);
sdio_release_host(func);
 
-   /* Power off the card manually in case it wasn't powered off above */
-   ret = mmc_power_save_host(card->host);
-   if (ret < 0)
-   goto out;
-
/* Let runtime PM know the card is powered off */
-   pm_runtime_put_sync(>dev);
-
-out:
-   return ret;
+   return pm_runtime_put_sync(>dev);
 }
 
 static int wl12xx_sdio_set_power(struct device *child, bool enable)
-- 
2.7.4



[PATCH] net: wireless: ti: wlcore: sdio: allow pm to handle sdio power

2018-04-25 Thread Eyal Reizer
pm_runtime handles sdio power on and power off transitions.
An old workaround for trying to control the power explicitly from the
driver was in fact causing failures on suspend/resume as the mmc layer
already power the module on resume.

In case of resume pm_runtime_get sync returns a positive device's usage
count causing the driver to try an re-initialize an already initialized
device. This was causing sdio bus failure on resume.

Remove this manual power on/off sequence as it is in-fact not needed.

Signed-off-by: Eyal Reizer <ey...@ti.com>
Cc: sta...@vger.kernel.org
---
 drivers/net/wireless/ti/wlcore/sdio.c | 27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index 1f727ba..6dbe61d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
struct mmc_card *card = func->card;
 
ret = pm_runtime_get_sync(>dev);
-   if (ret) {
-   /*
-* Runtime PM might be temporarily disabled, or the device
-* might have a positive reference counter. Make sure it is
-* really powered on.
-*/
-   ret = mmc_power_restore_host(card->host);
-   if (ret < 0) {
-   pm_runtime_put_sync(>dev);
-   goto out;
-   }
+   if (ret < 0) {
+   pm_runtime_put_noidle(>dev);
+   dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
+   __func__, ret);
+   goto out;
}
 
sdio_claim_host(func);
@@ -178,7 +172,6 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
 
 static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
 {
-   int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
 
@@ -186,16 +179,8 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue 
*glue)
sdio_disable_func(func);
sdio_release_host(func);
 
-   /* Power off the card manually in case it wasn't powered off above */
-   ret = mmc_power_save_host(card->host);
-   if (ret < 0)
-   goto out;
-
/* Let runtime PM know the card is powered off */
-   pm_runtime_put_sync(>dev);
-
-out:
-   return ret;
+   return pm_runtime_put_sync(>dev);
 }
 
 static int wl12xx_sdio_set_power(struct device *child, bool enable)
-- 
2.7.4



[PATCH] net: wireless: ti: wlcore: sdio: allow pm to handle sdio power

2018-04-25 Thread Eyal Reizer
pm_runtime handles sdio power on and power off transitions.
An old workaround for trying to control the power explicitly from the
driver was in fact causing failures on suspend/resume as the mmc layer
already power the module on resume.

In case of resume pm_runtime_get sync returns a positive device's usage
count causing the driver to try an re-initialize an already initialized
device. This was causing sdio bus failure on resume.

Remove this manual power on/off sequence as it is in-fact not needed.

Signed-off-by: Eyal Reizer 
Cc: sta...@vger.kernel.org
---
 drivers/net/wireless/ti/wlcore/sdio.c | 27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index 1f727ba..6dbe61d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
struct mmc_card *card = func->card;
 
ret = pm_runtime_get_sync(>dev);
-   if (ret) {
-   /*
-* Runtime PM might be temporarily disabled, or the device
-* might have a positive reference counter. Make sure it is
-* really powered on.
-*/
-   ret = mmc_power_restore_host(card->host);
-   if (ret < 0) {
-   pm_runtime_put_sync(>dev);
-   goto out;
-   }
+   if (ret < 0) {
+   pm_runtime_put_noidle(>dev);
+   dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
+   __func__, ret);
+   goto out;
}
 
sdio_claim_host(func);
@@ -178,7 +172,6 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue 
*glue)
 
 static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
 {
-   int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
 
@@ -186,16 +179,8 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue 
*glue)
sdio_disable_func(func);
sdio_release_host(func);
 
-   /* Power off the card manually in case it wasn't powered off above */
-   ret = mmc_power_save_host(card->host);
-   if (ret < 0)
-   goto out;
-
/* Let runtime PM know the card is powered off */
-   pm_runtime_put_sync(>dev);
-
-out:
-   return ret;
+   return pm_runtime_put_sync(>dev);
 }
 
 static int wl12xx_sdio_set_power(struct device *child, bool enable)
-- 
2.7.4



[PATCH v7] wlcore: spi: add wl18xx support

2016-07-19 Thread Eyal Reizer
From: Eyal Reizer <eyalrei...@gmail.com>

Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- Use inverted chip select for sending a dummy 4 bytes command that
  completes the init stage.

Signed-off-by: Eyal Reizer <ey...@ti.com>
Acked-by: Rob Herring <r...@kernel.org>
---
v1->v2:update device tree bindings configuration
v2->v3:revert from manual gpio manipulation. use inverted chip select instead
for sending the extra init cycle which, achieves the same hardware purpose.
update device tree bindings docucmentation accordingly
v3->v4: Remove redundant data form binding documentation and fix chip select
number mismatch in wl1271 example
v4->v5: Rebase on top of head of wireless-drivers-next
v5->v6: Add ACKs
v6->v7: Mail format issues
 .../bindings/net/wireless/ti,wlcore,spi.txt|  41 +--
 drivers/net/wireless/ti/wlcore/spi.c   | 123 ++---
 2 files changed, 137 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
index 9180724..8f9ced0 100644
--- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -1,19 +1,30 @@
-* Texas Instruments wl1271 wireless lan controller
+* Texas Instruments wl12xx/wl18xx wireless lan controller
 
-The wl1271 chip can be connected via SPI or via SDIO. This
+The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This
 document describes the binding for the SPI connected chip.
 
 Required properties:
-- compatible :  Should be "ti,wl1271"
+- compatible :  Should be one of the following:
+* "ti,wl1271"
+* "ti,wl1273"
+* "ti,wl1281"
+* "ti,wl1283"
+* "ti,wl1801"
+* "ti,wl1805"
+* "ti,wl1807"
+* "ti,wl1831"
+* "ti,wl1835"
+* "ti,wl1837"
 - reg : Chip select address of device
 - spi-max-frequency :   Maximum SPI clocking speed of device in Hz
-- ref-clock-frequency : Reference clock frequency
 - interrupt-parent, interrupts :
 Should contain parameters for 1 interrupt line.
 Interrupt parameters: parent, line number, type.
-- vwlan-supply :Point the node of the regulator that powers/enable the 
wl1271 chip
+- vwlan-supply :Point the node of the regulator that powers/enable the
+wl12xx/wl18xx chip
 
 Optional properties:
+- ref-clock-frequency : Reference clock frequency (should be set for wl12xx)
 - clock-xtal :  boolean, clock is generated from XTAL
 
 - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -21,16 +32,28 @@ Optional properties:
 
 Examples:
 
+For wl12xx family:
  {
-   wl1271@1 {
+   wlcore: wlcore@1 {
compatible = "ti,wl1271";
-
reg = <1>;
spi-max-frequency = <4800>;
-   clock-xtal;
-   ref-clock-frequency = <3840>;
interrupt-parent = <>;
interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
vwlan-supply = <_fixed>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   };
+};
+
+For wl18xx family:
+ {
+   wlcore: wlcore@0 {
+   compatible = "ti,wl1835";
+   reg = <0>;
+   spi-max-frequency = <4800>;
+   interrupt-parent = <>;
+   interrupts = <27 IRQ_TYPE_EDGE_RISING>;
+   vwlan-supply = <_fixed>;
};
 };
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index cea9443..73fbcf1 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -70,16 +70,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {

[PATCH v7] wlcore: spi: add wl18xx support

2016-07-19 Thread Eyal Reizer
From: Eyal Reizer 

Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- Use inverted chip select for sending a dummy 4 bytes command that
  completes the init stage.

Signed-off-by: Eyal Reizer 
Acked-by: Rob Herring 
---
v1->v2:update device tree bindings configuration
v2->v3:revert from manual gpio manipulation. use inverted chip select instead
for sending the extra init cycle which, achieves the same hardware purpose.
update device tree bindings docucmentation accordingly
v3->v4: Remove redundant data form binding documentation and fix chip select
number mismatch in wl1271 example
v4->v5: Rebase on top of head of wireless-drivers-next
v5->v6: Add ACKs
v6->v7: Mail format issues
 .../bindings/net/wireless/ti,wlcore,spi.txt|  41 +--
 drivers/net/wireless/ti/wlcore/spi.c   | 123 ++---
 2 files changed, 137 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
index 9180724..8f9ced0 100644
--- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -1,19 +1,30 @@
-* Texas Instruments wl1271 wireless lan controller
+* Texas Instruments wl12xx/wl18xx wireless lan controller
 
-The wl1271 chip can be connected via SPI or via SDIO. This
+The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This
 document describes the binding for the SPI connected chip.
 
 Required properties:
-- compatible :  Should be "ti,wl1271"
+- compatible :  Should be one of the following:
+* "ti,wl1271"
+* "ti,wl1273"
+* "ti,wl1281"
+* "ti,wl1283"
+* "ti,wl1801"
+* "ti,wl1805"
+* "ti,wl1807"
+* "ti,wl1831"
+* "ti,wl1835"
+* "ti,wl1837"
 - reg : Chip select address of device
 - spi-max-frequency :   Maximum SPI clocking speed of device in Hz
-- ref-clock-frequency : Reference clock frequency
 - interrupt-parent, interrupts :
 Should contain parameters for 1 interrupt line.
 Interrupt parameters: parent, line number, type.
-- vwlan-supply :Point the node of the regulator that powers/enable the 
wl1271 chip
+- vwlan-supply :Point the node of the regulator that powers/enable the
+wl12xx/wl18xx chip
 
 Optional properties:
+- ref-clock-frequency : Reference clock frequency (should be set for wl12xx)
 - clock-xtal :  boolean, clock is generated from XTAL
 
 - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -21,16 +32,28 @@ Optional properties:
 
 Examples:
 
+For wl12xx family:
  {
-   wl1271@1 {
+   wlcore: wlcore@1 {
compatible = "ti,wl1271";
-
reg = <1>;
spi-max-frequency = <4800>;
-   clock-xtal;
-   ref-clock-frequency = <3840>;
interrupt-parent = <>;
interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
vwlan-supply = <_fixed>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   };
+};
+
+For wl18xx family:
+ {
+   wlcore: wlcore@0 {
+   compatible = "ti,wl1835";
+   reg = <0>;
+   spi-max-frequency = <4800>;
+   interrupt-parent = <>;
+   interrupts = <27 IRQ_TYPE_EDGE_RISING>;
+   vwlan-supply = <_fixed>;
};
 };
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index cea9443..73fbcf1 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -70,16 +70,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glu

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
    interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer <ey...@ti.com>
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len;
}
 
+   /* Drive CS line high */
+   gpio_direction_output(master->cs_gpio

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
    interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer 
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len;
}
 
+   /* Drive CS line high */
+   gpio_direction_output(master->cs_gpios[0], 1);

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
From: Eyal <eyalr@eyalr-VirtualBox.(none)>

Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
        interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer <ey...@ti.com>
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
From: Eyal 

Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
    interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer 
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len;
}
 
+   /* Drive CS line high */
+   gpio_direction_output(master->cs_gpios[0], 1);

[PATCHv2] am335x-evm: add bluetooth support

2015-05-04 Thread Eyal Reizer
From: Eliad Peller 

uart1 is used for connecting to wilink8 bluetooth subsystem.
add the needed muxes and definitions.

Signed-off-by: Eliad Peller 
Signed-off-by: Eyal Reizer 
---
Changes in v2:
removed ti shared transport bindings

 arch/arm/boot/dts/am335x-evm.dts |   16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 0f398fa..765be27 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -191,6 +191,15 @@
>;
};
 
+   uart1_pins: pinmux_uart1_pins {
+   pinctrl-single,pins = <
+   0x178 (PIN_INPUT | MUX_MODE0)   /* 
uart1_ctsn.uart1_ctsn */
+   0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart1_rtsn.uart1_rtsn */
+   0x180 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
uart1_rxd.uart1_rxd */
+   0x184 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart1_txd.uart1_txd */
+   >;
+   };
+
clkout2_pin: pinmux_clkout2_pin {
pinctrl-single,pins = <
0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* 
xdma_event_intr1.clkout2 */
@@ -357,6 +366,13 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv2] am335x-evm: add bluetooth support

2015-05-04 Thread Eyal Reizer
From: Eliad Peller el...@wizery.com

uart1 is used for connecting to wilink8 bluetooth subsystem.
add the needed muxes and definitions.

Signed-off-by: Eliad Peller el...@wizery.com
Signed-off-by: Eyal Reizer ey...@ti.com
---
Changes in v2:
removed ti shared transport bindings

 arch/arm/boot/dts/am335x-evm.dts |   16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 0f398fa..765be27 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -191,6 +191,15 @@
;
};
 
+   uart1_pins: pinmux_uart1_pins {
+   pinctrl-single,pins = 
+   0x178 (PIN_INPUT | MUX_MODE0)   /* 
uart1_ctsn.uart1_ctsn */
+   0x17C (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart1_rtsn.uart1_rtsn */
+   0x180 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
uart1_rxd.uart1_rxd */
+   0x184 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart1_txd.uart1_txd */
+   ;
+   };
+
clkout2_pin: pinmux_clkout2_pin {
pinctrl-single,pins = 
0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* 
xdma_event_intr1.clkout2 */
@@ -357,6 +366,13 @@
status = okay;
 };
 
+uart1 {
+   pinctrl-names = default;
+   pinctrl-0 = uart1_pins;
+
+   status = okay;
+};
+
 i2c0 {
pinctrl-names = default;
pinctrl-0 = i2c0_pins;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Bluetooth: Add tty HCI driver

2015-04-30 Thread Eyal Reizer
tty_hci driver exposes a /dev/hci_tty character device node, that intends
to emulate a generic /dev/ttyX device that would be used by the user-space
Bluetooth stacks to send/receive data to/from the WL combo-connectivity
chipsets.

The device driver has no internal logic of its own to intrepret data & all
such logic is handled by the user-space stack.

Signed-off-by: Pavan Savoy 
 [Fixed checkpatch warnings]
Signed-off-by: Vishal Mahaveer 
 [Fixed checkpatch --strict warnings]
Signed-off-by: Eyal Reizer 
---
 drivers/misc/ti-st/Kconfig   |8 +
 drivers/misc/ti-st/Makefile  |1 +
 drivers/misc/ti-st/tty_hci.c |  538 ++
 3 files changed, 547 insertions(+)
 create mode 100644 drivers/misc/ti-st/tty_hci.c

diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
index f34dcc5..f2df2c7 100644
--- a/drivers/misc/ti-st/Kconfig
+++ b/drivers/misc/ti-st/Kconfig
@@ -14,4 +14,12 @@ config TI_ST
  are returned to relevant protocol drivers based on their
  packet types.
 
+config ST_HCI
+   tristate "HCI TTY emulation driver for Bluetooth"
+   depends on TI_ST
+   help
+ This enables the TTY device like emulation for HCI used by
+ user-space Bluetooth stacks.
+ It will provide a character device for user space Bluetooth stack to
+ send/receive data over shared transport.
 endmenu
diff --git a/drivers/misc/ti-st/Makefile b/drivers/misc/ti-st/Makefile
index 78d7ebb..4546219 100644
--- a/drivers/misc/ti-st/Makefile
+++ b/drivers/misc/ti-st/Makefile
@@ -4,3 +4,4 @@
 #
 obj-$(CONFIG_TI_ST)+= st_drv.o
 st_drv-objs:= st_core.o st_kim.o st_ll.o
+obj-$(CONFIG_ST_HCI)   += tty_hci.o
diff --git a/drivers/misc/ti-st/tty_hci.c b/drivers/misc/ti-st/tty_hci.c
new file mode 100644
index 000..7a6669f
--- /dev/null
+++ b/drivers/misc/ti-st/tty_hci.c
@@ -0,0 +1,538 @@
+/*
+ *  TTY emulation for user-space Bluetooth stacks over HCI-H4
+ *  Copyright (C) 2011-2012 Texas Instruments
+ *  Author: Pavan Savoy 
+ *
+ *  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
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ */
+
+/** define one of the following for debugging
+#define DEBUG
+#define VERBOSE
+*/
+
+#define pr_fmt(fmt) "(hci_tty): " fmt
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Number of seconds to wait for registration completion
+ * when ST returns PENDING status.
+ */
+#define BT_REGISTER_TIMEOUT   6000 /* 6 sec */
+
+/**
+ * struct ti_st - driver operation structure
+ * @hdev: hci device pointer which binds to bt driver
+ * @reg_status: ST registration callback status
+ * @st_write: write function provided by the ST driver
+ * to be used by the driver during send_frame.
+ * @wait_reg_completion - completion sync between ti_st_open
+ * and st_reg_completion_cb.
+ */
+struct ti_st {
+   struct hci_dev *hdev;
+   char reg_status;
+   long (*st_write)(struct sk_buff *);
+   struct completion wait_reg_completion;
+   wait_queue_head_t data_q;
+   struct sk_buff_head rx_list;
+};
+
+#define DEVICE_NAME "hci_tty"
+
+/***Functions called from ST driver**/
+/* Called by Shared Transport layer when receive data is
+ * available */
+static long st_receive(void *priv_data, struct sk_buff *skb)
+{
+   struct ti_st*hst = (void *)priv_data;
+
+   pr_debug("@ %s", __func__);
+#ifdef VERBOSE
+   print_hex_dump(KERN_INFO, ">rx>", DUMP_PREFIX_NONE,
+  16, 1, skb->data, skb->len, 0);
+#endif
+   skb_queue_tail(>rx_list, skb);
+   wake_up_interruptible(>data_q);
+   return 0;
+}
+
+/* Called by ST layer to indicate protocol registration completion
+ * status.ti_st_open() function will wait for signal from this
+ * API when st_register() function returns ST_PENDING.
+ */
+static void st_reg_completion_cb(void *priv_data, char data)
+{
+   struct ti_st*lhst = (void *)priv_data;
+
+   pr_info("@ %s\n", __func__);
+   /* Save registration status for use in ti_st_open() */
+   lhst->reg_status = data;
+   /* complete the wait in ti_st_open() */
+   complete(>wait_reg_completion);
+}
+
+/* protocol structure registered with shared transport */
+#define MAX_BT_CHNL_IDS 3
+static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
+   {
+   .chnl_id = 0x04, /* HCI Events */
+  

[PATCH] Bluetooth: Add tty HCI driver

2015-04-30 Thread Eyal Reizer
tty_hci driver exposes a /dev/hci_tty character device node, that intends
to emulate a generic /dev/ttyX device that would be used by the user-space
Bluetooth stacks to send/receive data to/from the WL combo-connectivity
chipsets.

The device driver has no internal logic of its own to intrepret data  all
such logic is handled by the user-space stack.

Signed-off-by: Pavan Savoy pavan_sa...@ti.com
 [Fixed checkpatch warnings]
Signed-off-by: Vishal Mahaveer vish...@ti.com
 [Fixed checkpatch --strict warnings]
Signed-off-by: Eyal Reizer ey...@ti.com
---
 drivers/misc/ti-st/Kconfig   |8 +
 drivers/misc/ti-st/Makefile  |1 +
 drivers/misc/ti-st/tty_hci.c |  538 ++
 3 files changed, 547 insertions(+)
 create mode 100644 drivers/misc/ti-st/tty_hci.c

diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
index f34dcc5..f2df2c7 100644
--- a/drivers/misc/ti-st/Kconfig
+++ b/drivers/misc/ti-st/Kconfig
@@ -14,4 +14,12 @@ config TI_ST
  are returned to relevant protocol drivers based on their
  packet types.
 
+config ST_HCI
+   tristate HCI TTY emulation driver for Bluetooth
+   depends on TI_ST
+   help
+ This enables the TTY device like emulation for HCI used by
+ user-space Bluetooth stacks.
+ It will provide a character device for user space Bluetooth stack to
+ send/receive data over shared transport.
 endmenu
diff --git a/drivers/misc/ti-st/Makefile b/drivers/misc/ti-st/Makefile
index 78d7ebb..4546219 100644
--- a/drivers/misc/ti-st/Makefile
+++ b/drivers/misc/ti-st/Makefile
@@ -4,3 +4,4 @@
 #
 obj-$(CONFIG_TI_ST)+= st_drv.o
 st_drv-objs:= st_core.o st_kim.o st_ll.o
+obj-$(CONFIG_ST_HCI)   += tty_hci.o
diff --git a/drivers/misc/ti-st/tty_hci.c b/drivers/misc/ti-st/tty_hci.c
new file mode 100644
index 000..7a6669f
--- /dev/null
+++ b/drivers/misc/ti-st/tty_hci.c
@@ -0,0 +1,538 @@
+/*
+ *  TTY emulation for user-space Bluetooth stacks over HCI-H4
+ *  Copyright (C) 2011-2012 Texas Instruments
+ *  Author: Pavan Savoy pavan_sa...@ti.com
+ *
+ *  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
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ */
+
+/** define one of the following for debugging
+#define DEBUG
+#define VERBOSE
+*/
+
+#define pr_fmt(fmt) (hci_tty):  fmt
+#include linux/module.h
+#include linux/cdev.h
+#include linux/fs.h
+#include linux/device.h
+
+#include linux/uaccess.h
+#include linux/tty.h
+#include linux/sched.h
+
+#include linux/delay.h
+#include linux/firmware.h
+#include linux/platform_device.h
+#include linux/poll.h
+#include linux/skbuff.h
+#include linux/interrupt.h
+
+#include linux/ti_wilink_st.h
+
+/* Number of seconds to wait for registration completion
+ * when ST returns PENDING status.
+ */
+#define BT_REGISTER_TIMEOUT   6000 /* 6 sec */
+
+/**
+ * struct ti_st - driver operation structure
+ * @hdev: hci device pointer which binds to bt driver
+ * @reg_status: ST registration callback status
+ * @st_write: write function provided by the ST driver
+ * to be used by the driver during send_frame.
+ * @wait_reg_completion - completion sync between ti_st_open
+ * and st_reg_completion_cb.
+ */
+struct ti_st {
+   struct hci_dev *hdev;
+   char reg_status;
+   long (*st_write)(struct sk_buff *);
+   struct completion wait_reg_completion;
+   wait_queue_head_t data_q;
+   struct sk_buff_head rx_list;
+};
+
+#define DEVICE_NAME hci_tty
+
+/***Functions called from ST driver**/
+/* Called by Shared Transport layer when receive data is
+ * available */
+static long st_receive(void *priv_data, struct sk_buff *skb)
+{
+   struct ti_st*hst = (void *)priv_data;
+
+   pr_debug(@ %s, __func__);
+#ifdef VERBOSE
+   print_hex_dump(KERN_INFO, rx, DUMP_PREFIX_NONE,
+  16, 1, skb-data, skb-len, 0);
+#endif
+   skb_queue_tail(hst-rx_list, skb);
+   wake_up_interruptible(hst-data_q);
+   return 0;
+}
+
+/* Called by ST layer to indicate protocol registration completion
+ * status.ti_st_open() function will wait for signal from this
+ * API when st_register() function returns ST_PENDING.
+ */
+static void st_reg_completion_cb(void *priv_data, char data)
+{
+   struct ti_st*lhst = (void *)priv_data;
+
+   pr_info(@ %s\n, __func__);
+   /* Save registration status for use in ti_st_open() */
+   lhst-reg_status = data;
+   /* complete the wait in ti_st_open() */
+   complete(lhst-wait_reg_completion);
+}
+
+/* protocol structure registered