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 ? >set_data : >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(>dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata) {
+   ret = of_property_read_u32(dn, "ngpio", );
+   if (ret)
+   goto of_err;
+
+   pdata->ngpio = val;
+
+   ret = of_property_read_u32(dn, "gpio_unbanked", );
+   if (ret)
+   goto of_err;
+
+   pdata->gpio_unbanked = val;
+
+   ret = of_property_read_u32(dn, "intc_irq_num", );
+   if (ret)
+   goto of_err;
+
+   pdata->intc_irq_num = val;
+   }
+
+   return pdata;
+
+of_err:
+   dev_err(>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 = >dev;
struct resource *res;
+   const struct of_device_id *match =
+   of_match_device(of_match_ptr(davinci_gpio_ids), >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(davinci_gpio_ids),
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this li

[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  = _config,
.mmc_config[1]  = _config,  /* controller 1 */
.nand_config[0] = _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 = <_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),
+   _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),
+   _gpio_platform_data);
+   if (ret)
+   pr_warn("dm365_evm_init: GPIO init failed: %d\n", ret);
+
evm_init_i2c();
davinci_serial_init(_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,
+   .end= IRQ_

[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 = _soc_info;
int ret;
 
+   ret = da8xx_register_gpio(_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] = {
_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(_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 = _timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 128,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = _serial_device,
.emac_pdata = _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 = _timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 144,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = _serial_device,
.emac_pdata = _emac_pdata,
.sram_dma   = DA8XX_SHARED_RAM_BASE,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vg

[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(_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(_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 100644

[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(_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(_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 ? >set_data : >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 = _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 = >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) {
-   pr_err("GPIO setup:  

[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 = _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/


[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/


[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 avinashphi...@ti.com
Signed-off-by: Sekhar Nori nsek...@ti.com
---
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 linux/gpio.h
-#include linux/errno.h
-#include linux/kernel.h
+
 #include linux/clk.h
-#include linux/err.h
+#include linux/errno.h
+#include linux/gpio.h
 #include linux/io.h
+#include linux/kernel.h
 
 #include asm/mach/irq.h
 
@@ -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 3/7] ARM: davinci: da8xx: creation of gpio platform device

2013-06-14 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

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 sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Sekhar Nori nsek...@ti.com
---
 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 sujit...@ti.com

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 sujit...@ti.com
[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 avinashphi...@ti.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Sekhar Nori nsek...@ti.com
---
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 linux/clk.h
+#include linux/device.h
 #include linux/errno.h
 #include linux/gpio.h
 #include linux/io.h
+#include linux/interrupt.h
+#include linux/irq.h
+#include linux/irqdomain.h
 #include linux/kernel.h
-
-#include asm/mach/irq.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/platform_data/gpio-davinci.h
 
 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

[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 avinashphi...@ti.com
Signed-off-by: Sekhar Nori nsek...@ti.com
---
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 mach/common.h
 #include mach/time.h
 #include mach/da8xx.h
-#include mach/gpio-davinci.h
 
 #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 mach/da8xx.h
 #include mach/cpufreq.h
 #include mach/pm.h
-#include mach/gpio-davinci.h
 
 #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 mach/serial.h
 #include mach/common.h
 #include linux/platform_data/spi-davinci.h
-#include mach/gpio-davinci.h
 
 #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 mach/common.h
 #include linux/platform_data/keyscan-davinci.h
 #include linux/platform_data/spi-davinci.h
-#include mach/gpio-davinci.h
 
 #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 mach/time.h
 #include mach/serial.h
 #include mach/common.h
-#include mach/gpio-davinci.h
 
 #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

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 avinashphi...@ti.com
 
 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 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 avinashphi...@ti.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Sekhar Nori nsek...@ti.com
---
 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 linux/mtd/partitions.h
 #include linux/spi/spi.h
 #include linux/spi/flash.h
+#include linux/platform_data/mtd-davinci.h
+#include linux/platform_data/gpio-davinci.h
+#include linux/platform_data/usb-davinci.h
+#include linux/platform_data/mtd-davinci-aemif.h
+#include linux/platform_data/spi-davinci.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
 
 #include mach/cp_intc.h
 #include mach/mux.h
-#include linux/platform_data/mtd-davinci.h
+#include mach/common.h
 #include mach/da8xx.h
-#include linux/platform_data/usb-davinci.h
-#include linux/platform_data/mtd-davinci-aemif.h
-#include linux/platform_data/spi-davinci.h
 
 #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 linux/mtd/partitions.h
 #include linux/mtd/physmap.h
 #include linux/platform_device.h
+#include linux/platform_data/gpio-davinci.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mtd-davinci-aemif.h
 #include linux/platform_data/spi-davinci.h
@@ -42,6 +43,7 @@
 #include mach/da8xx.h
 #include mach/mux.h
 #include mach/sram.h
+#include mach/common.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -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 linux/init.h
 #include linux/console.h
 #include linux/gpio.h
+#include linux/platform_data/gpio-davinci.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -20,6 +21,7 @@
 #include mach/cp_intc.h
 #include mach/da8xx.h
 #include mach/mux.h
+#include mach/common.h
 
 #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

[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 avinashphi...@ti.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Sekhar Nori nsek...@ti.com
---
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 linux/platform_data/i2c-davinci.h
 #include mach/serial.h
+#include mach/common.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mmc-davinci.h
 #include linux/platform_data/usb-davinci.h
+#include linux/platform_data/gpio-davinci.h
 
 #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 linux/platform_data/i2c-davinci.h
 #include mach/serial.h
+#include mach/common.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mmc-davinci.h
 #include linux/platform_data/usb-davinci.h
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 linux/platform_data/mmc-davinci.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/keyscan-davinci.h
+#include linux/platform_data/gpio-davinci.h
 
 #include media/ths7303.h
 #include media/tvp514x.h
@@ -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 linux

[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 avinashphi...@ti.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Sekhar Nori nsek...@ti.com
---
 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 linux/compiler.h
 #include linux/types.h
+#include linux/ioport.h
 
 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 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 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 avinashphi...@ti.com
---
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 3/4] ARM: davinci: da850: add GPIO DT entries

2013-06-14 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

Add DT entries for Davinci GPIO.

Signed-off-by: KV Sujith sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
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 dt-bindings/interrupt-controller/irq.h
 
 / {
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 4/4] ARM: davinci: da850 evm: add GPIO DT data

2013-06-14 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

- 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 sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 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 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 avinashphil...@gmail.com
---
 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 asm/mach/arch.h
 #include asm/mach-types.h
 
+#include mach/common.h
 #include mach/irqs.h
 #include mach/edma.h
 #include mach/mux.h
@@ -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 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 avinashphil...@gmail.com
---
 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 linux/kernel.h
 #include linux/init.h
+#include linux/io.h
 #include linux/gpio.h
 
 #include mach/common.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 2/4] gpio: davinci: DT changes for driver

2013-06-14 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

- 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 sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
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 dt-bindings/interrupt-controller/irq.h
+
+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 linux/irqdomain.h
 #include linux/kernel.h
 #include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
 #include linux/platform_device.h
 #include linux/platform_data/gpio-davinci.h
 
@@ -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(davinci_gpio_ids),
},
 };
 
-- 
1.7.9.5

--
To unsubscribe

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/


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  = _config,
> > .mmc_config[1]  = _config,  /* controller 1 */
> > .nand_config[0] = _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([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/97853/

> What is t

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/97853/

 What is the commit-id if it is in mainline? Where
 is the failure log?

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

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 asm/mach/arch.h
 #include asm/mach-types.h

+#include mach/common.h
 #include mach/irqs.h
 #include mach/edma.h
 #include mach/mux.h
@@ -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

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 mach/common.h

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 asm/mach/arch.h
   #include asm/mach-types.h
  
  +#include mach/common.h
   #include mach/irqs.h
   #include mach/edma.h
   #include mach/mux.h
  @@ -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
  arch/arm/mach-davinci/include/mach/gpio-davinci.h.
 
 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-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([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 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([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�:+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-11 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 00/11] Convert GPIO Davinci to platform driver

2013-06-11 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 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 sujit...@ti.com
  
  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 sujit...@ti.com
  [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 avinashphi...@ti.com
  ---
  +#include linux/module.h
  +#include linux/platform_device.h
  +#include linux/platform_data/gpio-davinci.h
 
  +#include mach/gpio-davinci.h
 
 This include seems unnecessary.

This include is not required.

 
   
   #include asm/mach/irq.h
 
 While at it, you can get rid of this include and use linux/irq.h 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 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 sujit...@ti.com
  
  Add struct davinci_gpio_platform_data davinci gpio module.
  
  Signed-off-by: KV Sujith sujit...@ti.com
  Signed-off-by: Philip Avinash avinashphi...@ti.com
 
 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 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 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 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 avinashphi...@ti.com 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 dt-bindings/interrupt-controller/irq.h 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 02/11] gpio: davinci: coding style correction

2013-05-23 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-23 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/


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

2013-05-23 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-23 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 avinashphi...@ti.com
  ---
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 = <_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 ? >set_data : >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(>dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata) {
+   ret = of_property_read_u32(dn, "ngpio", );
+   if (ret)
+   goto of_err;
+
+   pdata->ngpio = val;
+
+   ret = of_property_read_u32(dn, "gpio_unbanked", );
+   if (ret)
+   goto of_err;
+
+   pdata->gpio_unbanked = val;
+
+   ret = of_property_read_u32(dn, "intc_irq_num", );
+   if (ret)
+   goto of_err;
+
+   pdata->intc_irq_num = val;
+   }
+
+   return pdata;
+
+of_err:
+   dev_err(>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 = >dev;
struct resource *res;
+   const struct of_device_id *match =
+   of_match_device(of_match_ptr(davinci_gpio_ids), >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),
+   _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),
+   _gpio_platform_data);
+   if (ret)
+   pr_warn("dm365_evm_init: GPIO init failed: %d\n", ret);
+
evm_init_i2c();
davinci_serial_init(_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)
 {
+   int ret;
stru

[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 = _soc_info;
int ret;
 
+   ret = da8xx_register_gpio(_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] = {
_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(_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 = _timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 128,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = _serial_device,
.emac_pdata = _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 = _timer_info,
-   .gpio_type  = GPIO_TYPE_DAVINCI,
-   .gpio_base  = DA8XX_GPIO_BASE,
-   .gpio_num   = 144,
-   .gpio_irq   = IRQ_DA8XX_GPIO0,
.serial_dev = _serial_device,
.emac_pdata = _emac_pdata,
.sram_dma   = DA8XX_SHARED_RAM_BASE,
-- 
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 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(_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(_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(_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(_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(>lock, flags);
-   temp = __raw_readl(>dir);
+   spin_lock_irqsave(>lock, flags);
+   temp = __raw_readl(>dir);
if (out) {
temp &= ~mask;
-   __raw_writel(mask, value ? >set_data : >clr_data);
+   __raw_writel(mask, value ? >set_data : >clr_data);
} else {
temp |= mask;
}
-   __raw_writel(temp, >dir);
-   spin_unlock_irqrestore(>lock, flags);
+   __raw_writel(temp, >dir);
+   spin_unlock_irqrestore(>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(>in_data);
+   return (1 << offset) & __raw_readl(>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 ? >set_data : >clr_data);
+   __raw_writel((1 << offset), value ? >set_data : >clr_data);
 }
 
 static int __init davinci_gpio_setup(void)
@@ -160,30 +156,30 @@ static int __init davinci_gpio_setup(void)
return -ENOMEM;
 
for (i = 0, base = 0; base < ngpio; i++, base += 32) {
-   chips[i].chi

[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 ? >set_data : >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 = _soc_info;
+   struct davinci_gpio_controller *ctlrs;
+   struct davinci_gpio_platform_data *pdata;
struct davinci_gpio_regs *regs;
+   struct device *dev = >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);
-   if (WARN_ON(!gpio_base))
+   ctlrs = devm_k

[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 01/11] ARM: davinci: GPIO: Add platform data structure

2013-05-22 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

Add struct davinci_gpio_platform_data davinci gpio module.

Signed-off-by: KV Sujith sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 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 avinashphi...@ti.com
---
 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 linux/gpio.h
-#include linux/errno.h
-#include linux/kernel.h
+
 #include linux/clk.h
-#include linux/err.h
+#include linux/errno.h
+#include linux/gpio.h
 #include linux/io.h
+#include linux/kernel.h
 
 #include asm/mach/irq.h
 
@@ -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(regs-dir);
if (out) {
temp = ~mask;
-   __raw_writel(mask, value ? g-set_data : g-clr_data);
+   __raw_writel(mask, value ? regs-set_data : regs-clr_data);
} else {
temp |= mask;
}
-   __raw_writel(temp, g-dir);
-   spin_unlock_irqrestore(d-lock, flags);
+   __raw_writel(temp, regs-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(regs-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 ? regs-set_data : regs-clr_data);
 }
 
 static int __init davinci_gpio_setup(void)
@@ -160,30 +156,30 @@ static int __init davinci_gpio_setup(void)
return -ENOMEM;
 
for (i = 0, base = 0; base  ngpio; i

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

2013-05-22 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

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 sujit...@ti.com
[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 avinashphi...@ti.com
---
 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 linux/clk.h
+#include linux/device.h
 #include linux/errno.h
 #include linux/gpio.h
 #include linux/io.h
+#include linux/interrupt.h
+#include linux/irqdomain.h
 #include linux/kernel.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/platform_data/gpio-davinci.h
+#include mach/gpio-davinci.h
 
 #include asm/mach/irq.h
 
@@ -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 ? regs-set_data : regs-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

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

2013-05-22 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

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 sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 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 avinashphi...@ti.com
---
 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 linux/compiler.h
 #include linux/types.h
+#include linux/ioport.h
 
 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 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 avinashphi...@ti.com
---
 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 linux/mtd/partitions.h
 #include linux/spi/spi.h
 #include linux/spi/flash.h
+#include linux/platform_data/mtd-davinci.h
+#include linux/platform_data/gpio-davinci.h
+#include linux/platform_data/usb-davinci.h
+#include linux/platform_data/mtd-davinci-aemif.h
+#include linux/platform_data/spi-davinci.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
 
 #include mach/cp_intc.h
 #include mach/mux.h
-#include linux/platform_data/mtd-davinci.h
+#include mach/common.h
 #include mach/da8xx.h
-#include linux/platform_data/usb-davinci.h
-#include linux/platform_data/mtd-davinci-aemif.h
-#include linux/platform_data/spi-davinci.h
 
 #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 linux/mtd/partitions.h
 #include linux/mtd/physmap.h
 #include linux/platform_device.h
+#include linux/platform_data/gpio-davinci.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mtd-davinci-aemif.h
 #include linux/platform_data/spi-davinci.h
@@ -42,6 +43,7 @@
 #include mach/da8xx.h
 #include mach/mux.h
 #include mach/sram.h
+#include mach/common.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -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 linux/init.h
 #include linux/console.h
 #include linux/gpio.h
+#include linux/platform_data/gpio-davinci.h
 
 #include asm/mach-types.h
 #include asm/mach/arch.h
@@ -20,6 +21,7 @@
 #include mach/cp_intc.h
 #include mach/da8xx.h
 #include mach/mux.h
+#include mach/common.h
 
 #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

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

2013-05-22 Thread Philip Avinash
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 linux/platform_data/i2c-davinci.h
 #include mach/serial.h
+#include mach/common.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mmc-davinci.h
 #include linux/platform_data/usb-davinci.h
+#include linux/platform_data/gpio-davinci.h
 
 #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 linux/platform_data/i2c-davinci.h
 #include mach/serial.h
+#include mach/common.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/mmc-davinci.h
 #include linux/platform_data/usb-davinci.h
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 linux/platform_data/mmc-davinci.h
 #include linux/platform_data/mtd-davinci.h
 #include linux/platform_data/keyscan-davinci.h
+#include linux/platform_data/gpio-davinci.h
 
 #include media/tvp514x.h
 
@@ -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 linux/platform_data/mmc-davinci.h
 #include linux/platform_data/usb-davinci.h
 #include linux/platform_data/mtd-davinci-aemif.h
+#include linux/platform_data/gpio-davinci.h
 
 #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

[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 avinashphi...@ti.com
---
 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 asm-generic/gpio.h
+
 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 sujit...@ti.com

- 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 grant.lik...@secretlab.ca
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Rob Landley r...@landley.net
Cc: devicetree-disc...@lists.ozlabs.org
Cc: linux-...@vger.kernel.org
Signed-off-by: KV Sujith sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 .../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 linux/irqdomain.h
 #include linux/kernel.h
 #include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
 #include linux/platform_device.h
 #include linux/platform_data/gpio-davinci.h
 #include mach/gpio-davinci.h
@@ -133,6 +135,50 @@ static void davinci_gpio_set(struct gpio_chip *chip, 
unsigned offset,
__raw_writel((1  offset), value ? regs-set_data : regs-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

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

2013-05-22 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

Add DT entries for Davinci GPIO.

Signed-off-by: KV Sujith sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 11/11] ARM: davinci: da850 evm: add GPIO DT data

2013-05-22 Thread Philip Avinash
From: KV Sujith sujit...@ti.com

- 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 sujit...@ti.com
Signed-off-by: Philip Avinash avinashphi...@ti.com
---
 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 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�:+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-10 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�:+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-10 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

[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 avinashphi...@ti.com
---
Changes since v3:
- add pin mux info for EHRPWM1.

Changes since v1:
- Reusing ti,am33xxecap/ehrpwm 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 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 avinashphi...@ti.com
  ---
  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,am33xxecap/ehrpwm 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 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 avinashphi...@ti.com
---
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,am33xxecap/ehrpwm 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 {
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

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-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-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-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 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 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-04 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-04 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-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
  
 
 



  1   2   3   4   5   6   7   >