Re: [PATCH v2] pwm: samsung: add missing s3c->pwm_id

2012-12-13 Thread Joonyoung Shim

On 12/14/2012 04:34 PM, Thierry Reding wrote:

On Fri, Dec 14, 2012 at 03:58:58PM +0900, Joonyoung Shim wrote:

The s3c->pwm_id is used to calculate offset of related register.

Signed-off-by: Joonyoung Shim 

I've modified the subject a bit to make it clear the assignment of
s3c->pwm_id was missing, not the s3c->pwm_id field altogether.

Applied, thanks.


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


Re: [PATCH v2] pwm: samsung: add missing s3c->pwm_id

2012-12-13 Thread Thierry Reding
On Fri, Dec 14, 2012 at 03:58:58PM +0900, Joonyoung Shim wrote:
> The s3c->pwm_id is used to calculate offset of related register.
> 
> Signed-off-by: Joonyoung Shim 

I've modified the subject a bit to make it clear the assignment of
s3c->pwm_id was missing, not the s3c->pwm_id field altogether.

Applied, thanks.

Thierry


pgpDP2BWfdAFH.pgp
Description: PGP signature


[PATCH v2] pwm: samsung: add missing s3c->pwm_id

2012-12-13 Thread Joonyoung Shim
The s3c->pwm_id is used to calculate offset of related register.

Signed-off-by: Joonyoung Shim 
---
Changelog from v1:
 - move the assignment code to below.

 drivers/pwm/pwm-samsung.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 023a3be..0704a2a 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -222,6 +222,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 
/* calculate base of control bits in TCON */
s3c->tcon_base = id == 0 ? 0 : (id * 4) + 4;
+   s3c->pwm_id = id;
s3c->chip.dev = &pdev->dev;
s3c->chip.ops = &s3c_pwm_ops;
s3c->chip.base = -1;
-- 
1.7.9.5

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


Re: [PATCH] pwm: samsung: add missing s3c->pwm_id

2012-12-13 Thread Thierry Reding
On Fri, Dec 14, 2012 at 01:20:09PM +0900, Joonyoung Shim wrote:
> The s3c->pwm_id is used to calculate offset of related register.
> 
> Signed-off-by: Joonyoung Shim 
> ---
>  drivers/pwm/pwm-samsung.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index 023a3be..b415102 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -220,6 +220,8 @@ static int s3c_pwm_probe(struct platform_device *pdev)
>   return -ENOMEM;
>   }
>  
> + s3c->pwm_id = id;
> +
>   /* calculate base of control bits in TCON */
>   s3c->tcon_base = id == 0 ? 0 : (id * 4) + 4;

Can you please move the assignment to below the above line? That way s3c
initialization is more localized.

Thierry


pgpcTlFzGnRka.pgp
Description: PGP signature


[PATCH 1/2] i2c-core: Add gpio based bus arbitration implementation

2012-12-13 Thread Naveen Krishna Chatradhi
The arbitrator is a general purpose function which uses two GPIOs to
communicate with another device to claim/release a bus.

i2c_transfer()
if adapter->gpio_arbit
i2c_bus_claim();
__i2c_transfer();
i2c_bus_release();

Signed-off-by: Simon Glass 
Cc: Grant Grundler 
Signed-off-by: Naveen Krishna Chatradhi 
---
 .../devicetree/bindings/i2c/arbitrator-i2c.txt |   56 
 drivers/i2c/i2c-core.c |   67 
 drivers/of/of_i2c.c|   27 
 include/linux/i2c.h|   17 +
 include/linux/of_i2c.h |2 +
 5 files changed, 169 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/arbitrator-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/arbitrator-i2c.txt 
b/Documentation/devicetree/bindings/i2c/arbitrator-i2c.txt
new file mode 100644
index 000..cb91ea8
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/arbitrator-i2c.txt
@@ -0,0 +1,56 @@
+Device-Tree bindings for i2c gpio based bus arbitrator
+
+bus-arbitration-gpios :
+   Two GPIOs to use with the GPIO-based bus arbitration protocol
+(see below).
+The first should be an output, and is used to claim the I2C bus,
+the second should be an input, and signals that the other side (Client)
+wants to claim the bus. This allows two masters to share the same I2C bus.
+
+Required properties:
+   - bus-needs-gpio-arbitration;
+   - bus-arbitration-gpios: AP_CLAIM and Client_CLAIM gpios
+   - bus-arbitration-slew-delay-us:
+   - bus-arbitration-wait-retry-us:
+   - bus-arbitration-wait-free-us:
+
+Example nodes:
+
+i2c@0 {
+   /* If you want GPIO-based bus arbitration */
+   bus-needs-gpio-arbitration;
+   bus-arbitration-gpios = <&gpf0 3 1 0 0>, /* AP_CLAIM */
+   <&gpe0 4 0 3 0>; /* EC_CLAIM */
+
+   bus-arbitration-slew-delay-us = <10>;
+   bus-arbitration-wait-retry-us = <2000>;
+   bus-arbitration-wait-free-us = <5>;
+};
+
+GPIO-based Arbitration
+==
+This uses GPIO lines between the AP (SoC) and an attached EC (embedded
+controller) which both want to talk on the same I2C bus as master.
+
+The AP and EC each have a 'bus claim' line, which is an output that the
+other can see. These are both active low, with pull-ups enabled.
+
+- AP_CLAIM: output from AP, signalling to the EC that the AP wants the bus
+- EC_CLAIM: output from EC, signalling to the AP that the EC wants the bus
+
+
+Algorithm
+-
+The basic algorithm is to assert your line when you want the bus, then make
+sure that the other side doesn't want it also. A detailed explanation is best
+done with an example.
+
+Let's say the AP wants to claim the bus. It:
+1. Asserts AP_CLAIM
+2. Waits a little bit for the other side to notice (slew time, say 10
+microseconds)
+3. Checks EC_CLAIM. If this is not asserted, then the AP has the bus, and
+we are done
+4. Otherwise, wait for a few milliseconds and see if EC_CLAIM is released
+5. If not, back off, release the claim and wait for a few more milliseconds
+6. Go back to 1 (until retry time has expired)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a7edf98..222a6da 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "i2c-core.h"
@@ -1256,6 +1258,59 @@ void i2c_release_client(struct i2c_client *client)
 }
 EXPORT_SYMBOL(i2c_release_client);
 
+/**
+ * If we have enabled arbitration on this bus, claim the i2c bus, using
+ * the GPIO-based signalling protocol.
+ */
+static int i2c_bus_claim(struct i2c_gpio_arbit *i2c_arbit)
+{
+   unsigned long stop_retry, stop_time;
+   unsigned int gpio;
+
+   /* Start a round of trying to claim the bus */
+   stop_time = jiffies + usecs_to_jiffies(i2c_arbit->wait_free_us) + 1;
+   do {
+   /* Indicate that we want to claim the bus */
+   gpio_set_value(i2c_arbit->arb_gpios[I2C_ARB_GPIO_AP], 0);
+   udelay(i2c_arbit->slew_delay_us);
+
+   /* Wait for the EC to release it */
+   stop_retry = jiffies +
+   usecs_to_jiffies(i2c_arbit->wait_retry_us) + 1;
+   while (time_before(jiffies, stop_retry)) {
+   gpio = i2c_arbit->arb_gpios[I2C_ARB_GPIO_EC];
+   if (gpio_get_value(gpio)) {
+   /* We got it, so return */
+   return 0;
+   }
+
+   usleep_range(50, 200);
+   }
+
+   /* It didn't release, so give up, wait, and try again */
+   gpio_set_value(i2c_arbit->arb_gpios[I2C_ARB_GPIO_AP], 1);
+
+  

[PATCH 2/2] i2c-s3c2410: Add GPIO based bus arbitration functionality

2012-12-13 Thread Naveen Krishna Chatradhi
Makes use of the generic fucntions in of_i2c.c to parse arbitration
timing information and GPIOs for arbitration.

Also uses devm_gpio_request() instead of gpio_request() and
removes the gpio_free() calls

Signed-off-by: Naveen Krishna Chatradhi 
---
 drivers/i2c/busses/i2c-s3c2410.c |   79 +++---
 1 file changed, 47 insertions(+), 32 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index e93e7d6..d055cf8 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -855,54 +855,61 @@ static inline void s3c24xx_i2c_deregister_cpufreq(struct 
s3c24xx_i2c *i2c)
 #endif
 
 #ifdef CONFIG_OF
-static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c)
+static int of_i2c_parse_gpio(struct device *dev, const char *name,
+   int gpios[], size_t count, bool required)
 {
-   int idx, gpio, ret;
-
-   if (i2c->quirks & QUIRK_NO_GPIO)
-   return 0;
+   struct device_node *dn = dev->of_node;
+   int idx, gpio;
 
-   for (idx = 0; idx < 2; idx++) {
-   gpio = of_get_gpio(i2c->dev->of_node, idx);
+   for (idx = 0; idx < count; idx++) {
+   gpio = of_get_named_gpio(dn, name, idx);
if (!gpio_is_valid(gpio)) {
-   dev_err(i2c->dev, "invalid gpio[%d]: %d\n", idx, gpio);
-   goto free_gpio;
+   dev_dbg(dev, "invalid gpio[%d]: %d\n", idx, gpio);
+   if (idx || required) {
+   dev_err(dev, "invalid gpio[%d]: %d\n",
+   idx, gpio);
+   }
+   return -EINVAL;
}
-   i2c->gpios[idx] = gpio;
+   gpios[idx] = gpio;
 
-   ret = gpio_request(gpio, "i2c-bus");
-   if (ret) {
-   dev_err(i2c->dev, "gpio [%d] request failed\n", gpio);
-   goto free_gpio;
+   if (devm_gpio_request(dev, gpio, "i2c-bus")) {
+   dev_err(dev, "gpio [%d] request failed\n", gpio);
+   return -EINVAL;
}
}
return 0;
-
-free_gpio:
-   while (--idx >= 0)
-   gpio_free(i2c->gpios[idx]);
-   return -EINVAL;
 }
 
-static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c)
+static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c)
 {
-   unsigned int idx;
+   int ret = 0;
 
if (i2c->quirks & QUIRK_NO_GPIO)
-   return;
+   goto out;
+
+   if (of_i2c_parse_gpio(i2c->dev, "gpios", i2c->gpios, 2, true)) {
+   ret = -EINVAL;
+   goto out;
+   }
 
-   for (idx = 0; idx < 2; idx++)
-   gpio_free(i2c->gpios[idx]);
+   if (i2c->adap.gpio_arbit) {
+   if (!of_i2c_parse_gpio(i2c->dev, "bus-arbitration-gpios",
+   i2c->adap.gpio_arbit->arb_gpios, I2C_ARB_GPIO_COUNT,
+   false)) {
+   dev_warn(i2c->dev, "GPIO-based arbitration enabled");
+   } else
+   ret = -EINVAL;
+   }
+
+ out:
+   return ret;
 }
 #else
 static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c)
 {
return 0;
 }
-
-static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c)
-{
-}
 #endif
 
 /* s3c24xx_i2c_init
@@ -981,6 +988,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 {
struct s3c24xx_i2c *i2c;
struct s3c2410_platform_i2c *pdata = NULL;
+   struct i2c_gpio_arbit *arbit = NULL;
struct resource *res;
int ret;
 
@@ -1004,11 +1012,21 @@ static int s3c24xx_i2c_probe(struct platform_device 
*pdev)
goto err_noclk;
}
 
+   arbit = devm_kzalloc(&pdev->dev, sizeof(*arbit), GFP_KERNEL);
+   if (!arbit) {
+   ret = -ENOMEM;
+   goto err_noclk;
+   }
+
i2c->quirks = s3c24xx_get_device_quirks(pdev);
if (pdata)
memcpy(i2c->pdata, pdata, sizeof(*pdata));
-   else
+   else {
s3c24xx_i2c_parse_dt(pdev->dev.of_node, i2c);
+   /* Arbitration parameters */
+   i2c->adap.gpio_arbit = of_get_arbitrator_info(
+   pdev->dev.of_node, arbit);
+   }
 
strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name));
i2c->adap.owner   = THIS_MODULE;
@@ -1158,9 +1176,6 @@ static int s3c24xx_i2c_remove(struct platform_device 
*pdev)
clk_disable_unprepare(i2c->clk);
clk_put(i2c->clk);
 
-   if (pdev->dev.of_node && IS_ERR(i2c->pctrl))
-   s3c24xx_i2c_dt_gpio_free(i2c);
-
return 0;
 }
 
-- 
1.7.9.5

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

[PATCH 0/2] i2c: Implement generic gpio based bus arbitration

2012-12-13 Thread Naveen Krishna Chatradhi
This patchset adds
1. Support for generic gpio based i2c bus arbitration between 2 i2c Masters
Ex: between AP(exynos), device(EC).
2. Documentation and sample implmentation in i2c-s3c2410 driver.

Naveen Krishna Chatradhi (2):
  i2c-core: Add gpio based bus arbitration implementation
  i2c-s3c2410: Add GPIO based bus arbitration functionality

 .../devicetree/bindings/i2c/arbitrator-i2c.txt |   56 ++
 drivers/i2c/busses/i2c-s3c2410.c   |   79 
 drivers/i2c/i2c-core.c |   67 +
 drivers/of/of_i2c.c|   27 +++
 include/linux/i2c.h|   17 +
 include/linux/of_i2c.h |2 +
 6 files changed, 216 insertions(+), 32 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/arbitrator-i2c.txt

-- 
1.7.9.5

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


[PATCH] pwm: samsung: add missing s3c->pwm_id

2012-12-13 Thread Joonyoung Shim
The s3c->pwm_id is used to calculate offset of related register.

Signed-off-by: Joonyoung Shim 
---
 drivers/pwm/pwm-samsung.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 023a3be..b415102 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -220,6 +220,8 @@ static int s3c_pwm_probe(struct platform_device *pdev)
return -ENOMEM;
}
 
+   s3c->pwm_id = id;
+
/* calculate base of control bits in TCON */
s3c->tcon_base = id == 0 ? 0 : (id * 4) + 4;
s3c->chip.dev = &pdev->dev;
-- 
1.7.9.5

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


[PATCH v3] ARM: Exynos5250: Enabling dwc3-exynos driver

2012-12-13 Thread Vivek Gautam
Adding DWC3 device tree node for Exynos5250 along with the
device address and clock support needed for the controller.

Signed-off-by: Vivek Gautam 
---
Changes from v2:
 - Changed the compatible string to chip specific(samsung,exynos5250),
   since dwc3-exynos is being used from exynso5250 onwards.
 - Based on changes for USB 2.0:
   
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-December/024413.html

Changes from v1:
 - Changed the device node name from 'dwc3' to 'usb@1200'.
 - Added the documentation for device tree bindings for dwc3 controller.


 .../devicetree/bindings/usb/exynos-usb.txt |   14 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 +
 arch/arm/mach-exynos/Kconfig   |1 +
 arch/arm/mach-exynos/clock-exynos5.c   |   24 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 6 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index f66fcdd..d660410 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -38,3 +38,17 @@ Example:
reg = <0x1212 0x100>;
interrupts = <0 71 0>;
};
+
+DWC3
+Required properties:
+ - compatible: should be "samsung,exynos5250-dwc3" for USB 3.0 DWC3 controller.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   usb@1200 {
+   compatible = "samsung,exynos5250-dwc3";
+   reg = <0x1200 0x1>;
+   interrupts = <0 72 0>;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 75510d1..001a31b 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -299,6 +299,12 @@
rx-dma-channel = <&pdma0 11>; /* preliminary */
};
 
+   usb@1200 {
+   compatible = "samsung,exynos5250-dwc3";
+   reg = <0x1200 0x1>;
+   interrupts = <0 72 0>;
+   };
+
usb@1211 {
compatible = "samsung,exynos4210-ehci";
reg = <0x1211 0x100>;
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 91d5b6f..09f9587 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -426,6 +426,7 @@ config MACH_EXYNOS5_DT
depends on ARCH_EXYNOS5
select ARM_AMBA
select USE_OF
+   select USB_ARCH_HAS_XHCI
help
  Machine support for Samsung EXYNOS5 machine with device tree enabled.
  Select this if a fdt blob is available for the EXYNOS5 SoC based 
board.
diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index 5c63bc7..f2214a0 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -768,6 +768,11 @@ static struct clk exynos5_init_clocks_off[] = {
.enable = exynos5_clk_ip_fsys_ctrl ,
.ctrlbit= (1 << 18),
}, {
+   .name   = "usbdrd30",
+   .parent = &exynos5_clk_aclk_200.clk,
+   .enable = exynos5_clk_ip_fsys_ctrl,
+   .ctrlbit= (1 << 19),
+   }, {
.name   = "usbotg",
.enable = exynos5_clk_ip_fsys_ctrl,
.ctrlbit= (1 << 7),
@@ -1121,6 +1126,16 @@ static struct clksrc_sources exynos5_clkset_group = {
.nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
 };
 
+struct clk *exynos5_clkset_usbdrd30_list[] = {
+   [0] = &exynos5_clk_mout_mpll.clk,
+   [1] = &exynos5_clk_mout_cpll.clk,
+};
+
+struct clksrc_sources exynos5_clkset_usbdrd30 = {
+   .sources= exynos5_clkset_usbdrd30_list,
+   .nr_sources = ARRAY_SIZE(exynos5_clkset_usbdrd30_list),
+};
+
 /* Possible clock sources for aclk_266_gscl_sub Mux */
 static struct clk *clk_src_gscl_266_list[] = {
[0] = &clk_ext_xtal_mux,
@@ -1415,6 +1430,15 @@ static struct clksrc_clk exynos5_clksrcs[] = {
.parent = &exynos5_clk_mout_cpll.clk,
},
.reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
+   }, {
+   .clk= {
+   .name   = "sclk_usbdrd30",
+   .enable = exynos5_clksrc_mask_fsys_ctrl,
+   .ctrlbit= (1 << 28),
+   },
+   .sources = &exynos5_clkset_usbdrd30,
+   .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 28, .size = 1 
},
+   .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 24,

[PATCH v3 2/2] ARM: Exynos5250: Enabling ohci-exynos driver

2012-12-13 Thread Vivek Gautam
Adding OHCI device tree node for Exynos5250 along with
the device base address.

Signed-off-by: Vivek Gautam 
Acked-by: Jingoo Han 
---
 .../devicetree/bindings/usb/exynos-usb.txt |   15 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 ++
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 ++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
index e8bbb47..f66fcdd 100644
--- a/Documentation/devicetree/bindings/usb/exynos-usb.txt
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -23,3 +23,18 @@ Example:
interrupts = <0 71 0>;
samsung,vbus-gpio = <&gpx2 6 1 3 3>;
};
+
+OHCI
+Required properties:
+ - compatible: should be "samsung,exynos4210-ohci" for USB 2.0
+   OHCI companion controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Example:
+   usb@1212 {
+   compatible = "samsung,exynos4210-ohci";
+   reg = <0x1212 0x100>;
+   interrupts = <0 71 0>;
+   };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 584bb9a..75510d1 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -305,6 +305,12 @@
interrupts = <0 71 0>;
};
 
+   usb@1212 {
+   compatible = "samsung,exynos4210-ohci";
+   reg = <0x1212 0x100>;
+   interrupts = <0 71 0>;
+   };
+
amba {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index b2c662f..4bf6fd9 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -202,6 +202,7 @@
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
 #define EXYNOS5_PA_EHCI0x1211
+#define EXYNOS5_PA_OHCI0x1212
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index b3b9af1..07aa586 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -112,6 +112,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
"samsung-i2s.2", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-ehci", EXYNOS5_PA_EHCI,
"s5p-ehci", NULL),
+   OF_DEV_AUXDATA("samsung,exynos4210-ohci", EXYNOS5_PA_OHCI,
+   "exynos-ohci", NULL),
{},
 };
 
-- 
1.7.6.5

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


[PATCH v3 1/2] ARM: Exynos5250: Enabling ehci-s5p driver

2012-12-13 Thread Vivek Gautam
Adding EHCI device tree node for Exynos5250 along with
the device base adress and gpio line for vbus.

Signed-off-by: Vivek Gautam 
Acked-by: Jingoo Han 
---
 .../devicetree/bindings/usb/exynos-usb.txt |   25 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 +++
 arch/arm/boot/dts/exynos5250.dtsi  |6 
 arch/arm/mach-exynos/include/mach/map.h|1 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |2 +
 5 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/exynos-usb.txt 
b/Documentation/devicetree/bindings/usb/exynos-usb.txt
new file mode 100644
index 000..e8bbb47
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/exynos-usb.txt
@@ -0,0 +1,25 @@
+Samsung Exynos SoC USB controller
+
+The USB devices interface with USB controllers on Exynos SOCs.
+The device node has following properties.
+
+EHCI
+Required properties:
+ - compatible: should be "samsung,exynos4210-ehci" for USB 2.0
+   EHCI controller in host mode.
+ - reg: physical base address of the controller and length of memory mapped
+   region.
+ - interrupts: interrupt number to the cpu.
+
+Optional properties:
+ - samsung,vbus-gpio:  if present, specifies the GPIO that
+   needs to be pulled up for the bus to be powered.
+
+Example:
+
+   usb@1211 {
+   compatible = "samsung,exynos4210-ehci";
+   reg = <0x1211 0x100>;
+   interrupts = <0 71 0>;
+   samsung,vbus-gpio = <&gpx2 6 1 3 3>;
+   };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 711b55f..f990086 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -218,4 +218,8 @@
i2s_2: i2s@12D7 {
status = "disabled";
};
+
+   usb@1211 {
+   samsung,vbus-gpio = <&gpx2 6 1 3 3>;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 581e57a..584bb9a 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -299,6 +299,12 @@
rx-dma-channel = <&pdma0 11>; /* preliminary */
};
 
+   usb@1211 {
+   compatible = "samsung,exynos4210-ehci";
+   reg = <0x1211 0x100>;
+   interrupts = <0 71 0>;
+   };
+
amba {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/arm/mach-exynos/include/mach/map.h 
b/arch/arm/mach-exynos/include/mach/map.h
index cbb2852..b2c662f 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -201,6 +201,7 @@
 #define EXYNOS4_PA_EHCI0x1258
 #define EXYNOS4_PA_OHCI0x1259
 #define EXYNOS4_PA_HSPHY   0x125B
+#define EXYNOS5_PA_EHCI0x1211
 #define EXYNOS4_PA_MFC 0x1340
 
 #define EXYNOS4_PA_UART0x1380
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c 
b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 462e5ac..b3b9af1 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -110,6 +110,8 @@ static const struct of_dev_auxdata 
exynos5250_auxdata_lookup[] __initconst = {
"samsung-i2s.1", NULL),
OF_DEV_AUXDATA("samsung,samsung-i2s", 0x12D7,
"samsung-i2s.2", NULL),
+   OF_DEV_AUXDATA("samsung,exynos4210-ehci", EXYNOS5_PA_EHCI,
+   "s5p-ehci", NULL),
{},
 };
 
-- 
1.7.6.5

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


[PATCH v3 0/2] Enable ehci and ohci devices for exynos5250

2012-12-13 Thread Vivek Gautam
Changes from v2:
 - Changed the compatible string to chip specific(samsung,exynos4210),
   since ehci-s5p and ohci-exynos are being used from exynso4210 onwards.
 - Based on changes for drivers available at:
   http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg23218.html

Changes from v1:
 - Changed the device node names from 'ehci' and 'ohci' to
   'usb@1211' and 'usb@1212' as per discussion for the
   change 'http://www.spinics.net/lists/linux-usb/msg73993.html'
 - Rebased on for-next branch of linux-samsung.

Vivek Gautam (2):
  ARM: Exynos5250: Enabling ehci-s5p driver
  ARM: Exynos5250: Enabling ohci-exynos driver

 .../devicetree/bindings/usb/exynos-usb.txt |   40 
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |4 ++
 arch/arm/boot/dts/exynos5250.dtsi  |   12 ++
 arch/arm/mach-exynos/include/mach/map.h|2 +
 arch/arm/mach-exynos/mach-exynos5-dt.c |4 ++
 5 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/exynos-usb.txt

-- 
1.7.6.5

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


Re: [PATCH 2/2] usb: dwc3-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
CC: LKML

On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam  wrote:
> Using specific chip in compatible strings. Newer SOCs can claim
> device by using older string in the compatible list.
>
> Signed-off-by: Vivek Gautam 
> ---
>  drivers/usb/dwc3/dwc3-exynos.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index aae5328..9dce99a 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -188,7 +188,7 @@ static int dwc3_exynos_remove(struct platform_device 
> *pdev)
>
>  #ifdef CONFIG_OF
>  static const struct of_device_id exynos_dwc3_match[] = {
> -   { .compatible = "samsung,exynos-dwc3" },
> +   { .compatible = "samsung,exynos5250-dwc3" },
> {},
>  };
>  MODULE_DEVICE_TABLE(of, exynos_dwc3_match);
> --
> 1.7.6.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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


Re: [PATCH 1/2] usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam  wrote:
> Using specific chip in compatible strings. Newer SOCs can claim
> device by using older string in the compatible list.
>
> Signed-off-by: Vivek Gautam 
> ---
>  drivers/usb/host/ehci-s5p.c|2 +-
>  drivers/usb/host/ohci-exynos.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
> index 319dcfa..f18e6ac 100644
> --- a/drivers/usb/host/ehci-s5p.c
> +++ b/drivers/usb/host/ehci-s5p.c
> @@ -266,7 +266,7 @@ static const struct dev_pm_ops s5p_ehci_pm_ops = {
>
>  #ifdef CONFIG_OF
>  static const struct of_device_id exynos_ehci_match[] = {
> -   { .compatible = "samsung,exynos-ehci" },
> +   { .compatible = "samsung,exynos4210-ehci" },
> {},
>  };
>  MODULE_DEVICE_TABLE(of, exynos_ehci_match);
> diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> index aa3b884..77f2017 100644
> --- a/drivers/usb/host/ohci-exynos.c
> +++ b/drivers/usb/host/ohci-exynos.c
> @@ -267,7 +267,7 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
>
>  #ifdef CONFIG_OF
>  static const struct of_device_id exynos_ohci_match[] = {
> -   { .compatible = "samsung,exynos-ohci" },
> +   { .compatible = "samsung,exynos4210-ohci" },
> {},
>  };
>  MODULE_DEVICE_TABLE(of, exynos_ohci_match);
> --
> 1.7.6.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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


Re: [PATCH 0/2] usb: exynos: Fix compatible strings used for device

2012-12-13 Thread Vivek Gautam
CC: LKML

On Thu, Dec 13, 2012 at 8:22 PM, Vivek Gautam  wrote:
> Using chip specific compatible string as it should be.
> So fixing this for ehci-s5p, ohci-exynos and dwc3-exynos
> which till now used a generic 'exynos' in their compatible strings.
>
> This goes as per the discussion happened in the thread for
> [PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver
> available at:
> http://www.spinics.net/lists/linux-usb/msg74145.html
>
> Vivek Gautam (2):
>   usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device
>   usb: dwc3-exynos: Fix compatible strings for the device
>
>  drivers/usb/dwc3/dwc3-exynos.c |2 +-
>  drivers/usb/host/ehci-s5p.c|2 +-
>  drivers/usb/host/ohci-exynos.c |2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> --
> 1.7.6.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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


[PATCH 2/2] usb: dwc3-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam 
---
 drivers/usb/dwc3/dwc3-exynos.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index aae5328..9dce99a 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -188,7 +188,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_dwc3_match[] = {
-   { .compatible = "samsung,exynos-dwc3" },
+   { .compatible = "samsung,exynos5250-dwc3" },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_dwc3_match);
-- 
1.7.6.5

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


[PATCH 1/2] usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device

2012-12-13 Thread Vivek Gautam
Using specific chip in compatible strings. Newer SOCs can claim
device by using older string in the compatible list.

Signed-off-by: Vivek Gautam 
---
 drivers/usb/host/ehci-s5p.c|2 +-
 drivers/usb/host/ohci-exynos.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 319dcfa..f18e6ac 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -266,7 +266,7 @@ static const struct dev_pm_ops s5p_ehci_pm_ops = {
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_ehci_match[] = {
-   { .compatible = "samsung,exynos-ehci" },
+   { .compatible = "samsung,exynos4210-ehci" },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_ehci_match);
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index aa3b884..77f2017 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -267,7 +267,7 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
 
 #ifdef CONFIG_OF
 static const struct of_device_id exynos_ohci_match[] = {
-   { .compatible = "samsung,exynos-ohci" },
+   { .compatible = "samsung,exynos4210-ohci" },
{},
 };
 MODULE_DEVICE_TABLE(of, exynos_ohci_match);
-- 
1.7.6.5

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


[PATCH 0/2] usb: exynos: Fix compatible strings used for device

2012-12-13 Thread Vivek Gautam
Using chip specific compatible string as it should be.
So fixing this for ehci-s5p, ohci-exynos and dwc3-exynos
which till now used a generic 'exynos' in their compatible strings.

This goes as per the discussion happened in the thread for
[PATCH v2] ARM: Exynos5250: Enabling dwc3-exynos driver
available at:
http://www.spinics.net/lists/linux-usb/msg74145.html

Vivek Gautam (2):
  usb: ehci-s5p/ohci-exynos: Fix compatible strings for the device
  usb: dwc3-exynos: Fix compatible strings for the device

 drivers/usb/dwc3/dwc3-exynos.c |2 +-
 drivers/usb/host/ehci-s5p.c|2 +-
 drivers/usb/host/ohci-exynos.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
1.7.6.5

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


[PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2012-12-13 Thread Thomas Abraham
Add pinctrl device nodes for Exynos5250 SoC.

Signed-off-by: Thomas Abraham 
---
Few notes on this patch:
- Only pinctrl-0 and pinctrl-3 nodes have been added. Since pinctrl-1 is
  mostly used for camera interface, and since I do not have good
  understanding of this interface, I assumed the person with better
  understanding of camera interface can add the pinctrl-1 node. And
  pinctrl-2 node is used for C2C controller which I do not understand.
- The individual device nodes which are using the old style Samsung gpio
  bindings have not been converted over to pinctrl bindings yet. It might
  also be important to know if Linus's pinctrl grab in device core patch
  (http://comments.gmane.org/gmane.linux.kernel/1409263) gets accepted.
- This patch should not be merged for now which otherwise would break existing
  platforms which are using the old samsung gpio driver bindings. This patch
  is intended to get started with the migration to pinctrl framework.
  It is probably better to first prepare all the migration patches and
  merge them as a bunch.

 arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  575 +
 arch/arm/boot/dts/exynos5250.dtsi |  268 +-
 2 files changed, 596 insertions(+), 247 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5250-pinctrl.dtsi

diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
new file mode 100644
index 000..24180fc
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -0,0 +1,575 @@
+/*
+ * Samsung's Exynos5250 SoC pin-mux and pin-config device tree source
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung's Exynos5250 SoC pin-mux and pin-config optiosn are listed as device
+ * tree nodes are listed in this file.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/ {
+   pinctrl@1140 {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa2: gpa2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb0: gpb0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb1: gpb1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb2: gpb2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb3: gpb3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc2: gpc2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc3: gpc3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller

[PATCH 3/3] arm: exynos: skip wakeup interrupt registration for exynos5250 if pinctrl is enabled

2012-12-13 Thread Thomas Abraham
Skip the wakeup interrupt registration for Exynos5250 if pinctrl support
is enabled for Exynos5250.

Signed-off-by: Thomas Abraham 
---
 arch/arm/mach-exynos/common.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 73b940f..7ad5011 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -1019,6 +1019,7 @@ static int __init exynos_init_irq_eint(void)
static const struct of_device_id exynos_pinctrl_ids[] = {
{ .compatible = "samsung,pinctrl-exynos4210", },
{ .compatible = "samsung,pinctrl-exynos4x12", },
+   { .compatible = "samsung,pinctrl-exynos5250", },
};
struct device_node *pctrl_np, *wkup_np;
const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
-- 
1.6.6.rc2

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


[PATCH 2/3] gpio: samsung: skip gpiolib registration if pinctrl support is enabled for exynos5250

2012-12-13 Thread Thomas Abraham
Skip exynos5250 gpiolib registration if pinctrl support for exynos5250
is enabled.

Signed-off-by: Thomas Abraham 
---
 drivers/gpio/gpio-samsung.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 01f7fe9..849c134 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -3026,6 +3026,7 @@ static __init int samsung_gpiolib_init(void)
static const struct of_device_id exynos_pinctrl_ids[] = {
{ .compatible = "samsung,pinctrl-exynos4210", },
{ .compatible = "samsung,pinctrl-exynos4x12", },
+   { .compatible = "samsung,pinctrl-exynos5250", },
};
for_each_matching_node(pctrl_np, exynos_pinctrl_ids)
if (pctrl_np && of_device_is_available(pctrl_np))
-- 
1.6.6.rc2

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


[PATCH 1/3] pinctrl: exynos: add exynos5250 SoC specific data

2012-12-13 Thread Thomas Abraham
Add Samsung Exynos5250 SoC specific data to enable pinctrl support for
all platforms based on Exynos5250.

Signed-off-by: Thomas Abraham 
---
 drivers/pinctrl/pinctrl-exynos.c  |  108 +
 drivers/pinctrl/pinctrl-samsung.c |2 +
 drivers/pinctrl/pinctrl-samsung.h |1 +
 3 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 538b9dd..8738933 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -677,3 +677,111 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = {
.label  = "exynos4x12-gpio-ctrl3",
},
 };
+
+/* pin banks of exynos5250 pin-controller 0 */
+static struct samsung_pin_bank exynos5250_pin_banks0[] = {
+   EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08),
+   EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10),
+   EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14),
+   EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18),
+   EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c),
+   EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc1", 0x20),
+   EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc2", 0x24),
+   EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc3", 0x28),
+   EXYNOS_PIN_BANK_EINTG(4, 0x160, "gpd0", 0x2c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x30),
+   EXYNOS_PIN_BANK_EINTG(7, 0x2E0, "gpc4", 0x34),
+   EXYNOS_PIN_BANK_EINTN(6, 0x1A0, "gpy0"),
+   EXYNOS_PIN_BANK_EINTN(4, 0x1C0, "gpy1"),
+   EXYNOS_PIN_BANK_EINTN(6, 0x1E0, "gpy2"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x200, "gpy3"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x220, "gpy4"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x240, "gpy5"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x260, "gpy6"),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
+};
+
+/* pin banks of exynos5250 pin-controller 1 */
+static struct samsung_pin_bank exynos5250_pin_banks1[] = {
+   EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(4, 0x040, "gpf0", 0x08),
+   EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpf1", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14),
+   EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18),
+   EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gph0", 0x1c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph1", 0x20),
+};
+
+/* pin banks of exynos5250 pin-controller 2 */
+static struct samsung_pin_bank exynos5250_pin_banks2[] = {
+   EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08),
+   EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10),
+};
+
+/* pin banks of exynos5250 pin-controller 3 */
+static struct samsung_pin_bank exynos5250_pin_banks3[] = {
+   EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00),
+};
+
+/*
+ * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes
+ * four gpio/pin-mux/pinconfig controllers.
+ */
+struct samsung_pin_ctrl exynos5250_pin_ctrl[] = {
+   {
+   /* pin-controller instance 0 data */
+   .pin_banks  = exynos5250_pin_banks0,
+   .nr_banks   = ARRAY_SIZE(exynos5250_pin_banks0),
+   .geint_con  = EXYNOS_GPIO_ECON_OFFSET,
+   .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
+   .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
+   .weint_con  = EXYNOS_WKUP_ECON_OFFSET,
+   .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
+   .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
+   .svc= EXYNOS_SVC_OFFSET,
+   .eint_gpio_init = exynos_eint_gpio_init,
+   .eint_wkup_init = exynos_eint_wkup_init,
+   .label  = "exynos5250-gpio-ctrl0",
+   }, {
+   /* pin-controller instance 1 data */
+   .pin_banks  = exynos5250_pin_banks1,
+   .nr_banks   = ARRAY_SIZE(exynos5250_pin_banks1),
+   .geint_con  = EXYNOS_GPIO_ECON_OFFSET,
+   .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
+   .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
+   .svc= EXYNOS_SVC_OFFSET,
+   .eint_gpio_init = exynos_eint_gpio_init,
+   .label  = "exynos5250-gpio-ctrl1",
+   }, {
+   /* pin-controller instance 2 data */
+   .pin_banks  = exynos5250_pin_banks2,
+   .nr_banks   = ARRAY_SIZE(exynos5250_pin_banks2),

[PATCH 0/3] pinctrl: exynos: add support for Samsung's Exynos5250

2012-12-13 Thread Thomas Abraham
This patch series adds pinctrl driver support for Samsung's Exynos5250 SoC.
The first patch adds the required Exynos5250 SoC specific data which is
used by the Samsung pinctrl driver to setup the pinctrl/pinmux/eint
controllers. The second and third patches skips the wakeup interrupt and
gpiolib registration if the pinctrl support is enabled for Exynos5250.

Thomas Abraham (3):
  pinctrl: exynos: add exynos5250 SoC specific data
  gpio: samsung: skip gpiolib registration if pinctrl support is enabled for 
exynos5250
  arm: exynos: skip wakeup interrupt registration for exynos5250 if pinctrl is 
enabled

 arch/arm/mach-exynos/common.c |1 +
 drivers/gpio/gpio-samsung.c   |1 +
 drivers/pinctrl/pinctrl-exynos.c  |  108 +
 drivers/pinctrl/pinctrl-samsung.c |2 +
 drivers/pinctrl/pinctrl-samsung.h |1 +
 5 files changed, 113 insertions(+), 0 deletions(-)

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


[PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s

2012-12-13 Thread Padmavathi Venna
Add support for device based discovery.

Signed-off-by: Padmavathi Venna 
---
 .../devicetree/bindings/sound/samsung-i2s.txt  |   75 +++
 sound/soc/samsung/dma.c|1 +
 sound/soc/samsung/dma.h|1 +
 sound/soc/samsung/i2s.c|  233 
 4 files changed, 269 insertions(+), 41 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/samsung-i2s.txt

diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt 
b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
new file mode 100644
index 000..bff47b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
@@ -0,0 +1,75 @@
+* Samsung I2S controller
+
+Required SoC Specific Properties:
+
+- compatible : "samsung,samsung-i2s"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+[PRELIMINARY: the dma channel allocation will change once there are
+official DMA bindings]
+
+- tx-dma-channel-secondary: The dma channel specifier for secondary tx
+  operations. The format of the dma specifier depends on the dma
+  controller.
+- tx-dma-channel: The dma channel specifier for tx operations. The format of
+  the dma specifier depends on the dma controller.
+- rx-dma-channel: The dma channel specifier for rx operations. The format of
+  the dma specifier depends on the dma controller.
+
+Optional SoC Specific Properties:
+
+- samsung,supports-6ch: If the I2S Primary sound source has 5.1 Channel
+  support, this flag is enabled.
+- samsung,supports-rstclr: This flag should be set if I2S software reset bit
+  control is required. When this flag is set I2S software reset bit will be
+  enabled or disabled based on need.
+- samsung,supports-secdai:If I2S block has a secondary FIFO and internal DMA,
+  then this flag is enabled.
+- samsung,idma-addr: Internal DMA register base address of the audio
+  sub system(used in secondary sound source).
+
+Required Board Specific Properties:
+
+- gpios: The gpio specifier for data out,data in, LRCLK, CDCLK and SCLK
+  interface lines. The format of the gpio specifier depends on the gpio
+  controller.
+  The syntax of samsung gpio specifier is
+   <[phandle of the gpio controller node]
+[pin number within the gpio controller]
+[mux function]
+[flags and pull up/down]
+[drive strength]>
+
+Aliases:
+
+- All the I2S controller nodes are represented in the aliases node using
+  the following format 'i2s{n}' where n is a unique number for the alias.
+
+Example:
+
+- SoC Specific Portion:
+
+i2s@0383 {
+   compatible = "samsung,samsung-i2s";
+   reg = <0x0383 0x100>;
+   tx-dma-channel-secondary = <&pdma0 8>;
+   tx-dma-channel = <&pdma0 10>;
+   rx-dma-channel = <&pdma0 9>;
+   samsung,supports-6ch;
+   samsung,supports-rstclr;
+   samsung,supports-secdai;
+   samsung,idma-addr = <0x0300>;
+};
+
+- Board Specific Portion:
+
+i2s_0: i2s@0383 {
+   gpios = <&gpz 0 2 0 0>, /* I2S_0_SCLK */
+   <&gpz 1 2 0 0>, /* I2S_0_CDCLK */
+   <&gpz 2 2 0 0>, /* I2S_0_LRCK */
+   <&gpz 3 2 0 0>, /* I2S_0_SDI */
+   <&gpz 4 2 0 0>, /* I2S_0_SDO[1] */
+   <&gpz 5 2 0 0>, /* I2S_0_SDO[2] */
+   <&gpz 6 2 0 0>; /* I2S_0_SDO[3] */
+};
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index db87628..eb79844 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -168,6 +168,7 @@ static int dma_hw_params(struct snd_pcm_substream 
*substream,
req.cap = (samsung_dma_has_circular() ?
DMA_CYCLIC : DMA_SLAVE);
req.client = prtd->params->client;
+   req.dt_dmach_prop = prtd->params->dma_prop;
config.direction =
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 73d8c7c..9f5b35c 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -19,6 +19,7 @@ struct s3c_dma_params {
int dma_size;   /* Size of the DMA transfer */
unsigned ch;
struct samsung_dma_ops *ops;
+   struct property *dma_prop;
 };
 
 int asoc_dma_platform_register(struct device *dev);
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index ed5eeae..e3c9673 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -15,11 +15,15 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include "dma.h"
@@ -34,6 +38,10 @@ enum samsung_dai_type {
TYPE_SEC,
 };
 
+struct samsung_i2s_dai_data {
+   int dai_type;
+};
+
 struct i2s_dai {
/* Platform device for this DAI */
struct platform_device *pdev;
@@ -71,6 +79,7 @@ struct i

[PATCH V5 1/2] ASoC: Samsung: Rename samsung i2s secondary device name

2012-12-13 Thread Padmavathi Venna
All Samsung SoCs has max 3 i2s controllers. So the i2s secondary fifo
interface device id was named as samsung-i2s.4. Renaming this to
"samsung-i2s-sec" to support device tree in i2s driver.

Signed-off-by: Padmavathi Venna 
---
 sound/soc/samsung/i2s.c |   31 ---
 sound/soc/samsung/i2s.h |7 ---
 sound/soc/samsung/smdk_wm8580.c |7 ++-
 sound/soc/samsung/smdk_wm8994.c |4 ++--
 4 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d2d124f..ed5eeae 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -29,6 +29,11 @@
 
 #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
 
+enum samsung_dai_type {
+   TYPE_PRI,
+   TYPE_SEC,
+};
+
 struct i2s_dai {
/* Platform device for this DAI */
struct platform_device *pdev;
@@ -981,8 +986,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device 
*pdev, bool sec)
i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
} else {/* Create a new platform_device for Secondary */
i2s->pdev = platform_device_register_resndata(NULL,
-   pdev->name, pdev->id + SAMSUNG_I2S_SECOFF,
-   NULL, 0, NULL, 0);
+   "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
if (IS_ERR(i2s->pdev))
return NULL;
}
@@ -993,6 +997,11 @@ static struct i2s_dai *i2s_alloc_dai(struct 
platform_device *pdev, bool sec)
return i2s;
 }
 
+static inline int samsung_i2s_get_driver_data(struct platform_device *pdev)
+{
+   return platform_get_device_id(pdev)->driver_data;
+}
+
 static int samsung_i2s_probe(struct platform_device *pdev)
 {
u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan;
@@ -1001,10 +1010,13 @@ static int samsung_i2s_probe(struct platform_device 
*pdev)
struct samsung_i2s *i2s_cfg;
struct resource *res;
u32 regs_base, quirks;
+   enum samsung_dai_type samsung_dai_type;
int ret = 0;
 
/* Call during Seconday interface registration */
-   if (pdev->id >= SAMSUNG_I2S_SECOFF) {
+   samsung_dai_type = samsung_i2s_get_driver_data(pdev);
+
+   if (samsung_dai_type == TYPE_SEC) {
sec_dai = dev_get_drvdata(&pdev->dev);
snd_soc_register_dai(&sec_dai->pdev->dev,
&sec_dai->i2s_dai_drv);
@@ -1143,9 +1155,22 @@ static int samsung_i2s_remove(struct platform_device 
*pdev)
return 0;
 }
 
+static struct platform_device_id samsung_i2s_driver_ids[] = {
+   {
+   .name   = "samsung-i2s",
+   .driver_data= TYPE_PRI,
+   }, {
+   .name   = "samsung-i2s-sec",
+   .driver_data= TYPE_SEC,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, samsung-i2s-driver-ids);
+
 static struct platform_driver samsung_i2s_driver = {
.probe  = samsung_i2s_probe,
.remove = samsung_i2s_remove,
+   .id_table = samsung_i2s_driver_ids,
.driver = {
.name = "samsung-i2s",
.owner = THIS_MODULE,
diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
index d420a7c..7966afc 100644
--- a/sound/soc/samsung/i2s.h
+++ b/sound/soc/samsung/i2s.h
@@ -13,13 +13,6 @@
 #ifndef __SND_SOC_SAMSUNG_I2S_H
 #define __SND_SOC_SAMSUNG_I2S_H
 
-/*
- * Maximum number of I2S blocks that any SoC can have.
- * The secondary interface of a CPU dai(if there exists any),
- * is indexed at [cpu-dai's ID + SAMSUNG_I2S_SECOFF]
- */
-#define SAMSUNG_I2S_SECOFF 4
-
 #define SAMSUNG_I2S_DIV_BCLK   1
 
 #define SAMSUNG_I2S_RCLKSRC_0  0
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index 7e2b710..7a16b32 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -193,9 +193,9 @@ static struct snd_soc_dai_link smdk_dai[] = {
[SEC_PLAYBACK] = { /* Sec_Fifo Playback i/f */
.name = "Sec_FIFO TX",
.stream_name = "Playback",
-   .cpu_dai_name = "samsung-i2s.x",
+   .cpu_dai_name = "samsung-i2s-sec",
.codec_dai_name = "wm8580-hifi-playback",
-   .platform_name = "samsung-i2s.x",
+   .platform_name = "samsung-i2s-sec",
.codec_name = "wm8580.0-001b",
.ops = &smdk_ops,
},
@@ -223,9 +223,6 @@ static int __init smdk_audio_init(void)
if (machine_is_smdkc100()
|| machine_is_smdkv210() || machine_is_smdkc110()) {
smdk.num_links = 3;
-   /* Secondary is at offset SAMSUNG_I2S_SECOFF from Primary */
-   str = (char *)smdk_dai[SEC_PLAYBACK].cpu_dai_name;
-   str[strlen(str) - 1] = '0' + SAMSUNG_I2S_SECOFF;
} else if (machine_is_smdk6410()) {
str = (char *)

[PATCH V5 0/2] Add DT support for i2s

2012-12-13 Thread Padmavathi Venna
V5 patches are based on Mark Brown's for-next branch of
"git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git"

Changes since V4:
- Add a new patch for renaming the samsung i2s secondary fifo interface
  device name from "samsung-i2s.4" to "samsung-i2s-sec"
- Add platform_device_id table for the primary and secondary DAIs
- Avoid using of alias ids in the i2s driver by adding of_device_id
  table. Primary device can get registered via dt or non-dt but 
secondary
  device can get registered only at runtime because the secondary is not
  physically present on the board.

Changes since V3:
- Added syntex of gpio specifier as suggested by Mark Brown in
  DT document file
- Added the requirement for having I2S alias ids
- Explained about gpio lines
- Made a seperate patch to get the I2S rclk src clk from alias ID

Changes since V2:
- Rebased on 3.7-rc3
- Custom DT bindings are prefixed with samsung
- As generic device tree DMA helpers not yet mainlined
  I am still using custom dma bindings. So added a
  priliminary statement regarding the same. I will rework
  on my patch once generic DMA helpers are mainlined.

Chnages since V1:
- Rebased on 3.6-rc6

Padmavathi Venna (2):
  ASoC: Samsung: Rename samsung i2s secondary device name
  ASoC: SAMSUNG: Add DT support for i2s

 .../devicetree/bindings/sound/samsung-i2s.txt  |   75 ++
 sound/soc/samsung/dma.c|1 +
 sound/soc/samsung/dma.h|1 +
 sound/soc/samsung/i2s.c|  262 
 sound/soc/samsung/i2s.h|7 -
 sound/soc/samsung/smdk_wm8580.c|7 +-
 sound/soc/samsung/smdk_wm8994.c|4 +-
 7 files changed, 300 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/samsung-i2s.txt

-- 
1.7.4.4

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


[PATCH] pwm: add Exynos PWM driver

2012-12-13 Thread Joonyoung Shim
This is PWM driver to support 4 pwm for Exynos SoCs. Also this supports
device tree node.

The existing s3c24xx-pwm driver has many dependence with arch specific
codes and it is difficult to support device tree by static mapping of
PMW memory area. Also it can't support multi pwm to one device and can't
make to module.

Signed-off-by: Joonyoung Shim 
---
This is based on for-next branch of git://gitorious.org/linux-pwm/linux-pwm.git

 drivers/pwm/Kconfig  |9 ++
 drivers/pwm/Makefile |1 +
 drivers/pwm/pwm-exynos.c |  234 ++
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/pwm/pwm-exynos.c

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index ed81720..1632ace 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -46,6 +46,15 @@ config PWM_BFIN
  To compile this driver as a module, choose M here: the module
  will be called pwm-bfin.
 
+config PWM_EXYNOS
+   tristate "Exynos pwm support"
+   depends on ARCH_EXYNOS
+   help
+ Generic PWM framework driver for Exynos.
+
+ To compile this driver as a module, choose M here: the module
+ will be called pwm-exynos.
+
 config PWM_IMX
tristate "i.MX pwm support"
depends on ARCH_MXC
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index acfe482..423a251 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_PWM)  += core.o
 obj-$(CONFIG_PWM_AB8500)   += pwm-ab8500.o
 obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o
+obj-$(CONFIG_PWM_EXYNOS)   += pwm-exynos.o
 obj-$(CONFIG_PWM_IMX)  += pwm-imx.o
 obj-$(CONFIG_PWM_JZ4740)   += pwm-jz4740.o
 obj-$(CONFIG_PWM_LPC32XX)  += pwm-lpc32xx.o
diff --git a/drivers/pwm/pwm-exynos.c b/drivers/pwm/pwm-exynos.c
new file mode 100644
index 000..5a411b6
--- /dev/null
+++ b/drivers/pwm/pwm-exynos.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PWM_NUM4
+
+#define PWM_TCFG0  0x00
+#define PWM_TCFG1  0x04
+#define PWM_TCON   0x08
+#define PWM_TCNTB(hw)  (0x0c + (hw) * 0x0c)
+#define PWM_TCMPB(hw)  (0x10 + (hw) * 0x0c)
+#define PWM_TCNTO(hw)  (0x14 + (hw) * 0x0c)
+
+#define PWM_TCFG0_RST_VAL  0x101
+#define PWM_TCFG1_RST_VAL  0x0
+#define PWM_TCON_RST_VAL   0x44404 /* inverter on */
+
+#define PWM_TCFG0_PRESCALER0_MASK  0xff
+#define PWM_TCFG0_PRESCALER1_MASK  0xff00
+#define PWM_TCFG0_PRESCALER1_SHIFT 8
+
+#define PWM_TCFG1_MUX_MASK 0xf
+#define PWM_TCFG1_MUX_SHIFT4
+
+#define PWM_TCON_BASE(hw)  ((hw) ? ((hw) + 1) * 4 : 0)
+#define PWM_TCON_START(hw) (1 << (PWM_TCON_BASE(hw) + 0))
+#define PWM_TCON_MANUALUPDATE(hw)  (1 << (PWM_TCON_BASE(hw) + 1))
+#define PWM_TCON_INVERTER(hw)  (1 << (PWM_TCON_BASE(hw) + 2))
+#define PWM_TCON_AUTORELOAD(hw)(1 << (PWM_TCON_BASE(hw) + 3))
+
+struct exynos_pwm {
+   struct pwm_chip chip;
+   struct device   *dev;
+   struct clk  *clk;
+   struct mutexmutex;
+   void __iomem*base;
+};
+
+static int exynos_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
+int duty_ns, int period_ns)
+{
+   struct exynos_pwm *exynos = container_of(chip, struct exynos_pwm, chip);
+   unsigned long long c;
+   unsigned long period_cycles, duty_cycles;
+   unsigned long clk_rate;
+   unsigned int prescaler;
+   unsigned int divider;
+   unsigned int hw = pwm->hwpwm;
+   u32 val;
+
+   if (period_ns > NSEC_PER_SEC)
+   return -ERANGE;
+
+   val = readl(exynos->base + PWM_TCFG0);
+   if (hw == 0 || hw == 1)
+   prescaler = val & PWM_TCFG0_PRESCALER0_MASK;
+   else
+   prescaler = (val & PWM_TCFG0_PRESCALER1_MASK) >>
+   PWM_TCFG0_PRESCALER1_SHIFT;
+
+   val = readl(exynos->base + PWM_TCFG1);
+   divider = val & (PWM_TCFG1_MUX_MASK << (hw * PWM_TCFG1_MUX_SHIFT));
+   divider = 1 << divider;
+
+   /* Clock Frequency = PCLK / (prescaler + 1) / divider */
+   clk_rate = clk_get_rate(exynos->clk);
+   clk_rate = clk_rate / (prescaler + 1) / divider;
+
+   c = (unsigned long long)clk_rate * period_ns;
+   do_div(c, NSEC_PER_SEC);
+   period_cycles = (unsigned long)c;
+
+   c = (unsigned long long)period_cycles * duty_ns;
+   do_div(c, period_ns);
+   duty_cycles = (unsigned long)c;
+
+   /* because inverter i

[PATCH] ARM: EXYNOS: remove static mapping of PWM memory

2012-12-13 Thread Joonyoung Shim
The exynos SoCs uses MCT(Multi-Core Timer) so it doesn't need to map PWM
memory area to virtual memory(S3C_VA_TIMER) statically for timer.

This patch also remove functions call dependent to S3C_VA_TIMER.
- s3c_pwmclk_init()
- s5p_init_irq()

They access PWM registers via S3C_VA_TIMER but exynos will not use them
any more. There is a exception case about the universal_c210 board. The
universal_c210 board can't use MCT because of low SoC version.

Signed-off-by: Joonyoung Shim 
---
This is based on for-next branch of 
git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git

 arch/arm/mach-exynos/clock-exynos4.c   |2 --
 arch/arm/mach-exynos/clock-exynos5.c   |1 -
 arch/arm/mach-exynos/common.c  |   23 ---
 arch/arm/mach-exynos/mach-universal_c210.c |   21 +++--
 4 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-exynos/clock-exynos4.c 
b/arch/arm/mach-exynos/clock-exynos4.c
index efead60..8e5a0aa 100644
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -1597,6 +1597,4 @@ void __init exynos4_register_clocks(void)
 
register_syscore_ops(&exynos4_clock_syscore_ops);
s3c24xx_register_clock(&dummy_apb_pclk);
-
-   s3c_pwmclk_init();
 }
diff --git a/arch/arm/mach-exynos/clock-exynos5.c 
b/arch/arm/mach-exynos/clock-exynos5.c
index 5c63bc7..cf96990 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -1754,5 +1754,4 @@ void __init exynos5_register_clocks(void)
clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup));
 
register_syscore_ops(&exynos5_clock_syscore_ops);
-   s3c_pwmclk_init();
 }
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 73b940f..79dcb4a 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -141,11 +141,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
.length = SZ_64K,
.type   = MT_DEVICE,
}, {
-   .virtual= (unsigned long)S3C_VA_TIMER,
-   .pfn= __phys_to_pfn(EXYNOS4_PA_TIMER),
-   .length = SZ_16K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_WATCHDOG,
.pfn= __phys_to_pfn(EXYNOS4_PA_WATCHDOG),
.length = SZ_4K,
@@ -243,11 +238,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
.length = SZ_64K,
.type   = MT_DEVICE,
}, {
-   .virtual= (unsigned long)S3C_VA_TIMER,
-   .pfn= __phys_to_pfn(EXYNOS5_PA_TIMER),
-   .length = SZ_16K,
-   .type   = MT_DEVICE,
-   }, {
.virtual= (unsigned long)S3C_VA_WATCHDOG,
.pfn= __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
.length = SZ_4K,
@@ -654,13 +644,6 @@ void __init exynos4_init_irq(void)
 
if (!of_have_populated_dt())
combiner_init(S5P_VA_COMBINER_BASE, NULL);
-
-   /*
-* The parameters of s5p_init_irq() are for VIC init.
-* Theses parameters should be NULL and 0 because EXYNOS4
-* uses GIC instead of VIC.
-*/
-   s5p_init_irq(NULL, 0);
 }
 
 void __init exynos5_init_irq(void)
@@ -668,12 +651,6 @@ void __init exynos5_init_irq(void)
 #ifdef CONFIG_OF
of_irq_init(exynos_dt_irq_match);
 #endif
-   /*
-* The parameters of s5p_init_irq() are for VIC init.
-* Theses parameters should be NULL and 0 because EXYNOS4
-* uses GIC instead of VIC.
-*/
-   s5p_init_irq(NULL, 0);
 
gic_arch_extn.irq_set_wake = s3c_irq_wake;
 }
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c 
b/arch/arm/mach-exynos/mach-universal_c210.c
index 9e3340f..6eee378 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -29,6 +29,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1090,10 +1091,26 @@ static struct platform_device *universal_devices[] 
__initdata = {
&s5p_device_fimc_md,
 };
 
+static struct map_desc universal_iodesc[] __initdata = {
+   {
+   .virtual= (unsigned long)S3C_VA_TIMER,
+   .pfn= __phys_to_pfn(EXYNOS4_PA_TIMER),
+   .length = SZ_16K,
+   .type   = MT_DEVICE,
+   },
+};
+
+static void __init universal_init_irq(void)
+{
+   exynos4_init_irq();
+   s5p_init_irq(NULL, 0);
+}
+
 static void __init universal_map_io(void)
 {
-   exynos_init_io(NULL, 0);
+   exynos_init_io(universal_iodesc, ARRAY_SIZE(universal_iodesc));
s3c24xx_init_clocks(clk_xusbxti.rate);
+   s3c_pwmclk_init();
s3c24xx_init_uarts