Re: [PATCH 4/5] ARM: dts: imx23-olinuxino: enable Low Resolution ADC

2013-07-15 Thread Alexandre Pereira da Silva
On Mon, Jul 15, 2013 at 11:22 AM, Otavio Salvador
 wrote:
> The i.XM23 has a internal Low Resolution ADC; this enables the support
> for this device.
>
> Signed-off-by: Otavio Salvador 

Acked-by: Alexandre Pereira da Silva 
--
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 4/5] ARM: dts: imx23-olinuxino: enable Low Resolution ADC

2013-07-15 Thread Alexandre Pereira da Silva
On Mon, Jul 15, 2013 at 11:22 AM, Otavio Salvador
ota...@ossystems.com.br wrote:
 The i.XM23 has a internal Low Resolution ADC; this enables the support
 for this device.

 Signed-off-by: Otavio Salvador ota...@ossystems.com.br

Acked-by: Alexandre Pereira da Silva aletes@gmail.com
--
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: IMX23 usb instability on 3.9-rc5

2013-04-07 Thread Alexandre Pereira da Silva
On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam  wrote:
> Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?
>
> What is your DDR frequency: 133 or 96MHz? I saw some posts in the
> olimex forum that people had to run it at 96MHz to get stable
> operation.

Thanks Fabio,

That seems to be the case. I did two of the mods sugested on olimex forums.
1) Remove R17.
2) Drop DDR speed to 96MHZ.

The first improved the behavior a lot, but still have crashes. The
second have almost eliminated them.

On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam  wrote:
> Alexandre,
>
> On Sat, Apr 6, 2013 at 4:39 PM, Alexandre Pereira da Silva
>  wrote:
>> Hello,
>>
>> I am testing a usb key connected on a IMX23-Olinuxino board. The
>> kernel panics at heavy usb trafic. This was build with the mxs
>> defconfig
>>
>> This happens everytime with "dd if=/dev/sda of=/dev/null bs=4k". The
>> messages of the failure varies a lot from run to run.
>
> Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?
>
> What is your DDR frequency: 133 or 96MHz? I saw some posts in the
> olimex forum that people had to run it at 96MHz to get stable
> operation.
--
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: IMX23 usb instability on 3.9-rc5

2013-04-07 Thread Alexandre Pereira da Silva
On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam feste...@gmail.com wrote:
 Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?

 What is your DDR frequency: 133 or 96MHz? I saw some posts in the
 olimex forum that people had to run it at 96MHz to get stable
 operation.

Thanks Fabio,

That seems to be the case. I did two of the mods sugested on olimex forums.
1) Remove R17.
2) Drop DDR speed to 96MHZ.

The first improved the behavior a lot, but still have crashes. The
second have almost eliminated them.

On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam feste...@gmail.com wrote:
 Alexandre,

 On Sat, Apr 6, 2013 at 4:39 PM, Alexandre Pereira da Silva
 aletes@gmail.com wrote:
 Hello,

 I am testing a usb key connected on a IMX23-Olinuxino board. The
 kernel panics at heavy usb trafic. This was build with the mxs
 defconfig

 This happens everytime with dd if=/dev/sda of=/dev/null bs=4k. The
 messages of the failure varies a lot from run to run.

 Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?

 What is your DDR frequency: 133 or 96MHz? I saw some posts in the
 olimex forum that people had to run it at 96MHz to get stable
 operation.
--
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/


IMX23 usb instability on 3.9-rc5

2013-04-06 Thread Alexandre Pereira da Silva
Hello,

I am testing a usb key connected on a IMX23-Olinuxino board. The
kernel panics at heavy usb trafic. This was build with the mxs
defconfig

This happens everytime with "dd if=/dev/sda of=/dev/null bs=4k". The
messages of the failure varies a lot from run to run.

I tested also on kernel version 3.7.10 and the results are the same.

Please let me know if you need any more details.

Here its the panic messages:
# dd if=/dev/sda of=/dev/null bs=4k
[   83.49] Unable to handle kernel paging request at virtual
address be7a170c
[   83.49] pgd = c2b54000
[   83.49] [be7a170c] *pgd=
[   83.49] Internal error: Oops: 8005 [#1] ARM
[   83.49] Modules linked in:
[   83.49] CPU: 0Not tainted  (3.9.0-rc5-9-ge04a3b9 #4)
[   83.49] PC is at 0xbe7a170c
[   83.49] LR is at new_slab+0x274/0x2c4
[   83.49] pc : []lr : []psr: 6093
[   83.49] sp : c2bc9c68  ip : c3345000  fp : 0020
[   83.49] r10:   r9 : 6013  r8 : c111f880
[   83.49] r7 : c3345000  r6 : c3344fc0  r5 : c3344000  r4 : c3401b80
[   83.49] r3 :   r2 : 0040  r1 : c3344fc0  r0 : c3401b80
[   83.49] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment user
[   83.49] Control: 0005317f  Table: 42b54000  DAC: 0015
[   83.49] Process dd (pid: 112, stack limit = 0xc2bc81b8)
[   83.49] Stack: (0xc2bc9c68 to 0xc2bca000)
[   83.49] 9c60:   c113f300  c3401b80
c34005c0 8050 c0401cec
[   83.49] 9c80: 0001 c29b4588  c00e8064 c29b4588
c2bced80 0001 00400040
[   83.49] 9ca0:  c0221334 c29b4588 c2bced80 c0221268
 c3401b80 8050
[   83.49] 9cc0: c00e8064 c10dd220 000ec6ff  0020
c00ba998 c3401b80 8050
[   83.49] 9ce0: 0001   1000 0001
c10dd220  c00e8064
[   83.49] 9d00:  c00e8a34 0001 c10dd220 
0020 c10dd220 0001
[   83.49] 9d20:  c00e8ad8 c10dd220 c10dd220 0020
c00e8c28 c3005104 c00eb51c
[   83.49] 9d40: c3343fc0 c3005114 c00889d0 c3005114 1d40
c3004ff0 000ec6ff 
[   83.49] 9d60: c3005108 c00ee1ec c3005114 c3005104 c3005114
c3005104 c3005114 c0406cc0
[   83.49] 9d80: c10dd220 c0088a4c 6013 c3005104 0004
0020 c10dd220 0001
[   83.49] 9da0: 000ec6ff  0020 c0091754 0001
 c00915f4 c00569fc
[   83.49] 9dc0: 0001 c2a6d1c0  91827364 c2a6dee0
c2a6dee0 c2bc9dd8 c2bc9dd8
[   83.49] 9de0: c10dc994 c10dd254 1d1c c10dc1a0 1d1c
c3005104  c2a6d1c0
[   83.49] 9e00: 1d1b 01d1c000  c0091a28 0020
c3005104 c2a6d1c0 c0089d1c
[   83.49] 9e20: 1d1c 0001 c2952000 c2935400 01d1c000
 1000 
[   83.49] 9e40: c2bc9f40 000cc081   
c2a6d248 01d1b000 
[   83.49] 9e60: 01d1c000  c2bc9ef8 c3004ff0 1d1d
0001 0002 
[   83.49] 9e80: 1000 01421008   
c2a6d1c0 1000 c2bc9f80
[   83.49] 9ea0: c2b05d80 01d1c000   01421008
c00bf214 01d1c000 
[   83.49] 9ec0:    0001 
c2a6d1c0  
[   83.49] 9ee0:   c2b05d80  
 01d1c000 
[   83.49] 9f00:   1000  1000
  
[   83.49] 9f20:     
  
[   83.49] 9f40: 01421008 1000 c2a6d1c0 1000 c2a6d1c0
01421008 c2bc9f80 c00bf934
[   83.49] 9f60: c2a6d1c0 01421008 c2a6d1c0  01421008
1000 01d1c000 c00bfbb4
[   83.49] 9f80: 01d1c000  1000 000ac968 
01421008 0003 c000e268
[   83.49] 9fa0: c2bc8000 c000e0c0 000ac968  
01421008 1000 
[   83.49] 9fc0: 000ac968  01421008 0003 1000
01421008 1000 01421008
[   83.49] 9fe0: 1000 bed23ac8 e0dc b6f7e97c 6010
  
[   83.49] [] (new_slab+0x274/0x2c4) from []
(__slab_alloc.constprop.44+0x394/0x504)
[   83.49] [] (__slab_alloc.constprop.44+0x394/0x504)
from [] (kmem_cache_alloc+0x54/0x154)
[   83.49] [] (kmem_cache_alloc+0x54/0x154) from
[] (alloc_buffer_head+0x14/0x4c)
[   83.49] [] (alloc_buffer_head+0x14/0x4c) from
[] (alloc_page_buffers+0x1c/0xac)
[   83.49] [] (alloc_page_buffers+0x1c/0xac) from
[] (create_empty_buffers+0x14/0x130)
[   83.49] [] (create_empty_buffers+0x14/0x130) from
[] (create_page_buffers+0x34/0x4c)
[   83.49] [] (create_page_buffers+0x34/0x4c) from
[] (block_read_full_page+0x28/0x348)
[   83.49] [] (block_read_full_page+0x28/0x348) from
[] (__do_page_cache_readahead+0x1c0/0x218)
[   83.49] [] (__do_page_cache_readahead+0x1c0/0x218)
from [] (ra_submit+0x20/0x24)
[   83.49] [] (ra_submit+0x20/0x24) from []

Re: [PATCH] mmc: mxs-mmc: Add broken-cd devicetree property

2013-04-06 Thread Alexandre Pereira da Silva
On Sat, Apr 6, 2013 at 10:58 AM, Marc Kleine-Budde  wrote:
> According to the documentation broken card detect is something different
> than non-removable:
>
> >   - broken-cd: There is no card detection available; polling must be used.
> >   - non-removable: non-removable slot (like eMMC); assume always present.
>
> But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.

I will work on a better way to fix this.
--
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] ARM: dts: imx23-olinuxino: mark sdcard cd as broken

2013-04-06 Thread Alexandre Pereira da Silva
The imx23-olinuxino sdcard doesn't have card detect.

Signed-off-by: Alexandre Pereira da Silva 
---
 arch/arm/boot/dts/imx23-olinuxino.dts |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts 
b/arch/arm/boot/dts/imx23-olinuxino.dts
index a43141a..d4cc9f8 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -29,6 +29,7 @@
pinctrl-names = "default";
pinctrl-0 = <_4bit_pins_a 
_pins_fixup>;
bus-width = <4>;
+   broken-cd;
status = "okay";
};
 
-- 
1.7.10

--
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] mmc: mxs-mmc: Add broken-cd devicetree property

2013-04-06 Thread Alexandre Pereira da Silva
In case of broken card detect support, assume the card is non-removable

Signed-off-by: Alexandre Pereira da Silva 
---

This patch depends on Marc Kleine-Budde series adding support for non-removable.

 drivers/mmc/host/mxs-mmc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index c231881..8418928 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -689,7 +689,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc->caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8)
mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-   host->non_removable = of_property_read_bool(np, "non-removable");
+   host->non_removable = of_property_read_bool(np, "non-removable") |
+   of_property_read_bool(np, "broken-cd");
if (host->non_removable)
mmc->caps |= MMC_CAP_NONREMOVABLE;
host->wp_gpio = of_get_named_gpio_flags(np, "wp-gpios", 0, );
-- 
1.7.10

--
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] mmc: mxs-mmc: Add broken-cd devicetree property

2013-04-06 Thread Alexandre Pereira da Silva
In case of broken card detect support, assume the card is non-removable

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---

This patch depends on Marc Kleine-Budde series adding support for non-removable.

 drivers/mmc/host/mxs-mmc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index c231881..8418928 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -689,7 +689,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
mmc-caps |= MMC_CAP_4_BIT_DATA;
else if (bus_width == 8)
mmc-caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-   host-non_removable = of_property_read_bool(np, non-removable);
+   host-non_removable = of_property_read_bool(np, non-removable) |
+   of_property_read_bool(np, broken-cd);
if (host-non_removable)
mmc-caps |= MMC_CAP_NONREMOVABLE;
host-wp_gpio = of_get_named_gpio_flags(np, wp-gpios, 0, flags);
-- 
1.7.10

--
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] ARM: dts: imx23-olinuxino: mark sdcard cd as broken

2013-04-06 Thread Alexandre Pereira da Silva
The imx23-olinuxino sdcard doesn't have card detect.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 arch/arm/boot/dts/imx23-olinuxino.dts |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts 
b/arch/arm/boot/dts/imx23-olinuxino.dts
index a43141a..d4cc9f8 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -29,6 +29,7 @@
pinctrl-names = default;
pinctrl-0 = mmc0_4bit_pins_a 
mmc0_pins_fixup;
bus-width = 4;
+   broken-cd;
status = okay;
};
 
-- 
1.7.10

--
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] mmc: mxs-mmc: Add broken-cd devicetree property

2013-04-06 Thread Alexandre Pereira da Silva
On Sat, Apr 6, 2013 at 10:58 AM, Marc Kleine-Budde m...@pengutronix.de wrote:
 According to the documentation broken card detect is something different
 than non-removable:

- broken-cd: There is no card detection available; polling must be used.
- non-removable: non-removable slot (like eMMC); assume always present.

 But mxs-mmc set MMC_CAP_NEEDS_POLL unconditionally.

I will work on a better way to fix this.
--
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/


IMX23 usb instability on 3.9-rc5

2013-04-06 Thread Alexandre Pereira da Silva
Hello,

I am testing a usb key connected on a IMX23-Olinuxino board. The
kernel panics at heavy usb trafic. This was build with the mxs
defconfig

This happens everytime with dd if=/dev/sda of=/dev/null bs=4k. The
messages of the failure varies a lot from run to run.

I tested also on kernel version 3.7.10 and the results are the same.

Please let me know if you need any more details.

Here its the panic messages:
# dd if=/dev/sda of=/dev/null bs=4k
[   83.49] Unable to handle kernel paging request at virtual
address be7a170c
[   83.49] pgd = c2b54000
[   83.49] [be7a170c] *pgd=
[   83.49] Internal error: Oops: 8005 [#1] ARM
[   83.49] Modules linked in:
[   83.49] CPU: 0Not tainted  (3.9.0-rc5-9-ge04a3b9 #4)
[   83.49] PC is at 0xbe7a170c
[   83.49] LR is at new_slab+0x274/0x2c4
[   83.49] pc : [be7a170c]lr : [c00ba89c]psr: 6093
[   83.49] sp : c2bc9c68  ip : c3345000  fp : 0020
[   83.49] r10:   r9 : 6013  r8 : c111f880
[   83.49] r7 : c3345000  r6 : c3344fc0  r5 : c3344000  r4 : c3401b80
[   83.49] r3 :   r2 : 0040  r1 : c3344fc0  r0 : c3401b80
[   83.49] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment user
[   83.49] Control: 0005317f  Table: 42b54000  DAC: 0015
[   83.49] Process dd (pid: 112, stack limit = 0xc2bc81b8)
[   83.49] Stack: (0xc2bc9c68 to 0xc2bca000)
[   83.49] 9c60:   c113f300  c3401b80
c34005c0 8050 c0401cec
[   83.49] 9c80: 0001 c29b4588  c00e8064 c29b4588
c2bced80 0001 00400040
[   83.49] 9ca0:  c0221334 c29b4588 c2bced80 c0221268
 c3401b80 8050
[   83.49] 9cc0: c00e8064 c10dd220 000ec6ff  0020
c00ba998 c3401b80 8050
[   83.49] 9ce0: 0001   1000 0001
c10dd220  c00e8064
[   83.49] 9d00:  c00e8a34 0001 c10dd220 
0020 c10dd220 0001
[   83.49] 9d20:  c00e8ad8 c10dd220 c10dd220 0020
c00e8c28 c3005104 c00eb51c
[   83.49] 9d40: c3343fc0 c3005114 c00889d0 c3005114 1d40
c3004ff0 000ec6ff 
[   83.49] 9d60: c3005108 c00ee1ec c3005114 c3005104 c3005114
c3005104 c3005114 c0406cc0
[   83.49] 9d80: c10dd220 c0088a4c 6013 c3005104 0004
0020 c10dd220 0001
[   83.49] 9da0: 000ec6ff  0020 c0091754 0001
 c00915f4 c00569fc
[   83.49] 9dc0: 0001 c2a6d1c0  91827364 c2a6dee0
c2a6dee0 c2bc9dd8 c2bc9dd8
[   83.49] 9de0: c10dc994 c10dd254 1d1c c10dc1a0 1d1c
c3005104  c2a6d1c0
[   83.49] 9e00: 1d1b 01d1c000  c0091a28 0020
c3005104 c2a6d1c0 c0089d1c
[   83.49] 9e20: 1d1c 0001 c2952000 c2935400 01d1c000
 1000 
[   83.49] 9e40: c2bc9f40 000cc081   
c2a6d248 01d1b000 
[   83.49] 9e60: 01d1c000  c2bc9ef8 c3004ff0 1d1d
0001 0002 
[   83.49] 9e80: 1000 01421008   
c2a6d1c0 1000 c2bc9f80
[   83.49] 9ea0: c2b05d80 01d1c000   01421008
c00bf214 01d1c000 
[   83.49] 9ec0:    0001 
c2a6d1c0  
[   83.49] 9ee0:   c2b05d80  
 01d1c000 
[   83.49] 9f00:   1000  1000
  
[   83.49] 9f20:     
  
[   83.49] 9f40: 01421008 1000 c2a6d1c0 1000 c2a6d1c0
01421008 c2bc9f80 c00bf934
[   83.49] 9f60: c2a6d1c0 01421008 c2a6d1c0  01421008
1000 01d1c000 c00bfbb4
[   83.49] 9f80: 01d1c000  1000 000ac968 
01421008 0003 c000e268
[   83.49] 9fa0: c2bc8000 c000e0c0 000ac968  
01421008 1000 
[   83.49] 9fc0: 000ac968  01421008 0003 1000
01421008 1000 01421008
[   83.49] 9fe0: 1000 bed23ac8 e0dc b6f7e97c 6010
  
[   83.49] [c00ba89c] (new_slab+0x274/0x2c4) from [c0401cec]
(__slab_alloc.constprop.44+0x394/0x504)
[   83.49] [c0401cec] (__slab_alloc.constprop.44+0x394/0x504)
from [c00ba998] (kmem_cache_alloc+0x54/0x154)
[   83.49] [c00ba998] (kmem_cache_alloc+0x54/0x154) from
[c00e8064] (alloc_buffer_head+0x14/0x4c)
[   83.49] [c00e8064] (alloc_buffer_head+0x14/0x4c) from
[c00e8a34] (alloc_page_buffers+0x1c/0xac)
[   83.49] [c00e8a34] (alloc_page_buffers+0x1c/0xac) from
[c00e8ad8] (create_empty_buffers+0x14/0x130)
[   83.49] [c00e8ad8] (create_empty_buffers+0x14/0x130) from
[c00e8c28] (create_page_buffers+0x34/0x4c)
[   83.49] [c00e8c28] (create_page_buffers+0x34/0x4c) from
[c00eb51c] (block_read_full_page+0x28/0x348)
[   83.49] [c00eb51c] (block_read_full_page+0x28/0x348) from
[c0091754] (__do_page_cache_readahead+0x1c0/0x218)
[   

Re: [PATCH] ARM: dts: imx23-olinuxino: Set the sdcard as non-removable

2013-04-05 Thread Alexandre Pereira da Silva
On Fri, Apr 5, 2013 at 11:11 AM, Marek Vasut  wrote:
> The CD line is working perfectly well on this board, so I don't get it.

In the schematics of this board, the SSP1_DETECT pin is connected to
the green led. As I see, there is no way, the hardware can detect card
removal. Am I missing something here?
--
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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-05 Thread Alexandre Pereira da Silva
On Fri, Apr 5, 2013 at 6:13 AM, Shawn Guo  wrote:
>
> Marc already sent a similar patch[1] for that.

Thanks for pointing it out.

I will work on top of that patch.

> Shawn
>
> [1] http://thread.gmane.org/gmane.linux.kernel.mmc/19823/focus=19825
>
--
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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-05 Thread Alexandre Pereira da Silva
On Fri, Apr 5, 2013 at 6:13 AM, Shawn Guo shawn@linaro.org wrote:

 Marc already sent a similar patch[1] for that.

Thanks for pointing it out.

I will work on top of that patch.

 Shawn

 [1] http://thread.gmane.org/gmane.linux.kernel.mmc/19823/focus=19825

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


Re: [PATCH] ARM: dts: imx23-olinuxino: Set the sdcard as non-removable

2013-04-05 Thread Alexandre Pereira da Silva
On Fri, Apr 5, 2013 at 11:11 AM, Marek Vasut ma...@denx.de wrote:
 The CD line is working perfectly well on this board, so I don't get it.

In the schematics of this board, the SSP1_DETECT pin is connected to
the green led. As I see, there is no way, the hardware can detect card
removal. Am I missing something here?
--
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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-04 Thread Alexandre Pereira da Silva
Some boards and card slots doesn't have card detect feature available.
In that case allow to mark the cards as non-removable, via devicetree.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/mmc/host/mxs-mmc.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 4efe302..7d2cd74 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -95,6 +95,9 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_ssp *ssp = >ssp;
 
+   if (mmc->caps & MMC_CAP_NONREMOVABLE)
+   return 1;
+
return !(readl(ssp->base + HW_SSP_STATUS(ssp)) &
 BM_SSP_STATUS_CARD_DETECT);
 }
@@ -691,6 +694,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
if (flags & OF_GPIO_ACTIVE_LOW)
host->wp_inverted = 1;
 
+   if (of_find_property(np, "non-removable", NULL))
+   mmc->caps |= MMC_CAP_NONREMOVABLE;
+
mmc->f_min = 40;
mmc->f_max = 28800;
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-- 
1.7.10

--
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] ARM: dts: imx23-olinuxino: Set the sdcard as non-removable

2013-04-04 Thread Alexandre Pereira da Silva
The imx23-olinuxino sdcard doesn't support card detect.

Signed-off-by: Alexandre Pereira da Silva 
---
 arch/arm/boot/dts/imx23-olinuxino.dts |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts 
b/arch/arm/boot/dts/imx23-olinuxino.dts
index e7484e4..03f55c2 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -29,6 +29,7 @@
pinctrl-names = "default";
pinctrl-0 = <_4bit_pins_a 
_pins_fixup>;
bus-width = <4>;
+   non-removable;
status = "okay";
};
 
-- 
1.7.10

--
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] ARM: dts: imx23-olinuxino: Set the sdcard as non-removable

2013-04-04 Thread Alexandre Pereira da Silva
The imx23-olinuxino sdcard doesn't support card detect.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 arch/arm/boot/dts/imx23-olinuxino.dts |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts 
b/arch/arm/boot/dts/imx23-olinuxino.dts
index e7484e4..03f55c2 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -29,6 +29,7 @@
pinctrl-names = default;
pinctrl-0 = mmc0_4bit_pins_a 
mmc0_pins_fixup;
bus-width = 4;
+   non-removable;
status = okay;
};
 
-- 
1.7.10

--
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] mmc: mxs-mmc: Add support for non-removable cards

2013-04-04 Thread Alexandre Pereira da Silva
Some boards and card slots doesn't have card detect feature available.
In that case allow to mark the cards as non-removable, via devicetree.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 drivers/mmc/host/mxs-mmc.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 4efe302..7d2cd74 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -95,6 +95,9 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc)
struct mxs_mmc_host *host = mmc_priv(mmc);
struct mxs_ssp *ssp = host-ssp;
 
+   if (mmc-caps  MMC_CAP_NONREMOVABLE)
+   return 1;
+
return !(readl(ssp-base + HW_SSP_STATUS(ssp)) 
 BM_SSP_STATUS_CARD_DETECT);
 }
@@ -691,6 +694,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
if (flags  OF_GPIO_ACTIVE_LOW)
host-wp_inverted = 1;
 
+   if (of_find_property(np, non-removable, NULL))
+   mmc-caps |= MMC_CAP_NONREMOVABLE;
+
mmc-f_min = 40;
mmc-f_max = 28800;
mmc-ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-- 
1.7.10

--
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 3/3] pwm: lpc32xx - Set the chip base for dynamic allocation

2012-11-23 Thread Alexandre Pereira da Silva
On Wed, Nov 14, 2012 at 9:58 AM, Alban Bedel
 wrote:
> Signed-off-by: Alban Bedel 

Acked-by: Alexandre Pereira da Silva 

> ---
>  drivers/pwm/pwm-lpc32xx.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
> index f45ce2c..3e63689 100644
> --- a/drivers/pwm/pwm-lpc32xx.c
> +++ b/drivers/pwm/pwm-lpc32xx.c
> @@ -121,6 +121,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
> lpc32xx->chip.dev = >dev;
> lpc32xx->chip.ops = _pwm_ops;
> lpc32xx->chip.npwm = 2;
> +   lpc32xx->chip.base = -1;
>
> ret = pwmchip_add(>chip);
> if (ret < 0) {
> --
> 1.7.0.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] pwm: lpc32xx - Fix the PWM polarity

2012-11-23 Thread Alexandre Pereira da Silva
On Wed, Nov 14, 2012 at 9:58 AM, Alban Bedel
 wrote:
> The duty cycles value goes from 1 (99% HIGH) to 256 (0% HIGH) but it
> is stored modulo 256 in the register as it is only 8 bits wide.
>
> Signed-off-by: Alban Bedel 

Acked-by: Alexandre Pereira da Silva 

> ---
>  drivers/pwm/pwm-lpc32xx.c |   17 -
>  1 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
> index adb87f0..03ec3ff 100644
> --- a/drivers/pwm/pwm-lpc32xx.c
> +++ b/drivers/pwm/pwm-lpc32xx.c
> @@ -49,9 +49,24 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, 
> struct pwm_device *pwm,
> c = 0; /* 0 set division by 256 */
> period_cycles = c;
>
> +   /* The duty value is a follow:
> +*
> +*  DUTY HIGH LEVEL
> +*   1 99.9%
> +*   2590.0%
> +*   128   50.0%
> +*   220   10.0%
> +*   2550.1%
> +*   0  0.0%
> +*
> +* In other word the in-register value is duty % 256 with duty
> +* in the range 1-256.
> +*/
> c = 256 * duty_ns;
> do_div(c, period_ns);
> -   duty_cycles = c;
> +   if (c > 255)
> +   c = 255;
> +   duty_cycles = 256 - c;
>
> writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | 
> PWM_DUTY(duty_cycles),
> lpc32xx->base + (pwm->hwpwm << 2));
> --
> 1.7.0.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] pwm: lpc32xx - Fix the PWM polarity

2012-11-23 Thread Alexandre Pereira da Silva
On Wed, Nov 14, 2012 at 9:58 AM, Alban Bedel
alban.be...@avionic-design.de wrote:
 The duty cycles value goes from 1 (99% HIGH) to 256 (0% HIGH) but it
 is stored modulo 256 in the register as it is only 8 bits wide.

 Signed-off-by: Alban Bedel alban.be...@avionic-design.de

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 ---
  drivers/pwm/pwm-lpc32xx.c |   17 -
  1 files changed, 16 insertions(+), 1 deletions(-)

 diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
 index adb87f0..03ec3ff 100644
 --- a/drivers/pwm/pwm-lpc32xx.c
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -49,9 +49,24 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, 
 struct pwm_device *pwm,
 c = 0; /* 0 set division by 256 */
 period_cycles = c;

 +   /* The duty value is a follow:
 +*
 +*  DUTY HIGH LEVEL
 +*   1 99.9%
 +*   2590.0%
 +*   128   50.0%
 +*   220   10.0%
 +*   2550.1%
 +*   0  0.0%
 +*
 +* In other word the in-register value is duty % 256 with duty
 +* in the range 1-256.
 +*/
 c = 256 * duty_ns;
 do_div(c, period_ns);
 -   duty_cycles = c;
 +   if (c  255)
 +   c = 255;
 +   duty_cycles = 256 - c;

 writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | 
 PWM_DUTY(duty_cycles),
 lpc32xx-base + (pwm-hwpwm  2));
 --
 1.7.0.4

--
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 3/3] pwm: lpc32xx - Set the chip base for dynamic allocation

2012-11-23 Thread Alexandre Pereira da Silva
On Wed, Nov 14, 2012 at 9:58 AM, Alban Bedel
alban.be...@avionic-design.de wrote:
 Signed-off-by: Alban Bedel alban.be...@avionic-design.de

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 ---
  drivers/pwm/pwm-lpc32xx.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

 diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
 index f45ce2c..3e63689 100644
 --- a/drivers/pwm/pwm-lpc32xx.c
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -121,6 +121,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 lpc32xx-chip.dev = pdev-dev;
 lpc32xx-chip.ops = lpc32xx_pwm_ops;
 lpc32xx-chip.npwm = 2;
 +   lpc32xx-chip.base = -1;

 ret = pwmchip_add(lpc32xx-chip);
 if (ret  0) {
 --
 1.7.0.4

--
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] pwm: lpc32xx - Fix the PWM polarity

2012-11-08 Thread Alexandre Pereira da Silva
On Thu, Nov 8, 2012 at 11:12 AM, Roland Stigge  wrote:
> On 08/11/12 12:23, Alban Bedel wrote:
 It is intended, the formular for duty value in the register is:

 duty = (256 - 256*duty_ns/period_ns) % 256
>>>
>>> Where does this modulo defined? In the Manual, there is sth. like this
>>> defined for RELOADV (tables 606+607), but not for DUTY.
>>>
>>> Maybe I missed sth. in the manual. Link or hint appreciated!
>>
>> The manual doesn't mention this explicitly but you can see that without
>> the modulo when duty_ns==0 DUTY would be 256, but the register is only
>> 8 bits wide (ie. modulo 256). I made a few test and looked at the PWM
>> output on a scope they confirm this:
>>
>>  DUTY HIGH LEVEL
>>   1 99.9%
>>   2590.0%
>>   128   50.0%
>>   220   10.0%
>>   2550.1%
>>   0  0.0%
>>
>> I'll resubmit the patch with the clamping in the correct order.
>
> Thanks for measuring. With this, your resubmitted patch make much more
> sense now.
>
> Roland

Alban,

I think you should include this measurements on the source code as
comments, for future reference.

Thanks.
--
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] pwm: lpc32xx - Fix the PWM polarity

2012-11-08 Thread Alexandre Pereira da Silva
On Thu, Nov 8, 2012 at 11:12 AM, Roland Stigge sti...@antcom.de wrote:
 On 08/11/12 12:23, Alban Bedel wrote:
 It is intended, the formular for duty value in the register is:

 duty = (256 - 256*duty_ns/period_ns) % 256

 Where does this modulo defined? In the Manual, there is sth. like this
 defined for RELOADV (tables 606+607), but not for DUTY.

 Maybe I missed sth. in the manual. Link or hint appreciated!

 The manual doesn't mention this explicitly but you can see that without
 the modulo when duty_ns==0 DUTY would be 256, but the register is only
 8 bits wide (ie. modulo 256). I made a few test and looked at the PWM
 output on a scope they confirm this:

  DUTY HIGH LEVEL
   1 99.9%
   2590.0%
   128   50.0%
   220   10.0%
   2550.1%
   0  0.0%

 I'll resubmit the patch with the clamping in the correct order.

 Thanks for measuring. With this, your resubmitted patch make much more
 sense now.

 Roland

Alban,

I think you should include this measurements on the source code as
comments, for future reference.

Thanks.
--
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] pwm: lpc32xx - Fix the PWM polarity

2012-11-07 Thread Alexandre Pereira da Silva
On Wed, Nov 7, 2012 at 1:25 PM, Alban Bedel
 wrote:
> Signed-off-by: Alban Bedel 

Acked-by: Alexandre Pereira da Silva 

> ---
>  drivers/pwm/pwm-lpc32xx.c |6 +-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
> index adb87f0..0dc278d 100644
> --- a/drivers/pwm/pwm-lpc32xx.c
> +++ b/drivers/pwm/pwm-lpc32xx.c
> @@ -51,7 +51,11 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, 
> struct pwm_device *pwm,
>
> c = 256 * duty_ns;
> do_div(c, period_ns);
> -   duty_cycles = c;
> +   if (c == 0)
> +   c = 256;
> +   if (c > 255)
> +   c = 255;
> +   duty_cycles = 256 - c;
>
> writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | 
> PWM_DUTY(duty_cycles),
> lpc32xx->base + (pwm->hwpwm << 2));
> --
> 1.7.0.4
>
--
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] pwm: lpc32xx - Fix the PWM polarity

2012-11-07 Thread Alexandre Pereira da Silva
On Wed, Nov 7, 2012 at 1:25 PM, Alban Bedel
alban.be...@avionic-design.de wrote:
 Signed-off-by: Alban Bedel alban.be...@avionic-design.de

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 ---
  drivers/pwm/pwm-lpc32xx.c |6 +-
  1 files changed, 5 insertions(+), 1 deletions(-)

 diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
 index adb87f0..0dc278d 100644
 --- a/drivers/pwm/pwm-lpc32xx.c
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -51,7 +51,11 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, 
 struct pwm_device *pwm,

 c = 256 * duty_ns;
 do_div(c, period_ns);
 -   duty_cycles = c;
 +   if (c == 0)
 +   c = 256;
 +   if (c  255)
 +   c = 255;
 +   duty_cycles = 256 - c;

 writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | 
 PWM_DUTY(duty_cycles),
 lpc32xx-base + (pwm-hwpwm  2));
 --
 1.7.0.4

--
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: 3.7-rc3 oops on reboot

2012-10-29 Thread Alexandre Pereira da Silva
On Mon, Oct 29, 2012 at 12:41 PM, Roland Stigge  wrote:
> On 10/29/2012 02:51 PM, Alexandre Pereira da Silva wrote:
>>> I just tried both on a PHY3250 reference machine, and on a custom board
>>> and couldn't reproduce sth. like this. Booted the kernel and connected
>>> the ethernet cable later on, as well as with cable connected on boot.
>>
>> This is happening on my custom board. I didn't try this on the
>> reference board yet.
>>
>>> Any related patches applied? Can you reproduce this on a reference
>>> machine? Can you provide a .config for this? Any more detail about how
>>> this could be reproduced?
>>
>> No patches applied. I'm trying to bisect this. This happens on a clean
>> -rc1 as well. Doesn't happen on v3.6.
>>
>> Attached my .config
>>
>> To reproduce this, I am just running "reboot". I have the ethernet
>> cable always connected here.
>
> Just tried this with your .config on the PHY3250 (w/o your initrd
> thought) but couldn't reproduce the issue.
>
> Maybe it's related to your Micrel ethernet PHY (activated in your
> config) which I don't have hardware for?
>
> Otherwise, we would need to have a look at your devicetree.

Thanks for testing. I will investigate this further to see if I can
narrow source of the problem.
--
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: 3.7-rc3 oops on reboot

2012-10-29 Thread Alexandre Pereira da Silva
Roland, thanks for the quick response.

> I just tried both on a PHY3250 reference machine, and on a custom board
> and couldn't reproduce sth. like this. Booted the kernel and connected
> the ethernet cable later on, as well as with cable connected on boot.

This is happening on my custom board. I didn't try this on the
reference board yet.

> Any related patches applied? Can you reproduce this on a reference
> machine? Can you provide a .config for this? Any more detail about how
> this could be reproduced?

No patches applied. I'm trying to bisect this. This happens on a clean
-rc1 as well. Doesn't happen on v3.6.

Attached my .config

To reproduce this, I am just running "reboot". I have the ethernet
cable always connected here.


.config
Description: Binary data


Re: [PATCH 1/2] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free

2012-10-29 Thread Alexandre Pereira da Silva
On Sun, Oct 28, 2012 at 2:12 PM, Peter Senna Tschudin
 wrote:
> Based on commit b27393aecf66199f5ddad37c302d3e0cfadbe6c0
>
> Calling mdiobus_free without calling mdiobus_unregister causes
> BUG_ON(). This patch fixes the issue.
>
> The semantic patch that found this issue(http://coccinelle.lip6.fr/):
> // 
> @@
> expression E;
> @@
>   ... when != mdiobus_unregister(E);
>
> + mdiobus_unregister(E);
>   mdiobus_free(E);
> // 
>
> Signed-off-by: Peter Senna Tschudin 
> ---

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


Re: [PATCH 1/2] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free

2012-10-29 Thread Alexandre Pereira da Silva
On Sun, Oct 28, 2012 at 2:12 PM, Peter Senna Tschudin
peter.se...@gmail.com wrote:
 Based on commit b27393aecf66199f5ddad37c302d3e0cfadbe6c0

 Calling mdiobus_free without calling mdiobus_unregister causes
 BUG_ON(). This patch fixes the issue.

 The semantic patch that found this issue(http://coccinelle.lip6.fr/):
 // smpl
 @@
 expression E;
 @@
   ... when != mdiobus_unregister(E);

 + mdiobus_unregister(E);
   mdiobus_free(E);
 // /smpl

 Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
 ---

Tested-by: Alexandre Pereira da Silva aletes@gmail.com
--
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: 3.7-rc3 oops on reboot

2012-10-29 Thread Alexandre Pereira da Silva
Roland, thanks for the quick response.

 I just tried both on a PHY3250 reference machine, and on a custom board
 and couldn't reproduce sth. like this. Booted the kernel and connected
 the ethernet cable later on, as well as with cable connected on boot.

This is happening on my custom board. I didn't try this on the
reference board yet.

 Any related patches applied? Can you reproduce this on a reference
 machine? Can you provide a .config for this? Any more detail about how
 this could be reproduced?

No patches applied. I'm trying to bisect this. This happens on a clean
-rc1 as well. Doesn't happen on v3.6.

Attached my .config

To reproduce this, I am just running reboot. I have the ethernet
cable always connected here.


.config
Description: Binary data


Re: 3.7-rc3 oops on reboot

2012-10-29 Thread Alexandre Pereira da Silva
On Mon, Oct 29, 2012 at 12:41 PM, Roland Stigge sti...@antcom.de wrote:
 On 10/29/2012 02:51 PM, Alexandre Pereira da Silva wrote:
 I just tried both on a PHY3250 reference machine, and on a custom board
 and couldn't reproduce sth. like this. Booted the kernel and connected
 the ethernet cable later on, as well as with cable connected on boot.

 This is happening on my custom board. I didn't try this on the
 reference board yet.

 Any related patches applied? Can you reproduce this on a reference
 machine? Can you provide a .config for this? Any more detail about how
 this could be reproduced?

 No patches applied. I'm trying to bisect this. This happens on a clean
 -rc1 as well. Doesn't happen on v3.6.

 Attached my .config

 To reproduce this, I am just running reboot. I have the ethernet
 cable always connected here.

 Just tried this with your .config on the PHY3250 (w/o your initrd
 thought) but couldn't reproduce the issue.

 Maybe it's related to your Micrel ethernet PHY (activated in your
 config) which I don't have hardware for?

 Otherwise, we would need to have a look at your devicetree.

Thanks for testing. I will investigate this further to see if I can
narrow source of the problem.
--
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 RESEND] usb: gadget: lpc32xx_udc: Disable setup request error

2012-10-15 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
if (i < 0) {
/* setup processing failed, force stall */
-   dev_err(udc->dev,
+   dev_dbg(udc->dev,
"req %02x.%02x protocol STALL; stat %d\n",
reqtype, req, i);
udc->ep0state = WAIT_FOR_SETUP;
-- 
1.7.10

--
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 RESEND] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-10-15 Thread Alexandre Pereira da Silva
The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the
register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the
ST part.

This is a work around for this by using the interrupt source register that
should behave the same on both parts and has the needed information.

Signed-off-by: Alexandre Pereira da Silva 
---

This patch is very important to LPC32xx users. IMHO this should go in for 
3.7-rc2.

 drivers/usb/gadget/lpc32xx_udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f696fb9..21a9861 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
/* Get the VBUS status from the transceiver */
value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
-ISP1301_I2C_OTG_CONTROL_2);
+ISP1301_I2C_INTERRUPT_SOURCE);
 
/* VBUS on or off? */
-   if (value & OTG_B_SESS_VLD)
+   if (value & INT_SESS_VLD)
udc->vbus = 1;
else
udc->vbus = 0;
-- 
1.7.10

--
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 RESEND] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-10-15 Thread Alexandre Pereira da Silva
The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the
register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the
ST part.

This is a work around for this by using the interrupt source register that
should behave the same on both parts and has the needed information.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---

This patch is very important to LPC32xx users. IMHO this should go in for 
3.7-rc2.

 drivers/usb/gadget/lpc32xx_udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f696fb9..21a9861 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
/* Get the VBUS status from the transceiver */
value = i2c_smbus_read_byte_data(udc-isp1301_i2c_client,
-ISP1301_I2C_OTG_CONTROL_2);
+ISP1301_I2C_INTERRUPT_SOURCE);
 
/* VBUS on or off? */
-   if (value  OTG_B_SESS_VLD)
+   if (value  INT_SESS_VLD)
udc-vbus = 1;
else
udc-vbus = 0;
-- 
1.7.10

--
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 RESEND] usb: gadget: lpc32xx_udc: Disable setup request error

2012-10-15 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
if (i  0) {
/* setup processing failed, force stall */
-   dev_err(udc-dev,
+   dev_dbg(udc-dev,
req %02x.%02x protocol STALL; stat %d\n,
reqtype, req, i);
udc-ep0state = WAIT_FOR_SETUP;
-- 
1.7.10

--
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] spi/pl022: Devicetree support w/o platform data

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 9:49 AM, Roland Stigge  wrote:
> Even with devicetree support, we needed platform data to provide some data 
> like
> bus_id and enable_dma, leading to mixed device tree and platform data. This
> patch makes it possible to provide all that information via device tree. Now,
> the data must be provided via platform data _or_ device tree completely.
>
> Only in case of callback specification (dma_filter()), platform data is
> necessary.
>
> Signed-off-by: Roland Stigge 
> Acked-by: Linus Walleij 

Acked-by: Alexandre Pereira da Silva 

> ---
>  Documentation/devicetree/bindings/spi/spi_pl022.txt |9 
>  drivers/spi/spi-pl022.c |   41 
> +---
>  2 files changed, 45 insertions(+), 5 deletions(-)
>
> --- linux-2.6.orig/Documentation/devicetree/bindings/spi/spi_pl022.txt
> +++ linux-2.6/Documentation/devicetree/bindings/spi/spi_pl022.txt
> @@ -10,6 +10,15 @@ Optional properties:
>  - cs-gpios : should specify GPIOs used for chipselects.
>The gpios will be referred to as reg =  in the SPI child nodes.
>If unspecified, a single SPI device without a chip select can be used.
> +- pl022,bus-id : Bus ID (0, 1, ...)
> +- pl022,enable-dma : enables DMA driven transfers (boolean)
> +- pl022,autosuspend-delay : delay in ms following transfer completion before
> +   the runtime power management system suspends the
> +   device. A setting of 0 indicates no delay and the
> +device will be suspended immediately
> +- pl022,rt : indicates the controller should run the message pump with 
> realtime
> + priority to minimise the transfer latency on the bus (boolean)
> +
>
>  SPI slave nodes must be children of the SPI master node and can
>  contain the following properties.
> --- linux-2.6.orig/drivers/spi/spi-pl022.c
> +++ linux-2.6/drivers/spi/spi-pl022.c
> @@ -2024,6 +2024,36 @@ static void pl022_cleanup(struct spi_dev
> kfree(chip);
>  }
>
> +static struct pl022_ssp_controller *
> +pl022_platform_data_dt_get(struct device *dev)
> +{
> +   struct device_node *np = dev->of_node;
> +   struct pl022_ssp_controller *pd;
> +   u32 tmp;
> +
> +   if (!np) {
> +   dev_err(dev, "no dt node defined\n");
> +   return NULL;
> +   }
> +
> +   pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), 
> GFP_KERNEL);
> +   if (!pd) {
> +   dev_err(dev, "cannot allocate platform data memory\n");
> +   return NULL;
> +   }
> +
> +   of_property_read_u32(np, "pl022,bus-id", );
> +   pd->bus_id = tmp;
> +   of_property_read_u32(np, "num-cs", );
> +   pd->num_chipselect = tmp;
> +   pd->enable_dma = of_property_read_bool(np, "pl022,enable-dma") ? 1 : 
> 0;
> +   of_property_read_u32(np, "pl022,autosuspend-delay",
> +>autosuspend_delay);
> +   pd->rt = of_property_read_bool(np, "pl022,rt");
> +
> +   return pd;
> +}
> +
>  static int __devinit
>  pl022_probe(struct amba_device *adev, const struct amba_id *id)
>  {
> @@ -2036,18 +2066,19 @@ pl022_probe(struct amba_device *adev, co
>
> dev_info(>dev,
>  "ARM PL022 driver, device ID: 0x%08x\n", adev->periphid);
> -   if (platform_info == NULL) {
> -   dev_err(>dev, "probe - no platform data supplied\n");
> +   if (!platform_info && IS_ENABLED(CONFIG_OF))
> +   platform_info = pl022_platform_data_dt_get(dev);
> +
> +   if (!platform_info) {
> +   dev_err(dev, "probe: no platform data defined\n");
> status = -ENODEV;
> goto err_no_pdata;
> }
>
> if (platform_info->num_chipselect) {
> num_cs = platform_info->num_chipselect;
> -   } else if (IS_ENABLED(CONFIG_OF)) {
> -   of_property_read_u32(np, "num-cs", _cs);
> } else {
> -   dev_err(>dev, "probe: no chip select defined\n");
> +   dev_err(dev, "probe: no chip select defined\n");
> status = -ENODEV;
> goto err_no_pdata;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] ARM: LPC32xx: Platform update for devicetree completion of spi-pl022

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 10:00 AM, Roland Stigge  wrote:
> spi-pl022 got a further update to its devicetree support, completing 
> properties
> such that no platform data is necessary anymore. This patch adjusts phy3250.c
> accordingly: The supplied platform data is deleted. However, OF_DEV_AUXDATA()
> are still necessary due to device naming ("dev:ssp0").
>
> Signed-off-by: Roland Stigge 

Acked-by: Alexandre Pereira da Silva 

> --
> I will do a git pull request for arm-soc.git when the respective change in
> spi-pl022.c is merged.
>
> --- linux-2.6.orig/arch/arm/mach-lpc32xx/phy3250.c
> +++ linux-2.6/arch/arm/mach-lpc32xx/phy3250.c
> @@ -27,7 +27,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -156,21 +155,6 @@ static struct clcd_board lpc32xx_clcd_da
> .remove = lpc32xx_clcd_remove,
>  };
>
> -/*
> - * AMBA SSP (SPI)
> - */
> -static struct pl022_ssp_controller lpc32xx_ssp0_data = {
> -   .bus_id = 0,
> -   .num_chipselect = 1,
> -   .enable_dma = 0,
> -};
> -
> -static struct pl022_ssp_controller lpc32xx_ssp1_data = {
> -   .bus_id = 1,
> -   .num_chipselect = 1,
> -   .enable_dma = 0,
> -};
> -
>  static struct pl08x_channel_data pl08x_slave_channels[] = {
> {
> .bus_id = "nand-slc",
> @@ -232,8 +216,8 @@ static struct lpc32xx_mlc_platform_data
>  };
>
>  static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
> -   OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", 
> _ssp0_data),
> -   OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", 
> _ssp1_data),
> +   OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
> +   OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
> OF_DEV_AUXDATA("arm,pl110", 0x3104, "dev:clcd", 
> _clcd_data),
> OF_DEV_AUXDATA("arm,pl080", 0x3100, "pl08xdmac", _pd),
> OF_DEV_AUXDATA("arm,pl18x", 0x20098000, "20098000.sd",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: LPC32xx: DTS update for devicetree completion of spi-pl022

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 10:00 AM, Roland Stigge  wrote:
> spi-pl022 got a further update to its devicetree support, completing 
> properties
> such that no platform data is necessary anymore. This patch adjusts
> lpc32xx.dtsi accordingly.
>
> Signed-off-by: Roland Stigge 

Acked-by: Alexandre Pereira da Silva 

>
> ---
> I will do a git pull request for arm-soc.git when the respective change in
> spi-pl022.c is merged.
>
>  arch/arm/boot/dts/lpc32xx.dtsi |2 ++
>  1 file changed, 2 insertions(+)
>
> --- linux-2.6.orig/arch/arm/boot/dts/lpc32xx.dtsi
> +++ linux-2.6/arch/arm/boot/dts/lpc32xx.dtsi
> @@ -91,6 +91,7 @@
> compatible = "arm,pl022", "arm,primecell";
> reg = <0x20084000 0x1000>;
> interrupts = <0x14 0>;
> +   pl022,bus-id = <0>;
> };
>
> spi1: spi@20088000 {
> @@ -102,6 +103,7 @@
> compatible = "arm,pl022", "arm,primecell";
> reg = <0x2008c000 0x1000>;
> interrupts = <0x15 0>;
> +   pl022,bus-id = <1>;
> };
>
> spi2: spi@2009 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] ARM: LPC32xx: DTS update for devicetree completion of spi-pl022

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 10:00 AM, Roland Stigge sti...@antcom.de wrote:
 spi-pl022 got a further update to its devicetree support, completing 
 properties
 such that no platform data is necessary anymore. This patch adjusts
 lpc32xx.dtsi accordingly.

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-by: Alexandre Pereira da Silva aletes@gmail.com


 ---
 I will do a git pull request for arm-soc.git when the respective change in
 spi-pl022.c is merged.

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

 --- linux-2.6.orig/arch/arm/boot/dts/lpc32xx.dtsi
 +++ linux-2.6/arch/arm/boot/dts/lpc32xx.dtsi
 @@ -91,6 +91,7 @@
 compatible = arm,pl022, arm,primecell;
 reg = 0x20084000 0x1000;
 interrupts = 0x14 0;
 +   pl022,bus-id = 0;
 };

 spi1: spi@20088000 {
 @@ -102,6 +103,7 @@
 compatible = arm,pl022, arm,primecell;
 reg = 0x2008c000 0x1000;
 interrupts = 0x15 0;
 +   pl022,bus-id = 1;
 };

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


Re: [PATCH 2/2] ARM: LPC32xx: Platform update for devicetree completion of spi-pl022

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 10:00 AM, Roland Stigge sti...@antcom.de wrote:
 spi-pl022 got a further update to its devicetree support, completing 
 properties
 such that no platform data is necessary anymore. This patch adjusts phy3250.c
 accordingly: The supplied platform data is deleted. However, OF_DEV_AUXDATA()
 are still necessary due to device naming (dev:ssp0).

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 --
 I will do a git pull request for arm-soc.git when the respective change in
 spi-pl022.c is merged.

 --- linux-2.6.orig/arch/arm/mach-lpc32xx/phy3250.c
 +++ linux-2.6/arch/arm/mach-lpc32xx/phy3250.c
 @@ -27,7 +27,6 @@
  #include linux/gpio.h
  #include linux/amba/bus.h
  #include linux/amba/clcd.h
 -#include linux/amba/pl022.h
  #include linux/amba/pl08x.h
  #include linux/amba/mmci.h
  #include linux/of.h
 @@ -156,21 +155,6 @@ static struct clcd_board lpc32xx_clcd_da
 .remove = lpc32xx_clcd_remove,
  };

 -/*
 - * AMBA SSP (SPI)
 - */
 -static struct pl022_ssp_controller lpc32xx_ssp0_data = {
 -   .bus_id = 0,
 -   .num_chipselect = 1,
 -   .enable_dma = 0,
 -};
 -
 -static struct pl022_ssp_controller lpc32xx_ssp1_data = {
 -   .bus_id = 1,
 -   .num_chipselect = 1,
 -   .enable_dma = 0,
 -};
 -
  static struct pl08x_channel_data pl08x_slave_channels[] = {
 {
 .bus_id = nand-slc,
 @@ -232,8 +216,8 @@ static struct lpc32xx_mlc_platform_data
  };

  static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
 -   OF_DEV_AUXDATA(arm,pl022, 0x20084000, dev:ssp0, 
 lpc32xx_ssp0_data),
 -   OF_DEV_AUXDATA(arm,pl022, 0x2008C000, dev:ssp1, 
 lpc32xx_ssp1_data),
 +   OF_DEV_AUXDATA(arm,pl022, 0x20084000, dev:ssp0, NULL),
 +   OF_DEV_AUXDATA(arm,pl022, 0x2008C000, dev:ssp1, NULL),
 OF_DEV_AUXDATA(arm,pl110, 0x3104, dev:clcd, 
 lpc32xx_clcd_data),
 OF_DEV_AUXDATA(arm,pl080, 0x3100, pl08xdmac, pl08x_pd),
 OF_DEV_AUXDATA(arm,pl18x, 0x20098000, 20098000.sd,
--
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] spi/pl022: Devicetree support w/o platform data

2012-09-18 Thread Alexandre Pereira da Silva
On Tue, Sep 18, 2012 at 9:49 AM, Roland Stigge sti...@antcom.de wrote:
 Even with devicetree support, we needed platform data to provide some data 
 like
 bus_id and enable_dma, leading to mixed device tree and platform data. This
 patch makes it possible to provide all that information via device tree. Now,
 the data must be provided via platform data _or_ device tree completely.

 Only in case of callback specification (dma_filter()), platform data is
 necessary.

 Signed-off-by: Roland Stigge sti...@antcom.de
 Acked-by: Linus Walleij linus.wall...@linaro.org

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 ---
  Documentation/devicetree/bindings/spi/spi_pl022.txt |9 
  drivers/spi/spi-pl022.c |   41 
 +---
  2 files changed, 45 insertions(+), 5 deletions(-)

 --- linux-2.6.orig/Documentation/devicetree/bindings/spi/spi_pl022.txt
 +++ linux-2.6/Documentation/devicetree/bindings/spi/spi_pl022.txt
 @@ -10,6 +10,15 @@ Optional properties:
  - cs-gpios : should specify GPIOs used for chipselects.
The gpios will be referred to as reg = index in the SPI child nodes.
If unspecified, a single SPI device without a chip select can be used.
 +- pl022,bus-id : Bus ID (0, 1, ...)
 +- pl022,enable-dma : enables DMA driven transfers (boolean)
 +- pl022,autosuspend-delay : delay in ms following transfer completion before
 +   the runtime power management system suspends the
 +   device. A setting of 0 indicates no delay and the
 +device will be suspended immediately
 +- pl022,rt : indicates the controller should run the message pump with 
 realtime
 + priority to minimise the transfer latency on the bus (boolean)
 +

  SPI slave nodes must be children of the SPI master node and can
  contain the following properties.
 --- linux-2.6.orig/drivers/spi/spi-pl022.c
 +++ linux-2.6/drivers/spi/spi-pl022.c
 @@ -2024,6 +2024,36 @@ static void pl022_cleanup(struct spi_dev
 kfree(chip);
  }

 +static struct pl022_ssp_controller *
 +pl022_platform_data_dt_get(struct device *dev)
 +{
 +   struct device_node *np = dev-of_node;
 +   struct pl022_ssp_controller *pd;
 +   u32 tmp;
 +
 +   if (!np) {
 +   dev_err(dev, no dt node defined\n);
 +   return NULL;
 +   }
 +
 +   pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), 
 GFP_KERNEL);
 +   if (!pd) {
 +   dev_err(dev, cannot allocate platform data memory\n);
 +   return NULL;
 +   }
 +
 +   of_property_read_u32(np, pl022,bus-id, tmp);
 +   pd-bus_id = tmp;
 +   of_property_read_u32(np, num-cs, tmp);
 +   pd-num_chipselect = tmp;
 +   pd-enable_dma = of_property_read_bool(np, pl022,enable-dma) ? 1 : 
 0;
 +   of_property_read_u32(np, pl022,autosuspend-delay,
 +pd-autosuspend_delay);
 +   pd-rt = of_property_read_bool(np, pl022,rt);
 +
 +   return pd;
 +}
 +
  static int __devinit
  pl022_probe(struct amba_device *adev, const struct amba_id *id)
  {
 @@ -2036,18 +2066,19 @@ pl022_probe(struct amba_device *adev, co

 dev_info(adev-dev,
  ARM PL022 driver, device ID: 0x%08x\n, adev-periphid);
 -   if (platform_info == NULL) {
 -   dev_err(adev-dev, probe - no platform data supplied\n);
 +   if (!platform_info  IS_ENABLED(CONFIG_OF))
 +   platform_info = pl022_platform_data_dt_get(dev);
 +
 +   if (!platform_info) {
 +   dev_err(dev, probe: no platform data defined\n);
 status = -ENODEV;
 goto err_no_pdata;
 }

 if (platform_info-num_chipselect) {
 num_cs = platform_info-num_chipselect;
 -   } else if (IS_ENABLED(CONFIG_OF)) {
 -   of_property_read_u32(np, num-cs, num_cs);
 } else {
 -   dev_err(adev-dev, probe: no chip select defined\n);
 +   dev_err(dev, probe: no chip select defined\n);
 status = -ENODEV;
 goto err_no_pdata;
 }
--
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] input: gpio_keys_polled: fix dt pdata->nbuttons

2012-09-12 Thread Alexandre Pereira da Silva
pdata->nbuttons should be updated by the dt code.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/input/keyboard/gpio_keys_polled.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c 
b/drivers/input/keyboard/gpio_keys_polled.c
index 7908952..f2142de 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -129,6 +129,7 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
}
 
pdata->buttons = (struct gpio_keys_button *)(pdata + 1);
+   pdata->nbuttons = nbuttons;
 
pdata->rep = !!of_get_property(node, "autorepeat", NULL);
of_property_read_u32(node, "poll-interval", >poll_interval);
-- 
1.7.10

--
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] usb: gadget: lpc32xx_udc: Disable setup request error message

2012-09-12 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
if (i < 0) {
/* setup processing failed, force stall */
-   dev_err(udc->dev,
+   dev_dbg(udc->dev,
"req %02x.%02x protocol STALL; stat %d\n",
reqtype, req, i);
udc->ep0state = WAIT_FOR_SETUP;
-- 
1.7.10

--
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] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-09-12 Thread Alexandre Pereira da Silva
The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the
register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the
ST part.

This is a work around for this by using the interrupt source register that
should behave the same on both parts and has the needed information.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f696fb9..21a9861 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
/* Get the VBUS status from the transceiver */
value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
-ISP1301_I2C_OTG_CONTROL_2);
+ISP1301_I2C_INTERRUPT_SOURCE);
 
/* VBUS on or off? */
-   if (value & OTG_B_SESS_VLD)
+   if (value & INT_SESS_VLD)
udc->vbus = 1;
else
udc->vbus = 0;
-- 
1.7.10

--
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] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-09-12 Thread Alexandre Pereira da Silva
The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the
register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the
ST part.

This is a work around for this by using the interrupt source register that
should behave the same on both parts and has the needed information.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 drivers/usb/gadget/lpc32xx_udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f696fb9..21a9861 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
/* Get the VBUS status from the transceiver */
value = i2c_smbus_read_byte_data(udc-isp1301_i2c_client,
-ISP1301_I2C_OTG_CONTROL_2);
+ISP1301_I2C_INTERRUPT_SOURCE);
 
/* VBUS on or off? */
-   if (value  OTG_B_SESS_VLD)
+   if (value  INT_SESS_VLD)
udc-vbus = 1;
else
udc-vbus = 0;
-- 
1.7.10

--
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] usb: gadget: lpc32xx_udc: Disable setup request error message

2012-09-12 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
if (i  0) {
/* setup processing failed, force stall */
-   dev_err(udc-dev,
+   dev_dbg(udc-dev,
req %02x.%02x protocol STALL; stat %d\n,
reqtype, req, i);
udc-ep0state = WAIT_FOR_SETUP;
-- 
1.7.10

--
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] input: gpio_keys_polled: fix dt pdata-nbuttons

2012-09-12 Thread Alexandre Pereira da Silva
pdata-nbuttons should be updated by the dt code.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 drivers/input/keyboard/gpio_keys_polled.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c 
b/drivers/input/keyboard/gpio_keys_polled.c
index 7908952..f2142de 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -129,6 +129,7 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
}
 
pdata-buttons = (struct gpio_keys_button *)(pdata + 1);
+   pdata-nbuttons = nbuttons;
 
pdata-rep = !!of_get_property(node, autorepeat, NULL);
of_property_read_u32(node, poll-interval, pdata-poll_interval);
-- 
1.7.10

--
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 v5 2/2] spi/pl022: Add devicetree support

2012-08-21 Thread Alexandre Pereira da Silva
On Tue, Aug 21, 2012 at 1:01 PM, Roland Stigge  wrote:
> This patch adds device tree support to the spi-pl022 driver.
>
> Based on the initial patch by Alexandre Pereira da Silva 
> 
>
> Signed-off-by: Roland Stigge 

Acked-By: Alexandre Pereira da Silva 

> ---
>
>  Documentation/devicetree/bindings/spi/spi_pl022.txt |   15 +++
>  drivers/spi/spi-pl022.c |   79 
> +---
>  2 files changed, 85 insertions(+), 9 deletions(-)
>
> --- linux-2.6.orig/Documentation/devicetree/bindings/spi/spi_pl022.txt
> +++ linux-2.6/Documentation/devicetree/bindings/spi/spi_pl022.txt
> @@ -6,7 +6,22 @@ Required properties:
>  - interrupts : Should contain SPI controller interrupt
>
>  Optional properties:
> +- num-cs : total number of chipselects
>  - cs-gpios : should specify GPIOs used for chipselects.
>The gpios will be referred to as reg =  in the SPI child nodes.
>If unspecified, a single SPI device without a chip select can be used.
>
> +SPI slave nodes must be children of the SPI master node and can
> +contain the following properties.
> +
> +- pl022,interface : interface type:
> +   0: SPI
> +   1: Texas Instruments Synchronous Serial Frame Format
> +   2: Microwire (Half Duplex)
> +- pl022,com-mode : polling, interrupt or dma
> +- pl022,rx-level-trig : Rx FIFO watermark level
> +- pl022,tx-level-trig : Tx FIFO watermark level
> +- pl022,ctrl-len : Microwire interface: Control length
> +- pl022,wait-state : Microwire interface: Wait state
> +- pl022,duplex : Microwire interface: Full/Half duplex
> +
> --- linux-2.6.orig/drivers/spi/spi-pl022.c
> +++ linux-2.6/drivers/spi/spi-pl022.c
> @@ -41,6 +41,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  /*
>   * This macro is used to define some register default values.
> @@ -1778,12 +1779,14 @@ static const struct pl022_config_chip pl
>  static int pl022_setup(struct spi_device *spi)
>  {
> struct pl022_config_chip const *chip_info;
> +   struct pl022_config_chip chip_info_dt;
> struct chip_data *chip;
> struct ssp_clock_params clk_freq = { .cpsdvsr = 0, .scr = 0};
> int status = 0;
> struct pl022 *pl022 = spi_master_get_devdata(spi->master);
> unsigned int bits = spi->bits_per_word;
> u32 tmp;
> +   struct device_node *np = spi->dev.of_node;
>
> if (!spi->max_speed_hz)
> return -EINVAL;
> @@ -1806,10 +1809,32 @@ static int pl022_setup(struct spi_device
> chip_info = spi->controller_data;
>
> if (chip_info == NULL) {
> -   chip_info = _default_chip_info;
> -   /* spi_board_info.controller_data not is supplied */
> -   dev_dbg(>dev,
> -   "using default controller_data settings\n");
> +   if (np) {
> +   chip_info_dt = pl022_default_chip_info;
> +
> +   chip_info_dt.hierarchy = SSP_MASTER;
> +   of_property_read_u32(np, "pl022,interface",
> +   _info_dt.iface);
> +   of_property_read_u32(np, "pl022,com-mode",
> +   _info_dt.com_mode);
> +   of_property_read_u32(np, "pl022,rx-level-trig",
> +   _info_dt.rx_lev_trig);
> +   of_property_read_u32(np, "pl022,tx-level-trig",
> +   _info_dt.tx_lev_trig);
> +   of_property_read_u32(np, "pl022,ctrl-len",
> +   _info_dt.ctrl_len);
> +   of_property_read_u32(np, "pl022,wait-state",
> +   _info_dt.wait_state);
> +   of_property_read_u32(np, "pl022,duplex",
> +   _info_dt.duplex);
> +
> +   chip_info = _info_dt;
> +   } else {
> +   chip_info = _default_chip_info;
> +   /* spi_board_info.controller_data not is supplied */
> +   dev_dbg(>dev,
> +   "using default controller_data settings\n");
> +   }
> } else
> dev_dbg(>dev,
> "using user supplied controller_data settings\n");
> @@ -2006,7 +2031,8 @@ pl022_probe(struct amba_device *adev, co
> struct pl022_ssp_controller *platform_info = adev->dev.platform_data;
> struct spi_master *master;
> struct pl022 *pl022 = NULL; /*Data for this

Re: [PATCH v5 1/2] spi/pl022: Add chip select handling via GPIO

2012-08-21 Thread Alexandre Pereira da Silva
On Tue, Aug 21, 2012 at 1:00 PM, Roland Stigge  wrote:
> This patch adds the ability for the driver to control the chip select 
> directly.
> This enables independence from cs_control callbacks.  Configurable via
> platform_data, to be extended as DT in the following patch.
>
> Based on the initial patch by Alexandre Pereira da Silva 
> 
>
> Signed-off-by: Roland Stigge 

Acked-By: Alexandre Pereira da Silva 

> ---
> Applies to v3.6-rc2
>
> Patch set changes since v4:
> * Rename DT property: "pl022,num-chipselects" -> "num-cs"
> * Removed reference to Linux code in DT binding documentation
> * Removed property "pl022,hierarchy" - only support SPI master for now
> * Documented DT property pl022,interface
> * Removed property "pl022,slave-tx-disable" - not relevant in master mode
> * Added kerneldoc for cur_cs and chipselect list
> * Reorganized struct pl022 (int *chipselect)
> * Introduced int *chipselects to struct pl022_ssp_controller
> * Let platform data override DT data
> * Split patches into CS handling vs. DT support
>
> Changes since v3:
> * Proper use of IS_ENABLED
>
> Changes since v2:
> * Use IS_ENABLED instead of #ifdef
> * Remove bogus const change
>
> Changes since v1:
> * return EPROBE_DEFFER if gpios are not initialized yet
>
> Thanks Thierry Reding, Rob Herring and Linus Walleij for reviewing!
>
>  drivers/spi/spi-pl022.c|   47 
> +++--
>  include/linux/amba/pl022.h |2 +
>  2 files changed, 35 insertions(+), 14 deletions(-)
>
> --- linux-2.6.orig/drivers/spi/spi-pl022.c
> +++ linux-2.6/drivers/spi/spi-pl022.c
> @@ -40,6 +40,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  /*
>   * This macro is used to define some register default values.
> @@ -356,6 +357,8 @@ struct vendor_data {
>   * @sgt_rx: scattertable for the RX transfer
>   * @sgt_tx: scattertable for the TX transfer
>   * @dummypage: a dummy page used for driving data on the bus with DMA
> + * @cur_cs: current chip select (gpio)
> + * @chipselect: list of chipselects (gpios)
>   */
>  struct pl022 {
> struct amba_device  *adev;
> @@ -389,6 +392,8 @@ struct pl022 {
> char*dummypage;
> booldma_running;
>  #endif
> +   int cur_cs;
> +   int *chipselect;
>  };
>
>  /**
> @@ -433,6 +438,14 @@ static void null_cs_control(u32 command)
> pr_debug("pl022: dummy chip select control, CS=0x%x\n", command);
>  }
>
> +static void pl022_cs_control(struct pl022 *pl022, u32 command)
> +{
> +   if (gpio_is_valid(pl022->cur_cs))
> +   gpio_set_value(pl022->cur_cs, command);
> +   else
> +   pl022->cur_chip->cs_control(command);
> +}
> +
>  /**
>   * giveback - current spi_message is over, schedule next message and call
>   * callback of this message. Assumes that caller already
> @@ -479,7 +492,7 @@ static void giveback(struct pl022 *pl022
> if (next_msg && next_msg->spi != pl022->cur_msg->spi)
> next_msg = NULL;
> if (!next_msg || pl022->cur_msg->state == STATE_ERROR)
> -   pl022->cur_chip->cs_control(SSP_CHIP_DESELECT);
> +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
> else
> pl022->next_msg_cs_active = true;
>
> @@ -818,8 +831,7 @@ static void dma_callback(void *data)
> /* Update total bytes transferred */
> msg->actual_length += pl022->cur_transfer->len;
> if (pl022->cur_transfer->cs_change)
> -   pl022->cur_chip->
> -   cs_control(SSP_CHIP_DESELECT);
> +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
>
> /* Move to next transfer */
> msg->state = next_transfer(pl022);
> @@ -1252,8 +1264,7 @@ static irqreturn_t pl022_interrupt_handl
> /* Update total bytes transferred */
> msg->actual_length += pl022->cur_transfer->len;
> if (pl022->cur_transfer->cs_change)
> -   pl022->cur_chip->
> -   cs_control(SSP_CHIP_DESELECT);
> +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
> /* Move to next transfer */
> msg->state = next_transfer(pl022);
> tasklet_schedule(>pump_transfers);
> @@ -1338,7 +1349,7 @@ static void pump_transfers(unsigned long
>
> /* Reselect chip

Re: [PATCH v5 1/2] spi/pl022: Add chip select handling via GPIO

2012-08-21 Thread Alexandre Pereira da Silva
On Tue, Aug 21, 2012 at 1:00 PM, Roland Stigge sti...@antcom.de wrote:
 This patch adds the ability for the driver to control the chip select 
 directly.
 This enables independence from cs_control callbacks.  Configurable via
 platform_data, to be extended as DT in the following patch.

 Based on the initial patch by Alexandre Pereira da Silva 
 aletes@gmail.com

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-By: Alexandre Pereira da Silva aletes@gmail.com

 ---
 Applies to v3.6-rc2

 Patch set changes since v4:
 * Rename DT property: pl022,num-chipselects - num-cs
 * Removed reference to Linux code in DT binding documentation
 * Removed property pl022,hierarchy - only support SPI master for now
 * Documented DT property pl022,interface
 * Removed property pl022,slave-tx-disable - not relevant in master mode
 * Added kerneldoc for cur_cs and chipselect list
 * Reorganized struct pl022 (int *chipselect)
 * Introduced int *chipselects to struct pl022_ssp_controller
 * Let platform data override DT data
 * Split patches into CS handling vs. DT support

 Changes since v3:
 * Proper use of IS_ENABLED

 Changes since v2:
 * Use IS_ENABLED instead of #ifdef
 * Remove bogus const change

 Changes since v1:
 * return EPROBE_DEFFER if gpios are not initialized yet

 Thanks Thierry Reding, Rob Herring and Linus Walleij for reviewing!

  drivers/spi/spi-pl022.c|   47 
 +++--
  include/linux/amba/pl022.h |2 +
  2 files changed, 35 insertions(+), 14 deletions(-)

 --- linux-2.6.orig/drivers/spi/spi-pl022.c
 +++ linux-2.6/drivers/spi/spi-pl022.c
 @@ -40,6 +40,7 @@
  #include linux/dma-mapping.h
  #include linux/scatterlist.h
  #include linux/pm_runtime.h
 +#include linux/gpio.h

  /*
   * This macro is used to define some register default values.
 @@ -356,6 +357,8 @@ struct vendor_data {
   * @sgt_rx: scattertable for the RX transfer
   * @sgt_tx: scattertable for the TX transfer
   * @dummypage: a dummy page used for driving data on the bus with DMA
 + * @cur_cs: current chip select (gpio)
 + * @chipselect: list of chipselects (gpios)
   */
  struct pl022 {
 struct amba_device  *adev;
 @@ -389,6 +392,8 @@ struct pl022 {
 char*dummypage;
 booldma_running;
  #endif
 +   int cur_cs;
 +   int *chipselect;
  };

  /**
 @@ -433,6 +438,14 @@ static void null_cs_control(u32 command)
 pr_debug(pl022: dummy chip select control, CS=0x%x\n, command);
  }

 +static void pl022_cs_control(struct pl022 *pl022, u32 command)
 +{
 +   if (gpio_is_valid(pl022-cur_cs))
 +   gpio_set_value(pl022-cur_cs, command);
 +   else
 +   pl022-cur_chip-cs_control(command);
 +}
 +
  /**
   * giveback - current spi_message is over, schedule next message and call
   * callback of this message. Assumes that caller already
 @@ -479,7 +492,7 @@ static void giveback(struct pl022 *pl022
 if (next_msg  next_msg-spi != pl022-cur_msg-spi)
 next_msg = NULL;
 if (!next_msg || pl022-cur_msg-state == STATE_ERROR)
 -   pl022-cur_chip-cs_control(SSP_CHIP_DESELECT);
 +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
 else
 pl022-next_msg_cs_active = true;

 @@ -818,8 +831,7 @@ static void dma_callback(void *data)
 /* Update total bytes transferred */
 msg-actual_length += pl022-cur_transfer-len;
 if (pl022-cur_transfer-cs_change)
 -   pl022-cur_chip-
 -   cs_control(SSP_CHIP_DESELECT);
 +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);

 /* Move to next transfer */
 msg-state = next_transfer(pl022);
 @@ -1252,8 +1264,7 @@ static irqreturn_t pl022_interrupt_handl
 /* Update total bytes transferred */
 msg-actual_length += pl022-cur_transfer-len;
 if (pl022-cur_transfer-cs_change)
 -   pl022-cur_chip-
 -   cs_control(SSP_CHIP_DESELECT);
 +   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
 /* Move to next transfer */
 msg-state = next_transfer(pl022);
 tasklet_schedule(pl022-pump_transfers);
 @@ -1338,7 +1349,7 @@ static void pump_transfers(unsigned long

 /* Reselect chip select only if cs_change was requested */
 if (previous-cs_change)
 -   pl022-cur_chip-cs_control(SSP_CHIP_SELECT);
 +   pl022_cs_control(pl022, SSP_CHIP_SELECT);
 } else {
 /* STATE_START */
 message-state = STATE_RUNNING;
 @@ -1377,7 +1388,7 @@ static void do_interrupt_dma_transfer(st

 /* Enable target chip, if not already active */
 if (!pl022-next_msg_cs_active)
 -   pl022-cur_chip

Re: [PATCH v5 2/2] spi/pl022: Add devicetree support

2012-08-21 Thread Alexandre Pereira da Silva
On Tue, Aug 21, 2012 at 1:01 PM, Roland Stigge sti...@antcom.de wrote:
 This patch adds device tree support to the spi-pl022 driver.

 Based on the initial patch by Alexandre Pereira da Silva 
 aletes@gmail.com

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-By: Alexandre Pereira da Silva aletes@gmail.com

 ---

  Documentation/devicetree/bindings/spi/spi_pl022.txt |   15 +++
  drivers/spi/spi-pl022.c |   79 
 +---
  2 files changed, 85 insertions(+), 9 deletions(-)

 --- linux-2.6.orig/Documentation/devicetree/bindings/spi/spi_pl022.txt
 +++ linux-2.6/Documentation/devicetree/bindings/spi/spi_pl022.txt
 @@ -6,7 +6,22 @@ Required properties:
  - interrupts : Should contain SPI controller interrupt

  Optional properties:
 +- num-cs : total number of chipselects
  - cs-gpios : should specify GPIOs used for chipselects.
The gpios will be referred to as reg = index in the SPI child nodes.
If unspecified, a single SPI device without a chip select can be used.

 +SPI slave nodes must be children of the SPI master node and can
 +contain the following properties.
 +
 +- pl022,interface : interface type:
 +   0: SPI
 +   1: Texas Instruments Synchronous Serial Frame Format
 +   2: Microwire (Half Duplex)
 +- pl022,com-mode : polling, interrupt or dma
 +- pl022,rx-level-trig : Rx FIFO watermark level
 +- pl022,tx-level-trig : Tx FIFO watermark level
 +- pl022,ctrl-len : Microwire interface: Control length
 +- pl022,wait-state : Microwire interface: Wait state
 +- pl022,duplex : Microwire interface: Full/Half duplex
 +
 --- linux-2.6.orig/drivers/spi/spi-pl022.c
 +++ linux-2.6/drivers/spi/spi-pl022.c
 @@ -41,6 +41,7 @@
  #include linux/scatterlist.h
  #include linux/pm_runtime.h
  #include linux/gpio.h
 +#include linux/of_gpio.h

  /*
   * This macro is used to define some register default values.
 @@ -1778,12 +1779,14 @@ static const struct pl022_config_chip pl
  static int pl022_setup(struct spi_device *spi)
  {
 struct pl022_config_chip const *chip_info;
 +   struct pl022_config_chip chip_info_dt;
 struct chip_data *chip;
 struct ssp_clock_params clk_freq = { .cpsdvsr = 0, .scr = 0};
 int status = 0;
 struct pl022 *pl022 = spi_master_get_devdata(spi-master);
 unsigned int bits = spi-bits_per_word;
 u32 tmp;
 +   struct device_node *np = spi-dev.of_node;

 if (!spi-max_speed_hz)
 return -EINVAL;
 @@ -1806,10 +1809,32 @@ static int pl022_setup(struct spi_device
 chip_info = spi-controller_data;

 if (chip_info == NULL) {
 -   chip_info = pl022_default_chip_info;
 -   /* spi_board_info.controller_data not is supplied */
 -   dev_dbg(spi-dev,
 -   using default controller_data settings\n);
 +   if (np) {
 +   chip_info_dt = pl022_default_chip_info;
 +
 +   chip_info_dt.hierarchy = SSP_MASTER;
 +   of_property_read_u32(np, pl022,interface,
 +   chip_info_dt.iface);
 +   of_property_read_u32(np, pl022,com-mode,
 +   chip_info_dt.com_mode);
 +   of_property_read_u32(np, pl022,rx-level-trig,
 +   chip_info_dt.rx_lev_trig);
 +   of_property_read_u32(np, pl022,tx-level-trig,
 +   chip_info_dt.tx_lev_trig);
 +   of_property_read_u32(np, pl022,ctrl-len,
 +   chip_info_dt.ctrl_len);
 +   of_property_read_u32(np, pl022,wait-state,
 +   chip_info_dt.wait_state);
 +   of_property_read_u32(np, pl022,duplex,
 +   chip_info_dt.duplex);
 +
 +   chip_info = chip_info_dt;
 +   } else {
 +   chip_info = pl022_default_chip_info;
 +   /* spi_board_info.controller_data not is supplied */
 +   dev_dbg(spi-dev,
 +   using default controller_data settings\n);
 +   }
 } else
 dev_dbg(spi-dev,
 using user supplied controller_data settings\n);
 @@ -2006,7 +2031,8 @@ pl022_probe(struct amba_device *adev, co
 struct pl022_ssp_controller *platform_info = adev-dev.platform_data;
 struct spi_master *master;
 struct pl022 *pl022 = NULL; /*Data for this driver */
 -   int status = 0, i;
 +   struct device_node *np = adev-dev.of_node;
 +   int status = 0, i, num_cs;

 dev_info(adev-dev,
  ARM PL022 driver, device ID: 0x%08x\n, adev-periphid);
 @@ -2016,9 +2042,19 @@ pl022_probe(struct amba_device *adev, co
 goto err_no_pdata;
 }

 +   if (platform_info-num_chipselect

[PATCH RESEND v4] spi/pl022: add devicetree support

2012-08-20 Thread Alexandre Pereira da Silva
Add the chipselect array and cur_cs properties to pl022 main structure

Add a wrapper function to decide if the cs should be controlled by the
cs_control callback or the chipselect gpio

Populate chipselect property from cs-gpios

Populate master->dev.of_node, so the spi bus can find child spi
devices and register them

At pl022 setup, fill chip_data structure from dt nodes, if not provided
by platform.

Signed-off-by: Alexandre Pereira da Silva 
Acked-by: Roland Stigge 
---
Applies to v3.6-rc1

Changes since v3:
* Proper use of IS_ENABLED

Changes since v2:
* Use IS_ENABLED instead of #ifdef
* Remove bogus const change

Changes since v1:
* return EPROBE_DEFFER if gpios are not initialized yet

Thanks Thierry Reding for reviewing and improvements suggestions

 .../devicetree/bindings/spi/spi_pl022.txt  |   15 +++
 drivers/spi/spi-pl022.c|  114 
 2 files changed, 110 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt 
b/Documentation/devicetree/bindings/spi/spi_pl022.txt
index 306ec3f..b089ec7 100644
--- a/Documentation/devicetree/bindings/spi/spi_pl022.txt
+++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt
@@ -6,7 +6,22 @@ Required properties:
 - interrupts : Should contain SPI controller interrupt
 
 Optional properties:
+- pl022,num-chipselects : total number of chipselects
 - cs-gpios : should specify GPIOs used for chipselects.
   The gpios will be referred to as reg =  in the SPI child nodes.
   If unspecified, a single SPI device without a chip select can be used.
 
+SPI slave nodes must be children of the SPI master node and can
+contain the following properties.
+See include/linux/amba/pl022.h for more details
+
+- pl022,hierarchy : master or slave interface
+- pl022,interface : interface type
+- pl022,slave-tx-disable : disconnect tx line in slave mode
+- pl022,com-mode : polling, interrupt or dma
+- pl022,rx-level-trig : Rx FIFO watermark level
+- pl022,tx-level-trig : Tx FIFO watermark level
+- pl022,ctrl-len : Microwire interface: Control length
+- pl022,wait-state : Microwire interface: Wait state
+- pl022,duplex : Microwire interface: Full/Half duplex
+
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 400ae21..d8d7d21 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -40,6 +40,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /*
  * This macro is used to define some register default values.
@@ -389,6 +391,8 @@ struct pl022 {
char*dummypage;
booldma_running;
 #endif
+   int cur_cs;
+   int chipselect[0];
 };
 
 /**
@@ -433,6 +437,14 @@ static void null_cs_control(u32 command)
pr_debug("pl022: dummy chip select control, CS=0x%x\n", command);
 }
 
+static void pl022_cs_control(struct pl022 *pl022, u32 command)
+{
+   if (gpio_is_valid(pl022->cur_cs))
+   gpio_set_value(pl022->cur_cs, command);
+   else
+   pl022->cur_chip->cs_control(command);
+}
+
 /**
  * giveback - current spi_message is over, schedule next message and call
  * callback of this message. Assumes that caller already
@@ -479,7 +491,7 @@ static void giveback(struct pl022 *pl022)
if (next_msg && next_msg->spi != pl022->cur_msg->spi)
next_msg = NULL;
if (!next_msg || pl022->cur_msg->state == STATE_ERROR)
-   pl022->cur_chip->cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
else
pl022->next_msg_cs_active = true;
 
@@ -813,8 +825,7 @@ static void dma_callback(void *data)
/* Update total bytes transferred */
msg->actual_length += pl022->cur_transfer->len;
if (pl022->cur_transfer->cs_change)
-   pl022->cur_chip->
-   cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
 
/* Move to next transfer */
msg->state = next_transfer(pl022);
@@ -1247,8 +1258,7 @@ static irqreturn_t pl022_interrupt_handler(int irq, void 
*dev_id)
/* Update total bytes transferred */
msg->actual_length += pl022->cur_transfer->len;
if (pl022->cur_transfer->cs_change)
-   pl022->cur_chip->
-   cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
/* Move to next transfer */
msg->state = next_transfer(pl022);
tasklet_schedule(>pump_transfers);
@@ -1333,7 +1343,7 @@ static void pump_transfers(unsigned long data)
 
/* Reselect chip select only if cs_change was requested */

[PATCH RESEND v4] spi/pl022: add devicetree support

2012-08-20 Thread Alexandre Pereira da Silva
Add the chipselect array and cur_cs properties to pl022 main structure

Add a wrapper function to decide if the cs should be controlled by the
cs_control callback or the chipselect gpio

Populate chipselect property from cs-gpios

Populate master-dev.of_node, so the spi bus can find child spi
devices and register them

At pl022 setup, fill chip_data structure from dt nodes, if not provided
by platform.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
Acked-by: Roland Stigge sti...@antcom.de
---
Applies to v3.6-rc1

Changes since v3:
* Proper use of IS_ENABLED

Changes since v2:
* Use IS_ENABLED instead of #ifdef
* Remove bogus const change

Changes since v1:
* return EPROBE_DEFFER if gpios are not initialized yet

Thanks Thierry Reding for reviewing and improvements suggestions

 .../devicetree/bindings/spi/spi_pl022.txt  |   15 +++
 drivers/spi/spi-pl022.c|  114 
 2 files changed, 110 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt 
b/Documentation/devicetree/bindings/spi/spi_pl022.txt
index 306ec3f..b089ec7 100644
--- a/Documentation/devicetree/bindings/spi/spi_pl022.txt
+++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt
@@ -6,7 +6,22 @@ Required properties:
 - interrupts : Should contain SPI controller interrupt
 
 Optional properties:
+- pl022,num-chipselects : total number of chipselects
 - cs-gpios : should specify GPIOs used for chipselects.
   The gpios will be referred to as reg = index in the SPI child nodes.
   If unspecified, a single SPI device without a chip select can be used.
 
+SPI slave nodes must be children of the SPI master node and can
+contain the following properties.
+See include/linux/amba/pl022.h for more details
+
+- pl022,hierarchy : master or slave interface
+- pl022,interface : interface type
+- pl022,slave-tx-disable : disconnect tx line in slave mode
+- pl022,com-mode : polling, interrupt or dma
+- pl022,rx-level-trig : Rx FIFO watermark level
+- pl022,tx-level-trig : Tx FIFO watermark level
+- pl022,ctrl-len : Microwire interface: Control length
+- pl022,wait-state : Microwire interface: Wait state
+- pl022,duplex : Microwire interface: Full/Half duplex
+
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 400ae21..d8d7d21 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -40,6 +40,8 @@
 #include linux/dma-mapping.h
 #include linux/scatterlist.h
 #include linux/pm_runtime.h
+#include linux/gpio.h
+#include linux/of_gpio.h
 
 /*
  * This macro is used to define some register default values.
@@ -389,6 +391,8 @@ struct pl022 {
char*dummypage;
booldma_running;
 #endif
+   int cur_cs;
+   int chipselect[0];
 };
 
 /**
@@ -433,6 +437,14 @@ static void null_cs_control(u32 command)
pr_debug(pl022: dummy chip select control, CS=0x%x\n, command);
 }
 
+static void pl022_cs_control(struct pl022 *pl022, u32 command)
+{
+   if (gpio_is_valid(pl022-cur_cs))
+   gpio_set_value(pl022-cur_cs, command);
+   else
+   pl022-cur_chip-cs_control(command);
+}
+
 /**
  * giveback - current spi_message is over, schedule next message and call
  * callback of this message. Assumes that caller already
@@ -479,7 +491,7 @@ static void giveback(struct pl022 *pl022)
if (next_msg  next_msg-spi != pl022-cur_msg-spi)
next_msg = NULL;
if (!next_msg || pl022-cur_msg-state == STATE_ERROR)
-   pl022-cur_chip-cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
else
pl022-next_msg_cs_active = true;
 
@@ -813,8 +825,7 @@ static void dma_callback(void *data)
/* Update total bytes transferred */
msg-actual_length += pl022-cur_transfer-len;
if (pl022-cur_transfer-cs_change)
-   pl022-cur_chip-
-   cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
 
/* Move to next transfer */
msg-state = next_transfer(pl022);
@@ -1247,8 +1258,7 @@ static irqreturn_t pl022_interrupt_handler(int irq, void 
*dev_id)
/* Update total bytes transferred */
msg-actual_length += pl022-cur_transfer-len;
if (pl022-cur_transfer-cs_change)
-   pl022-cur_chip-
-   cs_control(SSP_CHIP_DESELECT);
+   pl022_cs_control(pl022, SSP_CHIP_DESELECT);
/* Move to next transfer */
msg-state = next_transfer(pl022);
tasklet_schedule(pl022-pump_transfers);
@@ -1333,7 +1343,7 @@ static void pump_transfers(unsigned long data)
 
/* Reselect chip select only if cs_change was requested */
if (previous-cs_change

Re: [PATCH v2] usb: gadget: composite: parse dt values

2012-08-09 Thread Alexandre Pereira da Silva
On Thu, Aug 9, 2012 at 8:49 AM, Felipe Balbi  wrote:
> Hi,
>
> On Thu, Aug 09, 2012 at 01:42:42PM +0200, Sebastian Andrzej Siewior wrote:
>> On Tue, Jul 24, 2012 at 10:15:20AM -0300, Alexandre Pereira da Silva wrote:
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/usb/gadget.txt
>> > @@ -0,0 +1,20 @@
>> > +Usb Gadget DeviceTree bindings
>> > +
>> > +These optional properties inside the usb device controller node are used 
>> > to
>> > +change some of the gadget drivers configuration:
>> > +- vendor-id: Usb vendor id
>> > +- product-id: Usb product id
>> > +- release: Version of this device
>> > +- vendor: Textual description of the vendor
>> > +- device: Textual description of this device
>> > +- serial: Textual representation of the device's serial number
>> > +
>> > +Binding Example:
>> > +   usbd@3102 {
>> > +   vendor-id = <0x0525>;
>> > +   product-id = <0xa4a6>;
>> > +   release = <1>;
>> > +   vendor = "Some Corp";
>> > +   device = "Test Device";
>> > +   serial = "12345";
>
> on top of everything Sebastian said, I think we should stick to the
> field names set forth on the USB specification meaning that instead of
> vendor-id we should use idVendor, instead of vendor we should use
> iManufacturer, and so on.

Thanks for the feedback.

I agree that this should look more like the usb specifications and
allow mapping between usb interfaces and gadget drivers.

I will rework this to provide a new patch that at least don't conflict
with this idea.
--
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] usb: gadget: composite: parse dt values

2012-08-09 Thread Alexandre Pereira da Silva
On Thu, Aug 9, 2012 at 8:49 AM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Thu, Aug 09, 2012 at 01:42:42PM +0200, Sebastian Andrzej Siewior wrote:
 On Tue, Jul 24, 2012 at 10:15:20AM -0300, Alexandre Pereira da Silva wrote:
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/usb/gadget.txt
  @@ -0,0 +1,20 @@
  +Usb Gadget DeviceTree bindings
  +
  +These optional properties inside the usb device controller node are used 
  to
  +change some of the gadget drivers configuration:
  +- vendor-id: Usb vendor id
  +- product-id: Usb product id
  +- release: Version of this device
  +- vendor: Textual description of the vendor
  +- device: Textual description of this device
  +- serial: Textual representation of the device's serial number
  +
  +Binding Example:
  +   usbd@3102 {
  +   vendor-id = 0x0525;
  +   product-id = 0xa4a6;
  +   release = 1;
  +   vendor = Some Corp;
  +   device = Test Device;
  +   serial = 12345;

 on top of everything Sebastian said, I think we should stick to the
 field names set forth on the USB specification meaning that instead of
 vendor-id we should use idVendor, instead of vendor we should use
 iManufacturer, and so on.

Thanks for the feedback.

I agree that this should look more like the usb specifications and
allow mapping between usb interfaces and gadget drivers.

I will rework this to provide a new patch that at least don't conflict
with this idea.
--
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: [GIT PULL] PWM subsystem for v3.6

2012-07-27 Thread Alexandre Pereira da Silva
On Fri, Jul 27, 2012 at 2:10 AM, Thierry Reding
 wrote:
> On Thu, Jul 26, 2012 at 02:11:58PM -0700, Linus Torvalds wrote:
>> On Thu, Jul 26, 2012 at 12:16 AM, Thierry Reding
>>  wrote:
>> >
>> > The new PWM subsystem aims at collecting all implementations of the
>> > legacy PWM API and to eventually replace it completely. The subsystem
>> > has been in development for over half a year now and many drivers have
>> > already been converted. It has been in linux-next for a couple of weeks
>> > and there have been no major issues so I think it is ready for inclusion
>> > in your tree.
>>
>> For new subsystems like this, I really want ack's from the people who
>> are expected to use it.
>
> At least the patch that adds me as the maintainer is Acked-by: Sascha
> Hauer, who did the original work, and Arnd Bergmann who was involved in
> the review process. Other people such as Shawn Guo and Mark Brown have
> also been reviewing these patches and new patches have been contributed
> by Eric Bénard, Axel Lin, Sachin Kamat, Alexandre Courbot, Alexandre
> Pereira da Silva and Philip Avinash.
>
> I'm adding all of them on Cc so they can ack this (I'm assuming acking
> this email will suffice).

I'm using this on LPC32XX.

Acked-By: Alexandre Pereira da Silva 
--
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: [GIT PULL] PWM subsystem for v3.6

2012-07-27 Thread Alexandre Pereira da Silva
On Fri, Jul 27, 2012 at 2:10 AM, Thierry Reding
thierry.red...@avionic-design.de wrote:
 On Thu, Jul 26, 2012 at 02:11:58PM -0700, Linus Torvalds wrote:
 On Thu, Jul 26, 2012 at 12:16 AM, Thierry Reding
 thierry.red...@avionic-design.de wrote:
 
  The new PWM subsystem aims at collecting all implementations of the
  legacy PWM API and to eventually replace it completely. The subsystem
  has been in development for over half a year now and many drivers have
  already been converted. It has been in linux-next for a couple of weeks
  and there have been no major issues so I think it is ready for inclusion
  in your tree.

 For new subsystems like this, I really want ack's from the people who
 are expected to use it.

 At least the patch that adds me as the maintainer is Acked-by: Sascha
 Hauer, who did the original work, and Arnd Bergmann who was involved in
 the review process. Other people such as Shawn Guo and Mark Brown have
 also been reviewing these patches and new patches have been contributed
 by Eric Bénard, Axel Lin, Sachin Kamat, Alexandre Courbot, Alexandre
 Pereira da Silva and Philip Avinash.

 I'm adding all of them on Cc so they can ack this (I'm assuming acking
 this email will suffice).

I'm using this on LPC32XX.

Acked-By: Alexandre Pereira da Silva aletes@gmail.com
--
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] usb: gadget: composite: parse dt values

2012-07-24 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to set VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva 
Acked-by: Michal Nazarewicz 
Acked-by: Rob Herring 
---
Applies to v3.5

Changes since V1:
* Minor patch description and code comments updates

 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = <0x0525>;
+   product-id = <0xa4a6>;
+   release = <1>;
+   vendor = "Some Corp";
+   device = "Test Device";
+   serial = "12345";
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor && of_property_read_u32(np, "vendor-id", ) == 0)
+   idVendor = reg;
+
+   if (!idProduct && of_property_read_u32(np, "product-id", ) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice && of_property_read_u32(np, "release", ) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, "vendor",
+   >iManufacturer) == 0)
+   cdev->manufacturer_override = override_id(cdev,
+   >desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, "device",
+   >iProduct) == 0)
+   cdev->product_override = override_id(cdev,
+   >desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, "serial",
+   >iSerialNumber) == 0)
+   cdev->serial_override = override_id(cdev,
+   >desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget->dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev->desc = *composite->dev;
 
+   /* grab values from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev->desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
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] usb: gadget: composite: parse dt values

2012-07-24 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to set VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
Acked-by: Michal Nazarewicz min...@mina86.com
Acked-by: Rob Herring rob.herr...@calxeda.com
---
Applies to v3.5

Changes since V1:
* Minor patch description and code comments updates

 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = 0x0525;
+   product-id = 0xa4a6;
+   release = 1;
+   vendor = Some Corp;
+   device = Test Device;
+   serial = 12345;
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include linux/module.h
 #include linux/device.h
 #include linux/utsname.h
+#include linux/of.h
 
 #include linux/usb/composite.h
 #include asm/unaligned.h
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor  of_property_read_u32(np, vendor-id, reg) == 0)
+   idVendor = reg;
+
+   if (!idProduct  of_property_read_u32(np, product-id, reg) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice  of_property_read_u32(np, release, reg) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, vendor,
+   composite-iManufacturer) == 0)
+   cdev-manufacturer_override = override_id(cdev,
+   cdev-desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, device,
+   composite-iProduct) == 0)
+   cdev-product_override = override_id(cdev,
+   cdev-desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, serial,
+   composite-iSerialNumber) == 0)
+   cdev-serial_override = override_id(cdev,
+   cdev-desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget-dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev-desc = *composite-dev;
 
+   /* grab values from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev-desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
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 RESEND V2] input: gpio_keys_polled: convert to dt

2012-07-19 Thread Alexandre Pereira da Silva
Hi, Dmitry

On Thu, Jul 19, 2012 at 4:27 AM, Dmitry Torokhov
 wrote:
> Hi Alexandre,
>
> On Mon, Jul 09, 2012 at 03:31:43PM -0300, Alexandre Pereira da Silva wrote:
>> @@ -38,7 +40,7 @@ struct gpio_keys_button_data {
>>  struct gpio_keys_polled_dev {
>>   struct input_polled_dev *poll_dev;
>>   struct device *dev;
>> - struct gpio_keys_platform_data *pdata;
>> + struct gpio_keys_platform_data pdata;
>>   struct gpio_keys_button_data data[0];
>>  };
>
> Instead of using a copy of pdata how about the patch below?

This solution looks fine to me.

> Thanks.
>
> --
> Dmitry
>
>
> Input: gpio_keys_polled - convert to dt
>
> From: Alexandre Pereira da Silva 
>
> Signed-off-by: Alexandre Pereira da Silva 
> Signed-off-by: Dmitry Torokhov 
> ---
>
>  .../devicetree/bindings/input/gpio-keys-polled.txt |   38 ++
>  drivers/input/keyboard/gpio_keys_polled.c  |  124 
> +++-
>  2 files changed, 157 insertions(+), 5 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/input/gpio-keys-polled.txt
>
>
> diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt 
> b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
> new file mode 100644
> index 000..313abef
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
> @@ -0,0 +1,38 @@
> +Device-Tree bindings for input/gpio_keys_polled.c keyboard driver
> +
> +Required properties:
> +   - compatible = "gpio-keys-polled";
> +   - poll-interval: Poll interval time in milliseconds
> +
> +Optional properties:
> +   - autorepeat: Boolean, Enable auto repeat feature of Linux input
> + subsystem.
> +
> +Each button (key) is represented as a sub-node of "gpio-keys-polled":
> +Subnode properties:
> +
> +   - gpios: OF device-tree gpio specification.
> +   - label: Descriptive name of the key.
> +   - linux,code: Keycode to emit.
> +
> +Optional subnode-properties:
> +   - linux,input-type: Specify event type this button/key generates.
> + If not specified defaults to <1> == EV_KEY.
> +   - debounce-interval: Debouncing interval time in milliseconds.
> + If not specified defaults to 5.
> +   - gpio-key,wakeup: Boolean, button can wake-up the system.
> +
> +Example nodes:
> +
> +   gpio_keys_polled {
> +   compatible = "gpio-keys-polled";
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   poll-interval = <100>;
> +   autorepeat;
> +   button@21 {
> +   label = "GPIO Key UP";
> +   linux,code = <103>;
> +   gpios = < 0 1>;
> +   };
> +   ...
> diff --git a/drivers/input/keyboard/gpio_keys_polled.c 
> b/drivers/input/keyboard/gpio_keys_polled.c
> index 2619297..5a8856e6 100644
> --- a/drivers/input/keyboard/gpio_keys_polled.c
> +++ b/drivers/input/keyboard/gpio_keys_polled.c
> @@ -25,6 +25,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  #define DRV_NAME   "gpio-keys-polled"
>
> @@ -100,6 +102,96 @@ static void gpio_keys_polled_close(struct 
> input_polled_dev *dev)
> pdata->disable(bdev->dev);
>  }
>
> +#ifdef CONFIG_OF
> +static struct gpio_keys_platform_data * __devinit
> +gpio_keys_polled_get_devtree_pdata(struct device *dev)
> +{
> +   struct device_node *node, *pp;
> +   struct gpio_keys_platform_data *pdata;
> +   struct gpio_keys_button *button;
> +   int error;
> +   int nbuttons;
> +   int i;
> +
> +   node = dev->of_node;
> +   if (!node) {
> +   error = -ENODEV;
> +   goto err_out;
> +   }
> +
> +   nbuttons = of_get_child_count(node);
> +   if (nbuttons == 0) {
> +   error = -ENODEV;
> +   goto err_out;
> +   }
> +
> +   pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
> +   GFP_KERNEL);
> +   if (!pdata) {
> +   error = -ENOMEM;
> +   goto err_out;
> +   }
> +
> +   pdata->rep = !!of_get_property(node, "autorepeat", NULL);
> +   of_property_read_u32(node, "poll-interval", >poll_interval);
> +
> +   i = 0;
> +   for_each_child_of_node(node, pp) {
> +   enum of_gpio_fl

Re: [PATCH RESEND V2] input: gpio_keys_polled: convert to dt

2012-07-19 Thread Alexandre Pereira da Silva
Hi, Dmitry

On Thu, Jul 19, 2012 at 4:27 AM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:
 Hi Alexandre,

 On Mon, Jul 09, 2012 at 03:31:43PM -0300, Alexandre Pereira da Silva wrote:
 @@ -38,7 +40,7 @@ struct gpio_keys_button_data {
  struct gpio_keys_polled_dev {
   struct input_polled_dev *poll_dev;
   struct device *dev;
 - struct gpio_keys_platform_data *pdata;
 + struct gpio_keys_platform_data pdata;
   struct gpio_keys_button_data data[0];
  };

 Instead of using a copy of pdata how about the patch below?

This solution looks fine to me.

 Thanks.

 --
 Dmitry


 Input: gpio_keys_polled - convert to dt

 From: Alexandre Pereira da Silva aletes@gmail.com

 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
 Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com
 ---

  .../devicetree/bindings/input/gpio-keys-polled.txt |   38 ++
  drivers/input/keyboard/gpio_keys_polled.c  |  124 
 +++-
  2 files changed, 157 insertions(+), 5 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/input/gpio-keys-polled.txt


 diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt 
 b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
 new file mode 100644
 index 000..313abef
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
 @@ -0,0 +1,38 @@
 +Device-Tree bindings for input/gpio_keys_polled.c keyboard driver
 +
 +Required properties:
 +   - compatible = gpio-keys-polled;
 +   - poll-interval: Poll interval time in milliseconds
 +
 +Optional properties:
 +   - autorepeat: Boolean, Enable auto repeat feature of Linux input
 + subsystem.
 +
 +Each button (key) is represented as a sub-node of gpio-keys-polled:
 +Subnode properties:
 +
 +   - gpios: OF device-tree gpio specification.
 +   - label: Descriptive name of the key.
 +   - linux,code: Keycode to emit.
 +
 +Optional subnode-properties:
 +   - linux,input-type: Specify event type this button/key generates.
 + If not specified defaults to 1 == EV_KEY.
 +   - debounce-interval: Debouncing interval time in milliseconds.
 + If not specified defaults to 5.
 +   - gpio-key,wakeup: Boolean, button can wake-up the system.
 +
 +Example nodes:
 +
 +   gpio_keys_polled {
 +   compatible = gpio-keys-polled;
 +   #address-cells = 1;
 +   #size-cells = 0;
 +   poll-interval = 100;
 +   autorepeat;
 +   button@21 {
 +   label = GPIO Key UP;
 +   linux,code = 103;
 +   gpios = gpio1 0 1;
 +   };
 +   ...
 diff --git a/drivers/input/keyboard/gpio_keys_polled.c 
 b/drivers/input/keyboard/gpio_keys_polled.c
 index 2619297..5a8856e6 100644
 --- a/drivers/input/keyboard/gpio_keys_polled.c
 +++ b/drivers/input/keyboard/gpio_keys_polled.c
 @@ -25,6 +25,8 @@
  #include linux/platform_device.h
  #include linux/gpio.h
  #include linux/gpio_keys.h
 +#include linux/of_platform.h
 +#include linux/of_gpio.h

  #define DRV_NAME   gpio-keys-polled

 @@ -100,6 +102,96 @@ static void gpio_keys_polled_close(struct 
 input_polled_dev *dev)
 pdata-disable(bdev-dev);
  }

 +#ifdef CONFIG_OF
 +static struct gpio_keys_platform_data * __devinit
 +gpio_keys_polled_get_devtree_pdata(struct device *dev)
 +{
 +   struct device_node *node, *pp;
 +   struct gpio_keys_platform_data *pdata;
 +   struct gpio_keys_button *button;
 +   int error;
 +   int nbuttons;
 +   int i;
 +
 +   node = dev-of_node;
 +   if (!node) {
 +   error = -ENODEV;
 +   goto err_out;
 +   }
 +
 +   nbuttons = of_get_child_count(node);
 +   if (nbuttons == 0) {
 +   error = -ENODEV;
 +   goto err_out;
 +   }
 +
 +   pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
 +   GFP_KERNEL);
 +   if (!pdata) {
 +   error = -ENOMEM;
 +   goto err_out;
 +   }
 +
 +   pdata-rep = !!of_get_property(node, autorepeat, NULL);
 +   of_property_read_u32(node, poll-interval, pdata-poll_interval);
 +
 +   i = 0;
 +   for_each_child_of_node(node, pp) {
 +   enum of_gpio_flags flags;
 +
 +   if (!of_find_property(pp, gpios, NULL)) {
 +   pdata-nbuttons--;
 +   dev_warn(dev, Found button without gpios\n);
 +   continue;
 +   }
 +
 +   button = pdata-buttons[i++];
 +
 +   button-gpio = of_get_gpio_flags(pp, 0, flags);
 +   button-active_low = flags  OF_GPIO_ACTIVE_LOW;
 +
 +   if (of_property_read_u32(pp, linux,code, button-code)) {
 +   dev_err(dev

Re: [PATCH RESEND] gpio: of_get_named_gpio_flags() return -EPROBE_DEFER if GPIO not yet available

2012-07-17 Thread Alexandre Pereira da Silva
On Tue, Jul 17, 2012 at 3:24 PM, Linus Walleij  wrote:
> On Thu, Jun 28, 2012 at 12:32 AM, Roland Stigge  wrote:
>
>> of_get_named_gpio_flags() and of_get_named_gpio() return -EPROBE_DEFER if the
>> respective GPIO is not (yet) available. This is useful if driver's probe()
>> functions try to get a GPIO whose controller isn't probed yet. Thus, the 
>> driver
>> can be probed again later on.
>>
>> The function still returns -EINVAL on other errors (parse error or node 
>> doesn't
>> exist). This way, the case of an optional/intentionally missing GPIO is 
>> handled
>> appropriately.
>>
>> Signed-off-by: Roland Stigge 
>
> Patch applied, if all gpio stuff shall defer properly in v3.6 we need this
> so let's do some testing in -next!
>
> Would be nice to get some ACK besides my own...

You can add mine. I've been using this patch for quite some time now.

Acked-by: Alexandre Pereira da Silva 

> 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 RESEND] gpio: of_get_named_gpio_flags() return -EPROBE_DEFER if GPIO not yet available

2012-07-17 Thread Alexandre Pereira da Silva
On Tue, Jul 17, 2012 at 3:24 PM, Linus Walleij linus.wall...@linaro.org wrote:
 On Thu, Jun 28, 2012 at 12:32 AM, Roland Stigge sti...@antcom.de wrote:

 of_get_named_gpio_flags() and of_get_named_gpio() return -EPROBE_DEFER if the
 respective GPIO is not (yet) available. This is useful if driver's probe()
 functions try to get a GPIO whose controller isn't probed yet. Thus, the 
 driver
 can be probed again later on.

 The function still returns -EINVAL on other errors (parse error or node 
 doesn't
 exist). This way, the case of an optional/intentionally missing GPIO is 
 handled
 appropriately.

 Signed-off-by: Roland Stigge sti...@antcom.de

 Patch applied, if all gpio stuff shall defer properly in v3.6 we need this
 so let's do some testing in -next!

 Would be nice to get some ACK besides my own...

You can add mine. I've been using this patch for quite some time now.

Acked-by: Alexandre Pereira da Silva aletes@gmail.com

 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] clk: fix compile for OF && !COMMON_CLK

2012-07-16 Thread Alexandre Pereira da Silva
On Mon, Jul 16, 2012 at 6:46 PM, Rob Herring  wrote:
> From: Rob Herring 
>
> With commit 766e6a4ec602d0c107 (clk: add DT clock binding support),
> compiling with OF && !COMMON_CLK is broken.

Thanks, Rob.

This fixed the issue for me, but Mike's comments applies.

> Reported-by: Alexandre Pereira da Silva 
> Reported-by: Prashant Gaikwad 
> Signed-off-by: Rob Herring 
> ---
>  drivers/clk/clkdev.c |2 +-
>  include/linux/clk.h  |7 ---
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 20649b3..8f87b0f 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -24,7 +24,7 @@
>  static LIST_HEAD(clocks);
>  static DEFINE_MUTEX(clocks_mutex);
>
> -#ifdef CONFIG_OF
> +#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
>  struct clk *of_clk_get(struct device_node *np, int index)
>  {
> struct of_phandle_args clkspec;
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 8b70342..35f7492 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -12,6 +12,7 @@
>  #ifndef __LINUX_CLK_H
>  #define __LINUX_CLK_H
>
> +#include 
>  #include 
>  #include 
>
> @@ -313,19 +314,19 @@ int clk_add_alias(const char *alias, const char 
> *alias_dev_name, char *id,
>  struct device_node;
>  struct of_phandle_args;
>
> -#ifdef CONFIG_OF
> +#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
>  struct clk *of_clk_get(struct device_node *np, int index);
>  struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
>  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
>  #else
>  static inline struct clk *of_clk_get(struct device_node *np, int index)
>  {
> -   return NULL;
> +   return ERR_PTR(-EINVAL);
>  }
>  static inline struct clk *of_clk_get_by_name(struct device_node *np,
>  const char *name)
>  {
> -   return NULL;
> +   return ERR_PTR(-EINVAL);
>  }
>  #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/


linux-next: Tree for July 16 - Build failure

2012-07-16 Thread Alexandre Pereira da Silva
Hi,

I am getting errors building lpc32xx defconfig on linux-next tree for
next-20120716 tag.

Here are the errors:
drivers/built-in.o: In function `of_clk_get':
drivers/clk/clkdev.c:42: undefined reference to `of_clk_get_from_provider'
make[1]: ** [vmlinux] Erro 1

Any suggestions?

Thanks.
--
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/


linux-next: Tree for July 16 - Build failure

2012-07-16 Thread Alexandre Pereira da Silva
Hi,

I am getting errors building lpc32xx defconfig on linux-next tree for
next-20120716 tag.

Here are the errors:
drivers/built-in.o: In function `of_clk_get':
drivers/clk/clkdev.c:42: undefined reference to `of_clk_get_from_provider'
make[1]: ** [vmlinux] Erro 1

Any suggestions?

Thanks.
--
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] clk: fix compile for OF !COMMON_CLK

2012-07-16 Thread Alexandre Pereira da Silva
On Mon, Jul 16, 2012 at 6:46 PM, Rob Herring robherri...@gmail.com wrote:
 From: Rob Herring rob.herr...@calxeda.com

 With commit 766e6a4ec602d0c107 (clk: add DT clock binding support),
 compiling with OF  !COMMON_CLK is broken.

Thanks, Rob.

This fixed the issue for me, but Mike's comments applies.

 Reported-by: Alexandre Pereira da Silva aletes@gmail.com
 Reported-by: Prashant Gaikwad pgaik...@nvidia.com
 Signed-off-by: Rob Herring rob.herr...@calxeda.com
 ---
  drivers/clk/clkdev.c |2 +-
  include/linux/clk.h  |7 ---
  2 files changed, 5 insertions(+), 4 deletions(-)

 diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
 index 20649b3..8f87b0f 100644
 --- a/drivers/clk/clkdev.c
 +++ b/drivers/clk/clkdev.c
 @@ -24,7 +24,7 @@
  static LIST_HEAD(clocks);
  static DEFINE_MUTEX(clocks_mutex);

 -#ifdef CONFIG_OF
 +#if defined(CONFIG_OF)  defined(CONFIG_COMMON_CLK)
  struct clk *of_clk_get(struct device_node *np, int index)
  {
 struct of_phandle_args clkspec;
 diff --git a/include/linux/clk.h b/include/linux/clk.h
 index 8b70342..35f7492 100644
 --- a/include/linux/clk.h
 +++ b/include/linux/clk.h
 @@ -12,6 +12,7 @@
  #ifndef __LINUX_CLK_H
  #define __LINUX_CLK_H

 +#include linux/err.h
  #include linux/kernel.h
  #include linux/notifier.h

 @@ -313,19 +314,19 @@ int clk_add_alias(const char *alias, const char 
 *alias_dev_name, char *id,
  struct device_node;
  struct of_phandle_args;

 -#ifdef CONFIG_OF
 +#if defined(CONFIG_OF)  defined(CONFIG_COMMON_CLK)
  struct clk *of_clk_get(struct device_node *np, int index);
  struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
  #else
  static inline struct clk *of_clk_get(struct device_node *np, int index)
  {
 -   return NULL;
 +   return ERR_PTR(-EINVAL);
  }
  static inline struct clk *of_clk_get_by_name(struct device_node *np,
  const char *name)
  {
 -   return NULL;
 +   return ERR_PTR(-EINVAL);
  }
  #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/


Re: [PATCH 1/2] mtd: lpc32xx_slc: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge  wrote:
> This patch adjusts the LPC32xx SLC NAND driver to the new pl08x DMA interface,
> fixing the compile error resulting from changed pl08x structures.
>
> Signed-off-by: Roland Stigge 

Acked-By: Alexandre Pereira da Silva 

> ---
>
> Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
> collide)
>
>  drivers/mtd/nand/lpc32xx_slc.c |   13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
> index 1719387..c8c1d06 100644
> --- a/drivers/mtd/nand/lpc32xx_slc.c
> +++ b/drivers/mtd/nand/lpc32xx_slc.c
> @@ -714,17 +714,6 @@ static int lpc32xx_nand_write_page_raw_syndrome(struct 
> mtd_info *mtd,
> return 0;
>  }
>
> -static bool lpc32xx_dma_filter(struct dma_chan *chan, void *param)
> -{
> -   struct pl08x_dma_chan *ch =
> -   container_of(chan, struct pl08x_dma_chan, chan);
> -
> -   /* In LPC32xx's PL080 DMA wiring, the SLC NAND DMA signal is #1 */
> -   if (ch->cd->min_signal == 1)
> -   return true;
> -   return false;
> -}
> -
>  static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
>  {
> struct mtd_info *mtd = >mtd;
> @@ -732,7 +721,7 @@ static int lpc32xx_nand_dma_setup(struct 
> lpc32xx_nand_host *host)
>
> dma_cap_zero(mask);
> dma_cap_set(DMA_SLAVE, mask);
> -   host->dma_chan = dma_request_channel(mask, lpc32xx_dma_filter, NULL);
> +   host->dma_chan = dma_request_channel(mask, pl08x_filter_id, 
> "nand-slc");
> if (!host->dma_chan) {
> dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
> return -EBUSY;
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: LPC32xx: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge  wrote:
> This patch adjusts the LPC32xx platform support to the new pl08x DMA 
> interface,
> fixing the compile error resulting from changed pl08x structures.
>
> Signed-off-by: Roland Stigge 

Acked-By: Alexandre Pereira da Silva 

> ---
>
> Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
> collide)
>
>  arch/arm/mach-lpc32xx/phy3250.c |7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
> index 8625237..b07dcc9 100644
> --- a/arch/arm/mach-lpc32xx/phy3250.c
> +++ b/arch/arm/mach-lpc32xx/phy3250.c
> @@ -186,13 +186,12 @@ static struct pl08x_channel_data pl08x_slave_channels[] 
> = {
> },
>  };
>
> -/* NOTE: These will change, according to RMK */
> -static int pl08x_get_signal(struct pl08x_dma_chan *ch)
> +static int pl08x_get_signal(const struct pl08x_channel_data *cd)
>  {
> -   return ch->cd->min_signal;
> +   return cd->min_signal;
>  }
>
> -static void pl08x_put_signal(struct pl08x_dma_chan *ch)
> +static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
>  {
>  }
>
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mtd: lpc32xx_mlc: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge  wrote:
> This patch adjusts the LPC32xx MLC NAND driver to the new pl08x DMA interface,
> fixing the compile error resulting from changed pl08x structures.
>
> Signed-off-by: Roland Stigge 

Acked-By: Alexandre Pereira da Silva 

> ---
>
> Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
> collide)
>
>  drivers/mtd/nand/lpc32xx_mlc.c |   13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
> index 260b2c2..1cf3593 100644
> --- a/drivers/mtd/nand/lpc32xx_mlc.c
> +++ b/drivers/mtd/nand/lpc32xx_mlc.c
> @@ -576,17 +576,6 @@ static void lpc32xx_ecc_enable(struct mtd_info *mtd, int 
> mode)
> /* Always enabled! */
>  }
>
> -static bool lpc32xx_dma_filter(struct dma_chan *chan, void *param)
> -{
> -   struct pl08x_dma_chan *ch =
> -   container_of(chan, struct pl08x_dma_chan, chan);
> -
> -   /* In LPC32xx's PL080 DMA wiring, the MLC NAND DMA signal is #12 */
> -   if (ch->cd->min_signal == 12)
> -   return true;
> -   return false;
> -}
> -
>  static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
>  {
> struct mtd_info *mtd = >mtd;
> @@ -594,7 +583,7 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host 
> *host)
>
> dma_cap_zero(mask);
> dma_cap_set(DMA_SLAVE, mask);
> -   host->dma_chan = dma_request_channel(mask, lpc32xx_dma_filter, NULL);
> +   host->dma_chan = dma_request_channel(mask, pl08x_filter_id, 
> "nand-mlc");
> if (!host->dma_chan) {
> dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
> return -EBUSY;
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mtd: lpc32xx_mlc: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge sti...@antcom.de wrote:
 This patch adjusts the LPC32xx MLC NAND driver to the new pl08x DMA interface,
 fixing the compile error resulting from changed pl08x structures.

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-By: Alexandre Pereira da Silva aletes@gmail.com

 ---

 Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
 collide)

  drivers/mtd/nand/lpc32xx_mlc.c |   13 +
  1 file changed, 1 insertion(+), 12 deletions(-)

 diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
 index 260b2c2..1cf3593 100644
 --- a/drivers/mtd/nand/lpc32xx_mlc.c
 +++ b/drivers/mtd/nand/lpc32xx_mlc.c
 @@ -576,17 +576,6 @@ static void lpc32xx_ecc_enable(struct mtd_info *mtd, int 
 mode)
 /* Always enabled! */
  }

 -static bool lpc32xx_dma_filter(struct dma_chan *chan, void *param)
 -{
 -   struct pl08x_dma_chan *ch =
 -   container_of(chan, struct pl08x_dma_chan, chan);
 -
 -   /* In LPC32xx's PL080 DMA wiring, the MLC NAND DMA signal is #12 */
 -   if (ch-cd-min_signal == 12)
 -   return true;
 -   return false;
 -}
 -
  static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
  {
 struct mtd_info *mtd = host-mtd;
 @@ -594,7 +583,7 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host 
 *host)

 dma_cap_zero(mask);
 dma_cap_set(DMA_SLAVE, mask);
 -   host-dma_chan = dma_request_channel(mask, lpc32xx_dma_filter, NULL);
 +   host-dma_chan = dma_request_channel(mask, pl08x_filter_id, 
 nand-mlc);
 if (!host-dma_chan) {
 dev_err(mtd-dev.parent, Failed to request DMA channel\n);
 return -EBUSY;
 --
 1.7.10.4

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


Re: [PATCH] ARM: LPC32xx: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge sti...@antcom.de wrote:
 This patch adjusts the LPC32xx platform support to the new pl08x DMA 
 interface,
 fixing the compile error resulting from changed pl08x structures.

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-By: Alexandre Pereira da Silva aletes@gmail.com

 ---

 Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
 collide)

  arch/arm/mach-lpc32xx/phy3250.c |7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

 diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
 index 8625237..b07dcc9 100644
 --- a/arch/arm/mach-lpc32xx/phy3250.c
 +++ b/arch/arm/mach-lpc32xx/phy3250.c
 @@ -186,13 +186,12 @@ static struct pl08x_channel_data pl08x_slave_channels[] 
 = {
 },
  };

 -/* NOTE: These will change, according to RMK */
 -static int pl08x_get_signal(struct pl08x_dma_chan *ch)
 +static int pl08x_get_signal(const struct pl08x_channel_data *cd)
  {
 -   return ch-cd-min_signal;
 +   return cd-min_signal;
  }

 -static void pl08x_put_signal(struct pl08x_dma_chan *ch)
 +static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
  {
  }

 --
 1.7.10.4

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


Re: [PATCH 1/2] mtd: lpc32xx_slc: Adjust to pl08x DMA interface changes

2012-07-13 Thread Alexandre Pereira da Silva
On Thu, Jul 12, 2012 at 9:22 AM, Roland Stigge sti...@antcom.de wrote:
 This patch adjusts the LPC32xx SLC NAND driver to the new pl08x DMA interface,
 fixing the compile error resulting from changed pl08x structures.

 Signed-off-by: Roland Stigge sti...@antcom.de

Acked-By: Alexandre Pereira da Silva aletes@gmail.com

 ---

 Applies to today's linux-next (integrated lpc32xx-next and dma branches which 
 collide)

  drivers/mtd/nand/lpc32xx_slc.c |   13 +
  1 file changed, 1 insertion(+), 12 deletions(-)

 diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
 index 1719387..c8c1d06 100644
 --- a/drivers/mtd/nand/lpc32xx_slc.c
 +++ b/drivers/mtd/nand/lpc32xx_slc.c
 @@ -714,17 +714,6 @@ static int lpc32xx_nand_write_page_raw_syndrome(struct 
 mtd_info *mtd,
 return 0;
  }

 -static bool lpc32xx_dma_filter(struct dma_chan *chan, void *param)
 -{
 -   struct pl08x_dma_chan *ch =
 -   container_of(chan, struct pl08x_dma_chan, chan);
 -
 -   /* In LPC32xx's PL080 DMA wiring, the SLC NAND DMA signal is #1 */
 -   if (ch-cd-min_signal == 1)
 -   return true;
 -   return false;
 -}
 -
  static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
  {
 struct mtd_info *mtd = host-mtd;
 @@ -732,7 +721,7 @@ static int lpc32xx_nand_dma_setup(struct 
 lpc32xx_nand_host *host)

 dma_cap_zero(mask);
 dma_cap_set(DMA_SLAVE, mask);
 -   host-dma_chan = dma_request_channel(mask, lpc32xx_dma_filter, NULL);
 +   host-dma_chan = dma_request_channel(mask, pl08x_filter_id, 
 nand-slc);
 if (!host-dma_chan) {
 dev_err(mtd-dev.parent, Failed to request DMA channel\n);
 return -EBUSY;
 --
 1.7.10.4

--
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] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 9:43 AM, Roland Stigge  wrote:
> Hi!
>
> On 07/10/2012 01:53 PM, Alexandre Pereira da Silva wrote:
>> Add lpc32xx soc pwm driver.
>>
>> Signed-off-by: Alexandre Pereira da Silva 
>> ---
>> +++ b/drivers/pwm/pwm-lpc32xx.c
>> @@ -0,0 +1,150 @@
>> +/*
>> + * Copyright 2012 Alexandre Pereira da Silva 
>> + *
>> + * The code contained herein is licensed under the GNU General Public
>> + * License. You may obtain a copy of the GNU General Public License
>> + * Version 2 or later at the following locations:
>> + *
>> + * http://www.opensource.org/licenses/gpl-license.html
>> + * http://www.gnu.org/copyleft/gpl.html
>
> Some nitpicking about legal wording and contents:
>
> It doesn't state explicitly that we are licensing via GPLv2.
>
> Further, maybe we can drop the links (which can become obsolete in the
> future)? We are shipping the GPL anyway, and other drivers also don't
> need links.
>
> E.g.:
>
>  * 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.

Thanks, Roland. I will apply that.
--
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] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 9:19 AM, Thierry Reding
 wrote:
> On Tue, Jul 10, 2012 at 08:53:32AM -0300, Alexandre Pereira da Silva wrote:
>> Add lpc32xx soc pwm driver.
>
> The subject and this still need fixing (soc -> SOC, pwm -> PWM).
>
>> Signed-off-by: Alexandre Pereira da Silva 
>> ---
>> Changes since v1:
>> * Style fixes
>> * Better error handling
>> * Improved Kconfig and DT descriptions
>>
>>  .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   17 +++
>>  drivers/pwm/Kconfig|   11 ++
>>  drivers/pwm/Makefile   |1 +
>>  drivers/pwm/pwm-lpc32xx.c  |  150 
>> 
>>  4 files changed, 179 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>>  create mode 100644 drivers/pwm/pwm-lpc32xx.c
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
>> b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>> new file mode 100644
>> index 000..e7720e3
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>> @@ -0,0 +1,17 @@
>> +LPC32XX PWM controller
>> +
>> +Required properties:
>> +- compatible: should be "nxp,lpc3220-pwm"
>> +- reg: physical base address and length of the controller's registers
>> +
>> +Examples:
>> +
>> +pwm1: pwm@0x4005C000 {
>> + compatible = "nxp,lpc3220-pwm";
>> + reg = <0x4005C000 0x4>;
>> +};
>> +
>> +pwm2: pwm@0x4005C004 {
>> + compatible = "nxp,lpc3220-pwm";
>> + reg = <0x4005C004 0x4>;
>> +};
>
> The PWM framework can support chips with multiple PWM devices. The
> LPC32xx seems to fit this model quite nicely, so you should instead
> instantiate one device and set npwm to 2.
>
>> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
>> index 0b2800f..ec2ac70 100644
>> --- a/drivers/pwm/Kconfig
>> +++ b/drivers/pwm/Kconfig
>> @@ -28,6 +28,17 @@ config PWM_IMX
>> To compile this driver as a module, choose M here: the module
>> will be called pwm-imx.
>>
>> +config PWM_LPC32XX
>> + tristate "LPC32XX PWM support"
>> + depends on ARCH_LPC32XX
>> + help
>> +   Generic PWM framework driver for LPC32XX. The LPC32XX SOC has two
>> +   PWM controllers.
>> +
>> +   To compile this driver as a module, choose M here: the module
>> +   will be called pwm-lpc32xx.
>> +
>> +
>
> There's a gratuitous blank line here, please remove.
>
>>  config PWM_MXS
>>   tristate "Freescale MXS PWM support"
>>   depends on ARCH_MXS && OF
>> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
>> index cec2500..5459702 100644
>> --- a/drivers/pwm/Makefile
>> +++ b/drivers/pwm/Makefile
>> @@ -1,6 +1,7 @@
>>  obj-$(CONFIG_PWM)+= core.o
>>  obj-$(CONFIG_PWM_BFIN)   += pwm-bfin.o
>>  obj-$(CONFIG_PWM_IMX)+= pwm-imx.o
>> +obj-$(CONFIG_PWM_LPC32XX)+= pwm-lpc32xx.o
>>  obj-$(CONFIG_PWM_MXS)+= pwm-mxs.o
>>  obj-$(CONFIG_PWM_PXA)+= pwm-pxa.o
>>  obj-$(CONFIG_PWM_SAMSUNG)+= pwm-samsung.o
>> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
>> new file mode 100644
>> index 000..d79f4f9
>> --- /dev/null
>> +++ b/drivers/pwm/pwm-lpc32xx.c
>> @@ -0,0 +1,150 @@
>> +/*
>> + * Copyright 2012 Alexandre Pereira da Silva 
>> + *
>> + * The code contained herein is licensed under the GNU General Public
>> + * License. You may obtain a copy of the GNU General Public License
>> + * Version 2 or later at the following locations:
>> + *
>> + * http://www.opensource.org/licenses/gpl-license.html
>> + * http://www.gnu.org/copyleft/gpl.html
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +struct lpc32xx_pwm_chip {
>> + struct pwm_chip chip;
>> + struct clk *clk;
>> + void __iomem *base;
>> +};
>> +
>> +#define PWM_ENABLE   (1 << 31)
>> +#define PWM_RELOADV(x)   (((x) & 0xFF) << 8)
>> +#define PWM_DUTY(x)  ((x) & 0xFF)
>> +
>> +#define to_lpc32xx_pwm_chip(_chip) \
>> + container_of(_chip, struct lpc32xx_pwm_chip, chip)
>> +
&g

Re: [PATCH] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 3:48 AM, Thierry Reding
 wrote:
> On Mon, Jul 09, 2012 at 04:27:54PM -0300, Alexandre Pereira da Silva wrote:
>> Add lpc32xx soc pwm driver.
>>
>> Signed-off-by: Alexandre Pereira da Silva 
>> ---
>>  .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   12 ++
>>  drivers/pwm/Kconfig|   11 ++
>>  drivers/pwm/Makefile   |1 +
>>  drivers/pwm/pwm-lpc32xx.c  |  151 
>> 
>>  4 files changed, 175 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>>  create mode 100644 drivers/pwm/pwm-lpc32xx.c
>
> Hi Alexandre,
>
> overall this looks good, just some comments inline. I'd very much
> appreciate an Acked-by from Roland on this.
>
>> diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
>> b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>> new file mode 100644
>> index 000..fb7b3d5
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
>> @@ -0,0 +1,12 @@
>> +LPC32XX PWM controller
>> +
>> +Required properties:
>> +- compatible: should be "nxp,lpc3220-pwm"
>
> Does the compatible have to be lpc3220-pwm? Can't it be lpc32xx-pwm to
> match the driver and binding names?
>
>> +- reg: physical base address and length of the controller's registers
>> +
>> +Example:
>> +
>> +pwm: pwm@80064000 {
>> + compatible = "nxp,lpc3220-pwm";
>> + reg = <0x80064000 2000>;
>
> You probably want to specify the size as 0x2000 as well.

I will copy here the dts for the two pwm controllers this chip has.
This should have been 4 instead.

>> +};
>> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
>> index 0b2800f..34086b1 100644
>> --- a/drivers/pwm/Kconfig
>> +++ b/drivers/pwm/Kconfig
>> @@ -28,6 +28,17 @@ config PWM_IMX
>> To compile this driver as a module, choose M here: the module
>> will be called pwm-imx.
>>
>> +config PWM_LPC32XX
>> + tristate "LPC32XX PWM support"
>> + depends on ARCH_LPC32XX
>> + help
>> +   Generic PWM framework driver for LPC32XX. The LPC32XX soc has two
>> +   pwm channels.
>
> Can we keep the spelling consistent here? It should be "PWM" and "SoC".
> It'd be nice if you could fix that up in the commit message as well.
>
>> +
>> +   To compile this driver as a module, choose M here: the module
>> +   will be called pwm-lpc32xx.
>> +
>> +
>>  config PWM_MXS
>>   tristate "Freescale MXS PWM support"
>>   depends on ARCH_MXS && OF
>> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
>> index cec2500..5459702 100644
>> --- a/drivers/pwm/Makefile
>> +++ b/drivers/pwm/Makefile
>> @@ -1,6 +1,7 @@
>>  obj-$(CONFIG_PWM)+= core.o
>>  obj-$(CONFIG_PWM_BFIN)   += pwm-bfin.o
>>  obj-$(CONFIG_PWM_IMX)+= pwm-imx.o
>> +obj-$(CONFIG_PWM_LPC32XX)+= pwm-lpc32xx.o
>>  obj-$(CONFIG_PWM_MXS)+= pwm-mxs.o
>>  obj-$(CONFIG_PWM_PXA)+= pwm-pxa.o
>>  obj-$(CONFIG_PWM_SAMSUNG)+= pwm-samsung.o
>> diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
>> new file mode 100644
>> index 000..c7fa126
>> --- /dev/null
>> +++ b/drivers/pwm/pwm-lpc32xx.c
>> @@ -0,0 +1,151 @@
>> +/*
>> + * Copyright 2012 Alexandre Pereira da Silva 
>> + *
>> + * The code contained herein is licensed under the GNU General Public
>> + * License. You may obtain a copy of the GNU General Public License
>> + * Version 2 or later at the following locations:
>> + *
>> + * http://www.opensource.org/licenses/gpl-license.html
>> + * http://www.gnu.org/copyleft/gpl.html
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +struct lpc32xx_pwm_chip {
>> + struct pwm_chip chip;
>> + struct device *dev;
>
> Can you drop this field? You initialize it, but it is never used
> subsequently in the driver.
>
>> + struct clk *clk;
>> + void __iomem *base;
>> +};
>> +
>> +#define PWM_ENABLE (1<<31)
>> +#define PWM_RELOADV(x)   (((x) & 0xFF)<<8)
>> +#define PWM_DUTY(x)  ((x) & 0xFF)
>
> There should be spaces 

Re: [PATCH] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 3:48 AM, Thierry Reding
thierry.red...@avionic-design.de wrote:
 On Mon, Jul 09, 2012 at 04:27:54PM -0300, Alexandre Pereira da Silva wrote:
 Add lpc32xx soc pwm driver.

 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
 ---
  .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   12 ++
  drivers/pwm/Kconfig|   11 ++
  drivers/pwm/Makefile   |1 +
  drivers/pwm/pwm-lpc32xx.c  |  151 
 
  4 files changed, 175 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
  create mode 100644 drivers/pwm/pwm-lpc32xx.c

 Hi Alexandre,

 overall this looks good, just some comments inline. I'd very much
 appreciate an Acked-by from Roland on this.

 diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
 b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 new file mode 100644
 index 000..fb7b3d5
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 @@ -0,0 +1,12 @@
 +LPC32XX PWM controller
 +
 +Required properties:
 +- compatible: should be nxp,lpc3220-pwm

 Does the compatible have to be lpc3220-pwm? Can't it be lpc32xx-pwm to
 match the driver and binding names?

 +- reg: physical base address and length of the controller's registers
 +
 +Example:
 +
 +pwm: pwm@80064000 {
 + compatible = nxp,lpc3220-pwm;
 + reg = 0x80064000 2000;

 You probably want to specify the size as 0x2000 as well.

I will copy here the dts for the two pwm controllers this chip has.
This should have been 4 instead.

 +};
 diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
 index 0b2800f..34086b1 100644
 --- a/drivers/pwm/Kconfig
 +++ b/drivers/pwm/Kconfig
 @@ -28,6 +28,17 @@ config PWM_IMX
 To compile this driver as a module, choose M here: the module
 will be called pwm-imx.

 +config PWM_LPC32XX
 + tristate LPC32XX PWM support
 + depends on ARCH_LPC32XX
 + help
 +   Generic PWM framework driver for LPC32XX. The LPC32XX soc has two
 +   pwm channels.

 Can we keep the spelling consistent here? It should be PWM and SoC.
 It'd be nice if you could fix that up in the commit message as well.

 +
 +   To compile this driver as a module, choose M here: the module
 +   will be called pwm-lpc32xx.
 +
 +
  config PWM_MXS
   tristate Freescale MXS PWM support
   depends on ARCH_MXS  OF
 diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
 index cec2500..5459702 100644
 --- a/drivers/pwm/Makefile
 +++ b/drivers/pwm/Makefile
 @@ -1,6 +1,7 @@
  obj-$(CONFIG_PWM)+= core.o
  obj-$(CONFIG_PWM_BFIN)   += pwm-bfin.o
  obj-$(CONFIG_PWM_IMX)+= pwm-imx.o
 +obj-$(CONFIG_PWM_LPC32XX)+= pwm-lpc32xx.o
  obj-$(CONFIG_PWM_MXS)+= pwm-mxs.o
  obj-$(CONFIG_PWM_PXA)+= pwm-pxa.o
  obj-$(CONFIG_PWM_SAMSUNG)+= pwm-samsung.o
 diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
 new file mode 100644
 index 000..c7fa126
 --- /dev/null
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -0,0 +1,151 @@
 +/*
 + * Copyright 2012 Alexandre Pereira da Silva aletes@gmail.com
 + *
 + * The code contained herein is licensed under the GNU General Public
 + * License. You may obtain a copy of the GNU General Public License
 + * Version 2 or later at the following locations:
 + *
 + * http://www.opensource.org/licenses/gpl-license.html
 + * http://www.gnu.org/copyleft/gpl.html
 + */
 +
 +#include linux/clk.h
 +#include linux/err.h
 +#include linux/io.h
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_address.h
 +#include linux/platform_device.h
 +#include linux/pwm.h
 +#include linux/slab.h
 +
 +struct lpc32xx_pwm_chip {
 + struct pwm_chip chip;
 + struct device *dev;

 Can you drop this field? You initialize it, but it is never used
 subsequently in the driver.

 + struct clk *clk;
 + void __iomem *base;
 +};
 +
 +#define PWM_ENABLE (131)
 +#define PWM_RELOADV(x)   (((x)  0xFF)8)
 +#define PWM_DUTY(x)  ((x)  0xFF)

 There should be spaces around .

 +
 +#define to_lpc32xx_pwm_chip(_chip) \
 + container_of(_chip, struct lpc32xx_pwm_chip, chip)
 +
 +static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 +   int duty_ns, int period_ns)

 The alignment looks wrong here. It seems like you aligned properly
 before adding the static.

 +{
 + struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
 + unsigned long long c;
 + int period_cycles, duty_cycles;
 +
 + c = clk_get_rate(lpc32xx-clk)/256;

 Spaces around /.

 + c = c * period_ns;
 + do_div(c, NSEC_PER_SEC);
 +
 + /* Handle high and low extremes */
 + if (c == 0)
 + c = 1;
 + if (c  255)
 + c = 0; /* 0 set division by 256 */
 + period_cycles = c;
 +
 + c = 256*duty_ns;

 Spaces

Re: [PATCH v2] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 9:19 AM, Thierry Reding
thierry.red...@avionic-design.de wrote:
 On Tue, Jul 10, 2012 at 08:53:32AM -0300, Alexandre Pereira da Silva wrote:
 Add lpc32xx soc pwm driver.

 The subject and this still need fixing (soc - SOC, pwm - PWM).

 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
 ---
 Changes since v1:
 * Style fixes
 * Better error handling
 * Improved Kconfig and DT descriptions

  .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   17 +++
  drivers/pwm/Kconfig|   11 ++
  drivers/pwm/Makefile   |1 +
  drivers/pwm/pwm-lpc32xx.c  |  150 
 
  4 files changed, 179 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
  create mode 100644 drivers/pwm/pwm-lpc32xx.c

 diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
 b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 new file mode 100644
 index 000..e7720e3
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 @@ -0,0 +1,17 @@
 +LPC32XX PWM controller
 +
 +Required properties:
 +- compatible: should be nxp,lpc3220-pwm
 +- reg: physical base address and length of the controller's registers
 +
 +Examples:
 +
 +pwm1: pwm@0x4005C000 {
 + compatible = nxp,lpc3220-pwm;
 + reg = 0x4005C000 0x4;
 +};
 +
 +pwm2: pwm@0x4005C004 {
 + compatible = nxp,lpc3220-pwm;
 + reg = 0x4005C004 0x4;
 +};

 The PWM framework can support chips with multiple PWM devices. The
 LPC32xx seems to fit this model quite nicely, so you should instead
 instantiate one device and set npwm to 2.

 diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
 index 0b2800f..ec2ac70 100644
 --- a/drivers/pwm/Kconfig
 +++ b/drivers/pwm/Kconfig
 @@ -28,6 +28,17 @@ config PWM_IMX
 To compile this driver as a module, choose M here: the module
 will be called pwm-imx.

 +config PWM_LPC32XX
 + tristate LPC32XX PWM support
 + depends on ARCH_LPC32XX
 + help
 +   Generic PWM framework driver for LPC32XX. The LPC32XX SOC has two
 +   PWM controllers.
 +
 +   To compile this driver as a module, choose M here: the module
 +   will be called pwm-lpc32xx.
 +
 +

 There's a gratuitous blank line here, please remove.

  config PWM_MXS
   tristate Freescale MXS PWM support
   depends on ARCH_MXS  OF
 diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
 index cec2500..5459702 100644
 --- a/drivers/pwm/Makefile
 +++ b/drivers/pwm/Makefile
 @@ -1,6 +1,7 @@
  obj-$(CONFIG_PWM)+= core.o
  obj-$(CONFIG_PWM_BFIN)   += pwm-bfin.o
  obj-$(CONFIG_PWM_IMX)+= pwm-imx.o
 +obj-$(CONFIG_PWM_LPC32XX)+= pwm-lpc32xx.o
  obj-$(CONFIG_PWM_MXS)+= pwm-mxs.o
  obj-$(CONFIG_PWM_PXA)+= pwm-pxa.o
  obj-$(CONFIG_PWM_SAMSUNG)+= pwm-samsung.o
 diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
 new file mode 100644
 index 000..d79f4f9
 --- /dev/null
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -0,0 +1,150 @@
 +/*
 + * Copyright 2012 Alexandre Pereira da Silva aletes@gmail.com
 + *
 + * The code contained herein is licensed under the GNU General Public
 + * License. You may obtain a copy of the GNU General Public License
 + * Version 2 or later at the following locations:
 + *
 + * http://www.opensource.org/licenses/gpl-license.html
 + * http://www.gnu.org/copyleft/gpl.html
 + */
 +
 +#include linux/clk.h
 +#include linux/err.h
 +#include linux/io.h
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_address.h
 +#include linux/platform_device.h
 +#include linux/pwm.h
 +#include linux/slab.h
 +
 +struct lpc32xx_pwm_chip {
 + struct pwm_chip chip;
 + struct clk *clk;
 + void __iomem *base;
 +};
 +
 +#define PWM_ENABLE   (1  31)
 +#define PWM_RELOADV(x)   (((x)  0xFF)  8)
 +#define PWM_DUTY(x)  ((x)  0xFF)
 +
 +#define to_lpc32xx_pwm_chip(_chip) \
 + container_of(_chip, struct lpc32xx_pwm_chip, chip)
 +
 +static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 +   int duty_ns, int period_ns)
 +{
 + struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
 + unsigned long long c;
 + int period_cycles, duty_cycles;
 +
 + c = clk_get_rate(lpc32xx-clk) / 256;
 + c = c * period_ns;
 + do_div(c, NSEC_PER_SEC);
 +
 + /* Handle high and low extremes */
 + if (c == 0)
 + c = 1;
 + if (c  255)
 + c = 0; /* 0 set division by 256 */
 + period_cycles = c;
 +
 + c = 256 * duty_ns;
 + do_div(c, period_ns);
 + duty_cycles = c;
 +
 + writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
 + lpc32xx-base);
 +
 + return 0;
 +}

 When you convert to having more than one PWM device per chip, you can
 use pwm-hwpwm to distinguish between them

Re: [PATCH v2] pwm: add lpc32xx pwm support

2012-07-10 Thread Alexandre Pereira da Silva
On Tue, Jul 10, 2012 at 9:43 AM, Roland Stigge sti...@antcom.de wrote:
 Hi!

 On 07/10/2012 01:53 PM, Alexandre Pereira da Silva wrote:
 Add lpc32xx soc pwm driver.

 Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
 ---
 +++ b/drivers/pwm/pwm-lpc32xx.c
 @@ -0,0 +1,150 @@
 +/*
 + * Copyright 2012 Alexandre Pereira da Silva aletes@gmail.com
 + *
 + * The code contained herein is licensed under the GNU General Public
 + * License. You may obtain a copy of the GNU General Public License
 + * Version 2 or later at the following locations:
 + *
 + * http://www.opensource.org/licenses/gpl-license.html
 + * http://www.gnu.org/copyleft/gpl.html

 Some nitpicking about legal wording and contents:

 It doesn't state explicitly that we are licensing via GPLv2.

 Further, maybe we can drop the links (which can become obsolete in the
 future)? We are shipping the GPL anyway, and other drivers also don't
 need links.

 E.g.:

  * 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.

Thanks, Roland. I will apply that.
--
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] pwm: add lpc32xx pwm support

2012-07-09 Thread Alexandre Pereira da Silva
Add lpc32xx soc pwm driver.

Signed-off-by: Alexandre Pereira da Silva 
---
 .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   12 ++
 drivers/pwm/Kconfig|   11 ++
 drivers/pwm/Makefile   |1 +
 drivers/pwm/pwm-lpc32xx.c  |  151 
 4 files changed, 175 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 create mode 100644 drivers/pwm/pwm-lpc32xx.c

diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
new file mode 100644
index 000..fb7b3d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
@@ -0,0 +1,12 @@
+LPC32XX PWM controller
+
+Required properties:
+- compatible: should be "nxp,lpc3220-pwm"
+- reg: physical base address and length of the controller's registers
+
+Example:
+
+pwm: pwm@80064000 {
+   compatible = "nxp,lpc3220-pwm";
+   reg = <0x80064000 2000>;
+};
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 0b2800f..34086b1 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -28,6 +28,17 @@ config PWM_IMX
  To compile this driver as a module, choose M here: the module
  will be called pwm-imx.
 
+config PWM_LPC32XX
+   tristate "LPC32XX PWM support"
+   depends on ARCH_LPC32XX
+   help
+ Generic PWM framework driver for LPC32XX. The LPC32XX soc has two
+ pwm channels.
+
+ To compile this driver as a module, choose M here: the module
+ will be called pwm-lpc32xx.
+
+
 config PWM_MXS
tristate "Freescale MXS PWM support"
depends on ARCH_MXS && OF
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index cec2500..5459702 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_PWM)  += core.o
 obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o
 obj-$(CONFIG_PWM_IMX)  += pwm-imx.o
+obj-$(CONFIG_PWM_LPC32XX)  += pwm-lpc32xx.o
 obj-$(CONFIG_PWM_MXS)  += pwm-mxs.o
 obj-$(CONFIG_PWM_PXA)  += pwm-pxa.o
 obj-$(CONFIG_PWM_SAMSUNG)  += pwm-samsung.o
diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
new file mode 100644
index 000..c7fa126
--- /dev/null
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2012 Alexandre Pereira da Silva 
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct lpc32xx_pwm_chip {
+   struct pwm_chip chip;
+   struct device *dev;
+   struct clk *clk;
+   void __iomem *base;
+};
+
+#define PWM_ENABLE (1<<31)
+#define PWM_RELOADV(x) (((x) & 0xFF)<<8)
+#define PWM_DUTY(x)((x) & 0xFF)
+
+#define to_lpc32xx_pwm_chip(_chip) \
+   container_of(_chip, struct lpc32xx_pwm_chip, chip)
+
+static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
+ int duty_ns, int period_ns)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+   unsigned long long c;
+   int period_cycles, duty_cycles;
+
+   c = clk_get_rate(lpc32xx->clk)/256;
+   c = c * period_ns;
+   do_div(c, NSEC_PER_SEC);
+
+   /* Handle high and low extremes */
+   if (c == 0)
+   c = 1;
+   if (c > 255)
+   c = 0; /* 0 set division by 256 */
+   period_cycles = c;
+
+   c = 256*duty_ns;
+   do_div(c, period_ns);
+   duty_cycles = c;
+
+   writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
+   lpc32xx->base);
+
+   return 0;
+}
+
+static int lpc32xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+
+   clk_enable(lpc32xx->clk);
+   return 0;
+}
+
+static void lpc32xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+
+   writel(0, lpc32xx->base);
+   clk_disable(lpc32xx->clk);
+}
+
+static const struct pwm_ops lpc32xx_pwm_ops = {
+   .config = lpc32xx_pwm_config,
+   .enable = lpc32xx_pwm_enable,
+   .disable = lpc32xx_pwm_disable,
+   .owner = THIS_MODULE,
+};
+
+static int lpc32xx_pwm_probe(struct platform_device *pdev)
+{
+   struct lpc32xx_pwm_chip *lpc32xx;
+   struct resource *res;
+   int ret;
+
+   lpc32xx = devm_kzalloc(>dev, sizeof(*lpc32xx), GFP_KERNEL);
+   if (!lpc32xx)
+   return

[PATCH RESEND] usb: gadget: composite: parse dt values

2012-07-09 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to override VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva 
Acked-by: Michal Nazarewicz 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = <0x0525>;
+   product-id = <0xa4a6>;
+   release = <1>;
+   vendor = "Some Corp";
+   device = "Test Device";
+   serial = "12345";
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor && of_property_read_u32(np, "vendor-id", ) == 0)
+   idVendor = reg;
+
+   if (!idProduct && of_property_read_u32(np, "product-id", ) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice && of_property_read_u32(np, "release", ) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, "vendor",
+   >iManufacturer) == 0)
+   cdev->manufacturer_override = override_id(cdev,
+   >desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, "device",
+   >iProduct) == 0)
+   cdev->product_override = override_id(cdev,
+   >desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, "serial",
+   >iSerialNumber) == 0)
+   cdev->serial_override = override_id(cdev,
+   >desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget->dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev->desc = *composite->dev;
 
+   /* grab overrides from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev->desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
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 RESEND] usb: gadget: composite: parse dt values

2012-07-09 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to override VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
Acked-by: Michal Nazarewicz min...@mina86.com
Acked-by: Rob Herring rob.herr...@calxeda.com
---
 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = 0x0525;
+   product-id = 0xa4a6;
+   release = 1;
+   vendor = Some Corp;
+   device = Test Device;
+   serial = 12345;
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include linux/module.h
 #include linux/device.h
 #include linux/utsname.h
+#include linux/of.h
 
 #include linux/usb/composite.h
 #include asm/unaligned.h
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor  of_property_read_u32(np, vendor-id, reg) == 0)
+   idVendor = reg;
+
+   if (!idProduct  of_property_read_u32(np, product-id, reg) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice  of_property_read_u32(np, release, reg) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, vendor,
+   composite-iManufacturer) == 0)
+   cdev-manufacturer_override = override_id(cdev,
+   cdev-desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, device,
+   composite-iProduct) == 0)
+   cdev-product_override = override_id(cdev,
+   cdev-desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, serial,
+   composite-iSerialNumber) == 0)
+   cdev-serial_override = override_id(cdev,
+   cdev-desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget-dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev-desc = *composite-dev;
 
+   /* grab overrides from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev-desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
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] pwm: add lpc32xx pwm support

2012-07-09 Thread Alexandre Pereira da Silva
Add lpc32xx soc pwm driver.

Signed-off-by: Alexandre Pereira da Silva aletes@gmail.com
---
 .../devicetree/bindings/pwm/lpc32xx-pwm.txt|   12 ++
 drivers/pwm/Kconfig|   11 ++
 drivers/pwm/Makefile   |1 +
 drivers/pwm/pwm-lpc32xx.c  |  151 
 4 files changed, 175 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
 create mode 100644 drivers/pwm/pwm-lpc32xx.c

diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt 
b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
new file mode 100644
index 000..fb7b3d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
@@ -0,0 +1,12 @@
+LPC32XX PWM controller
+
+Required properties:
+- compatible: should be nxp,lpc3220-pwm
+- reg: physical base address and length of the controller's registers
+
+Example:
+
+pwm: pwm@80064000 {
+   compatible = nxp,lpc3220-pwm;
+   reg = 0x80064000 2000;
+};
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 0b2800f..34086b1 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -28,6 +28,17 @@ config PWM_IMX
  To compile this driver as a module, choose M here: the module
  will be called pwm-imx.
 
+config PWM_LPC32XX
+   tristate LPC32XX PWM support
+   depends on ARCH_LPC32XX
+   help
+ Generic PWM framework driver for LPC32XX. The LPC32XX soc has two
+ pwm channels.
+
+ To compile this driver as a module, choose M here: the module
+ will be called pwm-lpc32xx.
+
+
 config PWM_MXS
tristate Freescale MXS PWM support
depends on ARCH_MXS  OF
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index cec2500..5459702 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_PWM)  += core.o
 obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o
 obj-$(CONFIG_PWM_IMX)  += pwm-imx.o
+obj-$(CONFIG_PWM_LPC32XX)  += pwm-lpc32xx.o
 obj-$(CONFIG_PWM_MXS)  += pwm-mxs.o
 obj-$(CONFIG_PWM_PXA)  += pwm-pxa.o
 obj-$(CONFIG_PWM_SAMSUNG)  += pwm-samsung.o
diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
new file mode 100644
index 000..c7fa126
--- /dev/null
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2012 Alexandre Pereira da Silva aletes@gmail.com
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include linux/clk.h
+#include linux/err.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/platform_device.h
+#include linux/pwm.h
+#include linux/slab.h
+
+struct lpc32xx_pwm_chip {
+   struct pwm_chip chip;
+   struct device *dev;
+   struct clk *clk;
+   void __iomem *base;
+};
+
+#define PWM_ENABLE (131)
+#define PWM_RELOADV(x) (((x)  0xFF)8)
+#define PWM_DUTY(x)((x)  0xFF)
+
+#define to_lpc32xx_pwm_chip(_chip) \
+   container_of(_chip, struct lpc32xx_pwm_chip, chip)
+
+static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
+ int duty_ns, int period_ns)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+   unsigned long long c;
+   int period_cycles, duty_cycles;
+
+   c = clk_get_rate(lpc32xx-clk)/256;
+   c = c * period_ns;
+   do_div(c, NSEC_PER_SEC);
+
+   /* Handle high and low extremes */
+   if (c == 0)
+   c = 1;
+   if (c  255)
+   c = 0; /* 0 set division by 256 */
+   period_cycles = c;
+
+   c = 256*duty_ns;
+   do_div(c, period_ns);
+   duty_cycles = c;
+
+   writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
+   lpc32xx-base);
+
+   return 0;
+}
+
+static int lpc32xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+
+   clk_enable(lpc32xx-clk);
+   return 0;
+}
+
+static void lpc32xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+   struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
+
+   writel(0, lpc32xx-base);
+   clk_disable(lpc32xx-clk);
+}
+
+static const struct pwm_ops lpc32xx_pwm_ops = {
+   .config = lpc32xx_pwm_config,
+   .enable = lpc32xx_pwm_enable,
+   .disable = lpc32xx_pwm_disable,
+   .owner = THIS_MODULE,
+};
+
+static int lpc32xx_pwm_probe(struct platform_device *pdev)
+{
+   struct lpc32xx_pwm_chip *lpc32xx;
+   struct resource *res;
+   int ret;
+
+   lpc32xx = devm_kzalloc(pdev-dev, sizeof(*lpc32xx), GFP_KERNEL