Skip to contentSkip to conversation

I2C: add CSR SiRFprimaII on-chip I2C controllers driver

PATCH New Barry Song 5 participants 7 messages Dec 14, 2011 – Dec 22, 2011 I2C subsystem host drivers

lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

From: Zhiwu Song <[email protected]>

SiRFprimaII is the latest generation application processor from CSR?s multi-function SoC product family.
The SoC support codes are in arch/arm/mach-prima2 from Linux mainline 3.0.
There are two I2C controllers on primaII, features include:
* Two I2C controller modules are on chip
* RISC I/O bus read write register
* Up to 16 bytes data buffer for issuing commands and writing data at the same time
* Up to 16 commands, and receiving read data 16 bytes at a time
* Error INT report (ACK check)
* No-ACK bus protocols (SCCB bus protocols)

---
-v4:
fix some minor issues pointed out by Shubhrajyoti Datta; move platform_driver.suspend/resume to dev_pm_ops;
use Wolfram Sang's new devm_request_and_ioremap() api, refer to:

     https://lkml.org/lkml/2011/10/25/226
 drivers/i2c/busses/Kconfig    |    7 +
 drivers/i2c/busses/Makefile   |    1 +
 drivers/i2c/busses/i2c-sirf.c |  440 +++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-sirf.h |   61 ++++++
 4 files changed, 512 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-sirf.c
 create mode 100644 drivers/i2c/busses/i2c-sirf.h
drivers/i2c/busses/Kconfig +10 -0
index a3afac4..61c561b 100644
@@ -618,6 +618,16 @@ config I2C_SH_MOBILE
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-sh_mobile.
 
+config I2C_SIRF
+	tristate "CSR SiRFprimaII I2C interface"
+	depends on ARCH_PRIMA2
+	help
+	  If you say yes to this option, support will be included for the
+	  CSR SiRFprimaII I2C interface.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-sirf.
+
 config I2C_SIMTEC
 	tristate "Simtec Generic I2C interface"
 	select I2C_ALGOBIT
drivers/i2c/busses/Makefile +1 -0
index fba6da6..c30db66 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_I2C_S3C2410)	+= i2c-s3c2410.o
 obj-$(CONFIG_I2C_S6000)		+= i2c-s6000.o
 obj-$(CONFIG_I2C_SH7760)	+= i2c-sh7760.o
 obj-$(CONFIG_I2C_SH_MOBILE)	+= i2c-sh_mobile.o
+obj-$(CONFIG_I2C_SIRF)		+= i2c-sirf.o
 obj-$(CONFIG_I2C_SIMTEC)	+= i2c-simtec.o
 obj-$(CONFIG_I2C_STU300)	+= i2c-stu300.o
 obj-$(CONFIG_I2C_TEGRA)		+= i2c-tegra.o
drivers/i2c/busses/i2c-sirf.c new file +440 -0

440 lines not on this page · raw message

drivers/i2c/busses/i2c-sirf.h new file +61 -0

61 lines not on this page · raw message

Signature · 6 lines
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our [email protected]/blog
#1 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

2011/12/14 Barry Song <[email protected]>:

Quoted 19 lines

From: Zhiwu Song <[email protected]>

SiRFprimaII is the latest generation application processor from CSR?s multi-function SoC product family.
The SoC support codes are in arch/arm/mach-prima2 from Linux mainline 3.0.
There are two I2C controllers on primaII, features include:
* Two I2C controller modules are on chip
* RISC I/O bus read write register
* Up to 16 bytes data buffer for issuing commands and writing data ?at the same time
* Up to 16 commands, and receiving read data 16 bytes at a time
* Error INT report (ACK check)
* No-ACK bus protocols (SCCB bus protocols)

Quoted 6 lines

---
?-v4:
?fix some minor issues pointed out by Shubhrajyoti Datta; ?move platform_driver.suspend/resume to dev_pm_ops; ?use Wolfram Sang's new devm_request_and_ioremap() api, refer to:
? ? https://lkml.org/lkml/2011/10/25/226

Hi Ben,
can we do something to move things ahead? the patch has sent for several weeks and 4 versions based on feedback from other people, you haven't given any comment, nack or ack. Are you still active, or are you just too busy to take care?
Thanks
barry

#2 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

In reply to Barry Song
Quoted 7 lines · Barry Song
drivers/i2c/busses/i2c-sirf.c new file +7 -0
+static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
+{
+	struct clk *clk;
+
+	clk = clk_get(&pdev->dev, NULL);
+	err = clk_prepare(clk);
+	err = clk_enable(clk);

...

drivers/i2c/busses/i2c-sirf.c line 366

Quoted 12 lines
drivers/i2c/busses/i2c-sirf.c new file +12 -0
+	clk_disable(clk);
+
+	dev_info(&pdev->dev, " I2C adapter ready to operate\n");
+
+	return 0;
+}
+
+static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev)
+{
+	clk_disable(siic->clk);
+	clk_unprepare(siic->clk);
+	clk_put(siic->clk);

This doesn't look right - look at the state which you leave the clk in upon successful probe, and now look at what you do when you do a remove.

It seems that you disable an already disabled clock to me.

#3 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

2011/12/21 Russell King - ARM Linux <[email protected]>:

Quoted 25 lines · Barry Song
Quoted 7 lines
(quoted diff) +7 -0
+static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
+{
+ ? ? struct clk *clk;
+
+ ? ? clk = clk_get(&pdev->dev, NULL);
+ ? ? err = clk_prepare(clk);
+ ? ? err = clk_enable(clk);

...

drivers/i2c/busses/i2c-sirf.c

Quoted 12 lines

+ ? ? clk_disable(clk);

drivers/i2c/busses/i2c-sirf.c new file +11 -0
+
+ ? ? dev_info(&pdev->dev, " I2C adapter ready to operate\n");
+
+ ? ? return 0;
+}
+
+static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev)
+{
+ ? ? clk_disable(siic->clk);
+ ? ? clk_unprepare(siic->clk);
+ ? ? clk_put(siic->clk);

This doesn't look right - look at the state which you leave the clk in upon successful probe, and now look at what you do when you do a remove.

Quoted 1 line

It seems that you disable an already disabled clock to me.

Russell, thanks! i will fix that in v5. but i have to wait for Ben's feedback and add other fixes together before doing that. Ben seems to have been scheduled out, i hope the state is TASK_INTERRUPTBILE not TASK_UNINTERRUPTBILE. Then my signal can wake up him.

Thanks
barry

#4 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

Quoted 23 lines · Barry Song

2011/12/21 Russell King - ARM Linux <[email protected]>:

Quoted 22 lines · Barry Song
Quoted 7 lines
(quoted diff) +7 -0
+static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
+{
+ ? ? struct clk *clk;
+
+ ? ? clk = clk_get(&pdev->dev, NULL);
+ ? ? err = clk_prepare(clk);
+ ? ? err = clk_enable(clk);

...

Quoted 12 lines

+ ? ? clk_disable(clk);

drivers/i2c/busses/i2c-sirf.c new file +11 -0
+
+ ? ? dev_info(&pdev->dev, " I2C adapter ready to operate\n");
+
+ ? ? return 0;
+}
+
+static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev)
+{
+ ? ? clk_disable(siic->clk);
+ ? ? clk_unprepare(siic->clk);
+ ? ? clk_put(siic->clk);

There's a handy clk_disable_unprepare function in the patch I ever sent out. It's in Sascha or Shawn's tree.

Richard

Quoted 18 lines
Quoted 4 lines

This doesn't look right - look at the state which you leave the clk in upon successful probe, and now look at what you do when you do a remove.

It seems that you disable an already disabled clock to me.

Russell, thanks! i will fix that in v5. but i have to wait for Ben's feedback and add other fixes together before doing that. Ben seems to have been scheduled out, i hope the state is TASK_INTERRUPTBILE not TASK_UNINTERRUPTBILE. Then my signal can wake up him.

Thanks
barry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

Quoted 24 lines · Richard Zhao
Quoted 23 lines · Barry Song

2011/12/21 Russell King - ARM Linux <[email protected]>:

Quoted 22 lines · Barry Song
Quoted 7 lines
(quoted diff) +7 -0
+static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
+{
+ ? ? struct clk *clk;
+
+ ? ? clk = clk_get(&pdev->dev, NULL);
+ ? ? err = clk_prepare(clk);
+ ? ? err = clk_enable(clk);

...

Quoted 12 lines

+ ? ? clk_disable(clk);

drivers/i2c/busses/i2c-sirf.c new file +11 -0
+
+ ? ? dev_info(&pdev->dev, " I2C adapter ready to operate\n");
+
+ ? ? return 0;
+}
+
+static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev)
+{
+ ? ? clk_disable(siic->clk);
+ ? ? clk_unprepare(siic->clk);
+ ? ? clk_put(siic->clk);
Quoted 3 lines

There's a handy clk_disable_unprepare function in the patch I ever sent out. It's in Sascha or Shawn's tree.

We cannot really ask people to use that before it hits Linus' tree.

Signature · 2 lines
Regards,
Shawn
#6 lore raw

PATCH v4 1/1 I2C: add CSR SiRFprimaII on-chip I2C controllers driver

2011/12/21 Shawn Guo <[email protected]>:

Quoted 25 lines · Richard Zhao
Quoted 24 lines · Barry Song
Quoted 23 lines

2011/12/21 Russell King - ARM Linux <[email protected]>:

Quoted 22 lines · Barry Song
Quoted 7 lines
(quoted diff) +7 -0
+static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
+{
+ ? ? struct clk *clk;
+
+ ? ? clk = clk_get(&pdev->dev, NULL);
+ ? ? err = clk_prepare(clk);
+ ? ? err = clk_enable(clk);

...

Quoted 12 lines

+ ? ? clk_disable(clk);

drivers/i2c/busses/i2c-sirf.c new file +11 -0
+
+ ? ? dev_info(&pdev->dev, " I2C adapter ready to operate\n");
+
+ ? ? return 0;
+}
+
+static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev)
+{
+ ? ? clk_disable(siic->clk);
+ ? ? clk_unprepare(siic->clk);
+ ? ? clk_put(siic->clk);
Quoted 4 lines
Quoted 3 lines

There's a handy clk_disable_unprepare function in the patch I ever sent out. It's in Sascha or Shawn's tree.

We cannot really ask people to use that before it hits Linus' tree.

Thanks. Shawn/Richard.
The problem is that Ben seems to have been scheduled to TASK_UNINTERRUPTIBLE.

Quoted 5 lines

--
Regards,
Shawn

-barry