* [PATCH v2 0/2] support hisilicon i2c
@ 2013-06-10 5:02 ` Zhangfei Gao
0 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: Wolfram Sang, Dirk Brandewie, baruch
Cc: Zhangfei Gao, devicetree-discuss, linux-arm-kernel
v2:
Suggested by Baruch
Support hisilicon i2c in i2c-designware-platdrv.c, and adding two optional properties
Zhangfei Gao (2):
i2c: designware: use module_platform_driver
i2c: designware: add two optional property tx/rx-fifo-size
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 17 +++++------------
2 files changed, 12 insertions(+), 12 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 0/2] support hisilicon i2c
@ 2013-06-10 5:02 ` Zhangfei Gao
0 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: linux-arm-kernel
v2:
Suggested by Baruch
Support hisilicon i2c in i2c-designware-platdrv.c, and adding two optional properties
Zhangfei Gao (2):
i2c: designware: use module_platform_driver
i2c: designware: add two optional property tx/rx-fifo-size
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 17 +++++------------
2 files changed, 12 insertions(+), 12 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] i2c: designware: use module_platform_driver
2013-06-10 5:02 ` Zhangfei Gao
@ 2013-06-10 5:02 ` Zhangfei Gao
-1 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: Wolfram Sang, Dirk Brandewie, baruch
Cc: Zhangfei Gao, devicetree-discuss, linux-arm-kernel
Instead of use platform_driver_probe, use module_platform_driver
To support deferred probing
Also subsys_initcall may too early to auto set pinctl
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 35b70a1..41659c0 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -231,6 +231,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
MODULE_ALIAS("platform:i2c_designware");
static struct platform_driver dw_i2c_driver = {
+ .probe = dw_i2c_probe,
.remove = dw_i2c_remove,
.driver = {
.name = "i2c_designware",
@@ -240,18 +241,7 @@ static struct platform_driver dw_i2c_driver = {
.pm = &dw_i2c_dev_pm_ops,
},
};
-
-static int __init dw_i2c_init_driver(void)
-{
- return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe);
-}
-subsys_initcall(dw_i2c_init_driver);
-
-static void __exit dw_i2c_exit_driver(void)
-{
- platform_driver_unregister(&dw_i2c_driver);
-}
-module_exit(dw_i2c_exit_driver);
+module_platform_driver(dw_i2c_driver);
MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] i2c: designware: use module_platform_driver
@ 2013-06-10 5:02 ` Zhangfei Gao
0 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: linux-arm-kernel
Instead of use platform_driver_probe, use module_platform_driver
To support deferred probing
Also subsys_initcall may too early to auto set pinctl
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 35b70a1..41659c0 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -231,6 +231,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
MODULE_ALIAS("platform:i2c_designware");
static struct platform_driver dw_i2c_driver = {
+ .probe = dw_i2c_probe,
.remove = dw_i2c_remove,
.driver = {
.name = "i2c_designware",
@@ -240,18 +241,7 @@ static struct platform_driver dw_i2c_driver = {
.pm = &dw_i2c_dev_pm_ops,
},
};
-
-static int __init dw_i2c_init_driver(void)
-{
- return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe);
-}
-subsys_initcall(dw_i2c_init_driver);
-
-static void __exit dw_i2c_exit_driver(void)
-{
- platform_driver_unregister(&dw_i2c_driver);
-}
-module_exit(dw_i2c_exit_driver);
+module_platform_driver(dw_i2c_driver);
MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-10 5:02 ` Zhangfei Gao
@ 2013-06-10 5:02 ` Zhangfei Gao
-1 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: Wolfram Sang, Dirk Brandewie, baruch
Cc: Zhangfei Gao, devicetree-discuss, linux-arm-kernel
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
index e42a2ee..61fdb44 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
@@ -6,6 +6,11 @@ Required properties :
- reg : Offset and length of the register set for the device
- interrupts : <IRQ> where IRQ is the interrupt number.
+Optional properties:
+
+ - rx-fifo-size : 1 cell, Rx fifo threshold
+ - tx-fifo-size : 1 cell, Tx fifo threshold
+
Recommended properties :
- clock-frequency : desired I2C bus clock frequency in Hz.
@@ -18,5 +23,7 @@ Example :
compatible = "snps,designware-i2c";
reg = <0xf0000 0x1000>;
interrupts = <11>;
+ rx-fifo-size = <16>;
+ tx-fifo-size = <16>;
clock-frequency = <400000>;
};
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 41659c0..6760cea 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+ struct device_node *np = pdev->dev.of_node;
int irq, r;
/* NOTE: driver uses the static register mapping */
@@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
dev->adapter.nr = pdev->id;
}
+ of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
+ of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
r = i2c_dw_init(dev);
if (r)
return r;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-10 5:02 ` Zhangfei Gao
0 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-10 5:02 UTC (permalink / raw)
To: linux-arm-kernel
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
index e42a2ee..61fdb44 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
@@ -6,6 +6,11 @@ Required properties :
- reg : Offset and length of the register set for the device
- interrupts : <IRQ> where IRQ is the interrupt number.
+Optional properties:
+
+ - rx-fifo-size : 1 cell, Rx fifo threshold
+ - tx-fifo-size : 1 cell, Tx fifo threshold
+
Recommended properties :
- clock-frequency : desired I2C bus clock frequency in Hz.
@@ -18,5 +23,7 @@ Example :
compatible = "snps,designware-i2c";
reg = <0xf0000 0x1000>;
interrupts = <11>;
+ rx-fifo-size = <16>;
+ tx-fifo-size = <16>;
clock-frequency = <400000>;
};
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 41659c0..6760cea 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+ struct device_node *np = pdev->dev.of_node;
int irq, r;
/* NOTE: driver uses the static register mapping */
@@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
dev->adapter.nr = pdev->id;
}
+ of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
+ of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
r = i2c_dw_init(dev);
if (r)
return r;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-10 5:02 ` Zhangfei Gao
@ 2013-06-10 18:49 ` Baruch Siach
-1 siblings, 0 replies; 12+ messages in thread
From: Baruch Siach @ 2013-06-10 18:49 UTC (permalink / raw)
To: Zhangfei Gao
Cc: Dirk Brandewie, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Wolfram Sang
Hi Zhangfei Gao,
On Mon, Jun 10, 2013 at 01:02:55PM +0800, Zhangfei Gao wrote:
> rx-fifo-size and tx-fifo-size will be updated if provided from dts
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> CC: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
> ---
> .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
> drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
> 2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> index e42a2ee..61fdb44 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> @@ -6,6 +6,11 @@ Required properties :
> - reg : Offset and length of the register set for the device
> - interrupts : <IRQ> where IRQ is the interrupt number.
>
> +Optional properties:
> +
> + - rx-fifo-size : 1 cell, Rx fifo threshold
I'd use the word 'size' instead of 'threshold' here. The term 'threshold' is
used for something else in the datasheet.
baruch
> + - tx-fifo-size : 1 cell, Tx fifo threshold
> +
> Recommended properties :
>
> - clock-frequency : desired I2C bus clock frequency in Hz.
> @@ -18,5 +23,7 @@ Example :
> compatible = "snps,designware-i2c";
> reg = <0xf0000 0x1000>;
> interrupts = <11>;
> + rx-fifo-size = <16>;
> + tx-fifo-size = <16>;
> clock-frequency = <400000>;
> };
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 41659c0..6760cea 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
> struct dw_i2c_dev *dev;
> struct i2c_adapter *adap;
> struct resource *mem;
> + struct device_node *np = pdev->dev.of_node;
> int irq, r;
>
> /* NOTE: driver uses the static register mapping */
> @@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
> dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
> dev->adapter.nr = pdev->id;
> }
> + of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
> + of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
> r = i2c_dw_init(dev);
> if (r)
> return r;
> --
> 1.7.9.5
>
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-10 18:49 ` Baruch Siach
0 siblings, 0 replies; 12+ messages in thread
From: Baruch Siach @ 2013-06-10 18:49 UTC (permalink / raw)
To: linux-arm-kernel
Hi Zhangfei Gao,
On Mon, Jun 10, 2013 at 01:02:55PM +0800, Zhangfei Gao wrote:
> rx-fifo-size and tx-fifo-size will be updated if provided from dts
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> CC: Baruch Siach <baruch@tkos.co.il>
> ---
> .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
> drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
> 2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> index e42a2ee..61fdb44 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
> @@ -6,6 +6,11 @@ Required properties :
> - reg : Offset and length of the register set for the device
> - interrupts : <IRQ> where IRQ is the interrupt number.
>
> +Optional properties:
> +
> + - rx-fifo-size : 1 cell, Rx fifo threshold
I'd use the word 'size' instead of 'threshold' here. The term 'threshold' is
used for something else in the datasheet.
baruch
> + - tx-fifo-size : 1 cell, Tx fifo threshold
> +
> Recommended properties :
>
> - clock-frequency : desired I2C bus clock frequency in Hz.
> @@ -18,5 +23,7 @@ Example :
> compatible = "snps,designware-i2c";
> reg = <0xf0000 0x1000>;
> interrupts = <11>;
> + rx-fifo-size = <16>;
> + tx-fifo-size = <16>;
> clock-frequency = <400000>;
> };
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 41659c0..6760cea 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
> struct dw_i2c_dev *dev;
> struct i2c_adapter *adap;
> struct resource *mem;
> + struct device_node *np = pdev->dev.of_node;
> int irq, r;
>
> /* NOTE: driver uses the static register mapping */
> @@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
> dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
> dev->adapter.nr = pdev->id;
> }
> + of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
> + of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
> r = i2c_dw_init(dev);
> if (r)
> return r;
> --
> 1.7.9.5
>
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-10 18:49 ` Baruch Siach
@ 2013-06-11 2:13 ` zhangfei
-1 siblings, 0 replies; 12+ messages in thread
From: zhangfei @ 2013-06-11 2:13 UTC (permalink / raw)
To: Baruch Siach
Cc: Dirk Brandewie, devicetree-discuss, linux-arm-kernel, Wolfram Sang
On 13-06-11 02:49 AM, Baruch Siach wrote:
> Hi Zhangfei Gao,
>
> On Mon, Jun 10, 2013 at 01:02:55PM +0800, Zhangfei Gao wrote:
>> rx-fifo-size and tx-fifo-size will be updated if provided from dts
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> CC: Baruch Siach <baruch@tkos.co.il>
>> ---
>> .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
>> drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> index e42a2ee..61fdb44 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> @@ -6,6 +6,11 @@ Required properties :
>> - reg : Offset and length of the register set for the device
>> - interrupts : <IRQ> where IRQ is the interrupt number.
>>
>> +Optional properties:
>> +
>> + - rx-fifo-size : 1 cell, Rx fifo threshold
>
> I'd use the word 'size' instead of 'threshold' here. The term 'threshold' is
> used for something else in the datasheet.
>
> baruch
>
OK, will update and resend the patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-11 2:13 ` zhangfei
0 siblings, 0 replies; 12+ messages in thread
From: zhangfei @ 2013-06-11 2:13 UTC (permalink / raw)
To: linux-arm-kernel
On 13-06-11 02:49 AM, Baruch Siach wrote:
> Hi Zhangfei Gao,
>
> On Mon, Jun 10, 2013 at 01:02:55PM +0800, Zhangfei Gao wrote:
>> rx-fifo-size and tx-fifo-size will be updated if provided from dts
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> CC: Baruch Siach <baruch@tkos.co.il>
>> ---
>> .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
>> drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> index e42a2ee..61fdb44 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
>> @@ -6,6 +6,11 @@ Required properties :
>> - reg : Offset and length of the register set for the device
>> - interrupts : <IRQ> where IRQ is the interrupt number.
>>
>> +Optional properties:
>> +
>> + - rx-fifo-size : 1 cell, Rx fifo threshold
>
> I'd use the word 'size' instead of 'threshold' here. The term 'threshold' is
> used for something else in the datasheet.
>
> baruch
>
OK, will update and resend the patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-11 2:13 ` zhangfei
@ 2013-06-11 2:30 ` Zhangfei Gao
-1 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-11 2:30 UTC (permalink / raw)
To: Wolfram Sang, Dirk Brandewie, baruch
Cc: Zhangfei Gao, devicetree-discuss, linux-arm-kernel
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
index e42a2ee..84717fe 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
@@ -6,6 +6,11 @@ Required properties :
- reg : Offset and length of the register set for the device
- interrupts : <IRQ> where IRQ is the interrupt number.
+Optional properties:
+
+ - rx-fifo-size : 1 cell, Rx fifo size
+ - tx-fifo-size : 1 cell, Tx fifo size
+
Recommended properties :
- clock-frequency : desired I2C bus clock frequency in Hz.
@@ -18,5 +23,7 @@ Example :
compatible = "snps,designware-i2c";
reg = <0xf0000 0x1000>;
interrupts = <11>;
+ rx-fifo-size = <16>;
+ tx-fifo-size = <16>;
clock-frequency = <400000>;
};
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 41659c0..6760cea 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+ struct device_node *np = pdev->dev.of_node;
int irq, r;
/* NOTE: driver uses the static register mapping */
@@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
dev->adapter.nr = pdev->id;
}
+ of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
+ of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
r = i2c_dw_init(dev);
if (r)
return r;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-11 2:30 ` Zhangfei Gao
0 siblings, 0 replies; 12+ messages in thread
From: Zhangfei Gao @ 2013-06-11 2:30 UTC (permalink / raw)
To: linux-arm-kernel
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Baruch Siach <baruch@tkos.co.il>
---
.../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++
drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
index e42a2ee..84717fe 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt
@@ -6,6 +6,11 @@ Required properties :
- reg : Offset and length of the register set for the device
- interrupts : <IRQ> where IRQ is the interrupt number.
+Optional properties:
+
+ - rx-fifo-size : 1 cell, Rx fifo size
+ - tx-fifo-size : 1 cell, Tx fifo size
+
Recommended properties :
- clock-frequency : desired I2C bus clock frequency in Hz.
@@ -18,5 +23,7 @@ Example :
compatible = "snps,designware-i2c";
reg = <0xf0000 0x1000>;
interrupts = <11>;
+ rx-fifo-size = <16>;
+ tx-fifo-size = <16>;
clock-frequency = <400000>;
};
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 41659c0..6760cea 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -85,6 +85,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+ struct device_node *np = pdev->dev.of_node;
int irq, r;
/* NOTE: driver uses the static register mapping */
@@ -140,6 +141,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1;
dev->adapter.nr = pdev->id;
}
+ of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
+ of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
r = i2c_dw_init(dev);
if (r)
return r;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-06-11 2:30 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-10 5:02 [PATCH v2 0/2] support hisilicon i2c Zhangfei Gao
2013-06-10 5:02 ` Zhangfei Gao
2013-06-10 5:02 ` [PATCH v2 1/2] i2c: designware: use module_platform_driver Zhangfei Gao
2013-06-10 5:02 ` Zhangfei Gao
2013-06-10 5:02 ` [PATCH v2 2/2] i2c: designware: add two optional property tx/rx-fifo-size Zhangfei Gao
2013-06-10 5:02 ` Zhangfei Gao
[not found] ` <1370840576-15651-3-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-10 18:49 ` Baruch Siach
2013-06-10 18:49 ` Baruch Siach
2013-06-11 2:13 ` zhangfei
2013-06-11 2:13 ` zhangfei
2013-06-11 2:30 ` [PATCH " Zhangfei Gao
2013-06-11 2:30 ` Zhangfei Gao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.