RE: [PATCH v2 0/4] GPIO DT support for da850

2013-06-14 Thread Philip, Avinash
On Fri, Jun 14, 2013 at 15:13:36, Philip, Avinash wrote:
> With conversion of GPIO davinci driver to platform driver, gpio-davinci driver
> can support DT boot.
> This patch series
> - adds dt binding support for gpio-davinci.
> - da850 dt support goio.
> 
> This patch series is based on Linux 3.10-rc4 and is availabel at [1].
> 
> 1. 
> https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4


This patch series has dependency on [PATCH v2 0/7] Convert GPIO Davinci to 
platform driver

https://lkml.org/lkml/2013/6/14/120

Thanks
Avinash

> 
> KV Sujith (3):
>   gpio: davinci: DT changes for driver
>   ARM: davinci: da850: add GPIO DT entries
>   ARM: davinci: da850 evm: add GPIO DT data
> 
> Philip Avinash (1):
>   ARM: davinci: da850: Use #include for all device trees
> 
>  .../devicetree/bindings/gpio/gpio-davinci.txt  |   32 +++
>  arch/arm/boot/dts/da850-enbw-cmc.dts   |2 +-
>  arch/arm/boot/dts/da850-evm.dts|   21 +++-
>  arch/arm/boot/dts/da850.dtsi   |   17 +-
>  drivers/gpio/gpio-davinci.c|   57 
> ++--
>  5 files changed, 123 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
> 
> -- 
> 1.7.9.5
> 
> ___
> Davinci-linux-open-source mailing list
> davinci-linux-open-sou...@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
> 

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


[PATCH v2 2/4] gpio: davinci: DT changes for driver

2013-06-14 Thread Philip Avinash
From: KV Sujith 

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file
  gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
Changes since v1:
- description for interrupts changed to reflecti
   interrupt array usage.

 .../devicetree/bindings/gpio/gpio-davinci.txt  |   32 +++
 drivers/gpio/gpio-davinci.c|   57 ++--
 2 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt 
b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
new file mode 100644
index 000..1c31638
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
@@ -0,0 +1,32 @@
+Davinci GPIO controller bindings
+
+Required Properties:
+- compatible:"ti,da830-gpio"
+
+- reg: Physical base address of the controller and length of memory mapped
+   region.
+
+- interrupts: Array of GPIO interrupt number.
+
+- ngpio: The number of GPIO pins supported
+
+- intc_irq_num: The number of IRQs supported by the Interrupt Controller
+
+- gpio_unbanked: The number of GPIOs that have an individual interrupt
+   line to processor.
+
+Example:
+#include 
+
+gpio: gpio@1e26000 {
+   compatible = "ti,da830-gpio";
+   reg = <0x226000 0x1000>;
+   interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH
+   44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH
+   46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH
+   48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH
+   50 IRQ_TYPE_EDGE_BOTH>;
+   ngpio = <144>;
+   intc_irq_num = <101>;
+   gpio_unbanked = <0>;
+};
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 475a5ece..cd2ed25 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -137,6 +139,50 @@ davinci_gpio_set(struct gpio_chip *chip, unsigned offset, 
int value)
__raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
 }
 
+static struct davinci_gpio_platform_data *davinci_gpio_set_pdata_of(
+   struct platform_device *pdev)
+{
+   struct device_node *dn = pdev->dev.of_node;
+   struct davinci_gpio_platform_data *pdata;
+   u32 val, ret;
+
+   pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata) {
+   ret = of_property_read_u32(dn, "ngpio", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->ngpio = val;
+
+   ret = of_property_read_u32(dn, "gpio_unbanked", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->gpio_unbanked = val;
+
+   ret = of_property_read_u32(dn, "intc_irq_num", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->intc_irq_num = val;
+   }
+
+   return pdata;
+
+of_err:
+   dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret);
+   return NULL;
+}
+
+static const struct of_device_id davinci_gpio_ids[] = {
+   {
+   .compatible = "ti,da830-gpio",
+   },
+   { },
+};
+
+MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
+
 static int davinci_gpio_probe(struct platform_device *pdev)
 {
int i, base;
@@ -146,13 +192,17 @@ static int davinci_gpio_probe(struct platform_device 
*pdev)
struct davinci_gpio_regs __iomem *regs;
struct device *dev = &pdev->dev;
struct resource *res;
+   const struct of_device_id *match =
+   of_match_device(of_match_ptr(davinci_gpio_ids), &pdev->dev);
 
-   pdata = dev->platform_data;
+   pdata = match ? davinci_gpio_set_pdata_of(pdev) : dev->platform_data;
if (!pdata) {
dev_err(dev, "No platform data found\n");
return -EINVAL;
}
 
+   dev->platform_data = pdata;
+
/*
 * The gpio banks conceptually expose a segmented bitmap,
 * and "ngpio" is one more than the largest zero-based
@@ -497,8 +547,9 @@ done:
 static struct platform_driver davinci_gpio_driver = {
.probe  = davinci_gpio_probe,
.driver = {
-   .name   = "davinci_gpio",
-   .owner  = THIS_MODULE,
+   .name   = "davinci_gpio",
+   .owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(dav

[PATCH 2/2] gpio: gpio-tnetv107x: Fix bulid breakge

2013-06-14 Thread Philip Avinash
includes linux/io.h for fixing following build error. This build error
comes only after removing select option of NEED_MACH_GPIO_H for
ARCH_DAVINCI. linux/io.h is got included from mach/gpio-davinci.h on
selection of NEED_MACH_GPIO_H.

drivers/gpio/gpio-tnetv107x.c: In function 'tnetv107x_gpio_request':
drivers/gpio/gpio-tnetv107x.c:63:2: error: implicit declaration of
function '__raw_writel'
drivers/gpio/gpio-tnetv107x.c:63:2: error: implicit declaration of
function '__raw_readl'
drivers/gpio/gpio-tnetv107x.c: In function 'tnetv107x_gpio_setup':
drivers/gpio/gpio-tnetv107x.c:172:2: error: implicit declaration of
function 'ioremap'
drivers/gpio/gpio-tnetv107x.c:172:7: warning: assignment makes pointer
from integer without a cast

Signed-off-by: Philip Avinash 
---
 drivers/gpio/gpio-tnetv107x.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-tnetv107x.c b/drivers/gpio/gpio-tnetv107x.c
index 3fa3e28..c7ed335 100644
--- a/drivers/gpio/gpio-tnetv107x.c
+++ b/drivers/gpio/gpio-tnetv107x.c
@@ -14,6 +14,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 
 #include 
-- 
1.7.9.5

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


[PATCH 1/2] ARM: davinci: fix for build breakage for tnetv107x platforms

2013-06-14 Thread Philip Avinash
Fix the following build breakage and section mismatch error. This build
break will comes only on removal of NEED_MACH_GPIO_H select option for
ARCH-DAVINCI.

arch/arm/mach-davinci/board-tnetv107x-evm.c:283:15: error:
'davinci_timer_init' undeclared here (not in a function)
arch/arm/mach-davinci/board-tnetv107x-evm.c:285:15: error:
'davinci_init_late' undeclared here (not in a function)
make[1]: *** [arch/arm/mach-davinci/board-tnetv107x-evm.o] Error 1

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/board-tnetv107x-evm.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c 
b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index ba79837..b5db980 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -147,7 +148,7 @@ static struct davinci_nand_pdata nand_config = {
.ecc_bits   = 1,
 };
 
-static struct davinci_uart_config serial_config __initconst = {
+static struct davinci_uart_config serial_config __initdata = {
.enabled_uarts  = BIT(1),
 };
 
@@ -245,7 +246,7 @@ static struct ti_ssp_data ssp_config = {
},
 };
 
-static struct tnetv107x_device_info evm_device_info __initconst = {
+static struct tnetv107x_device_info evm_device_info __initdata = {
.serial_config  = &serial_config,
.mmc_config[1]  = &mmc_config,  /* controller 1 */
.nand_config[0] = &nand_config, /* chip select 0 */
-- 
1.7.9.5

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


[PATCH 0/2] Fix build breakage for tnetv107x platforms

2013-06-14 Thread Philip Avinash
tnetv107x_defconfig build failing on removal selection of NEED_MACH_GPIO_H
for ARCH_DAVINCI. This is due to header files inclusion from mach/gpio-davinci.h
So this patch series fixes the build breakage on removal of NEED_MACH_GPIO_H.

This patch series is based on Linux 3.10-rc4 and is availabel at [1] and 
dependency on 2.

1. 
https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4
2. https://patchwork.kernel.org/patch/97853/

Philip Avinash (2):
  ARM: davinci: fix for build breakage for tnetv107x platforms
  gpio: gpio-tnetv107x: Fix bulid breakge

 arch/arm/mach-davinci/board-tnetv107x-evm.c |5 +++--
 drivers/gpio/gpio-tnetv107x.c   |1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
1.7.9.5

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


[PATCH v2 4/4] ARM: davinci: da850 evm: add GPIO DT data

2013-06-14 Thread Philip Avinash
From: KV Sujith 

- Add GPIO DT Data and pinmux for DA850 EVM. GPIO is configurable differently
  on different boards. So add GPIO pinmuxing in dts file.
- Dependency: This patch is dependent on Grab-pin-control patch;
  https://patchwork.kernel.org/patch/2013751/

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 arch/arm/boot/dts/da850-evm.dts |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 5bce7cc..2c127ff 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -17,6 +17,20 @@
soc {
pmx_core: pinmux@1c14120 {
status = "okay";
+   gpio_pins: pinmux_gpio_pins {
+   pinctrl-single,bits = <
+   /* GPIO2_4 GPIO2_6 */
+   0x18 0x8080 0xf0f0
+   /* GPIO2_8 GPIO2_15 */
+   0x14 0x8008 0xf00f
+   /* GPIO3_12 GPIO3_13 */
+   0x1C 0x8800 0xff00
+   /* GPIO4_0 GPIO4_1 */
+   0x28 0x8800 0xff00
+   /* GPIO6_9 GPIO6_10 GPIO6_13 */
+   0x34 0x08800800 0x0ff00f00
+   >;
+   };
};
serial0: serial@1c42000 {
status = "okay";
@@ -90,6 +104,11 @@
};
};
};
+   gpio: gpio@1e26000 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&gpio_pins>;
+   };
};
nand_cs3@6200 {
status = "okay";
-- 
1.7.9.5

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


[PATCH v2 3/4] ARM: davinci: da850: add GPIO DT entries

2013-06-14 Thread Philip Avinash
From: KV Sujith 

Add DT entries for Davinci GPIO.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
Changes since v1:
- interrupts member defined as array and with interrupt flags

 arch/arm/boot/dts/da850.dtsi |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3b66020..cd7b362 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -8,6 +8,7 @@
  * option) any later version.
  */
 #include "skeleton.dtsi"
+#include 
 
 / {
arm {
@@ -126,6 +127,20 @@
>;
};
};
+   gpio: gpio@1e26000 {
+   compatible = "ti,da830-gpio";
+   reg = <0x226000 0x1000>;
+   interrupts = <42 IRQ_TYPE_EDGE_BOTH
+   43 IRQ_TYPE_EDGE_BOTH 44 IRQ_TYPE_EDGE_BOTH
+   45 IRQ_TYPE_EDGE_BOTH 46 IRQ_TYPE_EDGE_BOTH
+   47 IRQ_TYPE_EDGE_BOTH 48 IRQ_TYPE_EDGE_BOTH
+   49 IRQ_TYPE_EDGE_BOTH 50 IRQ_TYPE_EDGE_BOTH>;
+   ngpio = <144>;
+   intc_irq_num = <101>;
+   gpio_unbanked = <0>;
+   status = "disabled";
+   };
serial0: serial@1c42000 {
compatible = "ns16550a";
reg = <0x42000 0x100>;
-- 
1.7.9.5

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


[PATCH v2 1/4] ARM: davinci: da850: Use #include for all device trees

2013-06-14 Thread Philip Avinash
Replace /include/ by #include for da850 device tree files, in order to
use the C pre-processor, making use of #define features possible.

Signed-off-by: Philip Avinash 
---
Changes since v1:
- New patch and comes as a dependency of patch 3/4

 arch/arm/boot/dts/da850-enbw-cmc.dts |2 +-
 arch/arm/boot/dts/da850-evm.dts  |2 +-
 arch/arm/boot/dts/da850.dtsi |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/da850-enbw-cmc.dts 
b/arch/arm/boot/dts/da850-enbw-cmc.dts
index 422fdb3..e750ab9 100644
--- a/arch/arm/boot/dts/da850-enbw-cmc.dts
+++ b/arch/arm/boot/dts/da850-enbw-cmc.dts
@@ -10,7 +10,7 @@
  * option) any later version.
  */
 /dts-v1/;
-/include/ "da850.dtsi"
+#include "da850.dtsi"
 
 / {
compatible = "enbw,cmc", "ti,da850";
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c914357..5bce7cc 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -8,7 +8,7 @@
  * Free Software Foundation, version 2.
  */
 /dts-v1/;
-/include/ "da850.dtsi"
+#include "da850.dtsi"
 
 / {
compatible = "ti,da850-evm", "ti,da850";
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 452bdc6..3b66020 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -7,7 +7,7 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
arm {
-- 
1.7.9.5

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


[PATCH v2 0/4] GPIO DT support for da850

2013-06-14 Thread Philip Avinash
With conversion of GPIO davinci driver to platform driver, gpio-davinci driver
can support DT boot.
This patch series
- adds dt binding support for gpio-davinci.
- da850 dt support goio.

This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. 
https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

KV Sujith (3):
  gpio: davinci: DT changes for driver
  ARM: davinci: da850: add GPIO DT entries
  ARM: davinci: da850 evm: add GPIO DT data

Philip Avinash (1):
  ARM: davinci: da850: Use #include for all device trees

 .../devicetree/bindings/gpio/gpio-davinci.txt  |   32 +++
 arch/arm/boot/dts/da850-enbw-cmc.dts   |2 +-
 arch/arm/boot/dts/da850-evm.dts|   21 +++-
 arch/arm/boot/dts/da850.dtsi   |   17 +-
 drivers/gpio/gpio-davinci.c|   57 ++--
 5 files changed, 123 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt

-- 
1.7.9.5

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


[PATCH v2 6/7] ARM: davinci: dmxxx: gpio device creation

2013-06-14 Thread Philip Avinash
Create davinci gpio device and remove gpio references in
davinci_soc_info structure for dmxxx platforms. Also add Memory and IRQ
resources for GPIO platform device.

Signed-off-by: Philip Avinash 
Acked-by: Linus Walleij 
Signed-off-by: Sekhar Nori 
---
Changes since v1:
- Add commit message

 arch/arm/mach-davinci/board-dm355-evm.c |   27 ++
 arch/arm/mach-davinci/board-dm355-leopard.c |1 +
 arch/arm/mach-davinci/board-dm365-evm.c |   28 +++
 arch/arm/mach-davinci/board-dm644x-evm.c|   26 +
 arch/arm/mach-davinci/board-dm646x-evm.c|   27 ++
 arch/arm/mach-davinci/board-neuros-osd2.c   |1 +
 arch/arm/mach-davinci/dm355.c   |4 
 arch/arm/mach-davinci/dm365.c   |5 -
 arch/arm/mach-davinci/dm644x.c  |4 
 arch/arm/mach-davinci/dm646x.c  |4 
 arch/arm/mach-davinci/include/mach/common.h |2 ++
 11 files changed, 112 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c 
b/arch/arm/mach-davinci/board-dm355-evm.c
index c2a0a67..05e6e86 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -28,9 +28,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include "davinci.h"
 
@@ -376,9 +378,34 @@ static struct spi_board_info dm355_evm_spi_info[] 
__initconst = {
},
 };
 
+static struct resource dm355_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DM355_GPIOBNK0,
+   .end= IRQ_DM355_GPIOBNK6,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
+   .ngpio = 104,
+   .intc_irq_num = DAVINCI_N_AINTC_IRQ,
+};
+
 static __init void dm355_evm_init(void)
 {
struct clk *aemif;
+   int ret;
+
+   ret = davinci_gpio_register(dm355_gpio_resources,
+   sizeof(dm355_gpio_resources),
+   &dm355_gpio_platform_data);
+   if (ret)
+   pr_warn("dm355_evm_init: GPIO init failed: %d\n", ret);
 
gpio_request(1, "dm9000");
gpio_direction_input(1);
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c 
b/arch/arm/mach-davinci/board-dm355-leopard.c
index dff4ddc..34a2b64 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index fd38c8d..60f7b84 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -746,8 +747,35 @@ static struct spi_board_info dm365_evm_spi_info[] 
__initconst = {
},
 };
 
+static struct resource dm365_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DM365_GPIO0,
+   .end= IRQ_DM365_GPIO7,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
+   .ngpio = 104,
+   .intc_irq_num = DAVINCI_N_AINTC_IRQ,
+   .gpio_unbanked = 8,
+};
+
 static __init void dm365_evm_init(void)
 {
+   int ret;
+
+   ret = davinci_gpio_register(dm365_gpio_resources,
+   sizeof(dm365_gpio_resources),
+   &dm365_gpio_platform_data);
+   if (ret)
+   pr_warn("dm365_evm_init: GPIO init failed: %d\n", ret);
+
evm_init_i2c();
davinci_serial_init(&uart_config);
 
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
b/arch/arm/mach-davinci/board-dm644x-evm.c
index a33686a..57a7ed8 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "davinci.h"
 
@@ -755,11 +756,36 @@ static int davinci_phy_fixup(struct phy_device *phydev)
 
 #define HAS_NAND   IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
 
+static struct resource dm644_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_GPIOBNK0,

[PATCH v2 5/7] ARM: davinci: da8xx: gpio device creation

2013-06-14 Thread Philip Avinash
Create davinci gpio device and remove references in davinci_soc_info
structure. Also rearrange header file inclusion in group basis.

Signed-off-by: Philip Avinash 
Acked-by: Linus Walleij 
Signed-off-by: Sekhar Nori 
---
 arch/arm/mach-davinci/board-da830-evm.c |   19 +++
 arch/arm/mach-davinci/board-da850-evm.c |   11 +++
 arch/arm/mach-davinci/board-omapl138-hawk.c |2 ++
 arch/arm/mach-davinci/da830.c   |4 
 arch/arm/mach-davinci/da850.c   |4 
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c 
b/arch/arm/mach-davinci/board-da830-evm.c
index 1332de8..4e8bcc1 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -22,17 +22,19 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#include 
 
 #define DA830_EVM_PHY_ID   ""
 /*
@@ -590,11 +592,20 @@ static struct spi_board_info da830evm_spi_info[] = {
},
 };
 
+static struct davinci_gpio_platform_data da830_gpio_platform_data = {
+   .ngpio = 128,
+   .intc_irq_num = DA830_N_CP_INTC_IRQ,
+};
+
 static __init void da830_evm_init(void)
 {
struct davinci_soc_info *soc_info = &davinci_soc_info;
int ret;
 
+   ret = da8xx_register_gpio(&da830_gpio_platform_data);
+   if (ret)
+   pr_warn("da830_evm_init: GPIO init failed: %d\n", ret);
+
ret = da830_register_edma(da830_edma_rsv);
if (ret)
pr_warning("da830_evm_init: edma registration failed: %d\n",
diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
b/arch/arm/mach-davinci/board-da850-evm.c
index 8a24b6c..d5dd010 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1138,6 +1140,11 @@ static struct edma_rsv_info *da850_edma_rsv[2] = {
&da850_edma_cc1_rsv,
 };
 
+static struct davinci_gpio_platform_data da850_gpio_platform_data = {
+   .ngpio = 144,
+   .intc_irq_num = DA850_N_CP_INTC_IRQ,
+};
+
 #ifdef CONFIG_CPU_FREQ
 static __init int da850_evm_init_cpufreq(void)
 {
@@ -1444,6 +1451,10 @@ static __init void da850_evm_init(void)
 {
int ret;
 
+   ret = da8xx_register_gpio(&da850_gpio_platform_data);
+   if (ret)
+   pr_warn("da850_evm_init: GPIO init failed: %d\n", ret);
+
ret = pmic_tps65070_init();
if (ret)
pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c 
b/arch/arm/mach-davinci/board-omapl138-hawk.c
index b8c20de..1f44a1b 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -20,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define HAWKBOARD_PHY_ID   "davinci_mdio-0:07"
 #define DA850_HAWK_MMCSD_CD_PINGPIO_TO_PIN(3, 12)
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index abbaf02..e7b79ee 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1195,10 +1195,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
.intc_irq_prios = da830_default_priorities,
.intc_irq_num   = DA830_N_CP_INTC_IRQ,
.timer_info = &da830_timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 128,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata,
 };
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 93bcf06..de8753d 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1298,10 +1298,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
.intc_irq_prios = da850_default_priorities,
.intc_irq_num   = DA850_N_CP_INTC_IRQ,
.timer_info = &da850_timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 144,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata,
.sram_dma   = DA8XX_SHARED_RAM_BASE,
-- 
1.7.9.5

--
To unsubscribe from this 

[PATCH v2 4/7] ARM: davinci: creation of gpio platform device for dmxxx platforms

2013-06-14 Thread Philip Avinash
gpio controller resource information being associated with
davinci_soc_info structure and not created any device. Hence davinci
gpio didn't fall under proper device model. This patch creates gpio
davinci as a platform device for dmxxx platforms.
Also add daivinci_register_gpio API to create platform device for dmxxx
platforms.

Signed-off-by: Philip Avinash 
Acked-by: Linus Walleij 
Signed-off-by: Sekhar Nori 
---
 arch/arm/mach-davinci/devices.c |   13 +
 arch/arm/mach-davinci/include/mach/common.h |2 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index a7068a3..b4f345b 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -313,6 +313,19 @@ static void davinci_init_wdt(void)
platform_device_register(&davinci_wdt_device);
 }
 
+static struct platform_device davinci_gpio_device = {
+   .name   = "davinci_gpio",
+   .id = -1,
+};
+
+int davinci_gpio_register(struct resource *res, int size, void *pdata)
+{
+   davinci_gpio_device.resource = res;
+   davinci_gpio_device.num_resources = size;
+   davinci_gpio_device.dev.platform_data = pdata;
+   return platform_device_register(&davinci_gpio_device);
+}
+
 /*-*/
 
 /*-*/
diff --git a/arch/arm/mach-davinci/include/mach/common.h 
b/arch/arm/mach-davinci/include/mach/common.h
index b124b77..bd389ba 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 extern void davinci_timer_init(void);
 
@@ -83,6 +84,7 @@ extern void davinci_common_init(struct davinci_soc_info 
*soc_info);
 extern void davinci_init_ide(void);
 void davinci_restart(char mode, const char *cmd);
 void davinci_init_late(void);
+int davinci_gpio_register(struct resource *res, int size, void *pdata);
 
 #ifdef CONFIG_DAVINCI_RESET_CLOCKS
 int davinci_clk_disable_unused(void);
-- 
1.7.9.5

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


RE: [PATCH v2 0/7] Convert GPIO Davinci to platform driver

2013-06-14 Thread Philip, Avinash

Sender mail id got corrupted. I will send another.

Thanks
Avinash

On Fri, Jun 14, 2013 at 15:04:34, y...@symphony.india.ext.ti.com wrote:
> From: Philip Avinash 
> 
> To support DT booting of da850 EVM, davinci gpio driver converted to platform
> driver. Also when here, start using gpiolib API for gpio get/set 
> functionalities.
> Hence removing gpio inline functionalities. However usage of gpiolib API will
> cause an additional software latencies.
> 
> In this patch series
> - Cleaned gpio Davinci driver code with proper commenting style.
> - Create platform driver for GPIO Davinci in da8xx and dmxxx platforms and
>   removed gpio related member updation in davinci_soc_info structure.
> - Remove soc_info reference in the gpio davinci driver and start uses
>   gpiolib interface.
> - gpio-tnetv107x driver also modified to use gpiolib API interface.
> 
> This series has been tested on da850 EVM for gpio interrupt generation.
> This patch series is based on Linux 3.10-rc4 and is availabel at [1].
> 
> 1. 
> https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4
> 
> KV Sujith (2):
>   gpio: davinci: move to platform device
>   ARM: davinci: da8xx: creation of gpio platform device
> 
> Philip Avinash (5):
>   gpio: davinci: coding style correction
>   ARM: davinci: creation of gpio platform device for dmxxx platforms
>   ARM: davinci: da8xx: gpio device creation
>   ARM: davinci: dmxxx: gpio device creation
>   ARM: davinci: Start using gpiolib API inplace of inline functions
> 
>  arch/arm/Kconfig  |1 -
>  arch/arm/mach-davinci/board-da830-evm.c   |   19 ++-
>  arch/arm/mach-davinci/board-da850-evm.c   |   11 ++
>  arch/arm/mach-davinci/board-dm355-evm.c   |   27 
>  arch/arm/mach-davinci/board-dm355-leopard.c   |1 +
>  arch/arm/mach-davinci/board-dm365-evm.c   |   28 
>  arch/arm/mach-davinci/board-dm644x-evm.c  |   26 
>  arch/arm/mach-davinci/board-dm646x-evm.c  |   27 
>  arch/arm/mach-davinci/board-neuros-osd2.c |1 +
>  arch/arm/mach-davinci/board-omapl138-hawk.c   |2 +
>  arch/arm/mach-davinci/da830.c |5 -
>  arch/arm/mach-davinci/da850.c |5 -
>  arch/arm/mach-davinci/devices-da8xx.c |   26 
>  arch/arm/mach-davinci/devices.c   |   13 ++
>  arch/arm/mach-davinci/dm355.c |5 -
>  arch/arm/mach-davinci/dm365.c |6 -
>  arch/arm/mach-davinci/dm644x.c|5 -
>  arch/arm/mach-davinci/dm646x.c|5 -
>  arch/arm/mach-davinci/include/mach/common.h   |4 +
>  arch/arm/mach-davinci/include/mach/da8xx.h|1 +
>  arch/arm/mach-davinci/include/mach/gpio-davinci.h |   91 -
>  arch/arm/mach-davinci/include/mach/gpio.h |   88 -
>  arch/arm/mach-davinci/tnetv107x.c |2 +-
>  drivers/gpio/gpio-davinci.c   |  144 
> ++---
>  drivers/gpio/gpio-tnetv107x.c |1 +
>  include/linux/platform_data/gpio-davinci.h|   59 +
>  26 files changed, 341 insertions(+), 262 deletions(-)
>  delete mode 100644 arch/arm/mach-davinci/include/mach/gpio-davinci.h
>  delete mode 100644 arch/arm/mach-davinci/include/mach/gpio.h
>  create mode 100644 include/linux/platform_data/gpio-davinci.h
> 
> -- 
> 1.7.9.5
> 
> 

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


[PATCH v2 7/7] ARM: davinci: Start using gpiolib API inplace of inline functions

2013-06-14 Thread Philip Avinash
Remove NEED_MACH_GPIO_H config select option for ARCH_DAVINCI to start
use gpiolib interface for davinci platforms. However with this software
latencies for gpio_get/set APIs will affect. Latency has increased by 18
microsecond with gpiolib API as compared with inline API's.

Software latency is calculated on da850 EVM for gpio_get_value API by
taking the printk timing for API execution with interrupts disabled.
Experiment has done for inline and gpiolib API interface.

  inline gpio API with interrupt disabled
  [   29.734337] before gpio_get
  [   29.736847] after gpio_get

  Time difference 0.00251

  gpio library with interrupt disabled
  [  272.876763] before gpio_get
  [  272.879291] after gpio_get

  Time difference 0.002528
  Latency increased by (0.002528 -  0.00251) = 18 microsecond.

Also being here
- Moved following definitions from mach folder to include directory
struct davinci_gpio_controller
Macro GPIO(x)
inline function __gpio_mask
- Removed GPIO_TYPE_DAVINCI enum definition as GPIO Davinci is converted
  to Linux device driver model.
- With removal of select option of NEED_MACH_GPIO_H for ARCH_DAVINCI,
  gpio-tnetv107x also start using gpiolib interface. Hence removes
  related header files
arch/arm/mach-davinci/include/mach/gpio-davinci.h
arch/arm/mach-davinci/include/mach/gpio.h

  and include linux/platform_data/gpio-davinci.h header file to support
  gpio-davinci platform definitions.

Signed-off-by: Philip Avinash 
Signed-off-by: Sekhar Nori 
---
Changes since v1:
- Remove inline GPIO API support for tnetv107x platforms
- Remove gpio header files in mach directory.
- Remove include of gpio header files from mach directory.
- Moved enum davinci_gpio_type to include folder
- Replace __ASM_ARCH_DAVINCI_GPIO_H with __DAVINCI_GPIO_PLATFORM_H

 arch/arm/Kconfig  |1 -
 arch/arm/mach-davinci/da830.c |1 -
 arch/arm/mach-davinci/da850.c |1 -
 arch/arm/mach-davinci/dm355.c |1 -
 arch/arm/mach-davinci/dm365.c |1 -
 arch/arm/mach-davinci/dm644x.c|1 -
 arch/arm/mach-davinci/dm646x.c|1 -
 arch/arm/mach-davinci/include/mach/gpio-davinci.h |   93 -
 arch/arm/mach-davinci/include/mach/gpio.h |   88 ---
 arch/arm/mach-davinci/tnetv107x.c |2 +-
 drivers/gpio/gpio-tnetv107x.c |1 +
 include/linux/platform_data/gpio-davinci.h|   34 
 12 files changed, 36 insertions(+), 189 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 49d993c..4d099fe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -839,7 +839,6 @@ config ARCH_DAVINCI
select GENERIC_CLOCKEVENTS
select GENERIC_IRQ_CHIP
select HAVE_IDE
-   select NEED_MACH_GPIO_H
select USE_OF
select ZONE_DMA
help
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index e7b79ee..0f2cb28 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "clock.h"
 #include "mux.h"
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index de8753d..cf62641 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "clock.h"
 #include "mux.h"
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index f7a18ff..9564202 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "davinci.h"
 #include "clock.h"
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 2c80a6b..8c8c0de 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "davinci.h"
 #include "clock.h"
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 9e23e64..75146b5 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "davinci.h"
 #include "clock.h"
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 1058e7c..d15a36c 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "davinci.h"
 #include "clock.h"
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h 
b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
deleted file mode 10

[PATCH v2 3/7] ARM: davinci: da8xx: creation of gpio platform device

2013-06-14 Thread Philip Avinash
From: KV Sujith 

gpio controller resource information being associated with
davinci_soc_info structure and not created any device. Hence davinci
gpio didn't fall under proper device model. This patch creates gpio
davinci as a platform device for da8xx platforms.

- Add Memory and IRQ resources for da8xx
- Register GPIO platform driver for da8xx.
- Add da8xx_register_gpio API to create platform device for da8xx
  platforms.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
Acked-by: Linus Walleij 
Signed-off-by: Sekhar Nori 
---
 arch/arm/mach-davinci/devices-da8xx.c  |   26 ++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 2 files changed, 27 insertions(+)

diff --git a/arch/arm/mach-davinci/devices-da8xx.c 
b/arch/arm/mach-davinci/devices-da8xx.c
index bf57252..892ad86 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -640,6 +640,32 @@ int __init da8xx_register_lcdc(struct 
da8xx_lcdc_platform_data *pdata)
return platform_device_register(&da8xx_lcdc_device);
 }
 
+static struct resource da8xx_gpio_resources[] = {
+   { /* registers */
+   .start  = DA8XX_GPIO_BASE,
+   .end= DA8XX_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DA8XX_GPIO0,
+   .end= IRQ_DA8XX_GPIO8,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct platform_device da8xx_gpio_device = {
+   .name   = "davinci_gpio",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(da8xx_gpio_resources),
+   .resource   = da8xx_gpio_resources,
+};
+
+int __init da8xx_register_gpio(void *pdata)
+{
+   da8xx_gpio_device.dev.platform_data = pdata;
+   return platform_device_register(&da8xx_gpio_device);
+}
+
 static struct resource da8xx_mmcsd0_resources[] = {
{   /* registers */
.start  = DA8XX_MMCSD0_BASE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index 2e1c9ea..aa66690 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -96,6 +96,7 @@ int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
 int da850_register_mmcsd1(struct davinci_mmc_config *config);
 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
 int da8xx_register_rtc(void);
+int da8xx_register_gpio(void *pdata);
 int da850_register_cpufreq(char *async_clk);
 int da8xx_register_cpuidle(void);
 void __iomem * __init da8xx_get_mem_ctlr(void);
-- 
1.7.9.5

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


[PATCH v2 2/7] gpio: davinci: move to platform device

2013-06-14 Thread Philip Avinash
From: KV Sujith 

Modify GPIO Davinci driver to be compliant to standard platform drivers.
The driver did not have platform driver structure or a probe. Instead,
had a davinci_gpio_setup() function which is called in the pure_init
sequence. The function also had dependency on davinci_soc_info structure
of the corresponding platform. For Device Tree(DT) implementation, we
need to get rid of the dependency on the davinci_soc_info structure.
Hence as a first stage of DT conversion, we implement a probe. Future
commits shall modify the probe to read platform related data from DT.

- Add platform_driver structure and driver register function for davinci
  GPIO driver. The driver registration is made to happen in
  postcore_initcall. This is required since machine init functions like
  da850_lcd_hw_init() make use of GPIO.
- Convert the davinci_gpio_setup() to davinci_gpio_probe().
- Remove access of members in soc_info structure. Instead, relevant data
  are taken from davinci_gpio_platform_data structure pointed by
  pdev->dev.platform_data.
- Change clk_get() to devm_clk_get() as devm_clk_get() is a device
  managed function and makes error handling simpler.
- Change pr_err to dev_err for ngpio error reporting.
- Arrange include files in alphabetical order
- Add struct davinci_gpio_platform_data davinci for gpio module.

Signed-off-by: KV Sujith 
[avinashphi...@ti.com: Move global definition for "struct
davinci_gpio_controller" variable to local in probe and set it as driver
data.]
Signed-off-by: Philip Avinash 
Acked-by: Linus Walleij 
Signed-off-by: Sekhar Nori 
---
Changes since v1:
- Merge header file to drivermodification patch
- Return error value updated.
- line break alignment fixing.

 arch/arm/mach-davinci/include/mach/gpio-davinci.h |2 +
 drivers/gpio/gpio-davinci.c   |  123 ++---
 include/linux/platform_data/gpio-davinci.h|   25 +
 3 files changed, 112 insertions(+), 38 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h 
b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
index 1fdd1fd..b325a1d 100644
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -60,6 +60,8 @@ struct davinci_gpio_controller {
void __iomem*set_data;
void __iomem*clr_data;
void __iomem*in_data;
+   int gpio_unbanked;
+   unsignedgpio_irq;
 };
 
 /* The __gpio_to_controller() and __gpio_mask() functions inline to constants
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index e8d189c..475a5ece 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -11,12 +11,17 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
 
 struct davinci_gpio_regs {
u32 dir;
@@ -36,10 +41,9 @@ struct davinci_gpio_regs {
 #define chip2controller(chip)  \
container_of(chip, struct davinci_gpio_controller, chip)
 
-static struct davinci_gpio_controller chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
 static void __iomem *gpio_base;
 
-static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio)
+static struct davinci_gpio_regs __iomem *gpio2regs(unsigned gpio)
 {
void __iomem *ptr;
 
@@ -67,7 +71,7 @@ static inline struct davinci_gpio_regs __iomem *irq2regs(int 
irq)
return g;
 }
 
-static int __init davinci_gpio_irq_setup(void);
+static int davinci_gpio_irq_setup(struct platform_device *pdev);
 
 /*--*/
 
@@ -133,33 +137,53 @@ davinci_gpio_set(struct gpio_chip *chip, unsigned offset, 
int value)
__raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
 }
 
-static int __init davinci_gpio_setup(void)
+static int davinci_gpio_probe(struct platform_device *pdev)
 {
int i, base;
unsigned ngpio;
-   struct davinci_soc_info *soc_info = &davinci_soc_info;
-   struct davinci_gpio_regs *regs;
-
-   if (soc_info->gpio_type != GPIO_TYPE_DAVINCI)
-   return 0;
+   struct davinci_gpio_controller *chips;
+   struct davinci_gpio_platform_data *pdata;
+   struct davinci_gpio_regs __iomem *regs;
+   struct device *dev = &pdev->dev;
+   struct resource *res;
+
+   pdata = dev->platform_data;
+   if (!pdata) {
+   dev_err(dev, "No platform data found\n");
+   return -EINVAL;
+   }
 
/*
 * The gpio banks conceptually expose a segmented bitmap,
 * and "ngpio" is one more than the largest zero-based
 * bit index that's valid.
 */
-   ngpio = soc_info->gpio_num;
+   ngpio = pdata->ngpio;
if (ngpio == 0) {

[PATCH v2 1/7] gpio: davinci: coding style correction

2013-06-14 Thread Philip Avinash
Make some minor coding style fixes. Use proper multi-line
commenting style, arrange include files alphabetically use
macros for bit definitions.

Signed-off-by: Philip Avinash 
Signed-off-by: Sekhar Nori 
---
Changes since v1:
- Remove variable name replacement
- Add line break after BINTEN macro definition

 drivers/gpio/gpio-davinci.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 17df6db..e8d189c 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -9,12 +9,12 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-#include 
-#include 
-#include 
+
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
 #include 
 
@@ -31,6 +31,8 @@ struct davinci_gpio_regs {
u32 intstat;
 };
 
+#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
+
 #define chip2controller(chip)  \
container_of(chip, struct davinci_gpio_controller, chip)
 
@@ -304,7 +306,8 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, 
unsigned offset)
 {
struct davinci_soc_info *soc_info = &davinci_soc_info;
 
-   /* NOTE:  we assume for now that only irqs in the first gpio_chip
+   /*
+* NOTE:  we assume for now that only irqs in the first gpio_chip
 * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
 */
if (offset < soc_info->gpio_unbanked)
@@ -368,7 +371,8 @@ static int __init davinci_gpio_irq_setup(void)
}
clk_prepare_enable(clk);
 
-   /* Arrange gpio_to_irq() support, handling either direct IRQs or
+   /*
+* Arrange gpio_to_irq() support, handling either direct IRQs or
 * banked IRQs.  Having GPIOs in the first GPIO bank use direct
 * IRQs, while the others use banked IRQs, would need some setup
 * tweaks to recognize hardware which can do that.
@@ -450,10 +454,11 @@ static int __init davinci_gpio_irq_setup(void)
}
 
 done:
-   /* BINTEN -- per-bank interrupt enable. genirq would also let these
+   /*
+* BINTEN -- per-bank interrupt enable. genirq would also let these
 * bits be set/cleared dynamically.
 */
-   __raw_writel(binten, gpio_base + 0x08);
+   __raw_writel(binten, gpio_base + BINTEN);
 
printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0));
 
-- 
1.7.9.5

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


[PATCH v2 0/7] Convert GPIO Davinci to platform driver

2013-06-14 Thread Philip Avinash
To support DT booting of da850 EVM, davinci gpio driver converted to platform
driver. Also when here, start using gpiolib API for gpio get/set 
functionalities.
Hence removing gpio inline functionalities. However usage of gpiolib API will
cause an additional software latencies.

In this patch series
- Cleaned gpio Davinci driver code with proper commenting style.
- Create platform driver for GPIO Davinci in da8xx and dmxxx platforms and
  removed gpio related member updation in davinci_soc_info structure.
- Remove soc_info reference in the gpio davinci driver and start uses
  gpiolib interface.
- gpio-tnetv107x driver also modified to use gpiolib API interface.

This series has been tested on da850 EVM for gpio interrupt generation.
This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. 
https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

KV Sujith (2):
  gpio: davinci: move to platform device
  ARM: davinci: da8xx: creation of gpio platform device

Philip Avinash (5):
  gpio: davinci: coding style correction
  ARM: davinci: creation of gpio platform device for dmxxx platforms
  ARM: davinci: da8xx: gpio device creation
  ARM: davinci: dmxxx: gpio device creation
  ARM: davinci: Start using gpiolib API inplace of inline functions

 arch/arm/Kconfig  |1 -
 arch/arm/mach-davinci/board-da830-evm.c   |   19 ++-
 arch/arm/mach-davinci/board-da850-evm.c   |   11 ++
 arch/arm/mach-davinci/board-dm355-evm.c   |   27 
 arch/arm/mach-davinci/board-dm355-leopard.c   |1 +
 arch/arm/mach-davinci/board-dm365-evm.c   |   28 
 arch/arm/mach-davinci/board-dm644x-evm.c  |   26 
 arch/arm/mach-davinci/board-dm646x-evm.c  |   27 
 arch/arm/mach-davinci/board-neuros-osd2.c |1 +
 arch/arm/mach-davinci/board-omapl138-hawk.c   |2 +
 arch/arm/mach-davinci/da830.c |5 -
 arch/arm/mach-davinci/da850.c |5 -
 arch/arm/mach-davinci/devices-da8xx.c |   26 
 arch/arm/mach-davinci/devices.c   |   13 ++
 arch/arm/mach-davinci/dm355.c |5 -
 arch/arm/mach-davinci/dm365.c |6 -
 arch/arm/mach-davinci/dm644x.c|5 -
 arch/arm/mach-davinci/dm646x.c|5 -
 arch/arm/mach-davinci/include/mach/common.h   |4 +
 arch/arm/mach-davinci/include/mach/da8xx.h|1 +
 arch/arm/mach-davinci/include/mach/gpio-davinci.h |   91 -
 arch/arm/mach-davinci/include/mach/gpio.h |   88 -
 arch/arm/mach-davinci/tnetv107x.c |2 +-
 drivers/gpio/gpio-davinci.c   |  144 ++---
 drivers/gpio/gpio-tnetv107x.c |1 +
 include/linux/platform_data/gpio-davinci.h|   59 +
 26 files changed, 341 insertions(+), 262 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/include/mach/gpio-davinci.h
 delete mode 100644 arch/arm/mach-davinci/include/mach/gpio.h
 create mode 100644 include/linux/platform_data/gpio-davinci.h

-- 
1.7.9.5

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


RE: [PATCH 03/11] gpio: davinci: Modify to platform driver

2013-06-13 Thread Philip, Avinash
On Thu, Jun 13, 2013 at 13:59:53, Nori, Sekhar wrote:
> On 6/13/2013 1:02 PM, Philip, Avinash wrote:
> 
> > With tnetv107x_defconfig build is failing
> > 
> > arch/arm/mach-davinci/board-tnetv107x-evm.c:282:15: error:
> >  'davinci_timer_init' undeclared here (not in a function)
> > arch/arm/mach-davinci/board-tnetv107x-evm.c:284:15: error:
> >  'davinci_init_late' undeclared here (not in a function)
> > make[1]: *** [arch/arm/mach-davinci/board-tnetv107x-evm.o] Error 1
> > 
> > Following patch fixes the build above breakage
> 
> The error you are seeing and the patch you provided below have no
> correlation.

No. Above build error fixed by
 
+#include 

Other changes are not related to above error.

> 
> > 
> > diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c 
> > b/arch/arm/mach-davinci/board-tnetv107x-evm.c
> > index ba79837..4a9c320 100644
> > --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
> > +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
> > @@ -30,6 +30,7 @@
> >  #include 
> >  #include 
> > 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -147,7 +148,7 @@ static struct davinci_nand_pdata nand_config = {
> > .ecc_bits   = 1,
> >  };
> > 
> > -static struct davinci_uart_config serial_config __initconst = {
> > +static struct davinci_uart_config serial_config = {
> > .enabled_uarts  = BIT(1),
> >  };
> 
> You can make this __initdata instead - assuming its okay to have this
> memory discarded at init.

I will check.

> 
> > 
> > @@ -245,7 +246,7 @@ static struct ti_ssp_data ssp_config = {
> > },
> >  };
> > 
> > -static struct tnetv107x_device_info evm_device_info __initconst = {
> > +static struct tnetv107x_device_info evm_device_info = {
> 
> Same here. You can make this __initdata.
> 
> Please send a formal patch for the errors you have seen.

Ok

> 
> > .serial_config  = &serial_config,
> > .mmc_config[1]  = &mmc_config,  /* controller 1 */
> > .nand_config[0] = &nand_config, /* chip select 0 */
> > 
> > 
> > 
> >>
> >>>
> >>> So I prefer to leave tnetv107x platform for now.
> >>
> >> I don't think that's acceptable. At least by me.
> > 
> > I think 2 options are available
> > 1. Convert gpio-tnetv107x.c to platform driver. This will help in
> > removing gpio references in davinci_soc_info structure.
> > 2. Remove inline gpio api support and start use gpiolib support.
> > 
> > I prefer first option. It will help in removing
> > .
> 
> Okay. Can you take this up in this series? I understand you may not have
> an tnetv107x board, but at least you can get to a series that builds.
> 
> Even if you choose to do just option #2, I am OK. What I really want to
> see is inline API gone completely (not just remain largely unused). This
> will also help you avoid exposing internal data structures like
> davinci_gpio_controller exposed to the whole kernel. The worse part
> right now is you have two copies of the same structure exposed globally
> from two different include folders.

I understood. I will take option 2.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 03/11] gpio: davinci: Modify to platform driver

2013-06-13 Thread Philip, Avinash
On Thu, Jun 13, 2013 at 11:47:52, Nori, Sekhar wrote:
> On 6/12/2013 5:40 PM, Philip, Avinash wrote:
> > On Wed, Jun 12, 2013 at 13:13:59, Nori, Sekhar wrote:
> >> On 6/11/2013 6:25 PM, Philip, Avinash wrote:
> >>
> >>> On Tue, Jun 11, 2013 at 17:26:06, Nori, Sekhar wrote:
> >>
> >>>> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> >>
> >>>>> @@ -179,13 +204,10 @@ static int __init davinci_gpio_setup(void)
> >>>>> gpiochip_add(&ctlrs[i].chip);
> >>>>> }
> >>>>>  
> >>>>> -   soc_info->gpio_ctlrs = ctlrs;
> >>>>
> >>>>> -   soc_info->gpio_ctlrs_num = DIV_ROUND_UP(ngpio, 32);
> >>>>
> >>>> You drop setting gpio_ctlrs_num here and don't introduce it anywhere
> >>>> else in the patchset so in effect you render the inline gpio get/set API
> >>>> useless. Looks like this initialization should be moved to platform code?
> >>>
> >>> With [PATCH 08/11] ARM: davinci: start using gpiolib support gpio get/set 
> >>> API
> >>> Has no more dependency on soc_info->gpio_ctlrs_num.
> >>
> >> With this series, you have removed support for inline gpio get/set API.
> >> I see that the inline functions are still available for use on
> >> tnetv107x. I wonder why it is important to keep these for tnetv107x when
> >> not necessary for other DaVinci devices?
> > 
> > To support DT boot in da850, gpio davinci has to be converted to a driver 
> > and
> > remove references to davinci_soc_info from driver. But tnetv107x has 
> > separate GPIO driver and reference to davinci_soc_info can also be removed.
> > But I didn't found defconfig support for tnetv107x platforms and left 
> > untouched.
> > As I will not be able to build and test on tnetv107x, I prefer to not touch 
> > it.
> 
> You can always build it by enabling it in menuconfig. Its an ARMv6
> platform so you will have to disable other ARMv5 based platforms from
> while enabling it. ARMv5 and ARMv6 cannot co-exist in the same image.

I will try and update.

> 
> > 
> >>
> >> When you are removing this feature, please note it prominently in your
> >> cover letter and patch description.
> > 
> > Ok
> > 
> >> Also, please provide some data on 
> >> how the latency now compares to that of inline access earlier. This is
> >> important especially for the read.
> > 
> > I am not sure whether I understood correctly or not? Meanwhile I had done
> > an experiment by reading printk timing before and after gpio_get_value from
> > a test module. I think this will help in software latency for inline access 
> > over
> > gpiolib specific access.
> > 
> > gpio_get_value latency testing code
> > 
> > +
> > +   local_irq_disable();
> > +   pr_emerg("%d %x\n", __LINE__, jiffies);
> > +   gpio_get_value(gpio_num);
> > +   pr_emerg("%d %x\n", __LINE__, jiffies);
> > +   local_irq_enable();
> > 
> > inline gpio functions with interrupt disabled
> > [   29.734337] 81 966c
> > [   29.736847] 83 966c
> > 
> > Time diff = 0.00251
> > 
> > gpio library with interrupt disabled
> > 
> > [  272.876763] 81 f567
> > [  272.879291] 83 f567
> > 
> > Time diff = 0.002528
> > 
> > Inline function takes less time as expected.
> 
> Okay, please note these experiments in your cover letter. Its an 18usec
> difference. I have no reference to say if that will affect any
> application, but it will at least serve as information for someone who
> may get affected by it.

Ok I will give above details in commit message.

> 
> > 
> >> For the writes, gpio clock will
> >> mostly determine how soon the value changes on the pin.
> >>
> >> I am okay with removing the inline access feature. It helps simplify
> >> code and most arm machines don't use them. I would just like to see some
> >> data for justification as this can be seen as feature regression. Also,
> >> if we are removing it, its better to also remove it completely and get
> >> the LOC savings instead of just stopping its usage.
> > 
> > I see build failure with below patch for tnetv107x
> > [v6,6/6] Davinci: tnetv107x default configuration 
> 
> Where is this patch?

This patch is not in mainline and got it from patchwork
https://patchwork.kernel.org/patch/978

RE: [PATCH 03/11] gpio: davinci: Modify to platform driver

2013-06-12 Thread Philip, Avinash
On Wed, Jun 12, 2013 at 13:13:59, Nori, Sekhar wrote:
> On 6/11/2013 6:25 PM, Philip, Avinash wrote:
> 
> > On Tue, Jun 11, 2013 at 17:26:06, Nori, Sekhar wrote:
> 
> >> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> 
> >>> @@ -179,13 +204,10 @@ static int __init davinci_gpio_setup(void)
> >>>   gpiochip_add(&ctlrs[i].chip);
> >>>   }
> >>>  
> >>> - soc_info->gpio_ctlrs = ctlrs;
> >>
> >>> - soc_info->gpio_ctlrs_num = DIV_ROUND_UP(ngpio, 32);
> >>
> >> You drop setting gpio_ctlrs_num here and don't introduce it anywhere
> >> else in the patchset so in effect you render the inline gpio get/set API
> >> useless. Looks like this initialization should be moved to platform code?
> > 
> > With [PATCH 08/11] ARM: davinci: start using gpiolib support gpio get/set 
> > API
> > Has no more dependency on soc_info->gpio_ctlrs_num.
> 
> With this series, you have removed support for inline gpio get/set API.
> I see that the inline functions are still available for use on
> tnetv107x. I wonder why it is important to keep these for tnetv107x when
> not necessary for other DaVinci devices?

To support DT boot in da850, gpio davinci has to be converted to a driver and
remove references to davinci_soc_info from driver. But tnetv107x has 
separate GPIO driver and reference to davinci_soc_info can also be removed.
But I didn't found defconfig support for tnetv107x platforms and left untouched.
As I will not be able to build and test on tnetv107x, I prefer to not touch it.

> 
> When you are removing this feature, please note it prominently in your
> cover letter and patch description.

Ok

> Also, please provide some data on 
> how the latency now compares to that of inline access earlier. This is
> important especially for the read.

I am not sure whether I understood correctly or not? Meanwhile I had done
an experiment by reading printk timing before and after gpio_get_value from
a test module. I think this will help in software latency for inline access over
gpiolib specific access.

gpio_get_value latency testing code

+
+   local_irq_disable();
+   pr_emerg("%d %x\n", __LINE__, jiffies);
+   gpio_get_value(gpio_num);
+   pr_emerg("%d %x\n", __LINE__, jiffies);
+   local_irq_enable();

inline gpio functions with interrupt disabled
[   29.734337] 81 966c
[   29.736847] 83 966c

Time diff = 0.00251

gpio library with interrupt disabled

[  272.876763] 81 f567
[  272.879291] 83 f567

Time diff = 0.002528

Inline function takes less time as expected.

> For the writes, gpio clock will
> mostly determine how soon the value changes on the pin.
> 
> I am okay with removing the inline access feature. It helps simplify
> code and most arm machines don't use them. I would just like to see some
> data for justification as this can be seen as feature regression. Also,
> if we are removing it, its better to also remove it completely and get
> the LOC savings instead of just stopping its usage.

I see build failure with below patch for tnetv107x
[v6,6/6] Davinci: tnetv107x default configuration 

So I prefer to leave tnetv107x platform for now.

Thanks
Avinash

> 



RE: [PATCH 01/11] ARM: davinci: GPIO: Add platform data structure

2013-06-11 Thread Philip, Avinash
On Tue, Jun 11, 2013 at 16:06:18, Nori, Sekhar wrote:
> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> > From: KV Sujith 
> > 
> > Add struct davinci_gpio_platform_data davinci gpio module.
> > 
> > Signed-off-by: KV Sujith 
> > Signed-off-by: Philip Avinash 
> 
> As Linus commented before, this should be merged with 03/11.

Ok

> 
> > ---
> >  include/linux/platform_data/gpio-davinci.h |   27 
> > +++
> >  1 file changed, 27 insertions(+)
> >  create mode 100644 include/linux/platform_data/gpio-davinci.h
> > 
> > diff --git a/include/linux/platform_data/gpio-davinci.h 
> > b/include/linux/platform_data/gpio-davinci.h
> > new file mode 100644
> > index 000..f1c8277
> > --- /dev/null
> > +++ b/include/linux/platform_data/gpio-davinci.h
> > @@ -0,0 +1,27 @@
> > +/*
> > + * gpio-davinci.h
> 
> I would drop this unnecessary filename mention as well.

Ok

> 
> > + *
> > + * DaVinci GPIO Platform Related Defines
> > + *
> > + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License as
> > + * published by the Free Software Foundation version 2.
> > + *
> > + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> > + * kind, whether express or implied; without even the implied warranty
> > + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + */
> > +
> > +#ifndef __ASM_ARCH_DAVINCI_GPIO_H
> > +#define __ASM_ARCH_DAVINCI_GPIO_H
> 
> This should now be __PLATFORM_DATA_DAVINCI_GPIO_H__ or some such since
> the file as been moved out of arch specific folder.

As Sergei pointed out, macro name will change to __GPIO_DAVINCI_H in next 
revision.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 03/11] gpio: davinci: Modify to platform driver

2013-06-11 Thread Philip, Avinash
On Tue, Jun 11, 2013 at 17:26:06, Nori, Sekhar wrote:
> 
> 
> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> > From: KV Sujith 
> > 
> > Modify GPIO Davinci driver to be compliant to standard platform drivers.
> > The driver did not have platform driver structure or a probe. Instead,
> > had a davinci_gpio_setup() function which is called in the pure_init
> > sequence. The function also had dependency on davinci_soc_info structure
> > of the corresponding platform. For Device Tree(DT) implementation, we
> > need to get rid of the dependency on the davinci_soc_info structure.
> > Hence as a first stage of DT conversion, we implement a probe. Future
> > commits shall modify the probe to read platform related data from DT.
> > 
> > - Add platform_driver structure and driver register function for davinci
> >   GPIO driver. The driver registration is made to happen in
> >   postcore_initcall. This is required since machine init functions like
> >   da850_lcd_hw_init() make use of GPIO.
> > - Convert the davinci_gpio_setup() to davinci_gpio_probe().
> > - Remove access of members in soc_info structure. Instead, relevant data
> >   are taken from davinci_gpio_platform_data structure pointed by
> >   pdev->dev.platform_data.
> > - Change clk_get() to devm_clk_get() as devm_clk_get() is a device
> >   managed function and makes error handling simpler.
> > - Change pr_err to dev_err for ngpio error reporting.
> > - Arrange include files and variables in alphabetical order
> > 
> > Signed-off-by: KV Sujith 
> > [avinashphi...@ti.com: Move global definition for "struct
> > davinci_gpio_controller" variable to local in probe and set it as driver
> > data.]
> > Signed-off-by: Philip Avinash 
> > ---
> > +#include 
> > +#include 
> > +#include 
> 
> > +#include 
> 
> This include seems unnecessary.

This include is not required.

> 
> >  
> >  #include 
> 
> While at it, you can get rid of this include and use  instead?

Ok

> 
> >  
> > +   pdata = dev->platform_data;
> > +   if (!pdata) {
> > +   dev_err(dev, "GPIO: No Platform Data Supplied\n");
> 
> dev_err should already tell that the error is coming from davinci-gpio
> so no need to prefix GPIO: again.

Ok

> 
> > +   return -EINVAL;
> > +   }
> > -   if (WARN_ON(!gpio_base))
> > +   ctlrs = devm_kzalloc(dev,
> > +   ngpio * sizeof(struct davinci_gpio_controller), GFP_KERNEL);
> 
> Line break alignment needs fixing.

Ok

> 
> > +   if (!ctlrs) {
> > +   dev_err(dev, "Memory alloc failed\n");
> > return -ENOMEM;
> > +   }
> > +
> > +   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +   if (unlikely(!res)) {
> > +   dev_err(dev, "Invalid mem resource\n");
> > +   return -ENODEV;
> 
> -EBUSY is better if you cannot get the resource.

Ok

> 
> > +   }
> > +
> > +   gpio_base = devm_ioremap_resource(dev, res);
> > +   if (!gpio_base)
> > +   return -EADDRNOTAVAIL;
> 
> devm_ioremap_resource gives an error encoder pointer if it fails so
> please use that instead of masking it.

Ok

> 
> >  
> > for (i = 0, base = 0; base < ngpio; i++, base += 32) {
> > ctlrs[i].chip.label = "DaVinci";
> > @@ -179,13 +204,10 @@ static int __init davinci_gpio_setup(void)
> > gpiochip_add(&ctlrs[i].chip);
> > }
> >  
> > -   soc_info->gpio_ctlrs = ctlrs;
> 
> > -   soc_info->gpio_ctlrs_num = DIV_ROUND_UP(ngpio, 32);
> 
> You drop setting gpio_ctlrs_num here and don't introduce it anywhere
> else in the patchset so in effect you render the inline gpio get/set API
> useless. Looks like this initialization should be moved to platform code?

With [PATCH 08/11] ARM: davinci: start using gpiolib support gpio get/set API
Has no more dependency on soc_info->gpio_ctlrs_num.

I can merge [PATCH 08/11] ARM: davinci: start using gpiolib support to
[PATCH 03/11] gpio: davinci: Modify to platform driver

> 
> > -

> > +   pdata = dev->platform_data;
> > +   ngpio = pdata->ngpio;
> > +   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > +   if (unlikely(!res)) {
> > +   dev_err(dev, "Invalid IRQ resource\n");
> > +   return -ENODEV;
> 
> -EBUSY again?

Ok

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH 00/11] Convert GPIO Davinci to platform driver

2013-06-10 Thread Philip, Avinash
On Tue, Jun 11, 2013 at 10:09:17, Nori, Sekhar wrote:
> 
> On 6/10/2013 2:32 PM, Philip, Avinash wrote:
> > On Fri, Jun 07, 2013 at 13:40:52, Nori, Sekhar wrote:
> >> Hi Avinash,
> >>
> >> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> >>> GPIO Davinci driver converted to platform driver to support DT booting.
> >>> In this patch series
> >>> - Cleaned gpio Davinci driver code with proper commenting style and 
> >>> appropriate
> >>>   variable names.
> >>> - Create platform driver for GPIO Davinci in da8xx and dm* platforms and 
> >>> removed
> >>>   gpio related member updation in davinci_soc_info structure.
> >>> - DT support added for da850 board and tested on da850 EVM.
> >>> - Remove soc_info reference in the gpio davinci driver and start uses
> >>>   gpiolib interface.
> >>
> >> Can you please document which platforms this series was tested on and how?
> > 
> > This series being tested on da850 EVM. Tested by setting VPIF_DOUT[12] as 
> > GPIO
> > pin [2] and reading GPIO status from GPIO[7,4]
> > 
> > GPIO[7,4] will reflect the status switch number 8 of the S7 dip switch in 
> > DA850 EVM.
> > 
> > Testing Procedure
> > 
> > Requirement GPIO SYSFS support [1]
> > 
> > #echo 116 > /sys/class/gpio/export
> > setting GPIO[7,4] as input GPIO
> > #echo "in" > /sys/class/gpio/gpio116/direction
> > #mount -t debugfs debugfs /sys/kernel/debug
> > Reading GPIO pin status
> > #cat /sys/kernel/debug/gpio
> > #echo 116 > /sys/class/gpio/unexport
> > 
> > 
> > 1. Enable GPIO SYSFS support through menconfig
> > --- GPIO Support
> > [ ]   Debug GPIO calls
> >[ ]   /sys/class/gpio/... (sysfs interface)
> >  
> > 2. Patch for pinmux support for GPIO[7,4] is available at
> > https://github.com/avinashphilip/am335x_linux/commits/linux_davinci_v3.10_soc_gpio
> 
> Can you check interrupt generation too since there are significant
> changes in that area? You can generate an interrupt using the MMC/SD
> card detect pin (inserting an MMC/SD card into the slot should generate
> an interrupt). You can also write a new value to any GPIO pin. That will
> also trigger an interrupt.

I have tested GPIO interrupt with GPIO[7,4] by inserting a kernel module in 
DA850 EVM.
For GPIO interrupt generation DIP switch position changed.

Source code for GPIO test kernel module is shared at
https://github.com/avinashphilip/am335x_linux/commit/affc0c1841beacd8430af689f7f12dcab0cbaf28

> 
> It will be nice if you can test this series on DM365 as well (read/write
> as well as interrupt).

Don't have any DM365 board for testing.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 09/11] gpio: davinci: DT changes for driver

2013-06-10 Thread Philip, Avinash
On Thu, May 30, 2013 at 23:55:22, Linus Walleij wrote:
> On Wed, May 22, 2013 at 9:10 AM, Philip Avinash  wrote:
> 
> (...)
> > +- interrupts: The Starting IRQ number for GPIO
> > +- intc_irq_num: The number of IRQs supported by the Interrupt Controller
> (...)
> 
> No this is not how you pass a number of IRQs in the device tree.
> 
> "interrupts" is an array. Pass every interrupt here for a full
> resolution of the IRQs.

Correct. I will change.

> 
> Further this looks fishy:
> 
> + interrupts = <42>;
> 
> Usually you pass flags with the IRQs, I would rather have expected
> an array like this:
> 
> interrupts = < 90 0x4 96 0x4 14 0x4 15 0x4 79 0x4>;
> 
> 0x4 is IRQ_TYPE_LEVEL_HIGH, you can use the dts
> #include  and
> define that symbolically.
> 
> Doesn't the DaVinci IRQ controller support *any* IRQ flags?

I wasn't sure about it.
But from davinci GPIO driver perspective, GPIO pins are
configured as edge sensitive. So IRQ_TYPE_EDGE_BOTH can be used.

So I will correct Documentation and update DT nodes in next version.

> 
> Since the driver code is not reading out the interrupts but
> (I guess?) falling back to platform data IRQ assignment,
> this seems wrong.

Driver code reads "Starting IRQ number for GPIO" from platform resource
See [PATCH 03/11] gpio: davinci: Modify to platform driver.
Driver requires only starting offset of gpio irq number. GPIO interrupt
Number expected in sequential order for davinci GPIO.

Thanks
Avinash

 
> Yours,
> Linus Walleij
> 

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


RE: [PATCH 00/11] Convert GPIO Davinci to platform driver

2013-06-10 Thread Philip, Avinash
On Fri, Jun 07, 2013 at 13:40:52, Nori, Sekhar wrote:
> Hi Avinash,
> 
> On 5/22/2013 12:40 PM, Philip Avinash wrote:
> > GPIO Davinci driver converted to platform driver to support DT booting.
> > In this patch series
> > - Cleaned gpio Davinci driver code with proper commenting style and 
> > appropriate
> >   variable names.
> > - Create platform driver for GPIO Davinci in da8xx and dm* platforms and 
> > removed
> >   gpio related member updation in davinci_soc_info structure.
> > - DT support added for da850 board and tested on da850 EVM.
> > - Remove soc_info reference in the gpio davinci driver and start uses
> >   gpiolib interface.
> 
> Can you please document which platforms this series was tested on and how?

This series being tested on da850 EVM. Tested by setting VPIF_DOUT[12] as GPIO
pin [2] and reading GPIO status from GPIO[7,4]

GPIO[7,4] will reflect the status switch number 8 of the S7 dip switch in DA850 
EVM.

Testing Procedure

Requirement GPIO SYSFS support [1]

#echo 116 > /sys/class/gpio/export
setting GPIO[7,4] as input GPIO
#echo "in" > /sys/class/gpio/gpio116/direction
#mount -t debugfs debugfs /sys/kernel/debug
Reading GPIO pin status
#cat /sys/kernel/debug/gpio
#echo 116 > /sys/class/gpio/unexport


1. Enable GPIO SYSFS support through menconfig
--- GPIO Support
[ ]   Debug GPIO calls
   [ ]   /sys/class/gpio/... (sysfs interface)
 
2. Patch for pinmux support for GPIO[7,4] is available at
https://github.com/avinashphilip/am335x_linux/commits/linux_davinci_v3.10_soc_gpio


Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 02/11] gpio: davinci: coding style correction

2013-05-22 Thread Philip, Avinash
On Wed, May 22, 2013 at 20:10:42, Russell King - ARM Linux wrote:
> On Wed, May 22, 2013 at 12:40:25PM +0530, Philip Avinash wrote:
> >  /*
> >   * Assuming the pin is muxed as a gpio output, set its output value.
> >   */
> > -static void
> > -davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> > +static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset,
> > +   int value)
> 
> This kind of stuff is just churn.  If you read Documentation/CodingStyle:
> 
> Statements longer than 80 columns will be broken into sensible chunks, unless
> exceeding 80 columns significantly increases readability and does not hide
> information. Descendants are always substantially shorter than the parent and
> are placed substantially to the right. The same applies to function headers
> with a long argument list. However, never break user-visible strings such as
> printk messages, because that breaks the ability to grep for them.
> 
> "broken into sensible chunks".  Here's the question: is the former a
> sensible format?  Arguably it is because it results in all the arguments
> fitting on one line at the expense of missing the return value.
> 
> The latter is also a sensible format - but breaks the arguments instead
> of the return value.
> 
> Both formats can be found in their entirety by grep by function name alone:
> 
>   grep -1 davinci_gpio_set
> 
> or if you prefer to type some more then you end up with more specific
> 
>   grep -A1 davinci_gpio_set
> or
>   grep -B1 davinci_gpio_set
> 
> depending on the version.
> 
> Where there's no clear advantage one way or the other, let the authors
> preference stand.

Ok I understood and I will remove these changes in next version.

Thanks
Avinash

> 

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


RE: [PATCH 02/11] gpio: davinci: coding style correction

2013-05-22 Thread Philip, Avinash
On Wed, May 22, 2013 at 18:29:46, Sergei Shtylyov wrote:
> Hello.
> 
> On 22-05-2013 11:10, Philip Avinash wrote:
> 
> > 1. Corrects coding and commenting styles
> > 2. Variables name change to meaningful name
> > 3. Remove unnecessary variable usage
> > 4. Add BINTEN macro definition
> >
> > Signed-off-by: Philip Avinash 
> > ---
> >   drivers/gpio/gpio-davinci.c |  182 
> > +--
> >   1 file changed, 89 insertions(+), 93 deletions(-)
> 
> > diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> > index 17df6db..d308955 100644
> > --- a/drivers/gpio/gpio-davinci.c
> > +++ b/drivers/gpio/gpio-davinci.c
> [...]
> > @@ -31,10 +31,11 @@ struct davinci_gpio_regs {
> > u32 intstat;
> >   };
> >
> > +#define BINTEN 0x08 /* GPIO Interrupt Per-Bank Enable Register */
> 
> Empty line needed here.

Ok, I will add.

> 
> >   #define chip2controller(chip) \
> > container_of(chip, struct davinci_gpio_controller, chip)
> >
> [...]
> > @@ -98,8 +94,8 @@ static int davinci_direction_in(struct gpio_chip *chip, 
> > unsigned offset)
> > return __davinci_direction(chip, offset, false, 0);
> >   }
> >
> > -static int
> > -davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
> > +static int davinci_direction_out(struct gpio_chip *chip, unsigned offset,
> > +   int value)
> 
>  This line should be aligned under the next character after (.

Will remove this change as Russel pointed out.

> 
> [...]
> > @@ -113,22 +109,22 @@ davinci_direction_out(struct gpio_chip *chip, 
> > unsigned offset, int value)
> [...]
> >   /*
> >* Assuming the pin is muxed as a gpio output, set its output value.
> >*/
> > -static void
> > -davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> > +static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset,
> > +   int value)
> 
>  Same here.

I will remove this change as Russel pointed out.

> 
> [...]
> > @@ -368,16 +363,16 @@ static int __init davinci_gpio_irq_setup(void)
> [...]
> > for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) {
> > -   chips[bank].chip.to_irq = gpio_to_irq_banked;
> > -   chips[bank].irq_base = soc_info->gpio_unbanked
> > -   ? -EINVAL
> > -   : (soc_info->intc_irq_num + gpio);
> > +   ctlrs[bank].chip.to_irq = gpio_to_irq_banked;
> > +   ctlrs[bank].irq_base = soc_info->gpio_unbanked ?
> > +   -EINVAL : (soc_info->intc_irq_num + gpio);
> 
> () not needed here.

Ok will remove in next version ().

Thanks
Avinash

> 
> WBR, Sergei
> 
> 

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


[PATCH 11/11] ARM: davinci: da850 evm: add GPIO DT data

2013-05-22 Thread Philip Avinash
From: KV Sujith 

- Add GPIO DT Data and pinmux for DA850 EVM. GPIO is configurable differently
  on different boards. So add GPIO pinmuxing in dts file.
- Dependency: This patch is dependent on Grab-pin-control patch;
  https://patchwork.kernel.org/patch/2013751/

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 arch/arm/boot/dts/da850-evm.dts |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c914357..ab59e60 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -17,6 +17,20 @@
soc {
pmx_core: pinmux@1c14120 {
status = "okay";
+   gpio_pins: pinmux_gpio_pins {
+   pinctrl-single,bits = <
+   /* GPIO2_4 GPIO2_6 */
+   0x18 0x8080 0xf0f0
+   /* GPIO2_8 GPIO2_15 */
+   0x14 0x8008 0xf00f
+   /* GPIO3_12 GPIO3_13 */
+   0x1C 0x8800 0xff00
+   /* GPIO4_0 GPIO4_1 */
+   0x28 0x8800 0xff00
+   /* GPIO6_9 GPIO6_10 GPIO6_13 */
+   0x34 0x08800800 0x0ff00f00
+   >;
+   };
};
serial0: serial@1c42000 {
status = "okay";
@@ -90,6 +104,11 @@
};
};
};
+   gpio: gpio@1e26000 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&gpio_pins>;
+   };
};
nand_cs3@6200 {
status = "okay";
-- 
1.7.9.5

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


[PATCH 10/11] ARM: davinci: da850: add GPIO DT entries

2013-05-22 Thread Philip Avinash
From: KV Sujith 

Add DT entries for Davinci GPIO.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 arch/arm/boot/dts/da850.dtsi |9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 452bdc6..9014eba 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -126,6 +126,15 @@
>;
};
};
+   gpio: gpio@1e26000 {
+   compatible = "ti,da830-gpio";
+   reg = <0x226000 0x1000>;
+   interrupts = <42>;
+   ngpio = <144>;
+   intc_irq_num = <101>;
+   gpio_unbanked = <0>;
+   status = "disabled";
+   };
serial0: serial@1c42000 {
compatible = "ns16550a";
reg = <0x42000 0x100>;
-- 
1.7.9.5

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


[PATCH 08/11] ARM: davinci: start using gpiolib support

2013-05-22 Thread Philip Avinash
- Remove NEED_MACH_GPIO_H config option for Davinci platforms to start
  using common gpio library interface.
- Added struct davinci_gpio_controller definitions in platform_data
  directory for Davinci gpio devices.
- Removed GPIO_TYPE_DAVINCI enum definition as GPIO Davinci is converted
  to Linux device driver model.

Signed-off-by: Philip Avinash 
---
 arch/arm/Kconfig  |1 -
 arch/arm/mach-davinci/include/mach/gpio-davinci.h |6 +++--
 include/linux/platform_data/gpio-davinci.h|   27 +
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 13b7394..74d3e85 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -955,7 +955,6 @@ config ARCH_DAVINCI
select GENERIC_CLOCKEVENTS
select GENERIC_IRQ_CHIP
select HAVE_IDE
-   select NEED_MACH_GPIO_H
select USE_OF
select ZONE_DMA
help
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h 
b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
index b325a1d..18140e0 100644
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -23,9 +23,10 @@
 
 #define DAVINCI_GPIO_BASE 0x01C67000
 
+#ifdef CONFIG_ARCH_DAVINCI_TNETV107X
+
 enum davinci_gpio_type {
-   GPIO_TYPE_DAVINCI = 0,
-   GPIO_TYPE_TNETV107X,
+   GPIO_TYPE_TNETV107X = 0,
 };
 
 /*
@@ -90,4 +91,5 @@ static inline u32 __gpio_mask(unsigned gpio)
return 1 << (gpio % 32);
 }
 
+#endif /* CONFIG_ARCH_DAVINCI_TNETV107X */
 #endif /* __DAVINCI_DAVINCI_GPIO_H */
diff --git a/include/linux/platform_data/gpio-davinci.h 
b/include/linux/platform_data/gpio-davinci.h
index f1c8277..75805d4 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -18,10 +18,37 @@
 #ifndef __ASM_ARCH_DAVINCI_GPIO_H
 #define __ASM_ARCH_DAVINCI_GPIO_H
 
+#include 
+
 struct davinci_gpio_platform_data {
u32 ngpio;
u32 gpio_unbanked;
u32 intc_irq_num;
 };
 
+
+struct davinci_gpio_controller {
+   struct gpio_chipchip;
+   int irq_base;
+   spinlock_t  lock;
+   void __iomem*regs;
+   void __iomem*set_data;
+   void __iomem*clr_data;
+   void __iomem*in_data;
+   int gpio_unbanked;
+   unsignedgpio_irq;
+};
+
+/*
+ * basic gpio routines
+ */
+#defineGPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
+
+/* Convert GPIO signal to GPIO pin number */
+#define GPIO_TO_PIN(bank, gpio)(16 * (bank) + (gpio))
+
+static inline u32 __gpio_mask(unsigned gpio)
+{
+   return 1 << (gpio % 32);
+}
 #endif
-- 
1.7.9.5

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


[PATCH 09/11] gpio: davinci: DT changes for driver

2013-05-22 Thread Philip Avinash
From: KV Sujith 

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file
  gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

Cc: Grant Likely 
Cc: Rob Herring 
Cc: Rob Landley 
Cc: devicetree-disc...@lists.ozlabs.org
Cc: linux-...@vger.kernel.org
Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 .../devicetree/bindings/gpio/gpio-davinci.txt  |   26 +
 drivers/gpio/gpio-davinci.c|   57 ++--
 2 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt 
b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
new file mode 100644
index 000..0d599d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
@@ -0,0 +1,26 @@
+Davinci GPIO controller bindings
+
+Required Properties:
+- compatible:"ti,da830-gpio"
+
+- reg: Physical base address of the controller and length of memory mapped
+   region.
+
+- interrupts: The Starting IRQ number for GPIO
+
+- ngpio: The number of GPIO pins supported
+
+- intc_irq_num: The number of IRQs supported by the Interrupt Controller
+
+- gpio_unbanked: The number of GPIOs that have an individual interrupt
+   line to processor.
+
+Example:
+gpio: gpio@1e26000 {
+   compatible = "ti,da830-gpio";
+   reg = <0x226000 0x1000>;
+   interrupts = <42>;
+   ngpio = <144>;
+   intc_irq_num = <101>;
+   gpio_unbanked = <0>;
+};
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 08830aa..dbe3b83 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -19,6 +19,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -133,6 +135,50 @@ static void davinci_gpio_set(struct gpio_chip *chip, 
unsigned offset,
__raw_writel((1 << offset), value ? ®s->set_data : ®s->clr_data);
 }
 
+static struct davinci_gpio_platform_data *davinci_gpio_set_pdata_of(
+   struct platform_device *pdev)
+{
+   struct device_node *dn = pdev->dev.of_node;
+   struct davinci_gpio_platform_data *pdata;
+   u32 val, ret;
+
+   pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata) {
+   ret = of_property_read_u32(dn, "ngpio", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->ngpio = val;
+
+   ret = of_property_read_u32(dn, "gpio_unbanked", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->gpio_unbanked = val;
+
+   ret = of_property_read_u32(dn, "intc_irq_num", &val);
+   if (ret)
+   goto of_err;
+
+   pdata->intc_irq_num = val;
+   }
+
+   return pdata;
+
+of_err:
+   dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret);
+   return NULL;
+}
+
+static const struct of_device_id davinci_gpio_ids[] = {
+   {
+   .compatible = "ti,da830-gpio",
+   },
+   { },
+};
+
+MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
+
 static int davinci_gpio_probe(struct platform_device *pdev)
 {
int i, base;
@@ -142,13 +188,17 @@ static int davinci_gpio_probe(struct platform_device 
*pdev)
struct davinci_gpio_regs *regs;
struct device *dev = &pdev->dev;
struct resource *res;
+   const struct of_device_id *match =
+   of_match_device(of_match_ptr(davinci_gpio_ids), &pdev->dev);
 
-   pdata = dev->platform_data;
+   pdata = match ? davinci_gpio_set_pdata_of(pdev) : dev->platform_data;
if (!pdata) {
dev_err(dev, "GPIO: No Platform Data Supplied\n");
return -EINVAL;
}
 
+   dev->platform_data = pdata;
+
/*
 * The gpio banks conceptually expose a segmented bitmap,
 * and "ngpio" is one more than the largest zero-based
@@ -490,8 +540,9 @@ done:
 static struct platform_driver davinci_gpio_driver = {
.probe  = davinci_gpio_probe,
.driver = {
-   .name   = "davinci_gpio",
-   .owner  = THIS_MODULE,
+   .name   = "davinci_gpio",
+   .owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(davinci_gpio_ids),
},
 };
 
-- 
1.7.9.5

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


[PATCH 07/11] ARM: davinci: create davinci gpio device for dm platforms

2013-05-22 Thread Philip Avinash
Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/board-dm355-evm.c |   27 ++
 arch/arm/mach-davinci/board-dm355-leopard.c |1 +
 arch/arm/mach-davinci/board-dm365-evm.c |   28 +++
 arch/arm/mach-davinci/board-dm644x-evm.c|   26 +
 arch/arm/mach-davinci/board-dm646x-evm.c|   27 ++
 arch/arm/mach-davinci/board-neuros-osd2.c   |1 +
 arch/arm/mach-davinci/dm355.c   |4 
 arch/arm/mach-davinci/dm365.c   |5 -
 arch/arm/mach-davinci/dm644x.c  |4 
 arch/arm/mach-davinci/dm646x.c  |4 
 arch/arm/mach-davinci/include/mach/common.h |2 ++
 11 files changed, 112 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c 
b/arch/arm/mach-davinci/board-dm355-evm.c
index bfdf8b9..785c7b8 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -28,9 +28,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include "davinci.h"
 
@@ -311,9 +313,34 @@ static struct spi_board_info dm355_evm_spi_info[] 
__initconst = {
},
 };
 
+static struct resource dm355_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DM355_GPIOBNK0,
+   .end= IRQ_DM355_GPIOBNK6,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
+   .ngpio = 104,
+   .intc_irq_num = DAVINCI_N_AINTC_IRQ,
+};
+
 static __init void dm355_evm_init(void)
 {
struct clk *aemif;
+   int ret;
+
+   ret = davinci_gpio_register(dm355_gpio_resources,
+   sizeof(dm355_gpio_resources),
+   &dm355_gpio_platform_data);
+   if (ret)
+   pr_warn("dm355_evm_init: GPIO init failed: %d\n", ret);
 
gpio_request(1, "dm9000");
gpio_direction_input(1);
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c 
b/arch/arm/mach-davinci/board-dm355-leopard.c
index dff4ddc..34a2b64 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index 4cfdd91..623263e 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -586,8 +587,35 @@ static struct spi_board_info dm365_evm_spi_info[] 
__initconst = {
},
 };
 
+static struct resource dm365_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DM365_GPIO0,
+   .end= IRQ_DM365_GPIO7,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
+   .ngpio = 104,
+   .intc_irq_num = DAVINCI_N_AINTC_IRQ,
+   .gpio_unbanked = 8,
+};
+
 static __init void dm365_evm_init(void)
 {
+   int ret;
+
+   ret = davinci_gpio_register(dm365_gpio_resources,
+   sizeof(dm365_gpio_resources),
+   &dm365_gpio_platform_data);
+   if (ret)
+   pr_warn("dm365_evm_init: GPIO init failed: %d\n", ret);
+
evm_init_i2c();
davinci_serial_init(&uart_config);
 
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
b/arch/arm/mach-davinci/board-dm644x-evm.c
index fc8e38e..76d9f6b 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "davinci.h"
 
@@ -755,11 +756,36 @@ static int davinci_phy_fixup(struct phy_device *phydev)
 
 #define HAS_NAND   IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
 
+static struct resource dm644_gpio_resources[] = {
+   { /* registers */
+   .start  = DAVINCI_GPIO_BASE,
+   .end= DAVINCI_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_GPIOBNK0,
+   .end= IRQ_GPIOBNK4,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
+   .ngpio = 71,
+   .intc_irq_num = DAVINCI_N_AINTC_IRQ,
+};
+
 static __init void davinci_evm_init(void)
 {

[PATCH 06/11] ARM: davinci: da8xx: gpio device creation

2013-05-22 Thread Philip Avinash
Create davinci gpio device and remove references in davinci_soc_info
structure. Also rearrange header file inclusion in group basis.

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/board-da830-evm.c |   19 +++
 arch/arm/mach-davinci/board-da850-evm.c |   11 +++
 arch/arm/mach-davinci/board-omapl138-hawk.c |2 ++
 arch/arm/mach-davinci/da830.c   |4 
 arch/arm/mach-davinci/da850.c   |4 
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c 
b/arch/arm/mach-davinci/board-da830-evm.c
index 1332de8..4e8bcc1 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -22,17 +22,19 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#include 
 
 #define DA830_EVM_PHY_ID   ""
 /*
@@ -590,11 +592,20 @@ static struct spi_board_info da830evm_spi_info[] = {
},
 };
 
+static struct davinci_gpio_platform_data da830_gpio_platform_data = {
+   .ngpio = 128,
+   .intc_irq_num = DA830_N_CP_INTC_IRQ,
+};
+
 static __init void da830_evm_init(void)
 {
struct davinci_soc_info *soc_info = &davinci_soc_info;
int ret;
 
+   ret = da8xx_register_gpio(&da830_gpio_platform_data);
+   if (ret)
+   pr_warn("da830_evm_init: GPIO init failed: %d\n", ret);
+
ret = da830_register_edma(da830_edma_rsv);
if (ret)
pr_warning("da830_evm_init: edma registration failed: %d\n",
diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
b/arch/arm/mach-davinci/board-da850-evm.c
index 8a24b6c..d5dd010 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1138,6 +1140,11 @@ static struct edma_rsv_info *da850_edma_rsv[2] = {
&da850_edma_cc1_rsv,
 };
 
+static struct davinci_gpio_platform_data da850_gpio_platform_data = {
+   .ngpio = 144,
+   .intc_irq_num = DA850_N_CP_INTC_IRQ,
+};
+
 #ifdef CONFIG_CPU_FREQ
 static __init int da850_evm_init_cpufreq(void)
 {
@@ -1444,6 +1451,10 @@ static __init void da850_evm_init(void)
 {
int ret;
 
+   ret = da8xx_register_gpio(&da850_gpio_platform_data);
+   if (ret)
+   pr_warn("da850_evm_init: GPIO init failed: %d\n", ret);
+
ret = pmic_tps65070_init();
if (ret)
pr_warn("%s: TPS65070 PMIC init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c 
b/arch/arm/mach-davinci/board-omapl138-hawk.c
index b8c20de..1f44a1b 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -20,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define HAWKBOARD_PHY_ID   "davinci_mdio-0:07"
 #define DA850_HAWK_MMCSD_CD_PINGPIO_TO_PIN(3, 12)
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index abbaf02..e7b79ee 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1195,10 +1195,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
.intc_irq_prios = da830_default_priorities,
.intc_irq_num   = DA830_N_CP_INTC_IRQ,
.timer_info = &da830_timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 128,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata,
 };
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 4d69338..5f7cfa4 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1297,10 +1297,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
.intc_irq_prios = da850_default_priorities,
.intc_irq_num   = DA850_N_CP_INTC_IRQ,
.timer_info = &da850_timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 144,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata,
.sram_dma   = DA8XX_SHARED_RAM_BASE,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-ker

[PATCH 05/11] ARM: davinci: creation of gpio platform device for dm platforms

2013-05-22 Thread Philip Avinash
gpio controller resource information being associated with
davinci_soc_info structure and not created any device. Hence davinci
gpio didn't fall under proper device model. This patch creates gpio
davinci as a platform device for dm platforms.
Also add daivinci_register_gpio API to create platform device for dm*
platforms.

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/devices.c |   13 +
 arch/arm/mach-davinci/include/mach/common.h |2 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index a7068a3..b4f345b 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -313,6 +313,19 @@ static void davinci_init_wdt(void)
platform_device_register(&davinci_wdt_device);
 }
 
+static struct platform_device davinci_gpio_device = {
+   .name   = "davinci_gpio",
+   .id = -1,
+};
+
+int davinci_gpio_register(struct resource *res, int size, void *pdata)
+{
+   davinci_gpio_device.resource = res;
+   davinci_gpio_device.num_resources = size;
+   davinci_gpio_device.dev.platform_data = pdata;
+   return platform_device_register(&davinci_gpio_device);
+}
+
 /*-*/
 
 /*-*/
diff --git a/arch/arm/mach-davinci/include/mach/common.h 
b/arch/arm/mach-davinci/include/mach/common.h
index b124b77..bd389ba 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 extern void davinci_timer_init(void);
 
@@ -83,6 +84,7 @@ extern void davinci_common_init(struct davinci_soc_info 
*soc_info);
 extern void davinci_init_ide(void);
 void davinci_restart(char mode, const char *cmd);
 void davinci_init_late(void);
+int davinci_gpio_register(struct resource *res, int size, void *pdata);
 
 #ifdef CONFIG_DAVINCI_RESET_CLOCKS
 int davinci_clk_disable_unused(void);
-- 
1.7.9.5

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


[PATCH 04/11] ARM: davinci: da8xx: creation of gpio platform device

2013-05-22 Thread Philip Avinash
From: KV Sujith 

gpio controller resource information being associated with
davinci_soc_info structure and not created any device. Hence davinci
gpio didn't fall under proper device model. This patch creates gpio
davinci as a platform device for da8xx platforms.

- Add Memory and IRQ resources for DA8xx.
- Register GPIO platform driver for DA8xx.
- Add da8xx_register_gpio API to create platform device for da8xx
  platforms.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/devices-da8xx.c  |   26 ++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 2 files changed, 27 insertions(+)

diff --git a/arch/arm/mach-davinci/devices-da8xx.c 
b/arch/arm/mach-davinci/devices-da8xx.c
index bf57252..892ad86 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -640,6 +640,32 @@ int __init da8xx_register_lcdc(struct 
da8xx_lcdc_platform_data *pdata)
return platform_device_register(&da8xx_lcdc_device);
 }
 
+static struct resource da8xx_gpio_resources[] = {
+   { /* registers */
+   .start  = DA8XX_GPIO_BASE,
+   .end= DA8XX_GPIO_BASE + SZ_4K - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+   { /* interrupt */
+   .start  = IRQ_DA8XX_GPIO0,
+   .end= IRQ_DA8XX_GPIO8,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct platform_device da8xx_gpio_device = {
+   .name   = "davinci_gpio",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(da8xx_gpio_resources),
+   .resource   = da8xx_gpio_resources,
+};
+
+int __init da8xx_register_gpio(void *pdata)
+{
+   da8xx_gpio_device.dev.platform_data = pdata;
+   return platform_device_register(&da8xx_gpio_device);
+}
+
 static struct resource da8xx_mmcsd0_resources[] = {
{   /* registers */
.start  = DA8XX_MMCSD0_BASE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index 2e1c9ea..aa66690 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -96,6 +96,7 @@ int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
 int da850_register_mmcsd1(struct davinci_mmc_config *config);
 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
 int da8xx_register_rtc(void);
+int da8xx_register_gpio(void *pdata);
 int da850_register_cpufreq(char *async_clk);
 int da8xx_register_cpuidle(void);
 void __iomem * __init da8xx_get_mem_ctlr(void);
-- 
1.7.9.5

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


[PATCH 02/11] gpio: davinci: coding style correction

2013-05-22 Thread Philip Avinash
1. Corrects coding and commenting styles
2. Variables name change to meaningful name
3. Remove unnecessary variable usage
4. Add BINTEN macro definition

Signed-off-by: Philip Avinash 
---
 drivers/gpio/gpio-davinci.c |  182 +--
 1 file changed, 89 insertions(+), 93 deletions(-)

diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 17df6db..d308955 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -9,12 +9,12 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-#include 
-#include 
-#include 
+
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 
 #include 
 
@@ -31,10 +31,11 @@ struct davinci_gpio_regs {
u32 intstat;
 };
 
+#define BINTEN 0x08 /* GPIO Interrupt Per-Bank Enable Register */
 #define chip2controller(chip)  \
container_of(chip, struct davinci_gpio_controller, chip)
 
-static struct davinci_gpio_controller chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
+static struct davinci_gpio_controller ctlrs[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
 static void __iomem *gpio_base;
 
 static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio)
@@ -53,42 +54,37 @@ static struct davinci_gpio_regs __iomem __init 
*gpio2regs(unsigned gpio)
ptr = gpio_base + 0xb0;
else
ptr = NULL;
+
return ptr;
 }
 
 static inline struct davinci_gpio_regs __iomem *irq2regs(int irq)
 {
-   struct davinci_gpio_regs __iomem *g;
-
-   g = (__force struct davinci_gpio_regs __iomem *)irq_get_chip_data(irq);
-
-   return g;
+   return (__force struct davinci_gpio_regs __iomem *)
+   irq_get_chip_data(irq);
 }
 
 static int __init davinci_gpio_irq_setup(void);
 
-/*--*/
-
-/* board setup code *MUST* setup pinmux and enable the GPIO clock. */
 static inline int __davinci_direction(struct gpio_chip *chip,
unsigned offset, bool out, int value)
 {
-   struct davinci_gpio_controller *d = chip2controller(chip);
-   struct davinci_gpio_regs __iomem *g = d->regs;
+   struct davinci_gpio_controller *ctlr = chip2controller(chip);
+   struct davinci_gpio_regs __iomem *regs = ctlr->regs;
unsigned long flags;
u32 temp;
u32 mask = 1 << offset;
 
-   spin_lock_irqsave(&d->lock, flags);
-   temp = __raw_readl(&g->dir);
+   spin_lock_irqsave(&ctlr->lock, flags);
+   temp = __raw_readl(®s->dir);
if (out) {
temp &= ~mask;
-   __raw_writel(mask, value ? &g->set_data : &g->clr_data);
+   __raw_writel(mask, value ? ®s->set_data : ®s->clr_data);
} else {
temp |= mask;
}
-   __raw_writel(temp, &g->dir);
-   spin_unlock_irqrestore(&d->lock, flags);
+   __raw_writel(temp, ®s->dir);
+   spin_unlock_irqrestore(&ctlr->lock, flags);
 
return 0;
 }
@@ -98,8 +94,8 @@ static int davinci_direction_in(struct gpio_chip *chip, 
unsigned offset)
return __davinci_direction(chip, offset, false, 0);
 }
 
-static int
-davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
+static int davinci_direction_out(struct gpio_chip *chip, unsigned offset,
+   int value)
 {
return __davinci_direction(chip, offset, true, value);
 }
@@ -113,22 +109,22 @@ davinci_direction_out(struct gpio_chip *chip, unsigned 
offset, int value)
  */
 static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-   struct davinci_gpio_controller *d = chip2controller(chip);
-   struct davinci_gpio_regs __iomem *g = d->regs;
+   struct davinci_gpio_controller *ctlr = chip2controller(chip);
+   struct davinci_gpio_regs __iomem *regs = ctlr->regs;
 
-   return (1 << offset) & __raw_readl(&g->in_data);
+   return (1 << offset) & __raw_readl(®s->in_data);
 }
 
 /*
  * Assuming the pin is muxed as a gpio output, set its output value.
  */
-static void
-davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+static void davinci_gpio_set(struct gpio_chip *chip, unsigned offset,
+   int value)
 {
-   struct davinci_gpio_controller *d = chip2controller(chip);
-   struct davinci_gpio_regs __iomem *g = d->regs;
+   struct davinci_gpio_controller *ctlr = chip2controller(chip);
+   struct davinci_gpio_regs __iomem *regs = ctlr->regs;
 
-   __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
+   __raw_writel((1 << offset), value ? ®s->set_data : ®s->clr_data);
 }
 
 static int __init davinci_gpio_setup(void)
@@ -160,30 +156,30 @@ static int __init davinci_gpio_setup(void)
return -ENOMEM;
 

[PATCH 03/11] gpio: davinci: Modify to platform driver

2013-05-22 Thread Philip Avinash
From: KV Sujith 

Modify GPIO Davinci driver to be compliant to standard platform drivers.
The driver did not have platform driver structure or a probe. Instead,
had a davinci_gpio_setup() function which is called in the pure_init
sequence. The function also had dependency on davinci_soc_info structure
of the corresponding platform. For Device Tree(DT) implementation, we
need to get rid of the dependency on the davinci_soc_info structure.
Hence as a first stage of DT conversion, we implement a probe. Future
commits shall modify the probe to read platform related data from DT.

- Add platform_driver structure and driver register function for davinci
  GPIO driver. The driver registration is made to happen in
  postcore_initcall. This is required since machine init functions like
  da850_lcd_hw_init() make use of GPIO.
- Convert the davinci_gpio_setup() to davinci_gpio_probe().
- Remove access of members in soc_info structure. Instead, relevant data
  are taken from davinci_gpio_platform_data structure pointed by
  pdev->dev.platform_data.
- Change clk_get() to devm_clk_get() as devm_clk_get() is a device
  managed function and makes error handling simpler.
- Change pr_err to dev_err for ngpio error reporting.
- Arrange include files and variables in alphabetical order

Signed-off-by: KV Sujith 
[avinashphi...@ti.com: Move global definition for "struct
davinci_gpio_controller" variable to local in probe and set it as driver
data.]
Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/include/mach/gpio-davinci.h |2 +
 drivers/gpio/gpio-davinci.c   |  121 +++--
 2 files changed, 87 insertions(+), 36 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h 
b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
index 1fdd1fd..b325a1d 100644
--- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -60,6 +60,8 @@ struct davinci_gpio_controller {
void __iomem*set_data;
void __iomem*clr_data;
void __iomem*in_data;
+   int gpio_unbanked;
+   unsignedgpio_irq;
 };
 
 /* The __gpio_to_controller() and __gpio_mask() functions inline to constants
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index d308955..08830aa 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -11,10 +11,17 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -35,10 +42,9 @@ struct davinci_gpio_regs {
 #define chip2controller(chip)  \
container_of(chip, struct davinci_gpio_controller, chip)
 
-static struct davinci_gpio_controller ctlrs[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
 static void __iomem *gpio_base;
 
-static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio)
+static struct davinci_gpio_regs __iomem *gpio2regs(unsigned gpio)
 {
void __iomem *ptr;
 
@@ -64,7 +70,7 @@ static inline struct davinci_gpio_regs __iomem *irq2regs(int 
irq)
irq_get_chip_data(irq);
 }
 
-static int __init davinci_gpio_irq_setup(void);
+static int davinci_gpio_irq_setup(struct platform_device *pdev);
 
 static inline int __davinci_direction(struct gpio_chip *chip,
unsigned offset, bool out, int value)
@@ -127,33 +133,52 @@ static void davinci_gpio_set(struct gpio_chip *chip, 
unsigned offset,
__raw_writel((1 << offset), value ? ®s->set_data : ®s->clr_data);
 }
 
-static int __init davinci_gpio_setup(void)
+static int davinci_gpio_probe(struct platform_device *pdev)
 {
int i, base;
unsigned ngpio;
-   struct davinci_soc_info *soc_info = &davinci_soc_info;
+   struct davinci_gpio_controller *ctlrs;
+   struct davinci_gpio_platform_data *pdata;
struct davinci_gpio_regs *regs;
+   struct device *dev = &pdev->dev;
+   struct resource *res;
 
-   if (soc_info->gpio_type != GPIO_TYPE_DAVINCI)
-   return 0;
+   pdata = dev->platform_data;
+   if (!pdata) {
+   dev_err(dev, "GPIO: No Platform Data Supplied\n");
+   return -EINVAL;
+   }
 
/*
 * The gpio banks conceptually expose a segmented bitmap,
 * and "ngpio" is one more than the largest zero-based
 * bit index that's valid.
 */
-   ngpio = soc_info->gpio_num;
+   ngpio = pdata->ngpio;
if (ngpio == 0) {
-   pr_err("GPIO setup:  how many GPIOs?\n");
+   dev_err(dev, "GPIO Probe: how many GPIOs?\n");
return -EINVAL;
}
 
if (WARN_ON(DAVINCI_N_GPIO < ngpio))
ngpio = DAVINCI_N_GPIO;
 
-   gpio_base = ioremap(soc_info->gpio_base, SZ_4K);
-

[PATCH 01/11] ARM: davinci: GPIO: Add platform data structure

2013-05-22 Thread Philip Avinash
From: KV Sujith 

Add struct davinci_gpio_platform_data davinci gpio module.

Signed-off-by: KV Sujith 
Signed-off-by: Philip Avinash 
---
 include/linux/platform_data/gpio-davinci.h |   27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 include/linux/platform_data/gpio-davinci.h

diff --git a/include/linux/platform_data/gpio-davinci.h 
b/include/linux/platform_data/gpio-davinci.h
new file mode 100644
index 000..f1c8277
--- /dev/null
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -0,0 +1,27 @@
+/*
+ * gpio-davinci.h
+ *
+ * DaVinci GPIO Platform Related Defines
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_DAVINCI_GPIO_H
+#define __ASM_ARCH_DAVINCI_GPIO_H
+
+struct davinci_gpio_platform_data {
+   u32 ngpio;
+   u32 gpio_unbanked;
+   u32 intc_irq_num;
+};
+
+#endif
-- 
1.7.9.5

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


[PATCH 00/11] Convert GPIO Davinci to platform driver

2013-05-22 Thread Philip Avinash
GPIO Davinci driver converted to platform driver to support DT booting.
In this patch series
- Cleaned gpio Davinci driver code with proper commenting style and appropriate
  variable names.
- Create platform driver for GPIO Davinci in da8xx and dm* platforms and removed
  gpio related member updation in davinci_soc_info structure.
- DT support added for da850 board and tested on da850 EVM.
- Remove soc_info reference in the gpio davinci driver and start uses
  gpiolib interface.

This sereise based on [1] and is avilable at [2].
1. http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.10/soc
2. 
https://github.com/avinashphilip/am335x_linux/commits/linux_davinci_v3.10_soc_gpio

KV Sujith (6):
  ARM: davinci: GPIO: Add platform data structure
  gpio: davinci: Modify to platform driver
  ARM: davinci: da8xx: creation of gpio platform device
  gpio: davinci: DT changes for driver
  ARM: davinci: da850: add GPIO DT entries
  ARM: davinci: da850 evm: add GPIO DT data

Philip Avinash (5):
  gpio: davinci: coding style correction
  ARM: davinci: creation of gpio platform device for dm platforms
  ARM: davinci: da8xx: gpio device creation
  ARM: davinci: create davinci gpio device for dm platforms
  ARM: davinci: start using gpiolib support

 .../devicetree/bindings/gpio/gpio-davinci.txt  |   26 ++
 arch/arm/Kconfig   |1 -
 arch/arm/boot/dts/da850-evm.dts|   19 ++
 arch/arm/boot/dts/da850.dtsi   |9 +
 arch/arm/mach-davinci/board-da830-evm.c|   19 +-
 arch/arm/mach-davinci/board-da850-evm.c|   11 +
 arch/arm/mach-davinci/board-dm355-evm.c|   27 ++
 arch/arm/mach-davinci/board-dm355-leopard.c|1 +
 arch/arm/mach-davinci/board-dm365-evm.c|   28 ++
 arch/arm/mach-davinci/board-dm644x-evm.c   |   26 ++
 arch/arm/mach-davinci/board-dm646x-evm.c   |   27 ++
 arch/arm/mach-davinci/board-neuros-osd2.c  |1 +
 arch/arm/mach-davinci/board-omapl138-hawk.c|2 +
 arch/arm/mach-davinci/da830.c  |4 -
 arch/arm/mach-davinci/da850.c  |4 -
 arch/arm/mach-davinci/devices-da8xx.c  |   26 ++
 arch/arm/mach-davinci/devices.c|   14 +
 arch/arm/mach-davinci/dm355.c  |4 -
 arch/arm/mach-davinci/dm365.c  |5 -
 arch/arm/mach-davinci/dm644x.c |4 -
 arch/arm/mach-davinci/dm646x.c |4 -
 arch/arm/mach-davinci/include/mach/common.h|4 +
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 arch/arm/mach-davinci/include/mach/gpio-davinci.h  |8 +-
 drivers/gpio/gpio-davinci.c|  346 +---
 include/linux/platform_data/gpio-davinci.h |   79 +
 26 files changed, 543 insertions(+), 157 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
 create mode 100644 include/linux/platform_data/gpio-davinci.h

-- 
1.7.9.5

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


[PATCH v5] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-10 Thread Philip Avinash
Add da850 EHRPWM & ECAP DT node along with pin-mux details.
Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
clock.

Signed-off-by: Philip Avinash 
---
Changes since v4:
- Add pin mux for PWM devices ECAP & EHRPWM.

Changes since v3:
- add pin mux info for EHRPWM1.

Changes since v1:
- Reusing ti,am33xx as compatible field as both IP's are
  similar with am33xx platform and da850 has no platform specific
  dependency.

 arch/arm/boot/dts/da850.dtsi |   73 ++
 arch/arm/mach-davinci/da8xx-dt.c |5 +++
 2 files changed, 78 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ade343..b2ae730 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -71,6 +71,49 @@
0x28 0x0022  0x00ff
>;
};
+   ehrpwm0a_pins: pinmux_ehrpwm0a_pins {
+   pinctrl-single,bits = <
+   /* EPWM0A */
+   0xc 0x0002 0x000f
+   >;
+   };
+   ehrpwm0b_pins: pinmux_ehrpwm0b_pins {
+   pinctrl-single,bits = <
+   /* EPWM0B */
+   0xc 0x0020 0x00f0
+   >;
+   };
+   ehrpwm1a_pins: pinmux_ehrpwm1a_pins {
+   pinctrl-single,bits = <
+   /* EPWM1A */
+   0x14 0x0002 0x000f
+   >;
+   };
+   ehrpwm1b_pins: pinmux_ehrpwm1b_pins {
+   pinctrl-single,bits = <
+   /* EPWM1B */
+   0x14 0x0020 0x00f0
+   >;
+   };
+   ecap0_pins: pinmux_ecap0_pins {
+   pinctrl-single,bits = <
+   /* ECAP0_APWM0 */
+   0x8 0x2000 0xf000
+   >;
+   };
+   ecap1_pins: pinmux_ecap1_pins {
+   pinctrl-single,bits = <
+   /* ECAP1_APWM1 */
+   0x4 0x4000 0xf000
+   >;
+   };
+   ecap2_pins: pinmux_ecap2_pins {
+   pinctrl-single,bits = <
+   /* ECAP2_APWM2 */
+   0x4 0x0004 0x000f
+   >;
+   };
+
};
serial0: serial@1c42000 {
compatible = "ns16550a";
@@ -122,6 +165,36 @@
interrupts = <16>;
status = "disabled";
};
+   ehrpwm0: ehrpwm@01f0 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+   status = "disabled";
+   };
+   ehrpwm1: ehrpwm@01f02000 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x302000 0x2000>;
+   status = "disabled";
+   };
+   ecap0: ecap@01f06000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+   status = "disabled";
+   };
+   ecap1: ecap@01f07000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x307000 0x80>;
+   status = "disabled";
+   };
+   ecap2: ecap@01f08000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x308000 0x80>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
 

RE: [PATCH v4] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-10 Thread Philip, Avinash
On Wed, Apr 10, 2013 at 17:05:24, Nori, Sekhar wrote:
> Avinash,
> 
> On 4/10/2013 1:32 PM, Philip Avinash wrote:
> > Add da850 EHRPWM & ECAP DT node along with pin-mux details for EHRPWM1.
> > Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> > clock.
> > 
> > Signed-off-by: Philip Avinash 
> > ---
> > Changes since v3:
> > - add pin mux info for EHRPWM1.
> 
> I think you misunderstood what I asked. Please add pinmux information
> for all the nodes you are adding (ecap0-2 and ehrpwm0). Without pinmux
> setup, these IPs cannot be used anyway. So why leave just the pinmux to
> be added by someone else?

Ok I will add and send updated version.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 
> > 
> > Changes since v1:
> > - Reusing ti,am33xx as compatible field as both IP's are
> >   similar with am33xx platform and da850 has no platform specific
> >   dependency.
> > 
> >  arch/arm/boot/dts/da850.dtsi |   42 
> > ++
> >  arch/arm/mach-davinci/da8xx-dt.c |5 +
> >  2 files changed, 47 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
> > index 3ade343..3bff30d 100644
> > --- a/arch/arm/boot/dts/da850.dtsi
> > +++ b/arch/arm/boot/dts/da850.dtsi
> > @@ -71,6 +71,18 @@
> > 0x28 0x0022  0x00ff
> > >;
> > };
> > +   ehrpwm1a_pins: pinmux_ehrpwm1a_pins {
> > +   pinctrl-single,bits = <
> > +   /* EPWM1A */
> > +   0x14 0x0002 0x000f
> > +   >;
> > +   };
> > +   ehrpwm1b_pins: pinmux_ehrpwm1b_pins {
> > +   pinctrl-single,bits = <
> > +   /* EPWM1B */
> > +   0x14 0x0020 0x00f0
> > +   >;
> > +   };
> > };
> > serial0: serial@1c42000 {
> > compatible = "ns16550a";
> > @@ -122,6 +134,36 @@
> > interrupts = <16>;
> > status = "disabled";
> > };
> > +   ehrpwm0: ehrpwm@01f0 {
> > +   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
> > +   #pwm-cells = <3>;
> > +   reg = <0x30 0x2000>;
> > +   status = "disabled";
> > +   };
> > +   ehrpwm1: ehrpwm@01f02000 {
> > +   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
> > +   #pwm-cells = <3>;
> > +   reg = <0x302000 0x2000>;
> > +   status = "disabled";
> > +   };
> > +   ecap0: ecap@01f06000 {
> > +   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
> > +   #pwm-cells = <3>;
> > +   reg = <0x306000 0x80>;
> > +   status = "disabled";
> > +   };
> > +   ecap1: ecap@01f07000 {
> > +   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
> > +   #pwm-cells = <3>;
> > +   reg = <0x307000 0x80>;
> > +   status = "disabled";
> > +   };
> > +   ecap2: ecap@01f08000 {
> > +   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
> > +   #pwm-cells = <3>;
> > +   reg = <0x308000 0x80>;
> > +   status = "disabled";
> > +   };
> > };
> > nand_cs3@6200 {
> > compatible = "ti,davinci-nand";
> > diff --git a/arch/arm/mach-davinci/da8xx-dt.c 
> > b/arch/arm/mach-davinci/da8xx-dt.c
> > index d83de8f..05bb9a2 100644
> > --- a/arch/arm/mach-davinci/da8xx-dt.c
> > +++ b/arch/arm/mach-davinci/da8xx-dt.c
> > @@ -41,6 +41,11 @@ struct of_dev_auxdata da850_auxdata_lookup[] __initdata 
> > = {
> > OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
> > OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
> > OF_DEV_AUXDATA("ti,da830-mmc", 0x01c4, "da830-mmc.0", NULL),
> > +   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f0, "ehrpwm", NULL),
> > +   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
> > +   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
> > +   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
> > +   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
> > {}
> >  };
> >  
> > 
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH v4] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-10 Thread Philip Avinash
Add da850 EHRPWM & ECAP DT node along with pin-mux details for EHRPWM1.
Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
clock.

Signed-off-by: Philip Avinash 
---
Changes since v3:
- add pin mux info for EHRPWM1.

Changes since v1:
- Reusing ti,am33xx as compatible field as both IP's are
  similar with am33xx platform and da850 has no platform specific
  dependency.

 arch/arm/boot/dts/da850.dtsi |   42 ++
 arch/arm/mach-davinci/da8xx-dt.c |5 +
 2 files changed, 47 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ade343..3bff30d 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -71,6 +71,18 @@
0x28 0x0022  0x00ff
>;
};
+   ehrpwm1a_pins: pinmux_ehrpwm1a_pins {
+   pinctrl-single,bits = <
+   /* EPWM1A */
+   0x14 0x0002 0x000f
+   >;
+   };
+   ehrpwm1b_pins: pinmux_ehrpwm1b_pins {
+   pinctrl-single,bits = <
+   /* EPWM1B */
+   0x14 0x0020 0x00f0
+   >;
+   };
};
serial0: serial@1c42000 {
compatible = "ns16550a";
@@ -122,6 +134,36 @@
interrupts = <16>;
status = "disabled";
};
+   ehrpwm0: ehrpwm@01f0 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+   status = "disabled";
+   };
+   ehrpwm1: ehrpwm@01f02000 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x302000 0x2000>;
+   status = "disabled";
+   };
+   ecap0: ecap@01f06000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+   status = "disabled";
+   };
+   ecap1: ecap@01f07000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x307000 0x80>;
+   status = "disabled";
+   };
+   ecap2: ecap@01f08000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x308000 0x80>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index d83de8f..05bb9a2 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -41,6 +41,11 @@ struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
OF_DEV_AUXDATA("ti,da830-mmc", 0x01c4, "da830-mmc.0", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f0, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
{}
 };
 
-- 
1.7.9.5

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


RE: [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-09 Thread Philip, Avinash
On Wed, Apr 10, 2013 at 11:25:19, Nori, Sekhar wrote:
> On 4/10/2013 11:00 AM, Philip, Avinash wrote:
> > On Tue, Apr 09, 2013 at 17:05:25, Nori, Sekhar wrote:
> >> On 4/9/2013 2:12 PM, Philip, Avinash wrote:
> >>> On Mon, Apr 08, 2013 at 18:39:57, Nori, Sekhar wrote:
> >>>>
> >>>> On 4/8/2013 2:39 PM, Philip, Avinash wrote:
> >>>>> On Tue, Apr 02, 2013 at 14:03:34, Nori, Sekhar wrote:
> >>>>>> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> >>>>>>> Add da850 EHRPWM & ECAP DT node.
> >>>>>>> Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> >>>>>>> clock.
> >>>>>>
> >>>>>> This looks fine to me but I will wait for the bindings to get accepted
> >>>>>> before taking this one.
> >>>>>
> >>>>> Sekhar,
> >>>>>
> >>>>> Binding document got accepted in PWM tree [1].
> >>>>> Can you accept this patch?
> >>>>
> >>>> Can you also add the pinmux definitions and resend just this patch?
> >>>> Sorry I did not notice those were missing earlier.
> >>>
> >>> According to latest schematics, ECAP instance 2 being used for PWM 
> >>> backlight
> >>> control. Should I add pin-mux only for ECAP2 or for all PWM instances?
> >>
> >> I meant add definitions in .dtsi. Since there is only one pin a given
> >> functionality can be present on in DaVinci, it can be done in a board
> >> independent manner.
> > 
> > I think here the expectation would be that .dtsi should populate the 
> > complete
> > pin-mux for SOC and board files should just be able to re-use it (add it as 
> > a phandler).
> 
> Yes, that's the idea.

Ok

> 
> > Also as per the above description .dtsi file will end up contain majorly 
> > pin-mux info
> > rather than the hardware data. Is it a good idea?
> 
> Pinmux is also hardware data, no? Thats why its present in DT.

I understood.

> 
> > On looking da850.dtsi file NAND pins were defined for 8-bit part. 
> > In case of NAND flash, the device might be sitting under different 
> > chip-select or may
> > have 16 bit part on  different boards. So pin-mux defined in soc.dtsi has 
> > to be split
> > separately for CS, DATA, Address.
> 
> The idea is to define pin groups that most of the time can be reused by
> .dts file as-is and if there are any board specific extra pins needed
> then they can be handled directly in .dts files. But the common cases
> don't have to be repeated in all boards. In case of NAND, CS and the top
> 8-pins when using a 16-bit bus can be moved to a different group. So, I
> agree instead of nand_cs3_pins, we could have had nand_pins and moved cs
> definitions to another re-usable group.

Ok, thanks for the detailed explanation.

> 
> > So it is always challenging to create pin-mux info in .dtsi file. So more 
> > useful/meaningful
> > way is to actually create pin-mux in board file rather in .dtsi file.
> 
> I don't see why it is so challenging. Repeating the same pinmux
> information over multiple .dts file (while making errors copying) will
> be challenging. And its not as if this is my original idea. imx (and I
> think some others) are doing it as well. See how pinmux is defined in
> imx53.dtsi and reused in a number of boards like evk, qsb, smd and so on.
> 
> >> See examples for other peripherals in existing
> >> da850.dtsi file.
> > 
> > I have gone through .dtsi. But it didn't describe the complete pin-mux like 
> > I2C1, MMC1, etc.
> 
> pinmux should be added for whatever nodes are added since pimux is part
> of node.
> 
> > So the expectation here is only to add ECAP2 pin-mux. Is it correct?
> 
> No, please add pinmux information for all the IP nodes you are adding. I
> am not insisting that you add all IP nodes at the same time. You can add
> whatever you have tested.

I actually tested EHRPWM1A and EHRPWM1B in older boards for back light support.
But in latest schematics shows ECAP2 being used for backlight control and can't
be tested as boards with this change is not accessible to me.
So I will add tested pin-mux details.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-09 Thread Philip, Avinash
On Tue, Apr 09, 2013 at 17:05:25, Nori, Sekhar wrote:
> On 4/9/2013 2:12 PM, Philip, Avinash wrote:
> > On Mon, Apr 08, 2013 at 18:39:57, Nori, Sekhar wrote:
> >>
> >> On 4/8/2013 2:39 PM, Philip, Avinash wrote:
> >>> On Tue, Apr 02, 2013 at 14:03:34, Nori, Sekhar wrote:
> >>>> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> >>>>> Add da850 EHRPWM & ECAP DT node.
> >>>>> Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> >>>>> clock.
> >>>>
> >>>> This looks fine to me but I will wait for the bindings to get accepted
> >>>> before taking this one.
> >>>
> >>> Sekhar,
> >>>
> >>> Binding document got accepted in PWM tree [1].
> >>> Can you accept this patch?
> >>
> >> Can you also add the pinmux definitions and resend just this patch?
> >> Sorry I did not notice those were missing earlier.
> > 
> > According to latest schematics, ECAP instance 2 being used for PWM backlight
> > control. Should I add pin-mux only for ECAP2 or for all PWM instances?
> 
> I meant add definitions in .dtsi. Since there is only one pin a given
> functionality can be present on in DaVinci, it can be done in a board
> independent manner.

I think here the expectation would be that .dtsi should populate the complete
pin-mux for SOC and board files should just be able to re-use it (add it as a 
phandler).
Also as per the above description .dtsi file will end up contain majorly 
pin-mux info
rather than the hardware data. Is it a good idea?

On looking da850.dtsi file NAND pins were defined for 8-bit part. 
In case of NAND flash, the device might be sitting under different chip-select 
or may
have 16 bit part on  different boards. So pin-mux defined in soc.dtsi has to be 
split
separately for CS, DATA, Address.

So it is always challenging to create pin-mux info in .dtsi file. So more 
useful/meaningful
way is to actually create pin-mux in board file rather in .dtsi file.

> See examples for other peripherals in existing
> da850.dtsi file.

I have gone through .dtsi. But it didn't describe the complete pin-mux like 
I2C1, MMC1, etc.
So the expectation here is only to add ECAP2 pin-mux. Is it correct?

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-09 Thread Philip, Avinash
On Mon, Apr 08, 2013 at 18:39:57, Nori, Sekhar wrote:
> 
> On 4/8/2013 2:39 PM, Philip, Avinash wrote:
> > On Tue, Apr 02, 2013 at 14:03:34, Nori, Sekhar wrote:
> >> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> >>> Add da850 EHRPWM & ECAP DT node.
> >>> Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> >>> clock.
> >>
> >> This looks fine to me but I will wait for the bindings to get accepted
> >> before taking this one.
> > 
> > Sekhar,
> > 
> > Binding document got accepted in PWM tree [1].
> > Can you accept this patch?
> 
> Can you also add the pinmux definitions and resend just this patch?
> Sorry I did not notice those were missing earlier.

According to latest schematics, ECAP instance 2 being used for PWM backlight
control. Should I add pin-mux only for ECAP2 or for all PWM instances?

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-04-08 Thread Philip, Avinash
On Tue, Apr 02, 2013 at 14:03:34, Nori, Sekhar wrote:
> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> > Add da850 EHRPWM & ECAP DT node.
> > Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> > clock.
> 
> This looks fine to me but I will wait for the bindings to get accepted
> before taking this one.

Sekhar,

Binding document got accepted in PWM tree [1].
Can you accept this patch?

1. https://gitorious.org/linux-pwm

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 0/2] Update device tree binding document for pwm-tiehrpwm & pwm-tiecap

2013-04-07 Thread Philip, Avinash
Thierry,

On Mon, Mar 25, 2013 at 12:34:51, Philip, Avinash wrote:
> Update device tree document of pwm-tiehrpwm & pwm-tiecap in order to reflect 
> the
> usage of similar modules in both da850 and am33xx platforms.

Can you accept both documentation update patches with Peter Korsgaard's Ack.

Thanks
Avinash
> 
> Philip Avinash (2):
>   pwm: pwm-tiecap: Update device-tree binding document
>   pwm: pwm-tiehrpwm: Update device-tree binding document
> 
>  .../devicetree/bindings/pwm/pwm-tiecap.txt |   12 ++--
>  .../devicetree/bindings/pwm/pwm-tiehrpwm.txt   |   12 ++--
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> -- 
> 1.7.9.5
> 
> 

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


RE: [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-04-04 Thread Philip, Avinash
On Thu, Apr 04, 2013 at 12:07:44, Philip, Avinash wrote:
> On Thu, Apr 04, 2013 at 11:19:44, Nori, Sekhar wrote:
> > On 4/4/2013 10:09 AM, Philip, Avinash wrote:
> > > On Tue, Apr 02, 2013 at 14:05:09, Nori, Sekhar wrote:
> > >> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> > >>> Add platform support for EHRPWM and ECAP by providing clock nodes and
> > >>> device tree nodes.
> > >>> This series depends on [1] and [2] and is available for testing at [3].
> > >>> Tested for back light support in da850 EVM with EHRPWM PWM device.
> > >>>
> > >>> [1] 
> > >>> http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
> > >>> [2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
> > >>> [3] 
> > >>> https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm
> > >>>
> > >>> Note:
> > >>> DT support for EHRPWM backlight has not been added in da850-evm.dts as 
> > >>> there is
> > >>> conflicting pin-mux requirement with SPI flash.
> > >>
> > >> Can you check if this is really true even in newer boards (have a look
> > >> at the latest schematics)? I remember this used to be a problem in very
> > >> early versions but was fixed later.
> > > 
> > > On looking schematics, panel has three power controls LCD_BACKLIGHT_PWR, 
> > > LCD_PANEL_PWR,
> > > LCD_PWM0. On latest schematic, LCD_PWM0 is connected to ECAP instance 2. 
> > > So backlight
> > > can control through ECAP2 (not conflicting with SPI1 cs0). Still for 
> > > controlling
> > > backlight, require support for LCD_BACKLIGHT_PWR & LCD_PANEL_PWR. These 
> > > signals
> > 
> > By controlling above you mean "switching on/off"? Otherwise this seems
> > to be contradicting the statement just before.
> 
> Yes these lines should be switching on/off.
> 
> > 
> > > to be controlled by GPIO 2[8] & GPIO 2[15]. In release platform callbacks 
> > > used
> > > to control GPIO functionality. But with DT support, I have to check how 
> > > platform
> > > callbacks can be used.
> > 
> > Platform callbacks are not possible with DT.
> 
> Ok.
> 
> > You can look at what freescale mxsfb.c does. Look for panel-enable-gpios DT 
> > binding.
> 
> I will use GPIO pin configuration info from DT nodes. From probe GPIO pin 
> make active and
> in remove disable GPIO pin.

For passing from GPIO pins from DT, GPIO DT node has to be populated. So this 
has dependency
on GPIO driver conversion for davinci platforms.

Thanks
Avinash

> 
> Thanks
> Avinash
> 
> > 
> > Thanks,
> > Sekhar
> > 
> 
> 



RE: [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-04-03 Thread Philip, Avinash
On Thu, Apr 04, 2013 at 11:19:44, Nori, Sekhar wrote:
> On 4/4/2013 10:09 AM, Philip, Avinash wrote:
> > On Tue, Apr 02, 2013 at 14:05:09, Nori, Sekhar wrote:
> >> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> >>> Add platform support for EHRPWM and ECAP by providing clock nodes and
> >>> device tree nodes.
> >>> This series depends on [1] and [2] and is available for testing at [3].
> >>> Tested for back light support in da850 EVM with EHRPWM PWM device.
> >>>
> >>> [1] 
> >>> http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
> >>> [2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
> >>> [3] 
> >>> https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm
> >>>
> >>> Note:
> >>> DT support for EHRPWM backlight has not been added in da850-evm.dts as 
> >>> there is
> >>> conflicting pin-mux requirement with SPI flash.
> >>
> >> Can you check if this is really true even in newer boards (have a look
> >> at the latest schematics)? I remember this used to be a problem in very
> >> early versions but was fixed later.
> > 
> > On looking schematics, panel has three power controls LCD_BACKLIGHT_PWR, 
> > LCD_PANEL_PWR,
> > LCD_PWM0. On latest schematic, LCD_PWM0 is connected to ECAP instance 2. So 
> > backlight
> > can control through ECAP2 (not conflicting with SPI1 cs0). Still for 
> > controlling
> > backlight, require support for LCD_BACKLIGHT_PWR & LCD_PANEL_PWR. These 
> > signals
> 
> By controlling above you mean "switching on/off"? Otherwise this seems
> to be contradicting the statement just before.

Yes these lines should be switching on/off.

> 
> > to be controlled by GPIO 2[8] & GPIO 2[15]. In release platform callbacks 
> > used
> > to control GPIO functionality. But with DT support, I have to check how 
> > platform
> > callbacks can be used.
> 
> Platform callbacks are not possible with DT.

Ok.

> You can look at what freescale mxsfb.c does. Look for panel-enable-gpios DT 
> binding.

I will use GPIO pin configuration info from DT nodes. From probe GPIO pin make 
active and
in remove disable GPIO pin.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-04-03 Thread Philip, Avinash
On Tue, Apr 02, 2013 at 14:05:09, Nori, Sekhar wrote:
> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> > Add platform support for EHRPWM and ECAP by providing clock nodes and
> > device tree nodes.
> > This series depends on [1] and [2] and is available for testing at [3].
> > Tested for back light support in da850 EVM with EHRPWM PWM device.
> > 
> > [1] 
> > http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
> > [2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
> > [3] 
> > https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm
> > 
> > Note:
> > DT support for EHRPWM backlight has not been added in da850-evm.dts as 
> > there is
> > conflicting pin-mux requirement with SPI flash.
> 
> Can you check if this is really true even in newer boards (have a look
> at the latest schematics)? I remember this used to be a problem in very
> early versions but was fixed later.

On looking schematics, panel has three power controls LCD_BACKLIGHT_PWR, 
LCD_PANEL_PWR,
LCD_PWM0. On latest schematic, LCD_PWM0 is connected to ECAP instance 2. So 
backlight
can control through ECAP2 (not conflicting with SPI1 cs0). Still for controlling
backlight, require support for LCD_BACKLIGHT_PWR & LCD_PANEL_PWR. These signals
to be controlled by GPIO 2[8] & GPIO 2[15]. In release platform callbacks used
to control GPIO functionality. But with DT support, I have to check how platform
callbacks can be used.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



[PATCH 1/3] ARM: davinci: da850: Add LCDC DT entries

2013-03-27 Thread Philip Avinash
Add LCDC DT entries in da850 dts file.

Signed-off-by: Philip Avinash 
---
 arch/arm/boot/dts/da850.dtsi |   21 +
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index a6cbf89..087b4ea 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -62,6 +62,21 @@
0x10 0x2200 0xff00
>;
};
+   lcdc_pins:pinmux_lcdc_pins {
+   pinctrl-single,bits = <
+   /* LCD_D[2], LCD_D[3], LCD_D[4],
+  LCD_D[5], LCD_D[6], LCD_D[7] */
+   0x40 0x2200 0xff00
+   /* LCD_D[10], LCD_D[11], LCD_D[12],
+  LCD_D[13], LCD_D[14], LCD_D[15],
+  LCD_D[0], LCD_D[1] */
+   0x44 0x 0x
+   /* LCD_PCLK, LCD_D[8], LCD_D[9] */
+   0x48 0x0222 0x0fff
+   /* LCD_AC_ENB_CS, LCD_VSYNC, LCD_HSYNC*/
+   0x4c 0x0222 0x0fff
+   >;
+   };
};
serial0: serial@1c42000 {
compatible = "ns16550a";
@@ -137,6 +152,12 @@
reg = <0x308000 0x80>;
status = "disabled";
};
+   lcdc: lcdc@01e13000 {
+   compatible = "ti,da830-lcdc";
+   reg = <0x213000 0x1000>;
+   interrupts = <52>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
-- 
1.7.9.5

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


[PATCH 2/3] ARM: davinci: da850: override LCDC DT node device name

2013-03-27 Thread Philip Avinash
Populate OF_DEV_AUXDATA with desired device name expected by da8xx-fb
driver. Without this clk_get of da8xx-fb DT driver fails.

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-davinci/da8xx-dt.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 89ee974..3436052 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -45,6 +45,7 @@ struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da830-lcdc", 0x01e13000, "da8xx_lcdc.0", NULL),
{}
 };
 
-- 
1.7.9.5

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


[PATCH 3/3] ARM: davinci: da850 evm: Add da850-evm LCD panel support

2013-03-27 Thread Philip Avinash
Update LCDC node with panel timings for da850-evm along pin-mux info.

Signed-off-by: Philip Avinash 
---
 arch/arm/boot/dts/da850-evm.dts |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index cae024b..33d024e 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -50,6 +50,28 @@
pinctrl-names = "default";
pinctrl-0 = <&ehrpwm1_pins>;
};
+
+   lcdc: lcdc@01e13000 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&lcdc_pins>;
+
+   display-timings {
+   480x272p62 {
+   clock-frequency = <7833600>;
+   hactive = <480>;
+   vactive = <272>;
+   hfront-porch = <2>;
+   hback-porch = <2>;
+   hsync-len = <41>;
+   vback-porch = <2>;
+   vfront-porch = <2>;
+   vsync-len = <10>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
};
nand_cs3@6200 {
status = "okay";
-- 
1.7.9.5

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


[PATCH 0/3] DT support for da850-evm LCD

2013-03-27 Thread Philip Avinash
Add support for da850-evm LCD.
Depends on [1], [2] and [3] and based on 3.9.rc4.
Tested on da850-evm and available for testing at [4]

1. video: da8xx-fb: am335x DT support
   https://lkml.org/lkml/2013/1/28/90
2. video: da8xx-fb: runtime timing configuration.
   https://lkml.org/lkml/2013/1/15/241
3. Platform support for EHRPWM & ECAP devices in DAVINCI.
   
http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2013-March/026798.html
4. https://github.com/avinashphilip/am335x_linux/tree/da850_lcd_dt_support 

Testing:
LCD panel back light should enabled through PWM. But back light goes off on SPI
transactions as spi1_cs0 will be the source for LCD back light power (provided
SPI flash support enabled).

Philip Avinash (3):
  ARM: davinci: da850: Add LCDC DT entries
  ARM: davinci: da850: override LCDC DT node device name
  ARM: davinci: da850 evm: Add da850-evm LCD panel support

 arch/arm/boot/dts/da850-evm.dts  |   22 ++
 arch/arm/boot/dts/da850.dtsi |   21 +
 arch/arm/mach-davinci/da8xx-dt.c |1 +
 3 files changed, 44 insertions(+)

-- 
1.7.9.5

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


RE: [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-03-25 Thread Philip, Avinash
On Mon, Mar 25, 2013 at 13:44:37, Nori, Sekhar wrote:
> On 3/25/2013 1:19 PM, Philip Avinash wrote:
> > Add platform support for EHRPWM and ECAP by providing clock nodes and
> > device tree nodes.
> > This series depends on [1] and [2] and is available for testing at [3].
> > Tested for back light support in da850 EVM with EHRPWM PWM device.
> > 
> > [1] 
> > http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
> > [2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
> > [3] 
> > https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm
> > 
> > Note:
> > DT support for EHRPWM backlight has not been added in da850-evm.dts as 
> > there is
> > conflicting pin-mux requirement with SPI flash.
> > 
> > Philip Avinash (3):
> >   ARM: davinci: clk framework support for enable/disable functionality
> 
> Patch 1/3 did not reach me. I cant find it in archives either so most
> likely no one received it. Can you please send that one patch again?

Done.

> 
> >   arm: davinci: clock node support for ECAP & EHRPWM
> 
> For future, please be consistent and capitalize 'ARM' in subject line.

Ok I will take care.

Thanks
Avinash
> 
> >   ARM: davinci: da850: add EHRPWM & ECAP DT node
> > 
> >  arch/arm/boot/dts/da850.dtsi   |   30 ++
> >  arch/arm/mach-davinci/clock.c  |   21 -
> >  arch/arm/mach-davinci/clock.h  |2 ++
> >  arch/arm/mach-davinci/da850.c  |   46 
> > 
> >  arch/arm/mach-davinci/da8xx-dt.c   |5 +++
> >  arch/arm/mach-davinci/include/mach/da8xx.h |1 +
> >  6 files changed, 98 insertions(+), 7 deletions(-)
> > 
> 
> Thanks,
> Sekhar
> 



[PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-03-25 Thread Philip Avinash
Add da850 EHRPWM & ECAP DT node.
Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
clock.

Signed-off-by: Philip Avinash 
---
Changes since v1:
- Reusing ti,am33xx as compatible field as both IP's are
  similar with am33xx platform and da850 has no platform specific
  dependency.

 arch/arm/boot/dts/da850.dtsi |   30 ++
 arch/arm/mach-davinci/da8xx-dt.c |5 +
 2 files changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ec1bda..62fd2d4 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -107,6 +107,36 @@
reg = <0x21000 0x1000>;
status = "disabled";
};
+   ehrpwm0: ehrpwm@01f0 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+   status = "disabled";
+   };
+   ehrpwm1: ehrpwm@01f02000 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x302000 0x2000>;
+   status = "disabled";
+   };
+   ecap0: ecap@01f06000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+   status = "disabled";
+   };
+   ecap1: ecap@01f07000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x307000 0x80>;
+   status = "disabled";
+   };
+   ecap2: ecap@01f08000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x308000 0x80>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 6b7a0a2..89ee974 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -40,6 +40,11 @@ static void __init da8xx_init_irq(void)
 struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f0, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
{}
 };
 
-- 
1.7.9.5

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


[PATCH v3 2/3] arm: davinci: clock node support for ECAP & EHRPWM

2013-03-25 Thread Philip Avinash
Add clock node support for ECAP and EHRPWM modules.
Also adds TBCLK for EHRWPM TBCLK to comply with pwm-tiehrpwm
driver.

Signed-off-by: Philip Avinash 
---
Changes Since v2:
- Add prefix of ehrpwm to tblck_enable and tblck_disable functions
- Make functions as static.

Changes Since v1:
- TBCLK make it as actual clock with enable/disable feature.

 arch/arm/mach-davinci/da850.c  |   46 
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 2 files changed, 47 insertions(+)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0c4a26d..2a2f60c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -383,6 +383,49 @@ static struct clk dsp_clk = {
.flags  = PSC_LRST | PSC_FORCE,
 };
 
+static struct clk ehrpwm_clk = {
+   .name   = "ehrpwm",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_PWM,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
+#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
+
+static void ehrpwm_tblck_enable(struct clk *clk)
+{
+   u32 val;
+
+   val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+   val |= DA8XX_EHRPWM_TBCLKSYNC;
+   writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+static void ehrpwm_tblck_disable(struct clk *clk)
+{
+   u32 val;
+
+   val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+   val &= ~DA8XX_EHRPWM_TBCLKSYNC;
+   writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+static struct clk ehrpwm_tbclk = {
+   .name   = "ehrpwm_tbclk",
+   .parent = &ehrpwm_clk,
+   .clk_enable = ehrpwm_tblck_enable,
+   .clk_disable= ehrpwm_tblck_disable,
+};
+
+static struct clk ecap_clk = {
+   .name   = "ecap",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_ECAP,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
 static struct clk_lookup da850_clks[] = {
CLK(NULL,   "ref",  &ref_clk),
CLK(NULL,   "pll0", &pll0_clk),
@@ -430,6 +473,9 @@ static struct clk_lookup da850_clks[] = {
CLK("vpif", NULL,   &vpif_clk),
CLK("ahci", NULL,   &sata_clk),
CLK("davinci-rproc.0",  NULL,   &dsp_clk),
+   CLK("ehrpwm",   "fck",  &ehrpwm_clk),
+   CLK("ehrpwm",   "tbclk",&ehrpwm_tbclk),
+   CLK("ecap", "fck",  &ecap_clk),
CLK(NULL,   NULL,   NULL),
 };
 
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index de439b7..be77ce2 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -55,6 +55,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SYSCFG0_VIRT(x)  (da8xx_syscfg0_base + (x))
 #define DA8XX_JTAG_ID_REG  0x18
 #define DA8XX_CFGCHIP0_REG 0x17c
+#define DA8XX_CFGCHIP1_REG 0x180
 #define DA8XX_CFGCHIP2_REG 0x184
 #define DA8XX_CFGCHIP3_REG 0x188
 
-- 
1.7.9.5

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


[PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-03-25 Thread Philip Avinash
Add platform support for EHRPWM and ECAP by providing clock nodes and
device tree nodes.
This series depends on [1] and [2] and is available for testing at [3].
Tested for back light support in da850 EVM with EHRPWM PWM device.

[1] http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
[2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
[3] https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm

Note:
DT support for EHRPWM backlight has not been added in da850-evm.dts as there is
conflicting pin-mux requirement with SPI flash.

Philip Avinash (3):
  ARM: davinci: clk framework support for enable/disable functionality
  arm: davinci: clock node support for ECAP & EHRPWM
  ARM: davinci: da850: add EHRPWM & ECAP DT node

 arch/arm/boot/dts/da850.dtsi   |   30 ++
 arch/arm/mach-davinci/clock.c  |   21 -
 arch/arm/mach-davinci/clock.h  |2 ++
 arch/arm/mach-davinci/da850.c  |   46 
 arch/arm/mach-davinci/da8xx-dt.c   |5 +++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 6 files changed, 98 insertions(+), 7 deletions(-)

-- 
1.7.9.5

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


[PATCH 2/2] pwm: pwm-tiehrpwm: Update device-tree binding document

2013-03-25 Thread Philip Avinash
Update binding document of pwm-tiehrpwm to reflect the usage of similar
modules in da850 and am3xx SOCs.

Signed-off-by: Philip Avinash 
Cc: Grant Likely 
Cc: Rob Herring 
Cc: Rob Landley 
---
 .../devicetree/bindings/pwm/pwm-tiehrpwm.txt   |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt 
b/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
index 4fc7079..9a71369 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
@@ -1,7 +1,9 @@
 TI SOC EHRPWM based PWM controller
 
 Required properties:
-- compatible : Must be "ti,am33xx-ehrpwm"
+- compatible: Must be "ti,-ehrpwm".
+  for am33xx - compatible = "ti,am33xx-ehrpwm";
+  for da850  - compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
 - #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
   First cell specifies the per-chip index of the PWM to use, the second
   cell is the period in nanoseconds and bit 0 in the third cell is used to
@@ -15,9 +17,15 @@ Optional properties:
 
 Example:
 
-ehrpwm0: ehrpwm@0 {
+ehrpwm0: ehrpwm@0 { /* EHRPWM on am33xx */
compatible = "ti,am33xx-ehrpwm";
#pwm-cells = <3>;
reg = <0x48300200 0x100>;
ti,hwmods = "ehrpwm0";
 };
+
+ehrpwm0: ehrpwm@0 { /* EHRPWM on da850 */
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+};
-- 
1.7.9.5

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


[PATCH 1/2] pwm: pwm-tiecap: Update device-tree binding document

2013-03-25 Thread Philip Avinash
Update binding document of pwm-tiecap to reflect the usage of similar
modules in da850 and am3xx SOCs.

Signed-off-by: Philip Avinash 
Cc: Grant Likely 
Cc: Rob Herring 
Cc: Rob Landley 
---
 .../devicetree/bindings/pwm/pwm-tiecap.txt |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt 
b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
index 131e8c1..43c4e81 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
@@ -1,7 +1,9 @@
 TI SOC ECAP based APWM controller
 
 Required properties:
-- compatible: Must be "ti,am33xx-ecap"
+- compatible: Must be "ti,-ecap".
+  for am33xx - compatible = "ti,am33xx-ecap";
+  for da850  - compatible = "ti,da850-ecap", "ti,am33xx-ecap";
 - #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
   First cell specifies the per-chip index of the PWM to use, the second
   cell is the period in nanoseconds and bit 0 in the third cell is used to
@@ -15,9 +17,15 @@ Optional properties:
 
 Example:
 
-ecap0: ecap@0 {
+ecap0: ecap@0 {  /* ECAP on am33xx */
compatible = "ti,am33xx-ecap";
#pwm-cells = <3>;
reg = <0x48300100 0x80>;
ti,hwmods = "ecap0";
 };
+
+ecap0: ecap@0 { /* ECAP on da850 */
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+};
-- 
1.7.9.5

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


[PATCH 0/2] Update device tree binding document for pwm-tiehrpwm & pwm-tiecap

2013-03-25 Thread Philip Avinash
Update device tree document of pwm-tiehrpwm & pwm-tiecap in order to reflect the
usage of similar modules in both da850 and am33xx platforms.

Philip Avinash (2):
  pwm: pwm-tiecap: Update device-tree binding document
  pwm: pwm-tiehrpwm: Update device-tree binding document

 .../devicetree/bindings/pwm/pwm-tiecap.txt |   12 ++--
 .../devicetree/bindings/pwm/pwm-tiehrpwm.txt   |   12 ++--
 2 files changed, 20 insertions(+), 4 deletions(-)

-- 
1.7.9.5

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


RE: [PATCH v2 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-03-22 Thread Philip, Avinash
On Fri, Mar 22, 2013 at 11:23:32, Nori, Sekhar wrote:
> On 3/21/2013 1:31 PM, Philip, Avinash wrote:
> > On Wed, Mar 20, 2013 at 18:17:59, Peter Korsgaard wrote:
> >>>>>>> "Sekhar" == Sekhar Nori  writes:
> >>
> >>  Sekhar> On 3/20/2013 12:11 PM, Philip Avinash wrote:
> >>  >> Add da850 EHRPWM & ECAP DT node.
> >>  >> Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
> >>  >> clock.
> >>  >> 
> >>  >> Signed-off-by: Philip Avinash 
> >>  >> ---
> >>  >> Changes since v1:
> >>  >> - Reusing ti,am33xx as compatible field as both IP's are
> >>  >> same with am33xx platform and da850 has no platform specific
> >>  >> dependency.
> >>
> >>  Sekhar> Which is fine, but I think the binding documentation still needs 
> >> to be
> >>  Sekhar> updated to document the ti,da850-ehrpwm binding. Looping Peter 
> >> (it is
> >>  Sekhar> always a good idea to CC folks who reviewed your patch last time
> >>  Sekhar> around). Also, please Cc the DT folks and devicetree-discuss list 
> >> too
> >>  Sekhar> for their opinion.
> >>
> >> Yes, thanks for CC'ing me. I also think da850-* should be
> >> documented. See Documentation/devicetree/bindings/gpio/8xxx_gpio.txt for
> >> an similar (old) example.
> > 
> > Peter,
> > 
> > In this binding file also, only initial compatible field is updated. Later 
> > on many
> > compatible were added in driver. But not update back to binding doc.
> 
> Probably someone forgot to keep updating the binding doc after a point.
> 
> > 
> > 
> > ---
> > followed by "fsl,mpc8349-gpio" for 83xx, "fsl,mpc8572-gpio" for 85xx and
> > "fsl,mpc8610-gpio" for 86xx.
> > ---
> > 
> > ---
> > static struct of_device_id mpc8xxx_gpio_ids[] __initdata = {
> > { .compatible = "fsl,mpc8349-gpio", },
> > { .compatible = "fsl,mpc8572-gpio", },
> > { .compatible = "fsl,mpc8610-gpio", },
> > { .compatible = "fsl,mpc5121-gpio", .data = mpc512x_irq_set_type, },
> > { .compatible = "fsl,pq3-gpio", },
> > { .compatible = "fsl,qoriq-gpio",   },
> > {}
> > };
> > ---
> > 
> > Grant/Rob,
> > With respect peters explanation (below), what is your opinion on adding 
> > information to 
> > binding doc for da850 support?
> > 
> > Peter --> if the hardware block is identical the dts should simply list:
> > Peter --> compatible = "ti,da850-ecap", "ti,am33xx-ecap"
> > Peter --> And the driver only bind to ti,am33xx-ecap (unless there ever 
> > needs to
> > Peter --> be a da850 specific workaround.
> > 
> > Or
> > Should I update both binding doc & the driver to use new compatible option 
> > "ti,da830-ecap"
> > (as da830 platform has initial IP support)?
> > Even with this, platforms da830, da850 and am33xx can reuse "ti,da830-ecap" 
> > compatible field.
> 
> To me updating the driver to keep adding a .compatible even when not
> using it elsewhere in code is not required. Adding the new binding in
> .dts file is must since you may need to do something specific to da830
> at a later time (and the .dtb should be considered ROM'ed so you wont be
> able to change it then).

Thanks for the explanation.
I will add "ti,da850-ecap" for da850.dtsi along with "ti,am33xx-ecap" as
compatible fields.

> Adding documentation for the binding is also
> required to help anyone wanting to know more about the binding after
> reading the .dts file.

I will adding documentation part for "ti,da850-ecap".

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH v2 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-03-21 Thread Philip, Avinash
On Wed, Mar 20, 2013 at 18:17:59, Peter Korsgaard wrote:
> >>>>> "Sekhar" == Sekhar Nori  writes:
> 
>  Sekhar> On 3/20/2013 12:11 PM, Philip Avinash wrote:
>  >> Add da850 EHRPWM & ECAP DT node.
>  >> Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
>  >> clock.
>  >> 
>  >> Signed-off-by: Philip Avinash 
>  >> ---
>  >> Changes since v1:
>  >> - Reusing ti,am33xx as compatible field as both IP's are
>  >> same with am33xx platform and da850 has no platform specific
>  >> dependency.
> 
>  Sekhar> Which is fine, but I think the binding documentation still needs to 
> be
>  Sekhar> updated to document the ti,da850-ehrpwm binding. Looping Peter (it is
>  Sekhar> always a good idea to CC folks who reviewed your patch last time
>  Sekhar> around). Also, please Cc the DT folks and devicetree-discuss list too
>  Sekhar> for their opinion.
> 
> Yes, thanks for CC'ing me. I also think da850-* should be
> documented. See Documentation/devicetree/bindings/gpio/8xxx_gpio.txt for
> an similar (old) example.

Peter,

In this binding file also, only initial compatible field is updated. Later on 
many
compatible were added in driver. But not update back to binding doc.


---
followed by "fsl,mpc8349-gpio" for 83xx, "fsl,mpc8572-gpio" for 85xx and
"fsl,mpc8610-gpio" for 86xx.
---

---
static struct of_device_id mpc8xxx_gpio_ids[] __initdata = {
{ .compatible = "fsl,mpc8349-gpio", },
{ .compatible = "fsl,mpc8572-gpio", },
{ .compatible = "fsl,mpc8610-gpio", },
{ .compatible = "fsl,mpc5121-gpio", .data = mpc512x_irq_set_type, },
{ .compatible = "fsl,pq3-gpio", },
{ .compatible = "fsl,qoriq-gpio",   },
{}
};
---

Grant/Rob,
With respect peters explanation (below), what is your opinion on adding 
information to 
binding doc for da850 support?

Peter --> if the hardware block is identical the dts should simply list:
Peter --> compatible = "ti,da850-ecap", "ti,am33xx-ecap"
Peter --> And the driver only bind to ti,am33xx-ecap (unless there ever needs to
Peter --> be a da850 specific workaround.

Or
Should I update both binding doc & the driver to use new compatible option 
"ti,da830-ecap"
(as da830 platform has initial IP support)?
Even with this, platforms da830, da850 and am33xx can reuse "ti,da830-ecap" 
compatible field.

Thanks
Avinash

> 
> -- 
> Bye, Peter Korsgaard
> ___
> Davinci-linux-open-source mailing list
> davinci-linux-open-sou...@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
> 

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


RE: [PATCH v2 2/3] arm: davinci: clock node support for ECAP & EHRPWM

2013-03-20 Thread Philip, Avinash
On Wed, Mar 20, 2013 at 16:54:34, Nori, Sekhar wrote:
> On 3/20/2013 12:11 PM, Philip Avinash wrote:
> > Add clock node support for ECAP and EHRPWM modules.
> > Also adds TBCLK for EHRWPM TBCLK to comply with pwm-tiehrpwm
> > driver.
> > 
> > Signed-off-by: Philip Avinash 
> > ---
> > Changes Since v1:
> > - TBCLK make it as actual clock with enable/disable feature.
> > 
> > :100644 100644 0c4a26d... dbed75c... M  arch/arm/mach-davinci/da850.c
> > :100644 100644 de439b7... be77ce2... M  
> > arch/arm/mach-davinci/include/mach/da8xx.h
> >  arch/arm/mach-davinci/da850.c  |   46 
> > 
> >  arch/arm/mach-davinci/include/mach/da8xx.h |1 +
> >  2 files changed, 47 insertions(+)
> > 
> > diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> > index 0c4a26d..dbed75c 100644
> > --- a/arch/arm/mach-davinci/da850.c
> > +++ b/arch/arm/mach-davinci/da850.c
> > @@ -383,6 +383,49 @@ static struct clk dsp_clk = {
> > .flags  = PSC_LRST | PSC_FORCE,
> >  };
> >  
> > +static struct clk ehrpwm_clk = {
> > +   .name   = "ehrpwm",
> > +   .parent = &pll0_sysclk2,
> > +   .lpsc   = DA8XX_LPSC1_PWM,
> > +   .gpsc   = 1,
> > +   .flags  = DA850_CLK_ASYNC3,
> > +};
> > +
> > +#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
> > +
> > +void tblck_enable(struct clk *clk)
> 
> This should be static. Also, since tbclk is associated with ehrpwm,
> please call the function ehrpwm_tbclk_enable().

Ok I will correct it.

Thanks
Avinash
> 
> > +{
> > +   u32 val;
> > +
> > +   val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
> > +   val |= DA8XX_EHRPWM_TBCLKSYNC;
> > +   writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
> > +}
> > +
> > +void tblck_disable(struct clk *clk)
> 
> Same comment as above applies.
> 
> Thanks,
> Sekhar
> 



RE: [PATCH v2 1/3] ARM: davinci: clk framework support for enable/disable functionality

2013-03-20 Thread Philip, Avinash
On Wed, Mar 20, 2013 at 16:49:55, Nori, Sekhar wrote:
> On 3/20/2013 12:11 PM, Philip Avinash wrote:
> > DAVINCI clock framework currently not supporting clock enable/disable
> > functionality on clock nodes. In DAVINCI platform EHRPWM module requires
> 
> Wrong. clock enable/disable is supported in the DaVinci clock
> implementation, but just for PSC clocks.
> 
> > support for clock enable/disable for TBCLK support. Hence this patch
> > adds support for enabling/disabling clocks depends on the availability
> > of the functionality.
> > 
> > Signed-off-by: Philip Avinash 
> > ---
> > Changes since v1:
> > - Add support for clock enable/disable functionality.
> > 
> > :100644 100644 d458558... aa89e5e... M  arch/arm/mach-davinci/clock.c
> > :100644 100644 8694b39... 1e4e836... M  arch/arm/mach-davinci/clock.h
> >  arch/arm/mach-davinci/clock.c |4 
> >  arch/arm/mach-davinci/clock.h |2 ++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
> > index d458558..aa89e5e 100644
> > --- a/arch/arm/mach-davinci/clock.c
> > +++ b/arch/arm/mach-davinci/clock.c
> > @@ -35,6 +35,8 @@ static void __clk_enable(struct clk *clk)
> >  {
> > if (clk->parent)
> > __clk_enable(clk->parent);
> > +   if (clk->clk_enable)
> > +   clk->clk_enable(clk);
> 
> Why ignore usecount in this case?

Will check usecount & do enable. 

> 
> > if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
> 
> if clk->enable is available, no need to check for 'clk->flags & CLK_PSC'

I will correct it.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH v2 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-03-19 Thread Philip Avinash
Add da850 EHRPWM & ECAP DT node.
Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
clock.

Signed-off-by: Philip Avinash 
---
Changes since v1:
- Reusing ti,am33xx as compatible field as both IP's are
  same with am33xx platform and da850 has no platform specific
  dependency.

:100644 100644 3ec1bda... 62fd2d4... M  arch/arm/boot/dts/da850.dtsi
:100644 100644 6b7a0a2... 89ee974... M  arch/arm/mach-davinci/da8xx-dt.c
 arch/arm/boot/dts/da850.dtsi |   30 ++
 arch/arm/mach-davinci/da8xx-dt.c |5 +
 2 files changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ec1bda..62fd2d4 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -107,6 +107,36 @@
reg = <0x21000 0x1000>;
status = "disabled";
};
+   ehrpwm0: ehrpwm@01f0 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+   status = "disabled";
+   };
+   ehrpwm1: ehrpwm@01f02000 {
+   compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x302000 0x2000>;
+   status = "disabled";
+   };
+   ecap0: ecap@01f06000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+   status = "disabled";
+   };
+   ecap1: ecap@01f07000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x307000 0x80>;
+   status = "disabled";
+   };
+   ecap2: ecap@01f08000 {
+   compatible = "ti,da850-ecap", "ti,am33xx-ecap";
+   #pwm-cells = <3>;
+   reg = <0x308000 0x80>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 6b7a0a2..89ee974 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -40,6 +40,11 @@ static void __init da8xx_init_irq(void)
 struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f0, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
{}
 };
 
-- 
1.7.9.5

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


[PATCH v2 1/3] ARM: davinci: clk framework support for enable/disable functionality

2013-03-19 Thread Philip Avinash
DAVINCI clock framework currently not supporting clock enable/disable
functionality on clock nodes. In DAVINCI platform EHRPWM module requires
support for clock enable/disable for TBCLK support. Hence this patch
adds support for enabling/disabling clocks depends on the availability
of the functionality.

Signed-off-by: Philip Avinash 
---
Changes since v1:
- Add support for clock enable/disable functionality.

:100644 100644 d458558... aa89e5e... M  arch/arm/mach-davinci/clock.c
:100644 100644 8694b39... 1e4e836... M  arch/arm/mach-davinci/clock.h
 arch/arm/mach-davinci/clock.c |4 
 arch/arm/mach-davinci/clock.h |2 ++
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index d458558..aa89e5e 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -35,6 +35,8 @@ static void __clk_enable(struct clk *clk)
 {
if (clk->parent)
__clk_enable(clk->parent);
+   if (clk->clk_enable)
+   clk->clk_enable(clk);
if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
true, clk->flags);
@@ -44,6 +46,8 @@ static void __clk_disable(struct clk *clk)
 {
if (WARN_ON(clk->usecount == 0))
return;
+   if (clk->clk_disable)
+   clk->clk_disable(clk);
if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) &&
(clk->flags & CLK_PSC))
davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 8694b39..1e4e836 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -104,6 +104,8 @@ struct clk {
int (*set_rate) (struct clk *clk, unsigned long rate);
int (*round_rate) (struct clk *clk, unsigned long rate);
int (*reset) (struct clk *clk, bool reset);
+   void (*clk_enable) (struct clk *clk);
+   void (*clk_disable) (struct clk *clk);
 };
 
 /* Clock flags: SoC-specific flags start at BIT(16) */
-- 
1.7.9.5

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


[PATCH v2 2/3] arm: davinci: clock node support for ECAP & EHRPWM

2013-03-19 Thread Philip Avinash
Add clock node support for ECAP and EHRPWM modules.
Also adds TBCLK for EHRWPM TBCLK to comply with pwm-tiehrpwm
driver.

Signed-off-by: Philip Avinash 
---
Changes Since v1:
- TBCLK make it as actual clock with enable/disable feature.

:100644 100644 0c4a26d... dbed75c... M  arch/arm/mach-davinci/da850.c
:100644 100644 de439b7... be77ce2... M  
arch/arm/mach-davinci/include/mach/da8xx.h
 arch/arm/mach-davinci/da850.c  |   46 
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 2 files changed, 47 insertions(+)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0c4a26d..dbed75c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -383,6 +383,49 @@ static struct clk dsp_clk = {
.flags  = PSC_LRST | PSC_FORCE,
 };
 
+static struct clk ehrpwm_clk = {
+   .name   = "ehrpwm",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_PWM,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
+#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
+
+void tblck_enable(struct clk *clk)
+{
+   u32 val;
+
+   val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+   val |= DA8XX_EHRPWM_TBCLKSYNC;
+   writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+void tblck_disable(struct clk *clk)
+{
+   u32 val;
+
+   val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+   val &= ~DA8XX_EHRPWM_TBCLKSYNC;
+   writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
+}
+
+static struct clk ehrpwm_tbclk = {
+   .name   = "ehrpwm_tbclk",
+   .parent = &ehrpwm_clk,
+   .clk_enable = tblck_enable,
+   .clk_disable= tblck_disable,
+};
+
+static struct clk ecap_clk = {
+   .name   = "ecap",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_ECAP,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
 static struct clk_lookup da850_clks[] = {
CLK(NULL,   "ref",  &ref_clk),
CLK(NULL,   "pll0", &pll0_clk),
@@ -430,6 +473,9 @@ static struct clk_lookup da850_clks[] = {
CLK("vpif", NULL,   &vpif_clk),
CLK("ahci", NULL,   &sata_clk),
CLK("davinci-rproc.0",  NULL,   &dsp_clk),
+   CLK("ehrpwm",   "fck",  &ehrpwm_clk),
+   CLK("ehrpwm",   "tbclk",&ehrpwm_tbclk),
+   CLK("ecap", "fck",  &ecap_clk),
CLK(NULL,   NULL,   NULL),
 };
 
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index de439b7..be77ce2 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -55,6 +55,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SYSCFG0_VIRT(x)  (da8xx_syscfg0_base + (x))
 #define DA8XX_JTAG_ID_REG  0x18
 #define DA8XX_CFGCHIP0_REG 0x17c
+#define DA8XX_CFGCHIP1_REG 0x180
 #define DA8XX_CFGCHIP2_REG 0x184
 #define DA8XX_CFGCHIP3_REG 0x188
 
-- 
1.7.9.5

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


[PATCH v2 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI.

2013-03-19 Thread Philip Avinash
Add platform support for EHRPWM and ECAP by providing clock nodes and
device tree nodes.
This series depends on [1] and [2] and is available for testing at [3].
Tested for backlight support in da850 EVM with EHRPWM PWM device.

[1] http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
[2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
[3] https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm

Note:
DT support for EHRPWM backlight has not been added in da850-evm.dts as there is
conflicting pin-mux requirement with SPI flash.

Philip Avinash (3):
  ARM: davinci: clk framework support for enable/disable functionality
  arm: davinci: clock node support for ECAP & EHRPWM
  ARM: davinci: da850: add EHRPWM & ECAP DT node

 arch/arm/boot/dts/da850.dtsi   |   30 ++
 arch/arm/mach-davinci/clock.c  |4 +++
 arch/arm/mach-davinci/clock.h  |2 ++
 arch/arm/mach-davinci/da850.c  |   46 
 arch/arm/mach-davinci/da8xx-dt.c   |5 +++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 6 files changed, 88 insertions(+)

-- 
1.7.9.5

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


[PATCH v2] pwm: davinci: Add Kconfig support for ECAP & EHRPWM devices

2013-03-19 Thread Philip Avinash
Add EHRPWM and ECAP support build support for DAVINCI_DA8XX platforms.

Also, since DAVINCI platforms doesn't support TI-PWM-Subsystem module,
remove the select option for CONFIG_PWM_TIPWMSS.

Also, update CONFIG_PWM_TIPWMSS compiler directive appropriately in
pwm-tipwmss.h to fix the below compiler error upon removal of
CONFIG_PWM_TIPWMSS for DAVINCI platforms.

drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_probe':
drivers/pwm/pwm-tiecap.c:263:4: error: 'PWMSS_ECAPCLK_EN' undeclared
(first use in this function)
drivers/pwm/pwm-tiecap.c:263:4: note: each undeclared identifier
is reported only once for each function it appears in
drivers/pwm/pwm-tiecap.c:264:17: error: 'PWMSS_ECAPCLK_EN_ACK'
undeclared (first use in this function)
drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_remove':
drivers/pwm/pwm-tiecap.c:291:49: error: 'PWMSS_ECAPCLK_STOP_REQ'
undeclared (first use in this function)
make[2]: *** [drivers/pwm/pwm-tiecap.o] Error 1
make[1]: *** [drivers/pwm] Error 2
    make: *** [drivers] Error 2

Signed-off-by: Philip Avinash 
---
Changes Since v1:
- Change the Kconfig dependency to ARCH_DAVINCI_DA8XX from
  ARCH_DAVINCI_DA850.

This patch series based on [1] and is available at [2].

[1] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
[2] https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm

:100644 100644 0e0bfa0... 115b644... M  drivers/pwm/Kconfig
:100644 100644 11f76a1... 10ad804... M  drivers/pwm/pwm-tipwmss.h
 drivers/pwm/Kconfig   |8 +++-
 drivers/pwm/pwm-tipwmss.h |2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 0e0bfa0..115b644 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -147,8 +147,7 @@ config PWM_TEGRA
 
 config  PWM_TIECAP
tristate "ECAP PWM support"
-   depends on SOC_AM33XX
-   select PWM_TIPWMSS
+   depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
help
  PWM driver support for the ECAP APWM controller found on AM33XX
  TI SOC
@@ -158,8 +157,7 @@ config  PWM_TIECAP
 
 config  PWM_TIEHRPWM
tristate "EHRPWM PWM support"
-   depends on SOC_AM33XX
-   select PWM_TIPWMSS
+   depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
help
  PWM driver support for the EHRPWM controller found on AM33XX
  TI SOC
@@ -169,7 +167,7 @@ config  PWM_TIEHRPWM
 
 config  PWM_TIPWMSS
bool
-   depends on SOC_AM33XX && (PWM_TIEHRPWM || PWM_TIECAP)
+   default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM)
help
  PWM Subsystem driver support for AM33xx SOC.
 
diff --git a/drivers/pwm/pwm-tipwmss.h b/drivers/pwm/pwm-tipwmss.h
index 11f76a1..10ad804 100644
--- a/drivers/pwm/pwm-tipwmss.h
+++ b/drivers/pwm/pwm-tipwmss.h
@@ -18,7 +18,6 @@
 #ifndef __TIPWMSS_H
 #define __TIPWMSS_H
 
-#ifdef CONFIG_PWM_TIPWMSS
 /* PWM substem clock gating */
 #define PWMSS_ECAPCLK_EN   BIT(0)
 #define PWMSS_ECAPCLK_STOP_REQ BIT(1)
@@ -28,6 +27,7 @@
 #define PWMSS_ECAPCLK_EN_ACK   BIT(0)
 #define PWMSS_EPWMCLK_EN_ACK   BIT(8)
 
+#ifdef CONFIG_PWM_TIPWMSS
 extern u16 pwmss_submodule_state_change(struct device *dev, int set);
 #else
 static inline u16 pwmss_submodule_state_change(struct device *dev, int set)
-- 
1.7.9.5

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


RE: [PATCH 2/3] ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1

2013-03-14 Thread Philip, Avinash
On Fri, Mar 15, 2013 at 10:38:58, Nori, Sekhar wrote:
> On 3/15/2013 10:27 AM, Philip, Avinash wrote:
> > On Thu, Mar 14, 2013 at 18:31:52, Nori, Sekhar wrote:
> >> On 3/14/2013 4:07 PM, Philip Avinash wrote:
> >>> da850 platforms require TBCLK synchronization in CFG_CHIP1 register for
> >>> TBCLK enable in EHRPWM modules. Enabling of TBCLK is done only if EHRPWM
> >>> DT node status is set to "okay" DT blob.
> >>> Also adds macro definitions for DA8XX_EHRPWM_TBCLKSYNC and
> >>> DA8XX_CFGCHIP1_REG.
> >>
> >> So there is actually a TBCLK in DA850 - it's just not modeled as a clock
> >> similar to the way it is done on AM335x? If yes, then instead of adding
> >> a dummy clock node and doing the TBCLK enable as part of init, why not
> >> model TBCLK in clock tree even on DA850?
> > 
> > 
> > TBCLK enabling should done from platform specific way. In DA850 it is done 
> > at
> > CFGCHIP1 register. Unfortunately Davinci clock frame work will support only
> > clock nodes inside PLLC and PSC modules. Handling of CFGCHP1 require
> 
> That's true at the moment, but that can be fixed.

I will check.

> 
> > modifications in clock frame work.
> > 
> > Hence handling it as part of initialization.
> 
> I am curious as to how this clock is handled in am335x. I searched for
> tbclk in arch/arm/ of linux-next but could not find any references.
> Where should I be looking?

Patch is submitted. This patch is not in Paul's tree.

[PATCH v2] ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK
https://patchwork.kernel.org/patch/2127581/

Paul,
Can you accept the above patch.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH 2/3] ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1

2013-03-14 Thread Philip, Avinash
On Thu, Mar 14, 2013 at 18:31:52, Nori, Sekhar wrote:
> On 3/14/2013 4:07 PM, Philip Avinash wrote:
> > da850 platforms require TBCLK synchronization in CFG_CHIP1 register for
> > TBCLK enable in EHRPWM modules. Enabling of TBCLK is done only if EHRPWM
> > DT node status is set to "okay" DT blob.
> > Also adds macro definitions for DA8XX_EHRPWM_TBCLKSYNC and
> > DA8XX_CFGCHIP1_REG.
> 
> So there is actually a TBCLK in DA850 - it's just not modeled as a clock
> similar to the way it is done on AM335x? If yes, then instead of adding
> a dummy clock node and doing the TBCLK enable as part of init, why not
> model TBCLK in clock tree even on DA850?


TBCLK enabling should done from platform specific way. In DA850 it is done at
CFGCHIP1 register. Unfortunately Davinci clock frame work will support only
clock nodes inside PLLC and PSC modules. Handling of CFGCHP1 require
modifications in clock frame work.

Hence handling it as part of initialization.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 



RE: [PATCH 2/3] pwm: pwm-tiecap: Add device-tree binding support for da850 SOC

2013-03-14 Thread Philip, Avinash
On Thu, Mar 14, 2013 at 17:13:08, Nori, Sekhar wrote:
> On 3/14/2013 4:02 PM, Philip Avinash wrote:
> > ECAP IP is used in da850 SOC's also. Hence adds ECAP device tree binding
> > support for da850.
> > 
> > Cc: Grant Likely 
> > Cc: Rob Herring 
> > Cc: Rob Landley 
> > Signed-off-by: Philip Avinash 
> > ---
> > :100644 100644 131e8c1... fcbd3c1... M  
> > Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
> > :100644 100644 22e96e2... e0d96c8... M  drivers/pwm/pwm-tiecap.c
> >  .../devicetree/bindings/pwm/pwm-tiecap.txt |2 +-
> >  drivers/pwm/pwm-tiecap.c   |1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt 
> > b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
> > index 131e8c1..fcbd3c1 100644
> > --- a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
> > +++ b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
> > @@ -1,7 +1,7 @@
> >  TI SOC ECAP based APWM controller
> >  
> >  Required properties:
> > -- compatible: Must be "ti,am33xx-ecap"
> > +- compatible: Must be "ti,am33xx-ecap" or "ti,da850-ecap"
> >  - #pwm-cells: Should be 3. Number of cells being used to specify PWM 
> > property.
> >First cell specifies the per-chip index of the PWM to use, the second
> >cell is the period in nanoseconds and bit 0 in the third cell is used to
> > diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
> > index 22e96e2..e0d96c8 100644
> > --- a/drivers/pwm/pwm-tiecap.c
> > +++ b/drivers/pwm/pwm-tiecap.c
> > @@ -197,6 +197,7 @@ static const struct pwm_ops ecap_pwm_ops = {
> >  
> >  static const struct of_device_id ecap_of_match[] = {
> > { .compatible   = "ti,am33xx-ecap" },
> > +   { .compatible   = "ti,da850-ecap" },
> > {},
> 
> You add a new compatible, but don't really show any changes in driver in
> this series. So why can't we simply use ti,am33xx-ecap on DA850 too?

Ok it can happily live with ti,am33xx-ecap. Hence this patch and next [1]patch
can be dropped.

1. [PATCH 3/3] pwm: pwm-tiehrpwm: Add device tree binding support for da850 SOC

Thanks
Avinash
> 
> Thanks,
> Sekhar
> 



RE: [PATCH 1/3] pwm: davinci: Add Kconfig support for ECAP & EHRPWM devices

2013-03-14 Thread Philip, Avinash
On Thu, Mar 14, 2013 at 17:09:04, Nori, Sekhar wrote:
> On 3/14/2013 4:02 PM, Philip Avinash wrote:
> > Add EHRPWM and ECAP support build support for DAVINCI_DA850 platforms.
> > 
> > Also, since DAVINCI platforms doesn't support TI-PWM-Subsystem module,
> > remove the select option for CONFIG_PWM_TIPWMSS.
> > 
> > Also, update CONFIG_PWM_TIPWMSS compiler directive appropriately in
> > pwm-tipwmss.h to fix the below compiler error upon removal of
> > CONFIG_PWM_TIPWMSS for Davinci platforms.
> > 
> > drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_probe':
> > drivers/pwm/pwm-tiecap.c:263:4: error: 'PWMSS_ECAPCLK_EN' undeclared
> > (first use in this function)
> > drivers/pwm/pwm-tiecap.c:263:4: note: each undeclared identifier
> > is reported only once for each function it appears in
> > drivers/pwm/pwm-tiecap.c:264:17: error: 'PWMSS_ECAPCLK_EN_ACK'
> > undeclared (first use in this function)
> > drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_remove':
> > drivers/pwm/pwm-tiecap.c:291:49: error: 'PWMSS_ECAPCLK_STOP_REQ'
> > undeclared (first use in this function)
> > make[2]: *** [drivers/pwm/pwm-tiecap.o] Error 1
> > make[1]: *** [drivers/pwm] Error 2
> > make: *** [drivers] Error 2
> > 
> > Signed-off-by: Philip Avinash 
> 
> >  config  PWM_TIECAP
> > tristate "ECAP PWM support"
> > -   depends on SOC_AM33XX
> > -   select PWM_TIPWMSS
> > +   depends on SOC_AM33XX || ARCH_DAVINCI_DA850
> 
> Having such narrow dependencies is wrong. The same device is present on
> DaVinci DA830 too. A depends on should not be required at all since the
> driver should build on all architectures. But I have seen resistance to
> doing that since users don't like to see configuration options totally
> irrelevant for the architecture they are building for. So may be take a
> middle path and do 'depends on ARCH_ARM'?

I will add dependency only on ARCH_ARM and submit another version.

Thanks
Avinash

> 
> Thanks,
> Sekhar
> 

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH 1/3] arm: davinci: clock node support for ECAP & EHRPWM

2013-03-14 Thread Philip Avinash
Add clock node support for ECAP and EHRPWM modules.
Also adds dummy clock for EHRWPM TBCLK to comply with pwm-tiehrpwm
driver.

Signed-off-by: Philip Avinash 
---
:100644 100644 0c4a26d... 891d075... M  arch/arm/mach-davinci/da850.c
 arch/arm/mach-davinci/da850.c |   24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0c4a26d..891d075 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -383,6 +383,27 @@ static struct clk dsp_clk = {
.flags  = PSC_LRST | PSC_FORCE,
 };
 
+static struct clk ehrpwm_clk = {
+   .name   = "ehrpwm",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_PWM,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
+static struct clk ehrpwm_tbclk = {
+   .name   = "ehrpwm_tbclk",
+   .parent = NULL,
+};
+
+static struct clk ecap_clk = {
+   .name   = "ecap",
+   .parent = &pll0_sysclk2,
+   .lpsc   = DA8XX_LPSC1_ECAP,
+   .gpsc   = 1,
+   .flags  = DA850_CLK_ASYNC3,
+};
+
 static struct clk_lookup da850_clks[] = {
CLK(NULL,   "ref",  &ref_clk),
CLK(NULL,   "pll0", &pll0_clk),
@@ -430,6 +451,9 @@ static struct clk_lookup da850_clks[] = {
CLK("vpif", NULL,   &vpif_clk),
CLK("ahci", NULL,   &sata_clk),
CLK("davinci-rproc.0",  NULL,   &dsp_clk),
+   CLK("ehrpwm",   "fck",  &ehrpwm_clk),
+   CLK("ehrpwm",   "tbclk",&ehrpwm_tbclk),
+   CLK("ecap", "fck",  &ecap_clk),
CLK(NULL,   NULL,   NULL),
 };
 
-- 
1.7.9.5

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


[PATCH 2/3] ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1

2013-03-14 Thread Philip Avinash
da850 platforms require TBCLK synchronization in CFG_CHIP1 register for
TBCLK enable in EHRPWM modules. Enabling of TBCLK is done only if EHRPWM
DT node status is set to "okay" DT blob.
Also adds macro definitions for DA8XX_EHRPWM_TBCLKSYNC and
DA8XX_CFGCHIP1_REG.

Signed-off-by: Philip Avinash 
---
:100644 100644 6b7a0a2... 72466ab... M  arch/arm/mach-davinci/da8xx-dt.c
:100644 100644 de439b7... be77ce2... M  
arch/arm/mach-davinci/include/mach/da8xx.h
 arch/arm/mach-davinci/da8xx-dt.c   |   15 +++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 6b7a0a2..72466ab 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -19,6 +19,7 @@
 #include 
 
 #define DA8XX_NUM_UARTS3
+#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
 
 void __init da8xx_uart_clk_enable(void)
 {
@@ -47,10 +48,24 @@ struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 
 static void __init da850_init_machine(void)
 {
+   struct device_node *ehrpwm_np;
+   const char *ehrpwm_compat = "ti,da850-ehrpwm";
+   void __iomem *cfg_chip1_base;
+
+   cfg_chip1_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG);
+
of_platform_populate(NULL, of_default_bus_match_table,
 da850_auxdata_lookup, NULL);
 
da8xx_uart_clk_enable();
+
+   for_each_compatible_node(ehrpwm_np, NULL, ehrpwm_compat)
+   if (of_device_is_available(ehrpwm_np)) {
+   /* Enable TBCLK synchronization for EHRWPM modules */
+   writel(readl(cfg_chip1_base) | DA8XX_EHRPWM_TBCLKSYNC,
+   cfg_chip1_base);
+   break;
+   }
 }
 
 static const char *da850_boards_compat[] __initdata = {
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index de439b7..be77ce2 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -55,6 +55,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SYSCFG0_VIRT(x)  (da8xx_syscfg0_base + (x))
 #define DA8XX_JTAG_ID_REG  0x18
 #define DA8XX_CFGCHIP0_REG 0x17c
+#define DA8XX_CFGCHIP1_REG 0x180
 #define DA8XX_CFGCHIP2_REG 0x184
 #define DA8XX_CFGCHIP3_REG 0x188
 
-- 
1.7.9.5

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


[PATCH 0/3] Platform support for EHRPWM & ECAP devices in Davinci.

2013-03-14 Thread Philip Avinash
Add platform support for EHRPWM and ECAP by providing clock nodes and
device tree nodes.
This series depends on [1] and [2] and is available for testing at [3]

[1] http://gitorious.org/linux-davinci/linux-davinci/trees/davinci-for-v3.9/dt-2
[2] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
[3] https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm

Philip Avinash (3):
  arm: davinci: clock node support for ECAP & EHRPWM
  ARM: davinci: da850: Enable EHRPWM TBCLK from CFG_CHIP1
  ARM: davinci: da850: add EHRPWM & ECAP DT node

 arch/arm/boot/dts/da850.dtsi   |   30 
 arch/arm/mach-davinci/da850.c  |   24 ++
 arch/arm/mach-davinci/da8xx-dt.c   |   20 +++
 arch/arm/mach-davinci/include/mach/da8xx.h |1 +
 4 files changed, 75 insertions(+)

-- 
1.7.9.5

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


[PATCH 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node

2013-03-14 Thread Philip Avinash
Add da850 EHRPWM & ECAP DT node.
Also adds OF_DEV_AUXDATA for EHRPWM & ECAP driver to use EHRPWM & ECAP
clock.

Signed-off-by: Philip Avinash 
---
:100644 100644 3ec1bda... 9b5b613... M  arch/arm/boot/dts/da850.dtsi
:100644 100644 72466ab... e32484c... M  arch/arm/mach-davinci/da8xx-dt.c
 arch/arm/boot/dts/da850.dtsi |   30 ++
 arch/arm/mach-davinci/da8xx-dt.c |5 +
 2 files changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ec1bda..9b5b613 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -107,6 +107,36 @@
reg = <0x21000 0x1000>;
status = "disabled";
};
+   ehrpwm0: ehrpwm@01f0 {
+   compatible = "ti,da850-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x30 0x2000>;
+   status = "disabled";
+   };
+   ehrpwm1: ehrpwm@01f02000 {
+   compatible = "ti,da850-ehrpwm";
+   #pwm-cells = <3>;
+   reg = <0x302000 0x2000>;
+   status = "disabled";
+   };
+   ecap0: ecap@01f06000 {
+   compatible = "ti,da850-ecap";
+   #pwm-cells = <3>;
+   reg = <0x306000 0x80>;
+   status = "disabled";
+   };
+   ecap1: ecap@01f07000 {
+   compatible = "ti,da850-ecap";
+   #pwm-cells = <3>;
+   reg = <0x307000 0x80>;
+   status = "disabled";
+   };
+   ecap2: ecap@01f08000 {
+   compatible = "ti,da850-ecap";
+   #pwm-cells = <3>;
+   reg = <0x308000 0x80>;
+   status = "disabled";
+   };
};
nand_cs3@6200 {
compatible = "ti,davinci-nand";
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 72466ab..e32484c 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -41,6 +41,11 @@ static void __init da8xx_init_irq(void)
 struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f0, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap", NULL),
+   OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap", NULL),
{}
 };
 
-- 
1.7.9.5

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


[PATCH 3/3] pwm: pwm-tiehrpwm: Add device tree binding support for da850 SOC

2013-03-14 Thread Philip Avinash
EHRPWM IP is used in da850 SOC's also. Hence adds EHRPWM device tree
binding support for da850.

Cc: Grant Likely 
Cc: Rob Herring 
Cc: Rob Landley 
Signed-off-by: Philip Avinash 
---
:100644 100644 4fc7079... 0442d65... M  
Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
:100644 100644 8b4c86f... 6561ec2... M  drivers/pwm/pwm-tiehrpwm.c
 .../devicetree/bindings/pwm/pwm-tiehrpwm.txt   |2 +-
 drivers/pwm/pwm-tiehrpwm.c |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt 
b/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
index 4fc7079..0442d65 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-tiehrpwm.txt
@@ -1,7 +1,7 @@
 TI SOC EHRPWM based PWM controller
 
 Required properties:
-- compatible : Must be "ti,am33xx-ehrpwm"
+- compatible : Must be "ti,am33xx-ehrpwm" or "ti,da850-ehrpwm"
 - #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
   First cell specifies the per-chip index of the PWM to use, the second
   cell is the period in nanoseconds and bit 0 in the third cell is used to
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 8b4c86f..6561ec2 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -428,6 +428,7 @@ static const struct pwm_ops ehrpwm_pwm_ops = {
 
 static const struct of_device_id ehrpwm_of_match[] = {
{ .compatible   = "ti,am33xx-ehrpwm" },
+   { .compatible   = "ti,da850-ehrpwm" },
{},
 };
 MODULE_DEVICE_TABLE(of, ehrpwm_of_match);
-- 
1.7.9.5

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


[PATCH 2/3] pwm: pwm-tiecap: Add device-tree binding support for da850 SOC

2013-03-14 Thread Philip Avinash
ECAP IP is used in da850 SOC's also. Hence adds ECAP device tree binding
support for da850.

Cc: Grant Likely 
Cc: Rob Herring 
Cc: Rob Landley 
Signed-off-by: Philip Avinash 
---
:100644 100644 131e8c1... fcbd3c1... M  
Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
:100644 100644 22e96e2... e0d96c8... M  drivers/pwm/pwm-tiecap.c
 .../devicetree/bindings/pwm/pwm-tiecap.txt |2 +-
 drivers/pwm/pwm-tiecap.c   |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt 
b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
index 131e8c1..fcbd3c1 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
@@ -1,7 +1,7 @@
 TI SOC ECAP based APWM controller
 
 Required properties:
-- compatible: Must be "ti,am33xx-ecap"
+- compatible: Must be "ti,am33xx-ecap" or "ti,da850-ecap"
 - #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
   First cell specifies the per-chip index of the PWM to use, the second
   cell is the period in nanoseconds and bit 0 in the third cell is used to
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 22e96e2..e0d96c8 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -197,6 +197,7 @@ static const struct pwm_ops ecap_pwm_ops = {
 
 static const struct of_device_id ecap_of_match[] = {
{ .compatible   = "ti,am33xx-ecap" },
+   { .compatible   = "ti,da850-ecap" },
{},
 };
 MODULE_DEVICE_TABLE(of, ecap_of_match);
-- 
1.7.9.5

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


[PATCH 1/3] pwm: davinci: Add Kconfig support for ECAP & EHRPWM devices

2013-03-14 Thread Philip Avinash
Add EHRPWM and ECAP support build support for DAVINCI_DA850 platforms.

Also, since DAVINCI platforms doesn't support TI-PWM-Subsystem module,
remove the select option for CONFIG_PWM_TIPWMSS.

Also, update CONFIG_PWM_TIPWMSS compiler directive appropriately in
pwm-tipwmss.h to fix the below compiler error upon removal of
CONFIG_PWM_TIPWMSS for Davinci platforms.

drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_probe':
drivers/pwm/pwm-tiecap.c:263:4: error: 'PWMSS_ECAPCLK_EN' undeclared
(first use in this function)
drivers/pwm/pwm-tiecap.c:263:4: note: each undeclared identifier
is reported only once for each function it appears in
drivers/pwm/pwm-tiecap.c:264:17: error: 'PWMSS_ECAPCLK_EN_ACK'
undeclared (first use in this function)
drivers/pwm/pwm-tiecap.c: In function 'ecap_pwm_remove':
drivers/pwm/pwm-tiecap.c:291:49: error: 'PWMSS_ECAPCLK_STOP_REQ'
undeclared (first use in this function)
make[2]: *** [drivers/pwm/pwm-tiecap.o] Error 1
make[1]: *** [drivers/pwm] Error 2
    make: *** [drivers] Error 2

Signed-off-by: Philip Avinash 
---
:100644 100644 0e0bfa0... 897b53c... M  drivers/pwm/Kconfig
:100644 100644 11f76a1... 10ad804... M  drivers/pwm/pwm-tipwmss.h
 drivers/pwm/Kconfig   |8 +++-
 drivers/pwm/pwm-tipwmss.h |2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 0e0bfa0..897b53c 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -147,8 +147,7 @@ config PWM_TEGRA
 
 config  PWM_TIECAP
tristate "ECAP PWM support"
-   depends on SOC_AM33XX
-   select PWM_TIPWMSS
+   depends on SOC_AM33XX || ARCH_DAVINCI_DA850
help
  PWM driver support for the ECAP APWM controller found on AM33XX
  TI SOC
@@ -158,8 +157,7 @@ config  PWM_TIECAP
 
 config  PWM_TIEHRPWM
tristate "EHRPWM PWM support"
-   depends on SOC_AM33XX
-   select PWM_TIPWMSS
+   depends on SOC_AM33XX || ARCH_DAVINCI_DA850
help
  PWM driver support for the EHRPWM controller found on AM33XX
  TI SOC
@@ -169,7 +167,7 @@ config  PWM_TIEHRPWM
 
 config  PWM_TIPWMSS
bool
-   depends on SOC_AM33XX && (PWM_TIEHRPWM || PWM_TIECAP)
+   default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM)
help
  PWM Subsystem driver support for AM33xx SOC.
 
diff --git a/drivers/pwm/pwm-tipwmss.h b/drivers/pwm/pwm-tipwmss.h
index 11f76a1..10ad804 100644
--- a/drivers/pwm/pwm-tipwmss.h
+++ b/drivers/pwm/pwm-tipwmss.h
@@ -18,7 +18,6 @@
 #ifndef __TIPWMSS_H
 #define __TIPWMSS_H
 
-#ifdef CONFIG_PWM_TIPWMSS
 /* PWM substem clock gating */
 #define PWMSS_ECAPCLK_EN   BIT(0)
 #define PWMSS_ECAPCLK_STOP_REQ BIT(1)
@@ -28,6 +27,7 @@
 #define PWMSS_ECAPCLK_EN_ACK   BIT(0)
 #define PWMSS_EPWMCLK_EN_ACK   BIT(8)
 
+#ifdef CONFIG_PWM_TIPWMSS
 extern u16 pwmss_submodule_state_change(struct device *dev, int set);
 #else
 static inline u16 pwmss_submodule_state_change(struct device *dev, int set)
-- 
1.7.9.5

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


[PATCH 0/3] Davinci support for EHRPWM & ECAP

2013-03-14 Thread Philip Avinash
This patch series enables EHRPWM & ECAP driver support for da850
platforms.

This patch series based on [1] and is available at [2]. This has been tested
backlight support using EHRPWM in da850-evm.

[1] https://gitorious.org/linux-pwm/linux-pwm/trees/for-next
[2] https://github.com/avinashphilip/am335x_linux/tree/davinci-for-v3.9_soc_pwm

Philip Avinash (3):
  pwm: davinci: Add Kconfig support for ECAP & EHRPWM devices
  pwm: pwm-tiecap: Add device-tree binding support for da850 SOC
  pwm: pwm-tiehrpwm: Add device tree binding support for da850 SOC

 .../devicetree/bindings/pwm/pwm-tiecap.txt |2 +-
 .../devicetree/bindings/pwm/pwm-tiehrpwm.txt   |2 +-
 drivers/pwm/Kconfig|8 +++-
 drivers/pwm/pwm-tiecap.c   |1 +
 drivers/pwm/pwm-tiehrpwm.c |1 +
 drivers/pwm/pwm-tipwmss.h  |2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

-- 
1.7.9.5

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


RE: linux-next: JFFS2 corruption

2013-02-27 Thread Philip, Avinash
On Wed, Feb 27, 2013 at 20:42:01, Mark Jackson wrote:
> On 26/02/13 23:18, Stephen Rothwell wrote:
> > Hi Mark,
> > 
> > On Tue, 26 Feb 2013 15:50:18 + Mark Jackson  
> > wrote:
> >>
> >> Just tested the current next-20130226 on a custom AM335X board, and if I 
> >> mount
> >> our JFFS2 image as read/write, the next reboot shows the image as being 
> >> corrupt.
> >>
> >> If I reprogram the jffs2 image into NAND and only mount the volume as 
> >> read-only,
> >> no corruption occurs and the system remains intact.
> >>
> >> I have also tested:-
> >>
> >> (a) reprogram ubifs image into nand
> >> (b) boot the volume as read-only (corrupt -> no)
> >> (c) remount the volume as read/write
> >> (d) rebooting the volume as read-only (corrupt -> yes)
> > 
> > Thanks for all the testing.  Sam questions as in my other email.
> 
> Okay, just tested 3v8 plus:-
> 
> https://patchwork.kernel.org/patch/1931251/
> https://patchwork.kernel.org/patch/1931221/
> https://patchwork.kernel.org/patch/1931201/
> and changed drivers/mtd/nand/elm.c, line 388 "ti,am33xx-elm" to 
> "ti,am3352-elm"
> 
> This produces an identical corruption.
> 
> I have also tested next-20130225 and next-20130227, and both cause the same 
> corruption.

JFFS2 is not supported in am335x with BCH8 ecc scheme because of ECC layout 
constraints.
Reasons for disabling JFFS2 support documented in the wiki
http://processors.wiki.ti.com/index.php/AM335x_JFFS2_Support_Guide#Reasons_for_disabling_JFFS2_support


Thanks
Avinash
> 
> Regards
> Mark J.
> 
> __
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 

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


[PATCH v3 3/3] mtd: devices: elm: Low power transition support

2013-02-19 Thread Philip Avinash
In low power modes of AM335X platforms, peripherals power is cut off.
This patch supports low power sleep transition support for ELM driver.

Signed-off-by: Philip Avinash 
---
Changes Since v2:
- Removes wait queue mechanism. The order of device creation ensures
  that nand driver got suspended well before elm module suspend.
  Hence no need to check elm module state on suspend.

 drivers/mtd/devices/elm.c |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index f034239..a41c968 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -379,6 +380,23 @@ static int elm_remove(struct platform_device *pdev)
return 0;
 }
 
+static int elm_suspend(struct device *dev)
+{
+   pm_runtime_put_sync(dev);
+   return 0;
+}
+
+static int elm_resume(struct device *dev)
+{
+   struct elm_info *info = dev_get_drvdata(dev);
+
+   pm_runtime_get_sync(dev);
+   elm_config(dev, info->bch_type);
+   return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
+
 #ifdef CONFIG_OF
 static const struct of_device_id elm_of_match[] = {
{ .compatible = "ti,am3352-elm" },
@@ -392,6 +410,7 @@ static struct platform_driver elm_driver = {
.name   = "elm",
.owner  = THIS_MODULE,
.of_match_table = of_match_ptr(elm_of_match),
+   .pm = &elm_pm_ops,
},
.probe  = elm_probe,
.remove = elm_remove,
-- 
1.7.9.5

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


[PATCH v3 2/3] arm: gpmc: Low power transition support

2013-02-19 Thread Philip Avinash
With GPMC converted to platform driver recently, adds low power
transition support in driver itself.

Signed-off-by: Philip Avinash 
---
Changes since v1:
Module disable & enable added using pm_runtime support.

 arch/arm/mach-omap2/gpmc.c |   20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index b1cd6c1..cc57988 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1361,9 +1361,29 @@ static __devexit int gpmc_remove(struct platform_device 
*pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int gpmc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   omap3_gpmc_save_context();
+   pm_runtime_put_sync(&pdev->dev);
+   return 0;
+}
+
+static int gpmc_resume(struct platform_device *pdev)
+{
+   pm_runtime_get_sync(&pdev->dev);
+   omap3_gpmc_restore_context();
+   return 0;
+}
+#endif
+
 static struct platform_driver gpmc_driver = {
.probe  = gpmc_probe,
.remove = __devexit_p(gpmc_remove),
+#ifdef CONFIG_PM
+   .suspend= gpmc_suspend,
+   .resume = gpmc_resume,
+#endif
.driver = {
.name   = DEVICE_NAME,
.owner  = THIS_MODULE,
-- 
1.7.9.5

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


RE: [PATCH v2 3/4] mtd: devices: elm: Low power transition support

2013-02-19 Thread Philip, Avinash
On Wed, Feb 13, 2013 at 18:13:03, Russell King - ARM Linux wrote:
> On Wed, Feb 13, 2013 at 11:42:01AM +0000, Philip, Avinash wrote:
> > On Sat, Feb 09, 2013 at 15:52:44, Russell King - ARM Linux wrote:
> > > On Thu, Feb 07, 2013 at 06:06:57PM +0530, Philip Avinash wrote:
> > > > +static int elm_suspend(struct device *dev)
> > > > +{
> > > > +   struct elm_info *info = dev_get_drvdata(dev);
> > > > +   wait_queue_head_t wq;
> > > > +   DECLARE_WAITQUEUE(wait, current);
> > > > +
> > > > +   init_waitqueue_head(&wq);
> > > > +   while (1) {
> > > > +   /* Make sure that ELM not running */
> > > > +   if (info->idle) {
> > > > +   add_wait_queue(&wq, &wait);
> > > > +   schedule();
> > > > +   remove_wait_queue(&wq, &wait);
> > > > +   } else {
> > > > +   break;
> > > > +   }
> > > > +   }
> > > 
> > > The above code looks really wrong - it will just spin endlessly with the
> > > waitqueues doing nothing useful.  What are you trying to do here?
> > 
> > The intention of waitqeue is to make the suspend process really wait till
> > the ELM module finishes current activity. Although this type of protection
> > already achieved in mtd layer using nand_suspend(), this one is particularly
> > required for ELM module to really make sure that *any pending* corrections 
> > to
> > finish really before gone to suspend.
> 
> I don't think you understand what's going on with the above, and why the
> above is completely ineffective.
> 
> 1. Your wait queue head is declared on stack, and there's no references
>to it outside of this function.  So _nothing_ can activate the wait
>queue.
> 2. You're not changing the current thread's status away from TASK_RUNNING,
>so schedule() will either return immediately or it will schedule another
>task if it's time for this one to be preempted.
> 
> In other words, the above can be rewritten as:
> 
>   while (info->idle)
>   schedule();
> 
> and it will still have the same effect.
> 
> Now, if you want to be kinder to the system, then you should use a
> wait queue properly.  Put the waitqueue head in struct elm_info.  Use
> wait_event() here.  And call wake_up() where you set info->idle to
> false.

I understood the issue. Thanks for the detailed explanation.

It seems the entire mechanism of ELM module state check is not required.
The ELM suspend procedure initiated only after the current MTD transaction
finishes and is ensured in MTD class driver.

So I can simply disable ELM module in suspend without any check.

Thanks
Avinash

> 

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


[PATCH v3 0/3] suspend/resume support for OMAP nand driver

2013-02-19 Thread Philip Avinash
This patch series adds low power transition support for OMAP NAND driver.
With recent driver conversion of GPMC to platform_driver, pm_runtime calls
can be used to handle module enable & disable of GPMC. This is taken care
patch #1.

patch #2 is for GPMC suspend/resume support.

This includes low power transition support of
- GPMC module
- ELM module

User initiated suspend/resume sequence tested on am335x-evm with NAND
flash support. Also tested in omap3-evm for user initiated
suspend/resume sequence with NAND flash.
This patch series based on [1] and is present in [2].

1. ARM: OMAP2+: AM33XX: Add suspend-resume support
   http://comments.gmane.org/gmane.linux.ports.arm.omap/91405
2. 
https://github.com/avinashphilip/am335x_linux/commits/NAND_supend_resume_support

Changes Since v2:
- Remove calll back of nand_suspend from omap2 nand driver, as the same call 
already
  done from suspend activity mtd class driver.

Philip Avinash (3):
  arm: gpmc: Converts GPMC driver to pm_runtime capable
  arm: gpmc: Low power transition support
  mtd: devices: elm: Low power transition support

 arch/arm/mach-omap2/gpmc.c |   30 +---
 drivers/mtd/devices/elm.c  |   54 
 2 files changed, 81 insertions(+), 3 deletions(-)

-- 
1.7.9.5

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


[PATCH v3 1/3] arm: gpmc: Converts GPMC driver to pm_runtime capable

2013-02-19 Thread Philip Avinash
Support for pm_runtime add to GPMC driver.

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-omap2/gpmc.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 2c57f81..b1cd6c1 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1317,7 +1318,8 @@ static int gpmc_probe(struct platform_device *pdev)
return PTR_ERR(gpmc_l3_clk);
}
 
-   clk_prepare_enable(gpmc_l3_clk);
+   pm_runtime_enable(&pdev->dev);
+   pm_runtime_get_sync(&pdev->dev);
 
gpmc_dev = &pdev->dev;
 
@@ -1329,7 +1331,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
rc = gpmc_mem_init();
if (IS_ERR_VALUE(rc)) {
-   clk_disable_unprepare(gpmc_l3_clk);
+   pm_runtime_put_sync(&pdev->dev);
clk_put(gpmc_l3_clk);
dev_err(gpmc_dev, "failed to reserve memory\n");
return rc;
@@ -1340,7 +1342,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
rc = gpmc_probe_dt(pdev);
if (rc < 0) {
-   clk_disable_unprepare(gpmc_l3_clk);
+   pm_runtime_put_sync(&pdev->dev);
clk_put(gpmc_l3_clk);
dev_err(gpmc_dev, "failed to probe DT parameters\n");
return rc;
@@ -1353,6 +1355,8 @@ static __devexit int gpmc_remove(struct platform_device 
*pdev)
 {
gpmc_free_irq();
gpmc_mem_exit();
+   pm_runtime_put_sync(&pdev->dev);
+   pm_runtime_disable(&pdev->dev);
gpmc_dev = NULL;
return 0;
 }
-- 
1.7.9.5

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


RE: [PATCH v2 3/4] mtd: devices: elm: Low power transition support

2013-02-13 Thread Philip, Avinash
On Sat, Feb 09, 2013 at 15:52:44, Russell King - ARM Linux wrote:
> On Thu, Feb 07, 2013 at 06:06:57PM +0530, Philip Avinash wrote:
> > +static int elm_suspend(struct device *dev)
> > +{
> > +   struct elm_info *info = dev_get_drvdata(dev);
> > +   wait_queue_head_t wq;
> > +   DECLARE_WAITQUEUE(wait, current);
> > +
> > +   init_waitqueue_head(&wq);
> > +   while (1) {
> > +   /* Make sure that ELM not running */
> > +   if (info->idle) {
> > +   add_wait_queue(&wq, &wait);
> > +   schedule();
> > +   remove_wait_queue(&wq, &wait);
> > +   } else {
> > +   break;
> > +   }
> > +   }
> 
> The above code looks really wrong - it will just spin endlessly with the
> waitqueues doing nothing useful.  What are you trying to do here?

The intention of waitqeue is to make the suspend process really wait till
the ELM module finishes current activity. Although this type of protection
already achieved in mtd layer using nand_suspend(), this one is particularly
required for ELM module to really make sure that *any pending* corrections to
finish really before gone to suspend.

If suspend activity initiated and NAND driver requested service of ELM
module for error correction, then suspend activity has to wait till
(info->idle == false), so that ELM module finishes activity.

I can think of adding different states to ELM module and take action.
I will add following states.

RUNNING
SUSPEND

Thanks
Avinash

> 

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


[PATCH v2] ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK

2013-02-11 Thread Philip Avinash
From: "Philip, Avinash" 

EHRPWM module requires explicit clock gating of TBCLK from control
module. Hence add TBCLK clock node in clock tree for EHRPWM modules.

Signed-off-by: Philip Avinash 
---
Changes since v1:
- Remove sparse warnings
arch/arm/mach-omap2/cclock33xx_data.c:844:1: warning: Using plain
integer as NULL pointer
arch/arm/mach-omap2/cclock33xx_data.c:850:1: warning: Using plain 
integer as NULL pointer
arch/arm/mach-omap2/cclock33xx_data.c:856:1: warning: Using plain 
integer as NULL pointer


 arch/arm/mach-omap2/cclock33xx_data.c |   30 ++
 arch/arm/mach-omap2/control.h |8 
 2 files changed, 38 insertions(+)

diff --git a/arch/arm/mach-omap2/cclock33xx_data.c 
b/arch/arm/mach-omap2/cclock33xx_data.c
index ea64ad6..22387fa 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -832,6 +832,33 @@ static struct clk_hw_omap wdt1_fck_hw = {
 
 DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
 
+static const char *pwmss_clk_parents[] = {
+   "dpll_per_m2_ck",
+};
+
+static const struct clk_ops ehrpwm_tbclk_ops = {
+   .enable = &omap2_dflt_clk_enable,
+   .disable= &omap2_dflt_clk_disable,
+};
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm0_tbclk, "l4ls_clkdm",
+NULL, NULL, 0,
+AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+AM33XX_PWMSS0_TBCLKEN_SHIFT,
+NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm1_tbclk, "l4ls_clkdm",
+NULL, NULL, 0,
+AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+AM33XX_PWMSS1_TBCLKEN_SHIFT,
+NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm2_tbclk, "l4ls_clkdm",
+NULL, NULL, 0,
+AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+AM33XX_PWMSS2_TBCLKEN_SHIFT,
+NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
 /*
  * clkdev
  */
@@ -910,6 +937,9 @@ static struct omap_clk am33xx_clks[] = {
CLK(NULL,   "clkout2_div_ck",   &clkout2_div_ck,
CK_AM33XX),
CLK(NULL,   "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
CLK(NULL,   "timer_sys_ck", &sys_clkin_ck,  CK_AM33XX),
+   CLK("48300200.ehrpwm",  "tbclk",&ehrpwm0_tbclk, CK_AM33XX),
+   CLK("48302200.ehrpwm",  "tbclk",&ehrpwm1_tbclk, CK_AM33XX),
+   CLK("48304200.ehrpwm",  "tbclk",&ehrpwm2_tbclk, CK_AM33XX),
 };
 
 
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 4b05eb9..2fe2812 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -389,6 +389,14 @@
 #define AM33XX_DDR_DATA0_IOCTRL0x1440
 #define AM33XX_DDR_DATA1_IOCTRL0x1444
 
+/* AM33XX PWMSS Control register */
+#define AM33XX_PWMSS_TBCLK_CLKCTRL 0x664
+
+/* AM33XX  PWMSS Control bitfields */
+#define AM33XX_PWMSS0_TBCLKEN_SHIFT0
+#define AM33XX_PWMSS1_TBCLKEN_SHIFT1
+#define AM33XX_PWMSS2_TBCLKEN_SHIFT2
+
 /* CONTROL OMAP STATUS register to identify OMAP3 features */
 #define OMAP3_CONTROL_OMAP_STATUS  0x044c
 
-- 
1.7.9.5

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


RE: [PATCH 1/7] ARM: OMAP: AM33xx hwmod: Corrects PWM subsystem HWMOD entries

2013-02-11 Thread Philip, Avinash
On Fri, Feb 08, 2013 at 20:40:18, Paul Walmsley wrote:
> Hi
> 
> On Wed, 2 Jan 2013, Philip Avinash wrote:
> 
> > EQEP entry is HWMOD entry is not present in HWMOD entry.
> 
> Patch descriptions need to make sense.  This one does not.  I've fixed it 
> for you this time, but please take more care in the future.
> 

Thanks for applying this patch & I will take care of the patch description
details.

Thanks
Avinash

> 
> - Paul
> 
> 
> From: Philip Avinash 
> Date: Wed, 2 Jan 2013 18:54:48 +0530
> Subject: [PATCH] ARM: OMAP: AM33xx hwmod: Corrects PWM subsystem HWMOD
>  entries
> 
> EQEP IP block integration data is not present in HWMOD data. Also
> address ranges specified for EACP & EHRPWM are not correct & HWMOD
> flags of ADDR_TYPE_RT are added to PWM subsystem register address
> space. This patch:
> 1. Corrects register address mapping for ECAP & EHRPWM
> 2. Removes  HWMOD flags in PWM submodule register address space.
> 3. Adds EQEP HWMOD entries.
> 
> Signed-off-by: Philip Avinash 
> [p...@pwsan.com: tweaked patch description]
> Signed-off-by: Paul Walmsley 
> ---
>  arch/arm/mach-omap2/omap_hwmod_33xx_data.c |  158 
> +---
>  1 file changed, 145 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
> index 9e34d4c..4b1cc4d 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
> @@ -784,7 +784,7 @@ static struct omap_hwmod am33xx_elm_hwmod = {
>  };
>  
>  /*
> - * 'epwmss' class: ecap0,1,2,  ehrpwm0,1,2
> + * 'epwmss' class: ehrpwm0,1,2 eqep0,1,2 ecap0,1,2
>   */
>  static struct omap_hwmod_class_sysconfig am33xx_epwmss_sysc = {
>   .rev_offs   = 0x0,
> @@ -864,6 +864,66 @@ static struct omap_hwmod am33xx_ehrpwm2_hwmod = {
>   },
>  };
>  
> +/* eqep0 */
> +static struct omap_hwmod_irq_info am33xx_eqep0_irqs[] = {
> + { .irq = 79 + OMAP_INTC_START, },
> + { .irq = -1 },
> +};
> +
> +static struct omap_hwmod am33xx_eqep0_hwmod = {
> + .name   = "eqep0",
> + .class  = &am33xx_epwmss_hwmod_class,
> + .clkdm_name = "l4ls_clkdm",
> + .mpu_irqs   = am33xx_eqep0_irqs,
> + .main_clk   = "l4ls_gclk",
> + .prcm   = {
> + .omap4  = {
> + .clkctrl_offs   = AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET,
> + .modulemode = MODULEMODE_SWCTRL,
> + },
> + },
> +};
> +
> +/* eqep1 */
> +static struct omap_hwmod_irq_info am33xx_eqep1_irqs[] = {
> + { .irq = 88 + OMAP_INTC_START, },
> + { .irq = -1 },
> +};
> +
> +static struct omap_hwmod am33xx_eqep1_hwmod = {
> + .name   = "eqep1",
> + .class  = &am33xx_epwmss_hwmod_class,
> + .clkdm_name = "l4ls_clkdm",
> + .mpu_irqs   = am33xx_eqep1_irqs,
> + .main_clk   = "l4ls_gclk",
> + .prcm   = {
> + .omap4  = {
> + .clkctrl_offs   = AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET,
> + .modulemode = MODULEMODE_SWCTRL,
> + },
> + },
> +};
> +
> +/* eqep2 */
> +static struct omap_hwmod_irq_info am33xx_eqep2_irqs[] = {
> + { .irq = 89 + OMAP_INTC_START, },
> + { .irq = -1 },
> +};
> +
> +static struct omap_hwmod am33xx_eqep2_hwmod = {
> + .name   = "eqep2",
> + .class  = &am33xx_epwmss_hwmod_class,
> + .clkdm_name = "l4ls_clkdm",
> + .mpu_irqs   = am33xx_eqep2_irqs,
> + .main_clk   = "l4ls_gclk",
> + .prcm   = {
> + .omap4  = {
> + .clkctrl_offs   = AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET,
> + .modulemode = MODULEMODE_SWCTRL,
> + },
> + },
> +};
> +
>  /* ecap0 */
>  static struct omap_hwmod_irq_info am33xx_ecap0_irqs[] = {
>   { .irq = 31 + OMAP_INTC_START, },
> @@ -2559,8 +2619,7 @@ static struct omap_hwmod_addr_space 
> am33xx_ehrpwm0_addr_space[] = {
>   },
>   {
>   .pa_start   = 0x48300200,
> - .pa_end = 0x48300200 + SZ_256 - 1,
> - .flags  = ADDR_TYPE_RT
> + .pa_end = 0x48300200 + SZ_128 - 1,
>   },
>   { }
>  };
> @@ -2585,8 +2644,7 @@ static struct omap_hwmod_addr_space 
> am33xx_ehrpwm1_addr_space[] = {
>   },
>   {
>   .pa_start 

RE: [PATCH 4/7] ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK

2013-02-11 Thread Philip, Avinash
On Fri, Feb 08, 2013 at 20:36:53, Paul Walmsley wrote:
> Hi,
> 
> On Wed, 2 Jan 2013, Philip Avinash wrote:
> 
> > EHRPWM module requires explicit clock gating of TBCLK from control
> > module. Hence add TBCLK clock node in clock tree for EHRPWM modules.
> > 
> > Signed-off-by: Philip Avinash 
> 
> This patch adds some sparse[1] warnings:
> 
> > arch/arm/mach-omap2/cclock33xx_data.c:844:1: warning: Using plain 
> integer as NULL pointer
> > arch/arm/mach-omap2/cclock33xx_data.c:850:1: warning: Using plain 
> integer as NULL pointer
> > arch/arm/mach-omap2/cclock33xx_data.c:856:1: warning: Using plain 
> integer as NULL pointer
> 
> Could you fix these, please?

Sorry for late response. I will send an updated version with fix for
sparse warnings.

Thanks
Avinash

> 
> 
> - Paul
> 
> 1. Sparse: https://sparse.wiki.kernel.org/index.php/Main_Page
> 
> 

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


[PATCH v2 4/4] mtd: nand: omap2: Low power transition support

2013-02-07 Thread Philip Avinash
Add support for Low power transition support in nand driver. Also
ensures the current transaction finishes before going to low power mode
with _suspend support in mtd layer.

Signed-off-by: Philip Avinash 
---
 drivers/mtd/nand/omap2.c |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 8e820dd..790215b 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -2103,9 +2103,28 @@ static int omap_nand_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int omap_nand_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   struct mtd_info *mtd = platform_get_drvdata(pdev);
+
+   mtd->_suspend(mtd);
+   return 0;
+}
+
+static int omap_nand_resume(struct platform_device *pdev)
+{
+   return 0;
+}
+#endif
+
 static struct platform_driver omap_nand_driver = {
.probe  = omap_nand_probe,
.remove = omap_nand_remove,
+#ifdef CONFIG_PM
+   .suspend= omap_nand_suspend,
+   .resume = omap_nand_resume,
+#endif
.driver = {
.name   = DRIVER_NAME,
.owner  = THIS_MODULE,
-- 
1.7.9.5

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


[PATCH v2 3/4] mtd: devices: elm: Low power transition support

2013-02-07 Thread Philip Avinash
In low power modes of AM335X platforms, peripherals power is cut off.
This patch supports low power sleep transition support for ELM driver.

Signed-off-by: Philip Avinash 
---
 drivers/mtd/devices/elm.c |   40 
 1 file changed, 40 insertions(+)

diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
index f034239..a9ac8f2 100644
--- a/drivers/mtd/devices/elm.c
+++ b/drivers/mtd/devices/elm.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -62,6 +63,7 @@ struct elm_info {
struct completion elm_completion;
struct list_head list;
enum bch_ecc bch_type;
+   bool idle;
 };
 
 static LIST_HEAD(elm_devices);
@@ -86,9 +88,11 @@ void elm_config(struct device *dev, enum bch_ecc bch_type)
u32 reg_val;
struct elm_info *info = dev_get_drvdata(dev);
 
+   info->idle = true;
reg_val = (bch_type & ECC_BCH_LEVEL_MASK) | (ELM_ECC_SIZE << 16);
elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val);
info->bch_type = bch_type;
+   info->idle = false;
 }
 EXPORT_SYMBOL(elm_config);
 
@@ -280,6 +284,7 @@ void elm_decode_bch_error_page(struct device *dev, u8 
*ecc_calc,
struct elm_info *info = dev_get_drvdata(dev);
u32 reg_val;
 
+   info->idle = true;
/* Enable page mode interrupt */
reg_val = elm_read_reg(info, ELM_IRQSTATUS);
elm_write_reg(info, ELM_IRQSTATUS, reg_val & INTR_STATUS_PAGE_VALID);
@@ -298,6 +303,7 @@ void elm_decode_bch_error_page(struct device *dev, u8 
*ecc_calc,
reg_val = elm_read_reg(info, ELM_IRQENABLE);
elm_write_reg(info, ELM_IRQENABLE, reg_val & ~INTR_EN_PAGE_MASK);
elm_error_correction(info, err_vec);
+   info->idle = false;
 }
 EXPORT_SYMBOL(elm_decode_bch_error_page);
 
@@ -368,6 +374,7 @@ static int elm_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&info->list);
list_add(&info->list, &elm_devices);
platform_set_drvdata(pdev, info);
+   info->idle = false;
return ret;
 }
 
@@ -379,6 +386,38 @@ static int elm_remove(struct platform_device *pdev)
return 0;
 }
 
+static int elm_suspend(struct device *dev)
+{
+   struct elm_info *info = dev_get_drvdata(dev);
+   wait_queue_head_t wq;
+   DECLARE_WAITQUEUE(wait, current);
+
+   init_waitqueue_head(&wq);
+   while (1) {
+   /* Make sure that ELM not running */
+   if (info->idle) {
+   add_wait_queue(&wq, &wait);
+   schedule();
+   remove_wait_queue(&wq, &wait);
+   } else {
+   break;
+   }
+   }
+   pm_runtime_put_sync(dev);
+   return 0;
+}
+
+static int elm_resume(struct device *dev)
+{
+   struct elm_info *info = dev_get_drvdata(dev);
+
+   pm_runtime_get_sync(dev);
+   elm_config(dev, info->bch_type);
+   return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
+
 #ifdef CONFIG_OF
 static const struct of_device_id elm_of_match[] = {
{ .compatible = "ti,am3352-elm" },
@@ -392,6 +431,7 @@ static struct platform_driver elm_driver = {
.name   = "elm",
.owner  = THIS_MODULE,
.of_match_table = of_match_ptr(elm_of_match),
+   .pm = &elm_pm_ops,
},
.probe  = elm_probe,
.remove = elm_remove,
-- 
1.7.9.5

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


[PATCH v2 2/4] arm: gpmc: Low power transition support

2013-02-07 Thread Philip Avinash
With GPMC converted to platform driver recently, adds low power
transition support in driver itself.

Signed-off-by: Philip Avinash 
---
Changes since v1:
Module disable & enable added using pm_runtime support.

 arch/arm/mach-omap2/gpmc.c |   20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index b1cd6c1..cc57988 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1361,9 +1361,29 @@ static __devexit int gpmc_remove(struct platform_device 
*pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int gpmc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+   omap3_gpmc_save_context();
+   pm_runtime_put_sync(&pdev->dev);
+   return 0;
+}
+
+static int gpmc_resume(struct platform_device *pdev)
+{
+   pm_runtime_get_sync(&pdev->dev);
+   omap3_gpmc_restore_context();
+   return 0;
+}
+#endif
+
 static struct platform_driver gpmc_driver = {
.probe  = gpmc_probe,
.remove = __devexit_p(gpmc_remove),
+#ifdef CONFIG_PM
+   .suspend= gpmc_suspend,
+   .resume = gpmc_resume,
+#endif
.driver = {
.name   = DEVICE_NAME,
.owner  = THIS_MODULE,
-- 
1.7.9.5

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


[PATCH v2 1/4] arm: gpmc: Converts GPMC driver to pm_runtime capable

2013-02-07 Thread Philip Avinash
Support for pm_runtime add to GPMC driver.

Signed-off-by: Philip Avinash 
---
 arch/arm/mach-omap2/gpmc.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 2c57f81..b1cd6c1 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1317,7 +1318,8 @@ static int gpmc_probe(struct platform_device *pdev)
return PTR_ERR(gpmc_l3_clk);
}
 
-   clk_prepare_enable(gpmc_l3_clk);
+   pm_runtime_enable(&pdev->dev);
+   pm_runtime_get_sync(&pdev->dev);
 
gpmc_dev = &pdev->dev;
 
@@ -1329,7 +1331,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
rc = gpmc_mem_init();
if (IS_ERR_VALUE(rc)) {
-   clk_disable_unprepare(gpmc_l3_clk);
+   pm_runtime_put_sync(&pdev->dev);
clk_put(gpmc_l3_clk);
dev_err(gpmc_dev, "failed to reserve memory\n");
return rc;
@@ -1340,7 +1342,7 @@ static int gpmc_probe(struct platform_device *pdev)
 
rc = gpmc_probe_dt(pdev);
if (rc < 0) {
-   clk_disable_unprepare(gpmc_l3_clk);
+   pm_runtime_put_sync(&pdev->dev);
clk_put(gpmc_l3_clk);
dev_err(gpmc_dev, "failed to probe DT parameters\n");
return rc;
@@ -1353,6 +1355,8 @@ static __devexit int gpmc_remove(struct platform_device 
*pdev)
 {
gpmc_free_irq();
gpmc_mem_exit();
+   pm_runtime_put_sync(&pdev->dev);
+   pm_runtime_disable(&pdev->dev);
gpmc_dev = NULL;
return 0;
 }
-- 
1.7.9.5

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


[PATCH v2 0/4] suspend/resume support for OMAP nand driver

2013-02-07 Thread Philip Avinash
This patch series adds low power transition support for OMAP NAND driver.
With recent driver conversion of GPMC to platform_driver, pm_runtime calls
can be used to handle module enable & disable of GPMC. This is taken care
patch #1.

patch #2 is for GPMC suspend/resume support.

This includes low power transition support of
- GPMC module
- ELM module
- OMAP2 NAND driver

User initiated suspend/resume sequence tested on am335x-evm with NAND
flash support. Also tested in omap3-evm for user initiated
suspend/resume sequence with NAND flash.
This patch series based on [1] and is present in [2].

1. ARM: OMAP2+: AM33XX: Add suspend-resume support
   http://comments.gmane.org/gmane.linux.ports.arm.omap/91405
2. 
https://github.com/avinashphilip/am335x_linux/commits/NAND_supend_resume_support


Philip Avinash (4):
  arm: gpmc: Converts GPMC driver to pm_runtime capable
  arm: gpmc: Low power transition support
  mtd: devices: elm: Low power transition support
  mtd: nand: omap2: Low power transition support

 arch/arm/mach-omap2/gpmc.c |   30 +++---
 drivers/mtd/devices/elm.c  |   40 
 drivers/mtd/nand/omap2.c   |   19 +++
 3 files changed, 86 insertions(+), 3 deletions(-)

-- 
1.7.9.5

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


RE: [PATCH 1/4] arch: arm: gpmc: gpmc migration support

2013-02-06 Thread Philip, Avinash
On Sat, Feb 02, 2013 at 03:35:10, Tony Lindgren wrote:
> * Philip Avinash  [130123 01:28]:
> > With recent GPMC driver conversion, usage of gpmc_save/restore_context
> > can done from gpmc driver itself. Hence removes the usage from pm34xx.c.
> > Also removes the conditional compilation primitives ARCH_OMAP3 for
> > gpmc_save/restore_context.
> 
> Hmm I think this will break GPMC for deeper idle modes. Note that we
> need to save and restore the context every time hitting off-idle, not
> just for suspend and resume. Or am I missing something here?

I understand dependency on idle modes. So I will send a second version
with this patch eliminated so that user initiated suspend/resume work
for am335x platforms.

Thanks
Avinash

> 
> Regards,
> 
> Tony
> 

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


RE: [PATCH] ARM: dts: AM33XX: Corrects typo in interrupt field in SPI node

2013-01-31 Thread Philip, Avinash
On Fri, Feb 01, 2013 at 11:07:27, Philip, Avinash wrote:
> DT field of "interrupts" was mentioned wrongly as "interrupt" in SPI
> node. This went unnoticed as spi-omap2 driver not making use of
> interrupt. Fixes the typo.
> 
> Signed-off-by: Philip Avinash 

Reported-by: Vaibhav Bedia 

Typo mistake was reported by Vaibhav. I forgot to mention "Reported-by"
tag while posting. Add the same on his behalf.

Thanks
Avinash

> ---
>  arch/arm/boot/dts/am33xx.dtsi |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
> index fbcb90b..cece3ad 100644
> --- a/arch/arm/boot/dts/am33xx.dtsi
> +++ b/arch/arm/boot/dts/am33xx.dtsi
> @@ -309,7 +309,7 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>   reg = <0x4803 0x400>;
> - interrupt = <65>;
> + interrupts = <65>;
>   ti,spi-num-cs = <2>;
>   ti,hwmods = "spi0";
>   status = "disabled";
> @@ -320,7 +320,7 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>   reg = <0x481a 0x400>;
> - interrupt = <125>;
> + interrupts = <125>;
>   ti,spi-num-cs = <2>;
>   ti,hwmods = "spi1";
>   status = "disabled";
> -- 
> 1.7.9.5
> 
> 

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


  1   2   3   4   >