* [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-11 2:37 ` Zhangfei Gao
0 siblings, 0 replies; 16+ messages in thread
From: Zhangfei Gao @ 2013-06-11 2:37 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] 16+ messages in thread
* [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-14 3:37 ` Baruch Siach
0 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2013-06-14 3:37 UTC (permalink / raw)
To: linux-arm-kernel
Hi Zhangfei,
On Tue, Jun 11, 2013 at 10:37:10AM +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>
Acked-by: 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;
--
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] 16+ messages in thread* Re: [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-14 3:37 ` Baruch Siach
0 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2013-06-14 3:37 UTC (permalink / raw)
To: Zhangfei Gao
Cc: Dirk Brandewie, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Wolfram Sang
Hi Zhangfei,
On Tue, Jun 11, 2013 at 10:37:10AM +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>
Acked-by: 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..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;
--
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] 16+ messages in thread
* [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-11 2:37 ` Zhangfei Gao
@ 2013-06-18 16:22 ` Wolfram Sang
-1 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2013-06-18 16:22 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jun 11, 2013 at 10:37:10AM +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..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
> +
I'd think the bindings are okay, yet I wonder they are not more used in
practice. So, an ack from a dt-expert would be appreciated.
> 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);
Those can fail.
> r = i2c_dw_init(dev);
> if (r)
> return r;
> --
> 1.7.9.5
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130618/ddddd0da/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-18 16:22 ` Wolfram Sang
0 siblings, 0 replies; 16+ messages in thread
From: Wolfram Sang @ 2013-06-18 16:22 UTC (permalink / raw)
To: Zhangfei Gao; +Cc: Dirk Brandewie, baruch, devicetree-discuss, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 2414 bytes --]
On Tue, Jun 11, 2013 at 10:37:10AM +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..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
> +
I'd think the bindings are okay, yet I wonder they are not more used in
practice. So, an ack from a dt-expert would be appreciated.
> 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);
Those can fail.
> r = i2c_dw_init(dev);
> if (r)
> return r;
> --
> 1.7.9.5
>
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
2013-06-18 16:22 ` Wolfram Sang
@ 2013-06-19 0:37 ` zhangfei
-1 siblings, 0 replies; 16+ messages in thread
From: zhangfei @ 2013-06-19 0:37 UTC (permalink / raw)
To: linux-arm-kernel
On 13-06-19 12:22 AM, Wolfram Sang wrote:
> On Tue, Jun 11, 2013 at 10:37:10AM +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..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
>> +
>
> I'd think the bindings are okay, yet I wonder they are not more used in
> practice. So, an ack from a dt-expert would be appreciated.
Thanks Wolfram,
The patches also acked by Baruch, the original writer.
Some platform can not provide fifo info from register
DW_IC_COMP_PARAM_1, hisilicon read such register is 0.
>> + of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
>> + of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
>
> Those can fail.
"rx-fifo-size and tx-fifo-size will be updated if provided from dts"
The thought is if dts have the optional properties, then update.
otherwise just use original value, read from register.
So I thought the read fail is fine?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 2/2] i2c: designware: add two optional property tx/rx-fifo-size
@ 2013-06-19 0:37 ` zhangfei
0 siblings, 0 replies; 16+ messages in thread
From: zhangfei @ 2013-06-19 0:37 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Dirk Brandewie, baruch, devicetree-discuss, linux-arm-kernel
On 13-06-19 12:22 AM, Wolfram Sang wrote:
> On Tue, Jun 11, 2013 at 10:37:10AM +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..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
>> +
>
> I'd think the bindings are okay, yet I wonder they are not more used in
> practice. So, an ack from a dt-expert would be appreciated.
Thanks Wolfram,
The patches also acked by Baruch, the original writer.
Some platform can not provide fifo info from register
DW_IC_COMP_PARAM_1, hisilicon read such register is 0.
>> + of_property_read_u32(np, "rx-fifo-size", &dev->rx_fifo_depth);
>> + of_property_read_u32(np, "tx-fifo-size", &dev->tx_fifo_depth);
>
> Those can fail.
"rx-fifo-size and tx-fifo-size will be updated if provided from dts"
The thought is if dts have the optional properties, then update.
otherwise just use original value, read from register.
So I thought the read fail is fine?
^ permalink raw reply [flat|nested] 16+ messages in thread