Re: [PATCH v4 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2016-01-07 Thread Uri Mashiach

Hi Kalle Valo,

On 01/07/2016 11:02 AM, Kalle Valo wrote:

Uri Mashiach <uri.mashi...@compulab.co.il> writes:


Device tree modifications:
- Pinmux for SPI0 and WiFi GPIOs.
- SPI0 node with wlcore as a child node.

Cc: Tony Lindgren <t...@atomide.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: Replace interrupts and interrupt-parent with interrupts-extended.
v2 -> v3: Move the pinctrl-0 = <_pins> to the wlcore node.
v3 -> v4: replace interrupts-extended with interrupts and interrupt-parent. 
(revert v2 modification).
   According to Rob Herring and 
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt,
  interrupts-extended should only be used when a device has multiple 
interrupt parents.

  arch/arm/boot/dts/am335x-cm-t335.dts | 55 
  1 file changed, 55 insertions(+)


To what tree should this patch go? My wireless-drivers-next tree doesn't
even have this file.


Should be applied into omap-for-v4.x/dt



https://patchwork.kernel.org/patch/7933441/



--
Thanks,
Uri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] ARM: dts: cm-t335: add audio support

2015-12-30 Thread Uri Mashiach
The TLV320AIC23B codec is connected to the CPU by McASP controller 1 for
data and I2C0 for control.

Modifications:
- Enable and configure McASP controller 1.
- Add TLV320AIC23B codec pinmux.
- Add TLV320AIC23B codec configurations.
- Use simple-audio-card as CPU to codec glue.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 69 
 1 file changed, 69 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index f232322..080340e 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -56,6 +56,36 @@
brightness-levels = <0 51 53 56 62 75 101 152 255>;
default-brightness-level = <8>;
};
+
+   sound {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "cm-t335";
+
+   simple-audio-card,widgets =
+   "Microphone", "Mic Jack",
+   "Line", "Line In",
+   "Headphone", "Headphone Jack";
+
+   simple-audio-card,routing =
+   "Headphone Jack", "LHPOUT",
+   "Headphone Jack", "RHPOUT",
+   "LLINEIN", "Line In",
+   "RLINEIN", "Line In",
+   "MICIN", "Mic Jack";
+
+   simple-audio-card,format = "i2s";
+   simple-audio-card,bitclock-master = <_master>;
+   simple-audio-card,frame-master = <_master>;
+
+   simple-audio-card,cpu {
+   sound-dai = <>;
+   };
+
+   sound_master: simple-audio-card,codec {
+   sound-dai = <>;
+   system-clock-frequency = <1200>;
+   };
+   };
 };
 
 _pinmux {
@@ -283,6 +313,20 @@
AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
>;
};
+
+   /* TLV320AIC23B codec */
+   mcasp1_pins: pinmux_mcasp1_pins {
+   pinctrl-single,pins = <
+   /* MII1_CRS.mcasp1_aclkx */
+   AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE4)
+   /* MII1_RX_ER.mcasp1_fsx */
+   AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE4)
+   /* MII1_COL.mcasp1_axr2 */
+   AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE4)
+   /* RMII1_REF_CLK.mcasp1_axr3 */
+   AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE4)
+   >;
+   };
 };
 
  {
@@ -317,6 +361,13 @@ status = "okay";
compatible = "emmicro,em3027";
reg = <0x56>;
};
+   /* Audio codec */
+   tlv320aic23: codec@1a {
+   compatible = "ti,tlv320aic23";
+   reg = <0x1a>;
+   #sound-dai-cells= <0>;
+   status = "okay";
+   };
 };
 
  {
@@ -495,3 +546,21 @@ status = "okay";
};
 };
 
+/* CPU audio */
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   op-mode = <0>;  /* MCASP_IIS_MODE */
+   tdm-slots = <2>;
+   /* 16 serializers */
+   num-serializer = <16>;
+   serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
+   0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0
+   >;
+   tx-num-evt = <1>;
+   rx-num-evt = <1>;
+
+   #sound-dai-cells= <0>;
+   status = "okay";
+};
-- 
2.5.0

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


[PATCH 1/3] ARM: dts: cm-t335: Add support for CAN bus

2015-12-30 Thread Uri Mashiach
Add CAN bus pinmux.
Enable D_CAN bus controllers 0 and 1

The pinmux of uart1 node contradicts the pinmux of dcan0 and dcan1 nodes.
U-Boot should delete the uart1 or dcan0/1 nodes.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index b700940..f3d7845 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -144,6 +144,24 @@
>;
};
 
+   dcan0_pins: pinmux_dcan0_pins {
+   pinctrl-single,pins = <
+   /* uart1_ctsn.dcan0_tx */
+   AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE2)
+   /* uart1_rtsn.dcan0_rx */
+   AM33XX_IOPAD(0x97C, PIN_INPUT | MUX_MODE2)
+   >;
+   };
+
+   dcan1_pins: pinmux_dcan1_pins {
+   pinctrl-single,pins = <
+   /* uart1_rxd.dcan1_tx */
+   AM33XX_IOPAD(0x980, PIN_OUTPUT | MUX_MODE2)
+   /* uart1_txd.dcan1_rx */
+   AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE2)
+   >;
+   };
+
ecap0_pins: pinmux_ecap0_pins {
pinctrl-single,pins = <
/* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
@@ -448,3 +466,15 @@ status = "okay";
vwlan-supply = <_fixed>;
};
 };
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+};
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+};
-- 
2.5.0

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


[PATCH 0/3] ARM: dts: cm-t335: add peripherals - part 2

2015-12-30 Thread Uri Mashiach
Add support for the following peripherals:
- CAN BUS
- Touchscreen
- Audio

Uri Mashiach (3):
  ARM: dts: cm-t335: Add support for CAN bus
  ARM: dts: cm-t335: add touchscreen support
  ARM: dts: cm-t335: add audio support

 arch/arm/boot/dts/am335x-cm-t335.dts | 116 +++
 1 file changed, 116 insertions(+)

-- 
2.5.0

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


[PATCH 2/3] ARM: dts: cm-t335: add touchscreen support

2015-12-30 Thread Uri Mashiach
Touchscreen and analog digital converter configurations.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index f3d7845..f232322 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -478,3 +478,20 @@ status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
 };
+
+/* Touschscreen and analog digital converter */
+ {
+   status = "okay";
+   tsc {
+   ti,wires = <4>;
+   ti,x-plate-resistance = <200>;
+   ti,coordinate-readouts = <5>;
+   ti,wire-config = <0x01 0x10 0x23 0x32>;
+   ti,charge-delay = <0x400>;
+   };
+
+   adc {
+   ti,adc-channels = <4 5 6 7>;
+   };
+};
+
-- 
2.5.0

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


[PATCH v4 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-30 Thread Uri Mashiach
Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Rob Herring <r...@kernel.org>
---
v1 -> v2: update interrupt documentation.
  replace interrupts and interrupt-parent with interrupts-extended.
  IRQ parameters retrieved from spi_device instead of DT.
  remove redundant #ifdef CONFIG_OF
v2 -> v3: Add MODULE_DEVICE_TABLE.
  Remove #ifdef CONFIG_OF.
  Make the Kconfig symbol to depend on OF.
  Replace irqd_get_trigger_type() with irq_get_trigger_type().
v3 -> v4: replace interrupts-extended with interrupts and interrupt-parent. 
(revert v2 modification).
  According to Rob Herring and 
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt,
  interrupts-extended should only be used when a device has multiple 
interrupt parents.

 .../bindings/net/wireless/ti,wlcore,spi.txt| 36 +
 drivers/net/wireless/ti/wlcore/Kconfig |  2 +-
 drivers/net/wireless/ti/wlcore/spi.c   | 47 --
 3 files changed, 80 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..9180724
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,36 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- 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
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@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>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/Kconfig 
b/drivers/net/wireless/ti/wlcore/Kconfig
index 7c09954..5918080 100644
--- a/drivers/net/wireless/ti/wlcore/Kconfig
+++ b/drivers/net/wireless/ti/wlcore/Kconfig
@@ -13,7 +13,7 @@ config WLCORE
 
 config WLCORE_SPI
tristate "TI wlcore SPI support"
-   depends on WLCORE && SPI_MASTER
+   depends on WLCORE && SPI_MASTER && OF
select CRC7
---help---
  This module adds support for the SPI interface of adapters using
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index dec1512..020ac1a 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "wlcore.h"
@@ -357,6 +358,39 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
 };
 
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+MODULE_DEVICE_TABLE(of, wlcore_spi_of_match_table);
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+ 

[PATCH v4 0/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-30 Thread Uri Mashiach
Add DT support for WLS1271 SPI driver.
Add power operation function to the WLS1271 SPI driver.

Uri Mashiach (3):
  wlcore/wl12xx: spi: add power operation function
  wlcore/wl12xx: spi: add device tree support
  wlcore/wl12xx: spi: add wifi support to cm-t335

 .../bindings/net/wireless/ti,wlcore,spi.txt| 36 +
 arch/arm/boot/dts/am335x-cm-t335.dts   | 55 ++
 drivers/net/wireless/ti/wlcore/Kconfig |  2 +-
 drivers/net/wireless/ti/wlcore/spi.c   | 86 +-
 4 files changed, 174 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

-- 
2.5.0

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


[PATCH v4 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-30 Thread Uri Mashiach
Device tree modifications:
- Pinmux for SPI0 and WiFi GPIOs.
- SPI0 node with wlcore as a child node.

Cc: Tony Lindgren <t...@atomide.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: Replace interrupts and interrupt-parent with interrupts-extended.
v2 -> v3: Move the pinctrl-0 = <_pins> to the wlcore node.
v3 -> v4: replace interrupts-extended with interrupts and interrupt-parent. 
(revert v2 modification).
  According to Rob Herring and 
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt,
  interrupts-extended should only be used when a device has multiple 
interrupt parents.

 arch/arm/boot/dts/am335x-cm-t335.dts | 55 
 1 file changed, 55 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 42e9b66..65f1099 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -11,6 +11,7 @@
 /dts-v1/;
 
 #include "am33xx.dtsi"
+#include 
 
 / {
model = "CompuLab CM-T335";
@@ -40,6 +41,15 @@
regulator-max-microvolt = <330>;
};
 
+   /* Regulator for WiFi */
+   vwlan_fixed: fixedregulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "vwlan_fixed";
+   gpio = < 20 GPIO_ACTIVE_HIGH>; /* gpio0_20 */
+   enable-active-high;
+   regulator-boot-off;
+   };
+
backlight {
compatible = "pwm-backlight";
pwms = < 0 5 0>;
@@ -223,6 +233,21 @@
>;
};
 
+   spi0_pins: pinmux_spi0_pins {
+   pinctrl-single,pins = <
+   /* spi0_sclk.spi0_sclk */
+   AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE0)
+   /* spi0_d0.spi0_d0 */
+   AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)
+   /* spi0_d1.spi0_d1 */
+   AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)
+   /* spi0_cs0.spi0_cs0 */
+   AM33XX_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0)
+   /* spi0_cs1.spi0_cs1 */
+   AM33XX_IOPAD(0x960, PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
/* wl1271 bluetooth */
bluetooth_pins: pinmux_bluetooth_pins {
pinctrl-single,pins = <
@@ -230,6 +255,16 @@
AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
>;
};
+
+   /* wl1271 WiFi */
+   wifi_pins: pinmux_wifi_pins {
+   pinctrl-single,pins = <
+   /* EMU1.gpio3_8 - WiFi IRQ */
+   AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)
+   /* XDMA_EVENT_INTR1.gpio0_20 - WiFi enable */
+   AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
+   >;
+   };
 };
 
  {
@@ -394,3 +429,23 @@ status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
 };
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ti,pindir-d0-out-d1-in = <1>;
+   /* WLS1271 WiFi */
+   wlcore: wlcore@1 {
+   compatible = "ti,wl1271";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupt-parent = <>;
+   interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
-- 
2.5.0

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


[PATCH v4 1/3] wlcore/wl12xx: spi: add power operation function

2015-12-30 Thread Uri Mashiach
The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: oops fix was removed to a separate fix.
v2 -> v3: no changes
v3 -> v4: update devm_regulator_get() error handling.

 drivers/net/wireless/ti/wlcore/spi.c | 39 
 1 file changed, 39 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 44f059f..dec1512 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -81,6 +82,7 @@
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
+   struct regulator *reg; /* Power regulator */
 };
 
 static void wl12xx_spi_reset(struct device *child)
@@ -318,11 +320,40 @@ static int __must_check wl12xx_spi_raw_write(struct 
device *child, int addr,
return 0;
 }
 
+/**
+ * wl12xx_spi_set_power - power on/off the wl12xx unit
+ * @child: wl12xx device handle.
+ * @enable: true/false to power on/off the unit.
+ *
+ * use the WiFi enable regulator to enable/disable the WiFi unit.
+ */
+static int wl12xx_spi_set_power(struct device *child, bool enable)
+{
+   int ret = 0;
+   struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+
+   WARN_ON(!glue->reg);
+
+   /* Update regulator state */
+   if (enable) {
+   ret = regulator_enable(glue->reg);
+   if (ret)
+   dev_err(child, "Power enable failure\n");
+   } else {
+   ret =  regulator_disable(glue->reg);
+   if (ret)
+   dev_err(child, "Power disable failure\n");
+   }
+
+   return ret;
+}
+
 static struct wl1271_if_operations spi_ops = {
.read   = wl12xx_spi_raw_read,
.write  = wl12xx_spi_raw_write,
.reset  = wl12xx_spi_reset,
.init   = wl12xx_spi_init,
+   .power  = wl12xx_spi_set_power,
.set_block_size = NULL,
 };
 
@@ -353,6 +384,14 @@ static int wl1271_probe(struct spi_device *spi)
 * comes from the board-peripherals file */
spi->bits_per_word = 32;
 
+   glue->reg = devm_regulator_get(>dev, "vwlan");
+   if (PTR_ERR(glue->reg) == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+   if (IS_ERR(glue->reg)) {
+   dev_err(glue->dev, "can't get regulator\n");
+   return PTR_ERR(glue->reg);
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi_setup failed\n");
-- 
2.5.0

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


[PATCH v3 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-28 Thread Uri Mashiach
Device tree modifications:
- Pinmux for SPI0 and WiFi GPIOs.
- SPI0 node with wlcore as a child node.

Cc: Tony Lindgren <t...@atomide.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@complab.co.il>
---
v1 -> v2: Replace interrupts and interrupt-parent with interrupts-extended.
v2 -> v3: Move the pinctrl-0 = <_pins> to the wlcore node.

arch/arm/boot/dts/am335x-cm-t335.dts | 54 
 1 file changed, 54 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 42e9b66..b700940 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -11,6 +11,7 @@
 /dts-v1/;
 
 #include "am33xx.dtsi"
+#include 
 
 / {
model = "CompuLab CM-T335";
@@ -40,6 +41,15 @@
regulator-max-microvolt = <330>;
};
 
+   /* Regulator for WiFi */
+   vwlan_fixed: fixedregulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "vwlan_fixed";
+   gpio = < 20 GPIO_ACTIVE_HIGH>; /* gpio0_20 */
+   enable-active-high;
+   regulator-boot-off;
+   };
+
backlight {
compatible = "pwm-backlight";
pwms = < 0 5 0>;
@@ -223,6 +233,21 @@
>;
};
 
+   spi0_pins: pinmux_spi0_pins {
+   pinctrl-single,pins = <
+   /* spi0_sclk.spi0_sclk */
+   AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE0)
+   /* spi0_d0.spi0_d0 */
+   AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)
+   /* spi0_d1.spi0_d1 */
+   AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)
+   /* spi0_cs0.spi0_cs0 */
+   AM33XX_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0)
+   /* spi0_cs1.spi0_cs1 */
+   AM33XX_IOPAD(0x960, PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
/* wl1271 bluetooth */
bluetooth_pins: pinmux_bluetooth_pins {
pinctrl-single,pins = <
@@ -230,6 +255,16 @@
AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
>;
};
+
+   /* wl1271 WiFi */
+   wifi_pins: pinmux_wifi_pins {
+   pinctrl-single,pins = <
+   /* EMU1.gpio3_8 - WiFi IRQ */
+   AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)
+   /* XDMA_EVENT_INTR1.gpio0_20 - WiFi enable */
+   AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
+   >;
+   };
 };
 
  {
@@ -394,3 +429,22 @@ status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
 };
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ti,pindir-d0-out-d1-in = <1>;
+   /* WLS1271 WiFi */
+   wlcore: wlcore@1 {
+   compatible = "ti,wl1271";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
-- 
2.5.0

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


[PATCH v3 1/3] wlcore/wl12xx: spi: add power operation function

2015-12-28 Thread Uri Mashiach
The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: oops fix was removed to a separate fix.
v2 -> v3: no changes

 drivers/net/wireless/ti/wlcore/spi.c | 37 
 1 file changed, 37 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 44f059f..d3a4bcb 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -81,6 +82,7 @@
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
+   struct regulator *reg; /* Power regulator */
 };
 
 static void wl12xx_spi_reset(struct device *child)
@@ -318,11 +320,40 @@ static int __must_check wl12xx_spi_raw_write(struct 
device *child, int addr,
return 0;
 }
 
+/**
+ * wl12xx_spi_set_power - power on/off the wl12xx unit
+ * @child: wl12xx device handle.
+ * @enable: true/false to power on/off the unit.
+ *
+ * use the WiFi enable regulator to enable/disable the WiFi unit.
+ */
+static int wl12xx_spi_set_power(struct device *child, bool enable)
+{
+   int ret = 0;
+   struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+
+   WARN_ON(!glue->reg);
+
+   /* Update regulator state */
+   if (enable) {
+   ret = regulator_enable(glue->reg);
+   if (ret)
+   dev_err(child, "Power enable failure\n");
+   } else {
+   ret =  regulator_disable(glue->reg);
+   if (ret)
+   dev_err(child, "Power disable failure\n");
+   }
+
+   return ret;
+}
+
 static struct wl1271_if_operations spi_ops = {
.read   = wl12xx_spi_raw_read,
.write  = wl12xx_spi_raw_write,
.reset  = wl12xx_spi_reset,
.init   = wl12xx_spi_init,
+   .power  = wl12xx_spi_set_power,
.set_block_size = NULL,
 };
 
@@ -353,6 +384,12 @@ static int wl1271_probe(struct spi_device *spi)
 * comes from the board-peripherals file */
spi->bits_per_word = 32;
 
+   glue->reg = devm_regulator_get(>dev, "vwlan");
+   if (IS_ERR(glue->reg)) {
+   dev_err(glue->dev, "can't get regulator\n");
+   return PTR_ERR(glue->reg);
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi_setup failed\n");
-- 
2.5.0

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


[PATCH v3 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-28 Thread Uri Mashiach
Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: update interrupt documentation.
  replace interrupts and interrupt-parent with interrupts-extended.
  IRQ parameters retrieved from spi_device instead of DT.
  remove redundant #ifdef CONFIG_OF
v2 -> v3: Add MODULE_DEVICE_TABLE.
  Remove #ifdef CONFIG_OF.
  Make the Kconfig symbol to depend on OF.
  Replace irqd_get_trigger_type() with irq_get_trigger_type().

 .../bindings/net/wireless/ti,wlcore,spi.txt| 34 
 drivers/net/wireless/ti/wlcore/Kconfig |  2 +-
 drivers/net/wireless/ti/wlcore/spi.c   | 47 --
 3 files changed, 78 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..502c27e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,34 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts-extended : 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
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/Kconfig 
b/drivers/net/wireless/ti/wlcore/Kconfig
index 7c09954..5918080 100644
--- a/drivers/net/wireless/ti/wlcore/Kconfig
+++ b/drivers/net/wireless/ti/wlcore/Kconfig
@@ -13,7 +13,7 @@ config WLCORE
 
 config WLCORE_SPI
tristate "TI wlcore SPI support"
-   depends on WLCORE && SPI_MASTER
+   depends on WLCORE && SPI_MASTER && OF
select CRC7
---help---
  This module adds support for the SPI interface of adapters using
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..0f2fb50 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "wlcore.h"
@@ -357,6 +358,39 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
 };
 
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+MODULE_DEVICE_TABLE(of, wlcore_spi_of_match_table);
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 static int wl1271_probe(struct spi_device *spi)
 {
struct wl12xx_spi_glue *glue;
@@ -366,8 +400,6 @@ static int wl1271_probe(struct spi_device *spi)
 
memset(_data, 0x00, sizeof(pdev_data));
 
-   /* TODO: add DT parsing when needed */
-
pdev_data.if_ops = _ops;
 
glue = devm_kzalloc(>dev, sizeof(*glue), GFP_KERNEL);
@@ 

[PATCH v3 0/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-28 Thread Uri Mashiach
Add DT support for WLS1271 SPI driver.
Add power operation function to the WLS1271 SPI driver.

Uri Mashiach (3):
  wlcore/wl12xx: spi: add power operation function
  wlcore/wl12xx: spi: add device tree support
  wlcore/wl12xx: spi: add wifi support to cm-t335

 .../bindings/net/wireless/ti,wlcore,spi.txt| 34 +
 arch/arm/boot/dts/am335x-cm-t335.dts   | 54 ++
 drivers/net/wireless/ti/wlcore/Kconfig |  2 +-
 drivers/net/wireless/ti/wlcore/spi.c   | 84 --
 4 files changed, 169 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

-- 
2.5.0

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


Re: [PATCH v2 1/3] wlcore/wl12xx: spi: add power operation function

2015-12-28 Thread Uri Mashiach

Hi Grygorii,

On 12/28/2015 01:59 PM, Grygorii Strashko wrote:

On 12/27/2015 07:14 PM, Uri Mashiach wrote:

Hello Grygorii,

On 12/24/2015 06:32 PM, Grygorii Strashko wrote:

On 12/24/2015 05:35 PM, Uri Mashiach wrote:

The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: oops fix was removed to a separate fix.

   drivers/net/wireless/ti/wlcore/spi.c | 37

   1 file changed, 37 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c
b/drivers/net/wireless/ti/wlcore/spi.c



[...]


+
   static struct wl1271_if_operations spi_ops = {
   .read= wl12xx_spi_raw_read,
   .write= wl12xx_spi_raw_write,
   .reset= wl12xx_spi_reset,
   .init= wl12xx_spi_init,
+.power= wl12xx_spi_set_power,
   .set_block_size = NULL,
   };

@@ -353,6 +384,12 @@ static int wl1271_probe(struct spi_device *spi)
* comes from the board-peripherals file */
   spi->bits_per_word = 32;

+glue->reg = devm_regulator_get(>dev, "vwlan");
+if (IS_ERR(glue->reg)) {


It will be more correct to handle -EPROBE_DEFER here also. Like:
   if (PTR_ERR(glue->reg) == -EPROBE_DEFER)
  return PTR_ERR(glue->reg);



It seems that the IS_ERR(glue->reg) condition covers the EPROBE_DEFER case.


True. But this is not an error and it's common practice do not print
any log messages in this case from driver :)



Sorry, already posted v3.
Will be in v4.




+dev_err(glue->dev, "can't get regulator\n");
+return PTR_ERR(glue->reg);
+}
+
   ret = spi_setup(spi);
   if (ret < 0) {
   dev_err(glue->dev, "spi_setup failed\n");











--
Thanks,
Uri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/3] wlcore/wl12xx: spi: add power operation function

2015-12-27 Thread Uri Mashiach

Hello Grygorii,

On 12/24/2015 06:32 PM, Grygorii Strashko wrote:

On 12/24/2015 05:35 PM, Uri Mashiach wrote:

The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: oops fix was removed to a separate fix.

  drivers/net/wireless/ti/wlcore/spi.c | 37

  1 file changed, 37 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c
b/drivers/net/wireless/ti/wlcore/spi.c



[...]


+
  static struct wl1271_if_operations spi_ops = {
  .read= wl12xx_spi_raw_read,
  .write= wl12xx_spi_raw_write,
  .reset= wl12xx_spi_reset,
  .init= wl12xx_spi_init,
+.power= wl12xx_spi_set_power,
  .set_block_size = NULL,
  };

@@ -353,6 +384,12 @@ static int wl1271_probe(struct spi_device *spi)
   * comes from the board-peripherals file */
  spi->bits_per_word = 32;

+glue->reg = devm_regulator_get(>dev, "vwlan");
+if (IS_ERR(glue->reg)) {


It will be more correct to handle -EPROBE_DEFER here also. Like:
  if (PTR_ERR(glue->reg) == -EPROBE_DEFER)
 return PTR_ERR(glue->reg);



It seems that the IS_ERR(glue->reg) condition covers the EPROBE_DEFER case.


+dev_err(glue->dev, "can't get regulator\n");
+return PTR_ERR(glue->reg);
+}
+
  ret = spi_setup(spi);
  if (ret < 0) {
  dev_err(glue->dev, "spi_setup failed\n");






--
Thanks,
Uri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-24 Thread Uri Mashiach

Hi Grygorii,

On 12/24/2015 06:32 PM, Grygorii Strashko wrote:

On 12/24/2015 05:35 PM, Uri Mashiach wrote:

Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: update interrupt documentation.
replace interrupts and interrupt-parent with interrupts-extended.
  IRQ parameters retrieved from spi_device instead of DT.
  remove redundant #ifdef CONFIG_OF

   .../bindings/net/wireless/ti,wlcore,spi.txt| 34 +
   drivers/net/wireless/ti/wlcore/spi.c   | 55 
--
   2 files changed, 85 insertions(+), 4 deletions(-)
   create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..502c27e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,34 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts-extended : 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
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..e9e8d54 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
   #include 
   #include 
   #include 
+#include 
   #include 

   #include "wlcore.h"
@@ -357,6 +358,46 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
   };

+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */


My question for your v1 was related to all above ifdefs.
If CONFIG_OF=n is not going to be supported then all this ifdefs
can be dropped and proper dependency can be added to Kconfig instead.



Will be done in v3.


+
   static int wl1271_probe(struct spi_device *spi)
   {
struct wl12xx_spi_glue *glue;
@@ -366,8 +407,6 @@ static int wl1271_probe(struct spi_device *spi)

memset(_data, 0x00, sizeof(pdev_data));

-   /* TODO: add DT parsing when needed */
-
pdev_data.if_ops = _ops;

glue = devm_kzalloc(>dev, sizeof(*glue), GFP_KERNEL);
@@ -390,6 +429,13 @@ static int wl1271_probe(struct spi_device *spi)
return PTR_ERR(glue->reg);
}

+   ret = wlcore_probe_of(spi, glue, _data);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   

Re: [PATCH v2 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-24 Thread Uri Mashiach

Hello Javier,

On 12/24/2015 06:25 PM, Javier Martinez Canillas wrote:

Hello Uri,

On Thu, Dec 24, 2015 at 12:35 PM, Uri Mashiach
<uri.mashi...@compulab.co.il> wrote:

Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: update interrupt documentation.
   replace interrupts and interrupt-parent with interrupts-extended.
   IRQ parameters retrieved from spi_device instead of DT.
   remove redundant #ifdef CONFIG_OF

  .../bindings/net/wireless/ti,wlcore,spi.txt| 34 +
  drivers/net/wireless/ti/wlcore/spi.c   | 55 --
  2 files changed, 85 insertions(+), 4 deletions(-)
  create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..502c27e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,34 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts-extended : 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
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..e9e8d54 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 

  #include "wlcore.h"
@@ -357,6 +358,46 @@ static struct wl1271_if_operations spi_ops = {
 .set_block_size = NULL,
  };

+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};


Could you please add a MODULE_DEVICE_TABLE(of, wlcore_spi_of_match_table) here?



Will be added in v3.


+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */
+


I don't understand what's the point of making the driver to be built
with !CONFIG_OF if the probe function is going to fail anyways. If
this driver really need then is better to remove the ifdefery and make
the Kconfig symbol to depend on OF.



Will be done in v3.


Best regards,
Javier



Thanks,
Uri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-24 Thread Uri Mashiach
Device tree modifications:
- Pinmux for SPI0 and WiFi GPIOs.
- SPI0 node with wlcore as a child node.

Cc: Tony Lindgren <t...@atomide.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@complab.co.il>
---
v1 -> v2: replace interrupts and interrupt-parent with interrupts-extended.

 arch/arm/boot/dts/am335x-cm-t335.dts | 57 +++-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 42e9b66..31f8371 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -11,6 +11,7 @@
 /dts-v1/;
 
 #include "am33xx.dtsi"
+#include 
 
 / {
model = "CompuLab CM-T335";
@@ -40,6 +41,15 @@
regulator-max-microvolt = <330>;
};
 
+   /* Regulator for WiFi */
+   vwlan_fixed: fixedregulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "vwlan_fixed";
+   gpio = < 20 GPIO_ACTIVE_HIGH>; /* gpio0_20 */
+   enable-active-high;
+   regulator-boot-off;
+   };
+
backlight {
compatible = "pwm-backlight";
pwms = < 0 5 0>;
@@ -50,7 +60,10 @@
 
 _pinmux {
pinctrl-names = "default";
-   pinctrl-0 = <_pins>;
+   pinctrl-0 = <
+ _pins
+ _pins
+   >;
 
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
@@ -223,6 +236,21 @@
>;
};
 
+   spi0_pins: pinmux_spi0_pins {
+   pinctrl-single,pins = <
+   /* spi0_sclk.spi0_sclk */
+   AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE0)
+   /* spi0_d0.spi0_d0 */
+   AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)
+   /* spi0_d1.spi0_d1 */
+   AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)
+   /* spi0_cs0.spi0_cs0 */
+   AM33XX_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0)
+   /* spi0_cs1.spi0_cs1 */
+   AM33XX_IOPAD(0x960, PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
/* wl1271 bluetooth */
bluetooth_pins: pinmux_bluetooth_pins {
pinctrl-single,pins = <
@@ -230,6 +258,16 @@
AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
>;
};
+
+   /* wl1271 WiFi */
+   wifi_pins: pinmux_wifi_pins {
+   pinctrl-single,pins = <
+   /* EMU1.gpio3_8 - WiFi IRQ */
+   AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)
+   /* XDMA_EVENT_INTR1.gpio0_20 - WiFi enable */
+   AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
+   >;
+   };
 };
 
  {
@@ -394,3 +432,20 @@ status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
 };
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ti,pindir-d0-out-d1-in = <1>;
+   /* WLS1271 WiFi */
+   wlcore: wlcore@1 {
+   compatible = "ti,wl1271";
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
-- 
2.5.0

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


[PATCH v2 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-24 Thread Uri Mashiach
Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: update interrupt documentation.
  replace interrupts and interrupt-parent with interrupts-extended.
  IRQ parameters retrieved from spi_device instead of DT.
  remove redundant #ifdef CONFIG_OF

 .../bindings/net/wireless/ti,wlcore,spi.txt| 34 +
 drivers/net/wireless/ti/wlcore/spi.c   | 55 --
 2 files changed, 85 insertions(+), 4 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..502c27e
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,34 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts-extended : 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
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   ref-clock-frequency = <3840>;
+   interrupts-extended = < 8 IRQ_TYPE_LEVEL_HIGH>;
+   vwlan-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..e9e8d54 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "wlcore.h"
@@ -357,6 +358,46 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue 
*glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */
+
 static int wl1271_probe(struct spi_device *spi)
 {
struct wl12xx_spi_glue *glue;
@@ -366,8 +407,6 @@ static int wl1271_probe(struct spi_device *spi)
 
memset(_data, 0x00, sizeof(pdev_data));
 
-   /* TODO: add DT parsing when needed */
-
pdev_data.if_ops = _ops;
 
glue = devm_kzalloc(>dev, sizeof(*glue), GFP_KERNEL);
@@ -390,6 +429,13 @@ static int wl1271_probe(struct spi_device *spi)
return PTR_ERR(glue->reg);
}
 
+   ret = wlcore_probe_of(spi, glue, _data);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get device tree parameters (%d)\n", ret);
+   return ret;
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi_setup failed\n");
@@ -407,7 +453,8 @@ static int wl1271_probe(struct spi_device *spi)
memset(res, 0x00, sizeof(res)

[PATCH v2 0/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-24 Thread Uri Mashiach
Add DT support for WLS1271 SPI driver.
Add power operation function to the WLS1271 SPI driver.

Uri Mashiach (3):
  wlcore/wl12xx: spi: add power operation function
  wlcore/wl12xx: spi: add device tree support
  wlcore/wl12xx: spi: add wifi support to cm-t335

 .../bindings/net/wireless/ti,wlcore,spi.txt| 34 
 arch/arm/boot/dts/am335x-cm-t335.dts   | 57 +-
 drivers/net/wireless/ti/wlcore/spi.c   | 92 +-
 3 files changed, 178 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

-- 
2.5.0

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


[PATCH v2 1/3] wlcore/wl12xx: spi: add power operation function

2015-12-24 Thread Uri Mashiach
The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: oops fix was removed to a separate fix.

 drivers/net/wireless/ti/wlcore/spi.c | 37 
 1 file changed, 37 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 44f059f..d3a4bcb 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -81,6 +82,7 @@
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
+   struct regulator *reg; /* Power regulator */
 };
 
 static void wl12xx_spi_reset(struct device *child)
@@ -318,11 +320,40 @@ static int __must_check wl12xx_spi_raw_write(struct 
device *child, int addr,
return 0;
 }
 
+/**
+ * wl12xx_spi_set_power - power on/off the wl12xx unit
+ * @child: wl12xx device handle.
+ * @enable: true/false to power on/off the unit.
+ *
+ * use the WiFi enable regulator to enable/disable the WiFi unit.
+ */
+static int wl12xx_spi_set_power(struct device *child, bool enable)
+{
+   int ret = 0;
+   struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+
+   WARN_ON(!glue->reg);
+
+   /* Update regulator state */
+   if (enable) {
+   ret = regulator_enable(glue->reg);
+   if (ret)
+   dev_err(child, "Power enable failure\n");
+   } else {
+   ret =  regulator_disable(glue->reg);
+   if (ret)
+   dev_err(child, "Power disable failure\n");
+   }
+
+   return ret;
+}
+
 static struct wl1271_if_operations spi_ops = {
.read   = wl12xx_spi_raw_read,
.write  = wl12xx_spi_raw_write,
.reset  = wl12xx_spi_reset,
.init   = wl12xx_spi_init,
+   .power  = wl12xx_spi_set_power,
.set_block_size = NULL,
 };
 
@@ -353,6 +384,12 @@ static int wl1271_probe(struct spi_device *spi)
 * comes from the board-peripherals file */
spi->bits_per_word = 32;
 
+   glue->reg = devm_regulator_get(>dev, "vwlan");
+   if (IS_ERR(glue->reg)) {
+   dev_err(glue->dev, "can't get regulator\n");
+   return PTR_ERR(glue->reg);
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi_setup failed\n");
-- 
2.5.0

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


Re: [PATCH 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-23 Thread Uri Mashiach

Hi Grygorii,

On 12/23/2015 12:25 PM, Grygorii Strashko wrote:

On 12/23/2015 10:35 AM, Uri Mashiach wrote:

Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
   .../bindings/net/wireless/ti,wlcore,spi.txt| 35 +++
   drivers/net/wireless/ti/wlcore/spi.c   | 67 
+++---
   2 files changed, 95 insertions(+), 7 deletions(-)
   create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..a3e7eb7
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,35 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts :  Should contain interrupt line and trigger type


It's good to describe here number of IRQ lines your device have and IRQ types 
(edge/level)



Maybe IRQ type should be provided by dts file 
(IRQ_TYPE_LEVEL_HIGH/IRQ_TYPE_EDGE_RISING...)

to enable support for additional controllers?


+- interrupt-parent :Should be the phandle for the interrupt controller

interrupt-parent is not required (also interrupts-extended can be used)



Will be done in v2.


+that services interrupts for this device
+- vwlan-supply :Point the node of the regulator that controls the 
wl1271 chip WLAN_EN pin


Pls, use gpio if this is required just to toggle WLAN_EN pin.

[ti,] power-gpio or en-gpio




The controller's power might need toggling in some board implementation.
Maybe GPIO and regulator should be implemented?


+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,just
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   interrupt-parent = <>;
+   interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+   wifi-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..7281f5a 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
   #include 
   #include 
   #include 
+#include 
   #include 

   #include "wlcore.h"
@@ -357,6 +358,54 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
   };

+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   ret = of_irq_to_resource(dt_node, 0, [0]);
+   if (spi->irq != ret) {
+   dev_err(glue->dev, "can't get interrupt resource\n");
+   return -EINVAL;
+   }


SPI core will parse IRQ for you (see below)


+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */
+
   static int wl1271_probe(struct spi_device *spi)
   {
struct wl12xx_spi_glue *glue;
@@ -365,8 +

Re: [PATCH 1/3] wlcore/wl12xx: spi: fix NULL pointer dereference (Oops)

2015-12-23 Thread Uri Mashiach

Hi Grygorii,

On 12/23/2015 12:08 PM, Grygorii Strashko wrote:

On 12/23/2015 10:35 AM, Uri Mashiach wrote:

The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Fix the below Oops when trying to modprobe wlcore_spi.
The oops occurs because the wl1271_power_{off,on}()
function doesn't check the power() function pointer.

[   23.401447] Unable to handle kernel NULL pointer dereference at
virtual address 
[   23.409954] pgd = c0004000
[   23.412922] [] *pgd=
[   23.416693] Internal error: Oops: 8007 [#1] SMP ARM
[   23.422168] Modules linked in: wl12xx wlcore mac80211 cfg80211
musb_dsps musb_hdrc usbcore usb_common snd_soc_simple_card evdev joydev
omap_rng wlcore_spi snd_soc_tlv320aic23_i2c rng_core snd_soc_tlv320aic23
c_can_platform c_can can_dev snd_soc_davinci_mcasp snd_soc_edma
snd_soc_omap omap_wdt musb_am335x cpufreq_dt thermal_sys hwmon
[   23.453253] CPU: 0 PID: 36 Comm: kworker/0:2 Not tainted
4.2.0-2-g951efee-dirty #233
[   23.461720] Hardware name: Generic AM33XX (Flattened Device Tree)
[   23.468123] Workqueue: events request_firmware_work_func
[   23.473690] task: de32efc0 ti: de4ee000 task.ti: de4ee000
[   23.479341] PC is at 0x0
[   23.482112] LR is at wl12xx_set_power_on+0x28/0x124 [wlcore]


Why can't you just add proper check in wl1271_power_on/wl1271_power_off() 
instead?



Will be done in v2.

Thanks,
Uri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-23 Thread Uri Mashiach

Hi Grygorii,

On 12/23/2015 12:25 PM, Grygorii Strashko wrote:

On 12/23/2015 10:35 AM, Uri Mashiach wrote:

Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
   .../bindings/net/wireless/ti,wlcore,spi.txt| 35 +++
   drivers/net/wireless/ti/wlcore/spi.c   | 67 
+++---
   2 files changed, 95 insertions(+), 7 deletions(-)
   create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..a3e7eb7
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,35 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts :  Should contain interrupt line and trigger type


It's good to describe here number of IRQ lines your device have and IRQ types 
(edge/level)


+- interrupt-parent :Should be the phandle for the interrupt controller

interrupt-parent is not required (also interrupts-extended can be used)


+that services interrupts for this device
+- vwlan-supply :Point the node of the regulator that controls the 
wl1271 chip WLAN_EN pin


Pls, use gpio if this is required just to toggle WLAN_EN pin.

[ti,] power-gpio or en-gpio



+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,just
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   interrupt-parent = <>;
+   interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+   wifi-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..7281f5a 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
   #include 
   #include 
   #include 
+#include 
   #include 

   #include "wlcore.h"
@@ -357,6 +358,54 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
   };

+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   ret = of_irq_to_resource(dt_node, 0, [0]);
+   if (spi->irq != ret) {
+   dev_err(glue->dev, "can't get interrupt resource\n");
+   return -EINVAL;
+   }


SPI core will parse IRQ for you (see below)



The IRQ type should be stored in res[0].flags.
Is there an alternative to of_irq_to_resource() for getting the IRQ type?


+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */
+
   static int wl1271_probe(struct spi_device *spi)
   {
struct wl12xx_spi_glue *glue;
@@ -365,8 +414,7 @@ static int wl1271_probe(struct spi_device *spi)
int ret;

memset(_data, 0x00, sizeof(pdev_data));
-
-   /* TODO: add DT parsing w

[PATCH 3/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-23 Thread Uri Mashiach
Device tree modifications:
- Pinmux for SPI0 and WiFi GPIOs.
- SPI0 node with wlcore as a child node.

Cc: Tony Lindgren <t...@atomide.com>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@complab.co.il>
---
Prerequisites:
This patch applies on Tony's omap-for-v4.5/dt branch.

 arch/arm/boot/dts/am335x-cm-t335.dts | 58 +++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 42e9b66..41242a5 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -11,6 +11,7 @@
 /dts-v1/;
 
 #include "am33xx.dtsi"
+#include 
 
 / {
model = "CompuLab CM-T335";
@@ -40,6 +41,15 @@
regulator-max-microvolt = <330>;
};
 
+   /* Regulator for WiFi */
+   vwlan_fixed: fixedregulator@2 {
+   compatible = "regulator-fixed";
+   regulator-name = "vwlan_fixed";
+   gpio = < 20 GPIO_ACTIVE_HIGH>; /* gpio0_20 */
+   enable-active-high;
+   regulator-boot-off;
+   };
+
backlight {
compatible = "pwm-backlight";
pwms = < 0 5 0>;
@@ -50,7 +60,10 @@
 
 _pinmux {
pinctrl-names = "default";
-   pinctrl-0 = <_pins>;
+   pinctrl-0 = <
+ _pins
+ _pins
+   >;
 
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
@@ -223,6 +236,21 @@
>;
};
 
+   spi0_pins: pinmux_spi0_pins {
+   pinctrl-single,pins = <
+   /* spi0_sclk.spi0_sclk */
+   AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE0)
+   /* spi0_d0.spi0_d0 */
+   AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)
+   /* spi0_d1.spi0_d1 */
+   AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)
+   /* spi0_cs0.spi0_cs0 */
+   AM33XX_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0)
+   /* spi0_cs1.spi0_cs1 */
+   AM33XX_IOPAD(0x960, PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
/* wl1271 bluetooth */
bluetooth_pins: pinmux_bluetooth_pins {
pinctrl-single,pins = <
@@ -230,6 +258,16 @@
AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
>;
};
+
+   /* wl1271 WiFi */
+   wifi_pins: pinmux_wifi_pins {
+   pinctrl-single,pins = <
+   /* EMU1.gpio3_8 - WiFi IRQ */
+   AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)
+   /* XDMA_EVENT_INTR1.gpio0_20 - WiFi enable */
+   AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
+   >;
+   };
 };
 
  {
@@ -394,3 +432,21 @@ status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
 };
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ti,pindir-d0-out-d1-in = <1>;
+   /* WLS1271 WiFi */
+   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>;
+   };
+};
-- 
2.5.0

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


[PATCH 0/3] wlcore/wl12xx: spi: add wifi support to cm-t335

2015-12-23 Thread Uri Mashiach
Add DT support for WLS1271 SPI driver.
Fix oops by adding a power callback.

Uri Mashiach (3):
  wlcore/wl12xx: spi: fix NULL pointer dereference (Oops)
  wlcore/wl12xx: spi: add device tree support
  wlcore/wl12xx: spi: add wifi support to cm-t335

 .../bindings/net/wireless/ti,wlcore,spi.txt|  35 +++
 arch/arm/boot/dts/am335x-cm-t335.dts   |  58 +++-
 drivers/net/wireless/ti/wlcore/spi.c   | 104 +++--
 3 files changed, 189 insertions(+), 8 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

-- 
2.5.0

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


[PATCH 1/3] wlcore/wl12xx: spi: fix NULL pointer dereference (Oops)

2015-12-23 Thread Uri Mashiach
The power function uses a consumer regulator access to update the WiFi
enable GPIO value.

Fix the below Oops when trying to modprobe wlcore_spi.
The oops occurs because the wl1271_power_{off,on}()
function doesn't check the power() function pointer.

[   23.401447] Unable to handle kernel NULL pointer dereference at
virtual address 
[   23.409954] pgd = c0004000
[   23.412922] [] *pgd=
[   23.416693] Internal error: Oops: 8007 [#1] SMP ARM
[   23.422168] Modules linked in: wl12xx wlcore mac80211 cfg80211
musb_dsps musb_hdrc usbcore usb_common snd_soc_simple_card evdev joydev
omap_rng wlcore_spi snd_soc_tlv320aic23_i2c rng_core snd_soc_tlv320aic23
c_can_platform c_can can_dev snd_soc_davinci_mcasp snd_soc_edma
snd_soc_omap omap_wdt musb_am335x cpufreq_dt thermal_sys hwmon
[   23.453253] CPU: 0 PID: 36 Comm: kworker/0:2 Not tainted
4.2.0-2-g951efee-dirty #233
[   23.461720] Hardware name: Generic AM33XX (Flattened Device Tree)
[   23.468123] Workqueue: events request_firmware_work_func
[   23.473690] task: de32efc0 ti: de4ee000 task.ti: de4ee000
[   23.479341] PC is at 0x0
[   23.482112] LR is at wl12xx_set_power_on+0x28/0x124 [wlcore]
[   23.488074] pc : [<>]lr : []psr: 6013
[   23.488074] sp : de4efe50  ip : 0002  fp : 
[   23.500162] r10: de7cdd00  r9 : dc848800  r8 : bf27af00
[   23.505663] r7 : bf27a1a8  r6 : dcbd8a80  r5 : dce0e2e0  r4 :
dce0d2e0
[   23.512536] r3 :   r2 :   r1 : 0001  r0 :
dc848810
[   23.519412] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[   23.527109] Control: 10c5387d  Table: 9cb78019  DAC: 0015
[   23.533160] Process kworker/0:2 (pid: 36, stack limit = 0xde4ee218)
[   23.539760] Stack: (0xde4efe50 to 0xde4f)

[...]

[   23.665030] [] (wl12xx_set_power_on [wlcore]) from
[] (wlcore_nvs_cb+0x118/0xa4c [wlcore])
[   23.675604] [] (wlcore_nvs_cb [wlcore]) from []
(request_firmware_work_func+0x30/0x58)
[   23.685784] [] (request_firmware_work_func) from
[] (process_one_work+0x1b4/0x4b4)
[   23.695591] [] (process_one_work) from []
(worker_thread+0x3c/0x4a4)
[   23.704124] [] (worker_thread) from []
(kthread+0xd4/0xf0)
[   23.711747] [] (kthread) from []
(ret_from_fork+0x14/0x3c)
[   23.719357] Code: bad PC value
[   23.722760] ---[ end trace 981be8510db9b3a9 ]---

Fix this by adding a power() function implementation.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 drivers/net/wireless/ti/wlcore/spi.c | 37 
 1 file changed, 37 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 44f059f..d3a4bcb 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -81,6 +82,7 @@
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
+   struct regulator *reg; /* Power regulator */
 };
 
 static void wl12xx_spi_reset(struct device *child)
@@ -318,11 +320,40 @@ static int __must_check wl12xx_spi_raw_write(struct 
device *child, int addr,
return 0;
 }
 
+/**
+ * wl12xx_spi_set_power - power on/off the wl12xx unit
+ * @child: wl12xx device handle.
+ * @enable: true/false to power on/off the unit.
+ *
+ * use the WiFi enable regulator to enable/disable the WiFi unit.
+ */
+static int wl12xx_spi_set_power(struct device *child, bool enable)
+{
+   int ret = 0;
+   struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+
+   WARN_ON(!glue->reg);
+
+   /* Update regulator state */
+   if (enable) {
+   ret = regulator_enable(glue->reg);
+   if (ret)
+   dev_err(child, "Power enable failure\n");
+   } else {
+   ret =  regulator_disable(glue->reg);
+   if (ret)
+   dev_err(child, "Power disable failure\n");
+   }
+
+   return ret;
+}
+
 static struct wl1271_if_operations spi_ops = {
.read   = wl12xx_spi_raw_read,
.write  = wl12xx_spi_raw_write,
.reset  = wl12xx_spi_reset,
.init   = wl12xx_spi_init,
+   .power  = wl12xx_spi_set_power,
.set_block_size = NULL,
 };
 
@@ -353,6 +384,12 @@ static int wl1271_probe(struct spi_device *spi)
 * comes from the board-peripherals file */
spi->bits_per_word = 32;
 
+   glue->reg = devm_regulator_get(>dev, "vwlan");
+   if (IS_ERR(glue->reg)) {
+   dev_err(glue->dev, "can't get regulator\n");
+   return PTR_ERR(glue->reg);
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi_setup f

[PATCH 2/3] wlcore/wl12xx: spi: add device tree support

2015-12-23 Thread Uri Mashiach
Add DT support for the wl1271 SPI WiFi.

Add documentation file for the wl1271 SPI WiFi.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 .../bindings/net/wireless/ti,wlcore,spi.txt| 35 +++
 drivers/net/wireless/ti/wlcore/spi.c   | 67 +++---
 2 files changed, 95 insertions(+), 7 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
new file mode 100644
index 000..a3e7eb7
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt
@@ -0,0 +1,35 @@
+* Texas Instruments wl1271 wireless lan controller
+
+The wl1271 chip 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"
+- reg : Chip select address of device
+- spi-max-frequency :   Maximum SPI clocking speed of device in Hz
+- ref-clock-frequency : Reference clock frequency
+- interrupts :  Should contain interrupt line and trigger type
+- interrupt-parent :Should be the phandle for the interrupt controller
+that services interrupts for this device
+- vwlan-supply :Point the node of the regulator that controls the 
wl1271 chip WLAN_EN pin
+
+Optional properties:
+- clock-xtal :  boolean, clock is generated from XTAL
+
+- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt
+  for optional SPI connection related properties,
+
+Examples:
+
+ {
+   wl1271@1 {
+   compatible = "ti,wl1271";
+
+   reg = <1>;
+   spi-max-frequency = <4800>;
+   clock-xtal;
+   interrupt-parent = <>;
+   interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+   wifi-supply = <_fixed>;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index d3a4bcb..7281f5a 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "wlcore.h"
@@ -357,6 +358,54 @@ static struct wl1271_if_operations spi_ops = {
.set_block_size = NULL,
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_spi_of_match_table[] = {
+   { .compatible = "ti,wl1271" },
+   { }
+};
+
+/**
+ * wlcore_probe_of - DT node parsing.
+ * @spi: SPI slave device parameters.
+ * @res: resource parameters.
+ * @glue: wl12xx SPI bus to slave device glue parameters.
+ * @pdev_data: wlcore device parameters
+ */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   struct device_node *dt_node = spi->dev.of_node;
+   int ret;
+
+   ret = of_irq_to_resource(dt_node, 0, [0]);
+   if (spi->irq != ret) {
+   dev_err(glue->dev, "can't get interrupt resource\n");
+   return -EINVAL;
+   }
+
+   if (of_find_property(dt_node, "clock-xtal", NULL))
+   pdev_data->ref_clock_xtal = true;
+
+   ret = of_property_read_u32(dt_node, "ref-clock-frequency",
+  _data->ref_clock_freq);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get reference clock frequency (%d)\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+#else /* CONFIG_OF */
+static int wlcore_probe_of(struct spi_device *spi, struct resource *res,
+  struct wl12xx_spi_glue *glue,
+  struct wlcore_platdev_data *pdev_data)
+{
+   return -ENODATA;
+}
+#endif /* CONFIG_OF */
+
 static int wl1271_probe(struct spi_device *spi)
 {
struct wl12xx_spi_glue *glue;
@@ -365,8 +414,7 @@ static int wl1271_probe(struct spi_device *spi)
int ret;
 
memset(_data, 0x00, sizeof(pdev_data));
-
-   /* TODO: add DT parsing when needed */
+   memset(res, 0x00, sizeof(res));
 
pdev_data.if_ops = _ops;
 
@@ -390,6 +438,13 @@ static int wl1271_probe(struct spi_device *spi)
return PTR_ERR(glue->reg);
}
 
+   ret = wlcore_probe_of(spi, [0], glue, _data);
+   if (IS_ERR_VALUE(ret)) {
+   dev_err(glue->dev,
+   "can't get device tree parameters (%d)\n", ret);
+   return ret;
+   }
+
ret = spi_setup(spi);
if (ret < 0) {
dev_err(glue->dev, "spi

[PATCH 2/5] ARM: dts: cm-t335: add support for SBC-T335

2015-12-13 Thread Uri Mashiach
Add basic support for the SBC-T335.

CompuLab SBC-T335 is a single baseboard computer.
The SBC-T335 is based on the Texas Instruments Cortex-A8 Sitara AM3354
SoC.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 Documentation/devicetree/bindings/arm/omap/omap.txt |  3 +++
 arch/arm/boot/dts/Makefile  |  1 +
 arch/arm/boot/dts/am335x-sbc-t335.dts   | 16 
 3 files changed, 20 insertions(+)
 create mode 100644 arch/arm/boot/dts/am335x-sbc-t335.dts

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 2154f97..358e87e 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -141,6 +141,9 @@ Boards:
 - AM335X CM-T335 : System On Module, built around the Sitara AM3352/4
   compatible = "compulab,cm-t335", "ti,am33xx"
 
+- AM335X SBC-T335 : single board computer, built around the Sitara AM3352/4
+  compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx"
+
 - OMAP5 EVM : Evaluation Module
   compatible = "ti,omap5-evm", "ti,omap5"
 
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 15411bc..d82ea97 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -466,6 +466,7 @@ dtb-$(CONFIG_SOC_AM33XX) += \
am335x-lxm.dtb \
am335x-nano.dtb \
am335x-pepper.dtb \
+   am335x-sbc-t335.dtb \
am335x-sl50.dtb \
am335x-wega-rdk.dtb
 dtb-$(CONFIG_ARCH_OMAP4) += \
diff --git a/arch/arm/boot/dts/am335x-sbc-t335.dts 
b/arch/arm/boot/dts/am335x-sbc-t335.dts
new file mode 100644
index 000..9e98445
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-sbc-t335.dts
@@ -0,0 +1,16 @@
+/*
+ * am335x-sbc-t335.dts - Device Tree file for Compulab SBC-T335
+ *
+ * Copyright (C) 2014 - 2015 CompuLab Ltd. - http://www.compulab.co.il/
+ *
+ * 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.
+ */
+
+#include "am335x-cm-t335.dts"
+
+/ {
+   model = "CompuLab CM-T335 on SB-T335";
+   compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx";
+};
-- 
2.5.0

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


[PATCH 3/5] ARM: dts: cm-t335: add support for I2C GPIO expander

2015-12-13 Thread Uri Mashiach
The I2C GPIO expander (PCA9555) adds 16 GPIOs to the module.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-sbc-t335.dts | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-sbc-t335.dts 
b/arch/arm/boot/dts/am335x-sbc-t335.dts
index 9e98445..4a5177e 100644
--- a/arch/arm/boot/dts/am335x-sbc-t335.dts
+++ b/arch/arm/boot/dts/am335x-sbc-t335.dts
@@ -14,3 +14,14 @@
model = "CompuLab CM-T335 on SB-T335";
compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx";
 };
+
+ {
+   /* GPIO extender */
+   gpio_ext: pca9555@26 {
+   compatible = "nxp,pca9555";
+   pinctrl-names = "default";
+   gpio-controller;
+   #gpio-cells = <2>;
+   reg = <0x26>;
+   };
+};
-- 
2.5.0

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


[PATCH 1/5] ARM: dts: cm-t335: add support for USB0

2015-12-13 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Enable USB0.

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 31ff1aa..ae2366e 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -237,6 +237,26 @@
};
 };
 
+ {
+   status = "okay";
+};
+
+_ctrl_mod {
+   status = "okay";
+};
+
+_phy {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+  {
+   status = "okay";
+};
+
  {
status = "okay";
 
-- 
2.5.0

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


[PATCH 0/5] ARM: dts: cm-t335: add peripheral support

2015-12-13 Thread Uri Mashiach
Add support for the following CM-T335 module peripherals:
USB, I2C controller, LCD/DVI, bluetooth

Ilya Ledvich (1):
  ARM: dts: cm-t335: add support for USB0

Uri Mashiach (4):
  ARM: dts: cm-t335: add support for SBC-T335
  ARM: dts: cm-t335: add support for I2C GPIO expander
  ARM: dts: cm-t335: add support for DVI/LCD
  ARM: dts: cm-t335: add support for bluetooth

 .../devicetree/bindings/arm/omap/omap.txt  |   3 +
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/am335x-cm-t335.dts   |  51 -
 arch/arm/boot/dts/am335x-sbc-t335.dts  | 219 +
 4 files changed, 273 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/am335x-sbc-t335.dts

-- 
2.5.0

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


[PATCH 4/5] ARM: dts: cm-t335: add support for DVI/LCD

2015-12-13 Thread Uri Mashiach
Add pinmux configuration for DVI/LCD.
Add DRM display driver node with timing configurations for DVI and LCD.
Add I2C GPIOs configurations for DVI and LCD enable.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-sbc-t335.dts | 192 ++
 1 file changed, 192 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-sbc-t335.dts 
b/arch/arm/boot/dts/am335x-sbc-t335.dts
index 4a5177e..917d7cc 100644
--- a/arch/arm/boot/dts/am335x-sbc-t335.dts
+++ b/arch/arm/boot/dts/am335x-sbc-t335.dts
@@ -13,6 +13,181 @@
 / {
model = "CompuLab CM-T335 on SB-T335";
compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx";
+
+   /* DRM display driver */
+   panel {
+   compatible = "ti,tilcdc,panel";
+   status = "okay";
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_pins_default>;
+   pinctrl-1 = <_pins_sleep>;
+
+   panel-info {
+   ac-bias   = <255>;
+   ac-bias-intrpt= <0>;
+   dma-burst-sz  = <16>;
+   bpp   = <32>;
+   fdd   = <0x80>;
+   sync-edge = <0>;
+   sync-ctrl = <1>;
+   raster-order  = <0>;
+   fifo-th   = <0>;
+   };
+   display-timings {
+   /* Timing selection performed by U-Boot */
+   timing0: lcd {/* 800x480p62 */
+   clock-frequency = <3000>;
+   hactive = <800>;
+   vactive = <480>;
+   hfront-porch = <39>;
+   hback-porch = <39>;
+   hsync-len = <47>;
+   vback-porch = <29>;
+   vfront-porch = <13>;
+   vsync-len = <2>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   timing1: dvi { /* 1024x768p60 */
+   clock-frequency = <6500>;
+   hactive = <1024>;
+   hfront-porch = <24>;
+   hback-porch = <160>;
+   hsync-len = <136>;
+   vactive = <768>;
+   vfront-porch = <3>;
+   vback-porch = <29>;
+   vsync-len = <6>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   };
+   };
+   };
+};
+
+_pinmux {
+   /* Display */
+   lcd_pins_default: lcd_pins_default {
+   pinctrl-single,pins = <
+   /* gpmc_ad8.lcd_data23 */
+   AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad9.lcd_data22 */
+   AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad10.lcd_data21 */
+   AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad11.lcd_data20 */
+   AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad12.lcd_data19 */
+   AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad13.lcd_data18 */
+   AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad14.lcd_data17 */
+   AM33XX_IOPAD(0x838, PIN_OUTPUT | MUX_MODE1)
+   /* gpmc_ad15.lcd_data16 */
+   AM33XX_IOPAD(0x83c, PIN_OUTPUT | MUX_MODE1)
+   /* lcd_data0.lcd_data0 */
+   AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)
+   /* lcd_data1.lcd_data1 */
+   AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)
+   /* lcd_data2.lcd_data2 */
+   AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)
+   /* lcd_data3.lcd_data3 */
+   AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)
+   /* lcd_data4.lcd_data4 */
+   AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)
+   /* lcd_data5.lcd_data5 */
+

[PATCH 5/5] ARM: dts: cm-t335: add support for bluetooth

2015-12-13 Thread Uri Mashiach
bluetooth HW is WLS1271 chip connected to UART1.

Device tree modifications:
- Pinmux for UART1.
- Pinmux for bluetooth enable GPIO.

Bluetooth enable GPIO is set to enable during startup by setting the
relevant pinmux pin to pull-up.

Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index ae2366e..42e9b66 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -50,7 +50,7 @@
 
 _pinmux {
pinctrl-names = "default";
-   pinctrl-0 = <>;
+   pinctrl-0 = <_pins>;
 
i2c0_pins: pinmux_i2c0_pins {
pinctrl-single,pins = <
@@ -121,6 +121,19 @@
>;
};
 
+   uart1_pins: pinmux_uart1_pins {
+   pinctrl-single,pins = <
+   /* uart1_ctsn.uart1_ctsn */
+   AM33XX_IOPAD(0x978, PIN_INPUT | MUX_MODE0)
+   /* uart1_rtsn.uart1_rtsn */
+   AM33XX_IOPAD(0x97C, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+   /* uart1_rxd.uart1_rxd */
+   AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* uart1_txd.uart1_txd */
+   AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+   >;
+   };
+
ecap0_pins: pinmux_ecap0_pins {
pinctrl-single,pins = <
/* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
@@ -209,6 +222,14 @@
AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)
>;
};
+
+   /* wl1271 bluetooth */
+   bluetooth_pins: pinmux_bluetooth_pins {
+   pinctrl-single,pins = <
+   /* XDMA_EVENT_INTR0.gpio0_19 - bluetooth enable */
+   AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
+   >;
+   };
 };
 
  {
@@ -218,6 +239,14 @@
status = "okay";
 };
 
+/* WLS1271 bluetooth */
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
-- 
2.5.0

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


Re: [PATCH v2 1/6] ARM: OMAP2+: dts: cm-t335: add initial support

2015-12-02 Thread Uri Mashiach

Hi Tony,

On 11/30/2015 09:51 PM, Tony Lindgren wrote:

* Uri Mashiach <uri.mashi...@compulab.co.il> [151124 06:03]:

--- /dev/null
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts

...


+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+};
+


FYI, the extra line break at the end of the file causes whitespace
warnings when applying. And fixing that causes extra hassles with
applying the other patches in the series as the patches won't apply..
So for the next time, you may want to check that ;)


Yes, I will definitely do that.



Also, the subject line should be "ARM: dts: ..." for the dts changes
so the git log loooks unified for all the ARM SoCs.


Got it. Thanks!



Anyways, I've fixed up those locally and applying into omap-for-v4.5/dt.



Thank you Tony!

--
Regards,
Uri.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/6] ARM: OMAP2+: dts: cm-t335: add support for NAND flash

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for NAND specific GPMC pins.
Add description for GPMC controller. Add child node for NAND flash
including CM-T335 specific partition table to GPMC node.
Enable error-location module (ELM).

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 arch/arm/boot/dts/am335x-cm-t335.dts | 106 +++
 1 file changed, 106 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 02b6679..431b6dd 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -62,6 +62,41 @@
>;
};
 
+   nandflash_pins: pinmux_nandflash_pins {
+   pinctrl-single,pins = <
+   /* gpmc_ad0.gpmc_ad0 */
+   AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad1.gpmc_ad1 */
+   AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad2.gpmc_ad2 */
+   AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad3.gpmc_ad3 */
+   AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad4.gpmc_ad4 */
+   AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad5.gpmc_ad5 */
+   AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad6.gpmc_ad6 */
+   AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad7.gpmc_ad7 */
+   AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wait0.gpmc_wait0 */
+   AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wpn.gpio0_30 */
+   AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7)
+   /* gpmc_csn0.gpmc_csn0  */
+   AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_advn_ale.gpmc_advn_ale */
+   AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_oen_ren.gpmc_oen_ren */
+   AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_wen.gpmc_wen */
+   AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_ben0_cle.gpmc_ben0_cle */
+   AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
/* uart0_rxd.uart0_rxd */
@@ -98,3 +133,74 @@
};
 };
 
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ranges = <0 0 0x0800 0x1000>;   /* CS0: NAND */
+   nand@0,0 {
+   reg = <0 0 0>; /* CS0, offset 0 */
+   ti,nand-ecc-opt = "bch8";
+   ti,elm-id = <>;
+   nand-bus-width = <8>;
+   gpmc,device-width = <1>;
+   gpmc,sync-clk-ps = <0>;
+   gpmc,cs-on-ns = <0>;
+   gpmc,cs-rd-off-ns = <44>;
+   gpmc,cs-wr-off-ns = <44>;
+   gpmc,adv-on-ns = <6>;
+   gpmc,adv-rd-off-ns = <34>;
+   gpmc,adv-wr-off-ns = <44>;
+   gpmc,we-on-ns = <0>;
+   gpmc,we-off-ns = <40>;
+   gpmc,oe-on-ns = <0>;
+   gpmc,oe-off-ns = <54>;
+   gpmc,access-ns = <64>;
+   gpmc,rd-cycle-ns = <82>;
+   gpmc,wr-cycle-ns = <82>;
+   gpmc,wait-on-read = "true";
+   gpmc,wait-on-write = "true";
+   gpmc,bus-turnaround-ns = <0>;
+   gpmc,cycle2cycle-delay-ns = <0>;
+   gpmc,clk-activation-ns = <0>;
+   gpmc,wait-monitoring-ns = <0>;
+   gpmc,wr-access-ns = <40>;
+   gpmc,wr-data-mux-bus-ns = <0>;
+   /* MTD partition table */
+   #address-cells = <1>;
+   #size-cells = <1>;
+   partition@0 {
+   label = "spl";
+   reg = <0x 0x0020>;
+   };
+   partition@1 {
+   label = "uboot";
+   reg = <0x0020 0x0010>;
+   

[PATCH v2 1/6] ARM: OMAP2+: dts: cm-t335: add initial support

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

Current patch adds support:
UART0 and GPIO LED

Detailed description can be found at the module site:
http://www.compulab.co.il/products/computer-on-modules/cm-t335/

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
[uri.mashi...@compulab.co.il: the default RAM amount reduced to
128MB to support also the minimal module configuration]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 .../devicetree/bindings/arm/omap/omap.txt  |  3 ++
 arch/arm/boot/dts/Makefile |  7 +--
 arch/arm/boot/dts/am335x-cm-t335.dts   | 63 ++
 3 files changed, 70 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 9f4e513..2154f97 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -138,6 +138,9 @@ Boards:
 - AM335X phyBOARD-WEGA: Single Board Computer dev kit
   compatible = "phytec,am335x-wega", "phytec,am335x-phycore-som", "ti,am33xx"
 
+- AM335X CM-T335 : System On Module, built around the Sitara AM3352/4
+  compatible = "compulab,cm-t335", "ti,am33xx"
+
 - OMAP5 EVM : Evaluation Module
   compatible = "ti,omap5-evm", "ti,omap5"
 
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index bb8fa02..0e011dc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -446,13 +446,14 @@ dtb-$(CONFIG_SOC_AM33XX) += \
am335x-base0033.dtb \
am335x-bone.dtb \
am335x-boneblack.dtb \
-   am335x-sl50.dtb \
+   am335x-chiliboard.dtb \
+   am335x-cm-t335.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
+   am335x-lxm.dtb \
am335x-nano.dtb \
am335x-pepper.dtb \
-   am335x-lxm.dtb \
-   am335x-chiliboard.dtb \
+   am335x-sl50.dtb \
am335x-wega-rdk.dtb
 dtb-$(CONFIG_ARCH_OMAP4) += \
omap4-duovero-parlor.dtb \
diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
new file mode 100644
index 000..719658e
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -0,0 +1,63 @@
+/*
+ * am335x-cm-t335.dts - Device Tree file for Compulab CM-T335
+ *
+ * Copyright (C) 2014 - 2015 CompuLab Ltd. - http://www.compulab.co.il/
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+#include "am33xx.dtsi"
+
+/ {
+   model = "CompuLab CM-T335";
+   compatible = "compulab,cm-t335", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x800>;   /* 128 MB */
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_led_pins>;
+   led@0 {
+   label = "cm_t335:green";
+   gpios = < 0 GPIO_ACTIVE_LOW>; /* gpio2_0 */
+   linux,default-trigger = "heartbeat";
+   };
+   };
+};
+
+_pinmux {
+   pinctrl-names = "default";
+   pinctrl-0 = <>;
+
+   gpio_led_pins: pinmux_gpio_led_pins {
+   pinctrl-single,pins = <
+   /* gpmc_csn3.gpio2_0 */
+   AM33XX_IOPAD(0x888, PIN_OUTPUT | MUX_MODE7)
+   >;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = <
+   /* uart0_rxd.uart0_rxd */
+   AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* uart0_txd.uart0_txd */
+   AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+   >;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+};
+
-- 
2.5.0

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


[PATCH v2 0/6] ARM: OMAP2+: dts: cm-t335: initial support

2015-11-24 Thread Uri Mashiach
Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

[v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions ]
Ilya Ledvich (6):
  ARM: OMAP2+: dts: cm-t335: add initial support
  ARM: OMAP2+: dts: cm-t335: add basic support for I2C
  ARM: OMAP2+: dts: cm-t335: add support for NAND flash
  ARM: OMAP2+: dts: cm-t335: add support for MMC
  ARM: OMAP2+: dts: cm-t335: add support for network device
  ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

 .../devicetree/bindings/arm/omap/omap.txt  |   3 +
 arch/arm/boot/dts/Makefile |   7 +-
 arch/arm/boot/dts/am335x-cm-t335.dts   | 348 +
 3 files changed, 355 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts

-- 
2.5.0

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


[PATCH v2 2/6] ARM: OMAP2+: dts: cm-t335: add basic support for I2C

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for I2C0 and I2C1 pins.
Add description for I2C0 bus, set clock frequency to 400kHz.
Add child nodes for 24c02 EEPROM and em3027 RTC on I2C0 bus.

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 arch/arm/boot/dts/am335x-cm-t335.dts | 37 
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 719658e..02b6679 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -37,6 +37,24 @@
pinctrl-names = "default";
pinctrl-0 = <>;
 
+   i2c0_pins: pinmux_i2c0_pins {
+   pinctrl-single,pins = <
+   /* i2c0_sda.i2c0_sda */
+   AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* i2c0_scl.i2c0_scl */
+   AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   i2c1_pins: pinmux_i2c1_pins {
+   pinctrl-single,pins = <
+   /* uart0_ctsn.i2c1_sda */
+   AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE2)
+   /* uart0_rtsn.i2c1_scl */
+   AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE2)
+   >;
+   };
+
gpio_led_pins: pinmux_gpio_led_pins {
pinctrl-single,pins = <
/* gpmc_csn3.gpio2_0 */
@@ -61,3 +79,22 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+   clock-frequency = <40>;
+   /* CM-T335 board EEPROM */
+   eeprom: 24c02@50 {
+   compatible = "atmel,24c02";
+   reg = <0x50>;
+   pagesize = <16>;
+   };
+   /* Real Time Clock */
+   ext_rtc: em3027@56 {
+   compatible = "emmicro,em3027";
+   reg = <0x56>;
+   };
+};
+
-- 
2.5.0

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


[PATCH v2 6/6] ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for ECAP0 pin.
Add node for PWM backlight device.
Use PWM output from ecap0 as backlight source.

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 arch/arm/boot/dts/am335x-cm-t335.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 9be0bfe..4939d82 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -39,6 +39,13 @@
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
};
+
+   backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 0>;
+   brightness-levels = <0 51 53 56 62 75 101 152 255>;
+   default-brightness-level = <8>;
+   };
 };
 
 _pinmux {
@@ -114,6 +121,13 @@
>;
};
 
+   ecap0_pins: pinmux_ecap0_pins {
+   pinctrl-single,pins = <
+   /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
+   AM33XX_IOPAD(0x964, 0x0)
+   >;
+   };
+
cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
@@ -223,6 +237,16 @@
};
 };
 
+ {
+   status = "okay";
+
+   ecap0: ecap@48300100 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   };
+};
+
  {
status = "okay";
pinctrl-names = "default";
-- 
2.5.0

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


[PATCH v2 4/6] ARM: OMAP2+: dts: cm-t335: add support for MMC

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for MMC0 pins.
Add fixed regulator 'vmmc_fixed'.
Enable MMC0 in 4-bit mode.

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 arch/arm/boot/dts/am335x-cm-t335.dts | 33 +
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 431b6dd..0a20256 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -31,6 +31,14 @@
linux,default-trigger = "heartbeat";
};
};
+
+   /* regulator for mmc */
+   vmmc_fixed: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "vmmc_fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
 };
 
 _pinmux {
@@ -105,6 +113,23 @@
AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
>;
};
+
+   mmc1_pins: pinmux_mmc1_pins {
+   pinctrl-single,pins = <
+   /* mmc0_dat3.mmc0_dat3 */
+   AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat2.mmc0_dat2 */
+   AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat1.mmc0_dat1 */
+   AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat0.mmc0_dat0 */
+   AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_clk.mmc0_clk */
+   AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_cmd.mmc0_cmd */
+   AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
 };
 
  {
@@ -204,3 +229,11 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+   vmmc-supply = <_fixed>;
+   bus-width = <4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+};
+
-- 
2.5.0

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


[PATCH v2 5/6] ARM: OMAP2+: dts: cm-t335: add support for network device

2015-11-24 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configurations for RGMII1 based CPSW Ethernet pins and
MDIO pins:
 - default configuration required for module in active state,
 - sleep configuration required for module in inactive state.
Add mac node with single slave device. Add nodes for davinci_mdio and
cpsw_emac0.

Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
Acked-by: Igor Grinberg <grinb...@compulab.co.il>
---
v1 -> v2: integrate AM33XX_IOPAD macro in pinmux definitions

 arch/arm/boot/dts/am335x-cm-t335.dts | 85 
 1 file changed, 85 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 0a20256..9be0bfe 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -114,6 +114,71 @@
>;
};
 
+   cpsw_default: cpsw_default {
+   pinctrl-single,pins = <
+   /* Slave 1 */
+   /* mii1_tx_en.rgmii1_tctl */
+   AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxdv.rgmii1_rctl */
+   AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd3.rgmii1_td3 */
+   AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd2.rgmii1_td2 */
+   AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd1.rgmii1_td1 */
+   AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd0.rgmii1_td0 */
+   AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txclk.rgmii1_tclk */
+   AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxclk.rgmii1_rclk */
+   AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd3.rgmii1_rd3 */
+   AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd2.rgmii1_rd2 */
+   AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd1.rgmii1_rd1 */
+   AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd0.rgmii1_rd0 */
+   AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)
+   >;
+   };
+
+   cpsw_sleep: cpsw_sleep {
+   pinctrl-single,pins = <
+   /* Slave 1 reset value */
+   AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
+   davinci_mdio_default: davinci_mdio_default {
+   pinctrl-single,pins = <
+   /* mdio_data.mdio_data */
+   AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | 
MUX_MODE0)
+   /* mdio_clk.mdio_clk */
+   AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   davinci_mdio_sleep: davinci_mdio_sleep {
+   pinctrl-single,pins = <
+   /* MDIO reset value */
+   AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
/* mmc0_dat3.mmc0_dat3 */
@@ -229,6 +294,26 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_default>;
+   pinctrl-1 = <_sleep>;
+   slaves = <1>;
+   status = "okay";
+};
+
+_mdio {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_mdio_default>;
+   pinctrl-1 = <_mdio_s

Re: [PATCH 2/6] ARM: OMAP2+: dts: cm-t335: add basic support for I2C

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for I2C0 and I2C1 pins.
Add description for I2C0 bus, set clock frequency to 400kHz.
Add child nodes for 24c02 EEPROM and em3027 RTC on I2C0 bus.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  arch/arm/boot/dts/am335x-cm-t335.dts | 37 
  1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 197d5ce..39df3d2 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -37,6 +37,24 @@
pinctrl-names = "default";
pinctrl-0 = <>;

+   i2c0_pins: pinmux_i2c0_pins {
+   pinctrl-single,pins = <
+   /* i2c0_sda.i2c0_sda */
+   0x188 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* i2c0_scl.i2c0_scl */
+   0x18c (PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   i2c1_pins: pinmux_i2c1_pins {
+   pinctrl-single,pins = <
+   /* uart0_ctsn.i2c1_sda */
+   0x168 (PIN_INPUT_PULLUP | MUX_MODE2)
+   /* uart0_rtsn.i2c1_scl */
+   0x16c (PIN_INPUT_PULLUP | MUX_MODE2)
+   >;
+   };
+
gpio_led_pins: pinmux_gpio_led_pins {
pinctrl-single,pins = <
0x88 (PIN_OUTPUT | MUX_MODE7)   /* gpmc_csn3.gpio2_0 */
@@ -60,3 +78,22 @@
status = "okay";
  };

+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+   clock-frequency = <40>;
+
+   eeprom: 24c02@50 {
+   compatible = "atmel,24c02";
+   reg = <0x50>;
+   pagesize = <16>;
+   };
+
+   ext_rtc: em3027@56 {
+   compatible = "emmicro,em3027";
+   reg = <0x56>;
+   };
+};
+


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


Re: [PATCH 5/6] ARM: OMAP2+: dts: cm-t335: add support for network device

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configurations for RGMII1 based CPSW Ethernet pins and
MDIO pins:
  - default configuration required for module in active state,
  - sleep configuration required for module in inactive state.
Add mac node with single slave device. Add nodes for davinci_mdio and
cpsw_emac0.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  arch/arm/boot/dts/am335x-cm-t335.dts | 85 
  1 file changed, 85 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 976c330..0296d3f 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -113,6 +113,71 @@
>;
};

+   cpsw_default: cpsw_default {
+   pinctrl-single,pins = <
+   /* Slave 1 */
+   /* mii1_txen.rgmii1_tctl */
+   0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxdv.rgmii1_rctl */
+   0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd3.rgmii1_td3 */
+   0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd2.rgmii1_td2 */
+   0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd1.rgmii1_td1 */
+   0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd0.rgmii1_td0 */
+   0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txclk.rgmii1_tclk */
+   0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxclk.rgmii1_rclk */
+   0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd3.rgmii1_rd3 */
+   0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd2.rgmii1_rd2 */
+   0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd1.rgmii1_rd1 */
+   0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd0.rgmii1_rd0 */
+   0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   >;
+   };
+
+   cpsw_sleep: cpsw_sleep {
+   pinctrl-single,pins = <
+   /* Slave 1 reset value */
+   0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
+   davinci_mdio_default: davinci_mdio_default {
+   pinctrl-single,pins = <
+   /* mdio_data.mdio_data */
+   0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
+   /* mdio_clk.mdio_clk */
+   0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   davinci_mdio_sleep: davinci_mdio_sleep {
+   pinctrl-single,pins = <
+   /* MDIO reset value */
+   0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
/* mmc0_dat3.mmc0_dat3 */
@@ -228,6 +293,26 @@
status = "okay";
  };

+ {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_default>;
+   pinctrl-1 = <_sleep>;
+   slaves = <1>;
+   status = "okay";
+};
+
+_mdio {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_mdio_default>;
+   pinctrl-1 = <_mdio_sleep>;
+   status = "okay";
+};
+
+_emac0 {
+   phy_id = <_mdio>, <0>;
+   phy-mode = "rgmii-txid";
+};
+
   {
status = "okay";
vmmc-supply = <_fixed>;


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


Re: [PATCH 6/6] ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:15, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for ECAP0 pin.
Add node for PWM backlight device.
Use PWM output from ecap0 as backlight source.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  arch/arm/boot/dts/am335x-cm-t335.dts | 24 
  1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 0296d3f..571a453 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -39,6 +39,13 @@
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
};
+
+   backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 0>;
+   brightness-levels = <0 51 53 56 62 75 101 152 255>;
+   default-brightness-level = <8>;
+   };
  };

  _pinmux {
@@ -113,6 +120,13 @@
>;
};

+   ecap0_pins: pinmux_ecap0_pins {
+   pinctrl-single,pins = <
+   /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
+   0x164 0x0
+   >;
+   };
+
cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
@@ -222,6 +236,16 @@
};
  };

+ {
+   status = "okay";
+
+   ecap0: ecap@48300100 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   };
+};
+
   {
status = "okay";
pinctrl-names = "default";


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


Re: [PATCH 0/6] ARM: OMAP2+: dts: cm-t335: initial support

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

Ilya Ledvich (6):
   ARM: OMAP2+: dts: cm-t335: add initial support
   ARM: OMAP2+: dts: cm-t335: add basic support for I2C
   ARM: OMAP2+: dts: cm-t335: add support for NAND flash
   ARM: OMAP2+: dts: cm-t335: add support for MMC
   ARM: OMAP2+: dts: cm-t335: add support for network device
   ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

  .../devicetree/bindings/arm/omap/omap.txt  |   3 +
  arch/arm/boot/dts/Makefile |   7 +-
  arch/arm/boot/dts/am335x-cm-t335.dts   | 347 +
  3 files changed, 354 insertions(+), 3 deletions(-)
  create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts


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


Re: [PATCH 1/6] ARM: OMAP2+: dts: cm-t335: add initial support

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

Current patch adds support:
UART0 and GPIO LED

Detailed description can be found at the module site:
http://www.compulab.co.il/products/computer-on-modules/cm-t335/

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
[uri.mashi...@compulab.co.il: the default RAM amount reduced to
128MB to support also the minimal module configuration]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  .../devicetree/bindings/arm/omap/omap.txt  |  3 ++
  arch/arm/boot/dts/Makefile |  7 +--
  arch/arm/boot/dts/am335x-cm-t335.dts   | 62 ++
  3 files changed, 69 insertions(+), 3 deletions(-)
  create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 9f4e513..2154f97 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -138,6 +138,9 @@ Boards:
  - AM335X phyBOARD-WEGA: Single Board Computer dev kit
compatible = "phytec,am335x-wega", "phytec,am335x-phycore-som", "ti,am33xx"

+- AM335X CM-T335 : System On Module, built around the Sitara AM3352/4
+  compatible = "compulab,cm-t335", "ti,am33xx"
+
  - OMAP5 EVM : Evaluation Module
compatible = "ti,omap5-evm", "ti,omap5"

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index bb8fa02..0e011dc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -446,13 +446,14 @@ dtb-$(CONFIG_SOC_AM33XX) += \
am335x-base0033.dtb \
am335x-bone.dtb \
am335x-boneblack.dtb \
-   am335x-sl50.dtb \
+   am335x-chiliboard.dtb \
+   am335x-cm-t335.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
+   am335x-lxm.dtb \
am335x-nano.dtb \
am335x-pepper.dtb \
-   am335x-lxm.dtb \
-   am335x-chiliboard.dtb \
+   am335x-sl50.dtb \
am335x-wega-rdk.dtb
  dtb-$(CONFIG_ARCH_OMAP4) += \
omap4-duovero-parlor.dtb \
diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
new file mode 100644
index 000..197d5ce
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -0,0 +1,62 @@
+/*
+ * am335x-cm-t335.dts - Device Tree file for Compulab CM-T335
+ *
+ * Copyright (C) 2014 - 2015 CompuLab Ltd. - http://www.compulab.co.il/
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+#include "am33xx.dtsi"
+
+/ {
+   model = "CompuLab CM-T335";
+   compatible = "compulab,cm-t335", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x800>; /* 128 MB */
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_led_pins>;
+   led@0 {
+   label = "cm_t335:green";
+   gpios = < 0 GPIO_ACTIVE_LOW>;   /* gpio2_0 */
+   linux,default-trigger = "heartbeat";
+   };
+   };
+};
+
+_pinmux {
+   pinctrl-names = "default";
+   pinctrl-0 = <>;
+
+   gpio_led_pins: pinmux_gpio_led_pins {
+   pinctrl-single,pins = <
+   0x88 (PIN_OUTPUT | MUX_MODE7)   /* gpmc_csn3.gpio2_0 */
+   >;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = <
+   /* uart0_rxd.uart0_rxd */
+   0x170 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* uart0_txd.uart0_txd */
+   0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+   >;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+};
+


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


Re: [PATCH 3/6] ARM: OMAP2+: dts: cm-t335: add support for NAND flash

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for NAND specific GPMC pins.
Add description for GPMC controller. Add child node for NAND flash
including CM-T335 specific partition table to GPMC node.
Enable error-location module (ELM).

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  arch/arm/boot/dts/am335x-cm-t335.dts | 106 +++
  1 file changed, 106 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 39df3d2..9d6117a 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -61,6 +61,41 @@
>;
};

+   nandflash_pins: pinmux_nandflash_pins {
+   pinctrl-single,pins = <
+   /* gpmc_ad0.gpmc_ad0 */
+   0x0 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad1.gpmc_ad1 */
+   0x4 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad2.gpmc_ad2 */
+   0x8 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad3.gpmc_ad3 */
+   0xc (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad4.gpmc_ad4 */
+   0x10 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad5.gpmc_ad5 */
+   0x14 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad6.gpmc_ad6 */
+   0x18 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad7.gpmc_ad7 */
+   0x1c (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wait0.gpmc_wait0 */
+   0x70 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wpn.gpio0_30 */
+   0x74 (PIN_INPUT_PULLUP | MUX_MODE7)
+   /* gpmc_csn0.gpmc_csn0  */
+   0x7c (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_advn_ale.gpmc_advn_ale */
+   0x90 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_oen_ren.gpmc_oen_ren */
+   0x94 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_wen.gpmc_wen */
+   0x98 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_be0n_cle.gpmc_be0n_cle */
+   0x9c (PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
/* uart0_rxd.uart0_rxd */
@@ -97,3 +132,74 @@
};
  };

+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ranges = <0 0 0x0800 0x1000>; /* CS0: NAND */
+   nand@0,0 {
+   reg = <0 0 0>; /* CS0, offset 0 */
+   ti,nand-ecc-opt = "bch8";
+   ti,elm-id = <>;
+   nand-bus-width = <8>;
+   gpmc,device-width = <1>;
+   gpmc,sync-clk-ps = <0>;
+   gpmc,cs-on-ns = <0>;
+   gpmc,cs-rd-off-ns = <44>;
+   gpmc,cs-wr-off-ns = <44>;
+   gpmc,adv-on-ns = <6>;
+   gpmc,adv-rd-off-ns = <34>;
+   gpmc,adv-wr-off-ns = <44>;
+   gpmc,we-on-ns = <0>;
+   gpmc,we-off-ns = <40>;
+   gpmc,oe-on-ns = <0>;
+   gpmc,oe-off-ns = <54>;
+   gpmc,access-ns = <64>;
+   gpmc,rd-cycle-ns = <82>;
+   gpmc,wr-cycle-ns = <82>;
+   gpmc,wait-on-read = "true";
+   gpmc,wait-on-write = "true";
+   gpmc,bus-turnaround-ns = <0>;
+   gpmc,cycle2cycle-delay-ns = <0>;
+   gpmc,clk-activation-ns = <0>;
+   gpmc,wait-monitoring-ns = <0>;
+   gpmc,wr-access-ns = <40>;
+   gpmc,wr-data-mux-bus-ns = <0>;
+   /* MTD partition table */
+   #address-cells = <1>;
+   #size-cells = <1>;
+   partition@0 {
+   label = "spl";
+   reg = <0x 0x0020>;
+   };
+   partition@1 {
+   label = "uboot";
+   reg = <0x0020 0x0010>;
+   };
+   partition@2 {
+   label = "uboot environment";
+   reg = <0x0030 0x0010>;
+   };
+   partition@3 {
+   l

Re: [PATCH 4/6] ARM: OMAP2+: dts: cm-t335: add support for MMC

2015-11-11 Thread Uri Mashiach

Gentle ping

On 27/10/15 14:14, Uri Mashiach wrote:

From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for MMC0 pins.
Add fixed regulator 'vmmc_fixed'.
Enable MMC0 in 4-bit mode.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
  arch/arm/boot/dts/am335x-cm-t335.dts | 33 +
  1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 9d6117a..976c330 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -31,6 +31,14 @@
linux,default-trigger = "heartbeat";
};
};
+
+   /* regulator for mmc */
+   vmmc_fixed: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "vmmc_fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
  };

  _pinmux {
@@ -104,6 +112,23 @@
0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
>;
};
+
+   mmc1_pins: pinmux_mmc1_pins {
+   pinctrl-single,pins = <
+   /* mmc0_dat3.mmc0_dat3 */
+   0xf0 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat2.mmc0_dat2 */
+   0xf4 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat1.mmc0_dat1 */
+   0xf8 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat0.mmc0_dat0 */
+   0xfc (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_clk.mmc0_clk */
+   0x100 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_cmd.mmc0_cmd */
+   0x104 (PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
  };

   {
@@ -203,3 +228,11 @@
status = "okay";
  };

+ {
+   status = "okay";
+   vmmc-supply = <_fixed>;
+   bus-width = <4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+};
+


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


[PATCH 5/6] ARM: OMAP2+: dts: cm-t335: add support for network device

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configurations for RGMII1 based CPSW Ethernet pins and
MDIO pins:
 - default configuration required for module in active state,
 - sleep configuration required for module in inactive state.
Add mac node with single slave device. Add nodes for davinci_mdio and
cpsw_emac0.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 85 
 1 file changed, 85 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 976c330..0296d3f 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -113,6 +113,71 @@
>;
};
 
+   cpsw_default: cpsw_default {
+   pinctrl-single,pins = <
+   /* Slave 1 */
+   /* mii1_txen.rgmii1_tctl */
+   0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxdv.rgmii1_rctl */
+   0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd3.rgmii1_td3 */
+   0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd2.rgmii1_td2 */
+   0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd1.rgmii1_td1 */
+   0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txd0.rgmii1_td0 */
+   0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_txclk.rgmii1_tclk */
+   0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxclk.rgmii1_rclk */
+   0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd3.rgmii1_rd3 */
+   0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd2.rgmii1_rd2 */
+   0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd1.rgmii1_rd1 */
+   0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   /* mii1_rxd0.rgmii1_rd0 */
+   0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2)
+   >;
+   };
+
+   cpsw_sleep: cpsw_sleep {
+   pinctrl-single,pins = <
+   /* Slave 1 reset value */
+   0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
+   davinci_mdio_default: davinci_mdio_default {
+   pinctrl-single,pins = <
+   /* mdio_data.mdio_data */
+   0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
+   /* mdio_clk.mdio_clk */
+   0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   davinci_mdio_sleep: davinci_mdio_sleep {
+   pinctrl-single,pins = <
+   /* MDIO reset value */
+   0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+   >;
+   };
+
mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
/* mmc0_dat3.mmc0_dat3 */
@@ -228,6 +293,26 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_default>;
+   pinctrl-1 = <_sleep>;
+   slaves = <1>;
+   status = "okay";
+};
+
+_mdio {
+   pinctrl-names = "default", "sleep";
+   pinctrl-0 = <_mdio_default>;
+   pinctrl-1 = <_mdio_sleep>;
+   status = "okay";
+};
+
+_emac0 {
+   phy_id = <_mdio>, <0>;
+   phy-mode = "rgmii-txid";
+};
+
  {
status = "okay";
vmmc-supply = <_fixed>;
-- 
2.6.0

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


[PATCH 4/6] ARM: OMAP2+: dts: cm-t335: add support for MMC

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for MMC0 pins.
Add fixed regulator 'vmmc_fixed'.
Enable MMC0 in 4-bit mode.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 33 +
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 9d6117a..976c330 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -31,6 +31,14 @@
linux,default-trigger = "heartbeat";
};
};
+
+   /* regulator for mmc */
+   vmmc_fixed: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "vmmc_fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
 };
 
 _pinmux {
@@ -104,6 +112,23 @@
0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
>;
};
+
+   mmc1_pins: pinmux_mmc1_pins {
+   pinctrl-single,pins = <
+   /* mmc0_dat3.mmc0_dat3 */
+   0xf0 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat2.mmc0_dat2 */
+   0xf4 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat1.mmc0_dat1 */
+   0xf8 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_dat0.mmc0_dat0 */
+   0xfc (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_clk.mmc0_clk */
+   0x100 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* mmc0_cmd.mmc0_cmd */
+   0x104 (PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
 };
 
  {
@@ -203,3 +228,11 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+   vmmc-supply = <_fixed>;
+   bus-width = <4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+};
+
-- 
2.6.0

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


[PATCH 6/6] ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for ECAP0 pin.
Add node for PWM backlight device.
Use PWM output from ecap0 as backlight source.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 0296d3f..571a453 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -39,6 +39,13 @@
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
};
+
+   backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 0>;
+   brightness-levels = <0 51 53 56 62 75 101 152 255>;
+   default-brightness-level = <8>;
+   };
 };
 
 _pinmux {
@@ -113,6 +120,13 @@
>;
};
 
+   ecap0_pins: pinmux_ecap0_pins {
+   pinctrl-single,pins = <
+   /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
+   0x164 0x0
+   >;
+   };
+
cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
@@ -222,6 +236,16 @@
};
 };
 
+ {
+   status = "okay";
+
+   ecap0: ecap@48300100 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   };
+};
+
  {
status = "okay";
pinctrl-names = "default";
-- 
2.6.0

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


[PATCH 0/6] ARM: OMAP2+: dts: cm-t335: initial support

2015-10-27 Thread Uri Mashiach
Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

Ilya Ledvich (6):
  ARM: OMAP2+: dts: cm-t335: add initial support
  ARM: OMAP2+: dts: cm-t335: add basic support for I2C
  ARM: OMAP2+: dts: cm-t335: add support for NAND flash
  ARM: OMAP2+: dts: cm-t335: add support for MMC
  ARM: OMAP2+: dts: cm-t335: add support for network device
  ARM: OMAP2+: dts: cm-t335: add support for PWM backlight

 .../devicetree/bindings/arm/omap/omap.txt  |   3 +
 arch/arm/boot/dts/Makefile |   7 +-
 arch/arm/boot/dts/am335x-cm-t335.dts   | 347 +
 3 files changed, 354 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts

-- 
2.6.0

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


[PATCH 2/6] ARM: OMAP2+: dts: cm-t335: add basic support for I2C

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for I2C0 and I2C1 pins.
Add description for I2C0 bus, set clock frequency to 400kHz.
Add child nodes for 24c02 EEPROM and em3027 RTC on I2C0 bus.

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 37 
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 197d5ce..39df3d2 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -37,6 +37,24 @@
pinctrl-names = "default";
pinctrl-0 = <>;
 
+   i2c0_pins: pinmux_i2c0_pins {
+   pinctrl-single,pins = <
+   /* i2c0_sda.i2c0_sda */
+   0x188 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* i2c0_scl.i2c0_scl */
+   0x18c (PIN_INPUT_PULLUP | MUX_MODE0)
+   >;
+   };
+
+   i2c1_pins: pinmux_i2c1_pins {
+   pinctrl-single,pins = <
+   /* uart0_ctsn.i2c1_sda */
+   0x168 (PIN_INPUT_PULLUP | MUX_MODE2)
+   /* uart0_rtsn.i2c1_scl */
+   0x16c (PIN_INPUT_PULLUP | MUX_MODE2)
+   >;
+   };
+
gpio_led_pins: pinmux_gpio_led_pins {
pinctrl-single,pins = <
0x88 (PIN_OUTPUT | MUX_MODE7)   /* gpmc_csn3.gpio2_0 */
@@ -60,3 +78,22 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+   clock-frequency = <40>;
+
+   eeprom: 24c02@50 {
+   compatible = "atmel,24c02";
+   reg = <0x50>;
+   pagesize = <16>;
+   };
+
+   ext_rtc: em3027@56 {
+   compatible = "emmicro,em3027";
+   reg = <0x56>;
+   };
+};
+
-- 
2.6.0

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


[PATCH 3/6] ARM: OMAP2+: dts: cm-t335: add support for NAND flash

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add pinmux configuration for NAND specific GPMC pins.
Add description for GPMC controller. Add child node for NAND flash
including CM-T335 specific partition table to GPMC node.
Enable error-location module (ELM).

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 arch/arm/boot/dts/am335x-cm-t335.dts | 106 +++
 1 file changed, 106 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
index 39df3d2..9d6117a 100644
--- a/arch/arm/boot/dts/am335x-cm-t335.dts
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -61,6 +61,41 @@
>;
};
 
+   nandflash_pins: pinmux_nandflash_pins {
+   pinctrl-single,pins = <
+   /* gpmc_ad0.gpmc_ad0 */
+   0x0 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad1.gpmc_ad1 */
+   0x4 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad2.gpmc_ad2 */
+   0x8 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad3.gpmc_ad3 */
+   0xc (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad4.gpmc_ad4 */
+   0x10 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad5.gpmc_ad5 */
+   0x14 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad6.gpmc_ad6 */
+   0x18 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_ad7.gpmc_ad7 */
+   0x1c (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wait0.gpmc_wait0 */
+   0x70 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* gpmc_wpn.gpio0_30 */
+   0x74 (PIN_INPUT_PULLUP | MUX_MODE7)
+   /* gpmc_csn0.gpmc_csn0  */
+   0x7c (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_advn_ale.gpmc_advn_ale */
+   0x90 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_oen_ren.gpmc_oen_ren */
+   0x94 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_wen.gpmc_wen */
+   0x98 (PIN_OUTPUT | MUX_MODE0)
+   /* gpmc_be0n_cle.gpmc_be0n_cle */
+   0x9c (PIN_OUTPUT | MUX_MODE0)
+   >;
+   };
+
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
/* uart0_rxd.uart0_rxd */
@@ -97,3 +132,74 @@
};
 };
 
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   ranges = <0 0 0x0800 0x1000>;   /* CS0: NAND */
+   nand@0,0 {
+   reg = <0 0 0>; /* CS0, offset 0 */
+   ti,nand-ecc-opt = "bch8";
+   ti,elm-id = <>;
+   nand-bus-width = <8>;
+   gpmc,device-width = <1>;
+   gpmc,sync-clk-ps = <0>;
+   gpmc,cs-on-ns = <0>;
+   gpmc,cs-rd-off-ns = <44>;
+   gpmc,cs-wr-off-ns = <44>;
+   gpmc,adv-on-ns = <6>;
+   gpmc,adv-rd-off-ns = <34>;
+   gpmc,adv-wr-off-ns = <44>;
+   gpmc,we-on-ns = <0>;
+   gpmc,we-off-ns = <40>;
+   gpmc,oe-on-ns = <0>;
+   gpmc,oe-off-ns = <54>;
+   gpmc,access-ns = <64>;
+   gpmc,rd-cycle-ns = <82>;
+   gpmc,wr-cycle-ns = <82>;
+   gpmc,wait-on-read = "true";
+   gpmc,wait-on-write = "true";
+   gpmc,bus-turnaround-ns = <0>;
+   gpmc,cycle2cycle-delay-ns = <0>;
+   gpmc,clk-activation-ns = <0>;
+   gpmc,wait-monitoring-ns = <0>;
+   gpmc,wr-access-ns = <40>;
+   gpmc,wr-data-mux-bus-ns = <0>;
+   /* MTD partition table */
+   #address-cells = <1>;
+   #size-cells = <1>;
+   partition@0 {
+   label = "spl";
+   reg = <0x 0x0020>;
+   };
+   partition@1 {
+   label = "uboot";
+   reg = <0x0020 0x0010>;
+   };
+   partition@2 {
+   label = "uboot environment";
+   reg = <0x0030 0x0010>;
+   };
+   partition@3 {
+   label = "dtb";
+   reg = &

[PATCH 1/6] ARM: OMAP2+: dts: cm-t335: add initial support

2015-10-27 Thread Uri Mashiach
From: Ilya Ledvich <i...@compulab.co.il>

Add basic support for CompuLab cm-t335 module based on AM335X SoC.

CM-T335 is a tiny computer-on-module (CoM) / system-on-module (SoM)
The module is built around the Texas Instruments Sitara AM3352/4
system-on-chip.

The CPU is supplemented with up-to 512MB DDR3 and up-to 1GB of on-board
NAND storage, WiFi connected to SPI, Bluetooth, Analog audio, Gigabit
Ethernet, CAN bus.

Current patch adds support:
UART0 and GPIO LED

Detailed description can be found at the module site:
http://www.compulab.co.il/products/computer-on-modules/cm-t335/

Acked-by: Igor Grinberg <grinb...@compulab.co.il>
Signed-off-by: Ilya Ledvich <i...@compulab.co.il>
[uri.mashi...@compulab.co.il: the default RAM amount reduced to
128MB to support also the minimal module configuration]
Signed-off-by: Uri Mashiach <uri.mashi...@compulab.co.il>
---
 .../devicetree/bindings/arm/omap/omap.txt  |  3 ++
 arch/arm/boot/dts/Makefile |  7 +--
 arch/arm/boot/dts/am335x-cm-t335.dts   | 62 ++
 3 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/am335x-cm-t335.dts

diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt 
b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 9f4e513..2154f97 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -138,6 +138,9 @@ Boards:
 - AM335X phyBOARD-WEGA: Single Board Computer dev kit
   compatible = "phytec,am335x-wega", "phytec,am335x-phycore-som", "ti,am33xx"
 
+- AM335X CM-T335 : System On Module, built around the Sitara AM3352/4
+  compatible = "compulab,cm-t335", "ti,am33xx"
+
 - OMAP5 EVM : Evaluation Module
   compatible = "ti,omap5-evm", "ti,omap5"
 
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index bb8fa02..0e011dc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -446,13 +446,14 @@ dtb-$(CONFIG_SOC_AM33XX) += \
am335x-base0033.dtb \
am335x-bone.dtb \
am335x-boneblack.dtb \
-   am335x-sl50.dtb \
+   am335x-chiliboard.dtb \
+   am335x-cm-t335.dtb \
am335x-evm.dtb \
am335x-evmsk.dtb \
+   am335x-lxm.dtb \
am335x-nano.dtb \
am335x-pepper.dtb \
-   am335x-lxm.dtb \
-   am335x-chiliboard.dtb \
+   am335x-sl50.dtb \
am335x-wega-rdk.dtb
 dtb-$(CONFIG_ARCH_OMAP4) += \
omap4-duovero-parlor.dtb \
diff --git a/arch/arm/boot/dts/am335x-cm-t335.dts 
b/arch/arm/boot/dts/am335x-cm-t335.dts
new file mode 100644
index 000..197d5ce
--- /dev/null
+++ b/arch/arm/boot/dts/am335x-cm-t335.dts
@@ -0,0 +1,62 @@
+/*
+ * am335x-cm-t335.dts - Device Tree file for Compulab CM-T335
+ *
+ * Copyright (C) 2014 - 2015 CompuLab Ltd. - http://www.compulab.co.il/
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+#include "am33xx.dtsi"
+
+/ {
+   model = "CompuLab CM-T335";
+   compatible = "compulab,cm-t335", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x800>;   /* 128 MB */
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_led_pins>;
+   led@0 {
+   label = "cm_t335:green";
+   gpios = < 0 GPIO_ACTIVE_LOW>; /* gpio2_0 */
+   linux,default-trigger = "heartbeat";
+   };
+   };
+};
+
+_pinmux {
+   pinctrl-names = "default";
+   pinctrl-0 = <>;
+
+   gpio_led_pins: pinmux_gpio_led_pins {
+   pinctrl-single,pins = <
+   0x88 (PIN_OUTPUT | MUX_MODE7)   /* gpmc_csn3.gpio2_0 */
+   >;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = <
+   /* uart0_rxd.uart0_rxd */
+   0x170 (PIN_INPUT_PULLUP | MUX_MODE0)
+   /* uart0_txd.uart0_txd */
+   0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+   >;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   status = "okay";
+};
+
-- 
2.6.0

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