support hisilicon i2c
Subsystems (4)
v3 cover support hisilicon i2c
v3:
patch 02, use size instead of threshold
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(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/2 i2c: designware: use module_platform_driver
Instead of use platform_driver_probe, use module_platform_driver To support deferred probing
Also subsys_initcall may too early to auto set pinctl
--- drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +2 -12
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("Synopsys DesignWare I2C bus adapter" );
Signature · 1 line
1.7.9.5
PATCH v3 1/2 i2c: designware: use module_platform_driver
Quoted 6 lines · Zhangfei Gao
Instead of use
platform_driver_probe, usemodule_platform_driverTo support deferred probing
Alsosubsys_initcallmay too early to auto set pinctlSigned-off-by Zhangfei Gao <[email protected]>CC Baruch Siach <[email protected]>
Basically OK, but please resend for 3.12, so we get enough testing before entering mainline. I am a bit anxious of side effects and 3.11 is too near.
-------------- 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/df3973ee/attachment.sig>
PATCH v3 1/2 i2c: designware: use module_platform_driver
Quoted 5 lines · Wolfram Sang
Quoted 4 lines · Zhangfei Gao
Instead of use
platform_driver_probe, usemodule_platform_driverTo support deferred probing
Alsosubsys_initcallmay too early to auto set pinctl
Quoted 7 lines
Quoted 2 lines
Signed-off-by Zhangfei Gao <[email protected]>CC Baruch Siach <[email protected]>Basically OK, but please resend for 3.12, so we get enough testing before entering mainline. I am a bit anxious of side effects and 3.11 is too near.
Dear Wolfram,
Sorry for the silly question: How to be prepared for 3.12?
Do you mean there is specific git & branch, which I should rebase on? linux-next.git is what I use now.
Thanks
PATCH v3 2/2 i2c: designware: add two optional property tx/rx-fifo-size
In reply to Zhangfei Gaorx-fifo-size and tx-fifo-size will be updated if provided from dts
--- .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 2 files changed, 10 insertions(+)
Documentation/devicetree/bindings/i2c/i2c-designware.txt +7 -0
@@ -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>; };
drivers/i2c/busses/i2c-designware-platdrv.c +3 -0
@@ -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;
Signature · 1 line
1.7.9.5
PATCH v3 2/2 i2c: designware: add two optional property tx/rx-fifo-size
Hi Zhangfei,
Quoted 4 lines · Zhangfei Gao
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by Zhangfei Gao <[email protected]>CC Baruch Siach <[email protected]>
Quoted 50 lines
--- .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 2 files changed, 10 insertions(+)Documentation/devicetree/bindings/i2c/i2c-designware.txt +7
-0@@ -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>; };drivers/i2c/busses/i2c-designware-platdrv.c +3
-0@@ -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;
Signature · 3 lines
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 -PATCH v3 2/2 i2c: designware: add two optional property tx/rx-fifo-size
In reply to Zhangfei GaoQuoted 14 lines · Zhangfei Gao
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by Zhangfei Gao <[email protected]>CC Baruch Siach <[email protected]>--- .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 2 files changed, 10 insertions(+)Documentation/devicetree/bindings/i2c/i2c-designware.txt +0
-0
Documentation/devicetree/bindings/i2c/i2c-designware.txt Required properties : · line 13
Quoted 8 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt +5
-0@@ -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.
Quoted 24 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt +2
-0Recommended 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>; };drivers/i2c/busses/i2c-designware-platdrv.c +1
-0@@ -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 */
drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_probe(struct platform_device *pdev) · line 145
Quoted 5 lines
drivers/i2c/busses/i2c-designware-platdrv.c +2
-0@@ -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.
Quoted 6 lines
drivers/i2c/busses/i2c-designware-platdrv.c +0
-0r =i2c_dw_init (dev);if (r)return r;Signature · 1 line
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>
PATCH v3 2/2 i2c: designware: add two optional property tx/rx-fifo-size
Quoted 18 lines · Wolfram Sang
Quoted 17 lines · Zhangfei Gao
rx-fifo-size and tx-fifo-size will be updated if provided from dts
Signed-off-by Zhangfei Gao <[email protected]>CC Baruch Siach <[email protected]>--- .../devicetree/bindings/i2c/i2c-designware.txt | 7 +++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 2 files changed, 10 insertions(+)Documentation/devicetree/bindings/i2c/i2c-designware.txt +0
-0@@ -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.
Quoted 8 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt Required properties : · line 13
Quoted 5 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt +5
-0+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.
Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt Required properties : · line 15
Quoted 2 lines
Documentation/devicetree/bindings/i2c/i2c-designware.txt +2
-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?