Skip to contentSkip to conversation

i2c: UniPhier: add I2C drivers based on driver model

PATCH Superseded Masahiro Yamada 3 participants 8 messages Dec 26, 2014 – Jan 13, 2015

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover i2c: UniPhier: add I2C drivers based on driver model

Masahiro Yamada (4):
i2c: UniPhier: add driver for UniPhier i2c controller
i2c: UniPhier: add driver for UniPhier FIFO-builtin i2c controller
ARM: UniPhier: enable I2C for UniPhier SoCs
ARM: UniPhier: enable CONFIG_I2C_EEPROM

 configs/ph1_ld4_defconfig    |   2 +
 configs/ph1_pro4_defconfig   |   2 +
 configs/ph1_sld8_defconfig   |   2 +
 drivers/i2c/Kconfig          |  22 +++
 drivers/i2c/Makefile         |   2 +
 drivers/i2c/i2c-uniphier-f.c | 374 +++++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-uniphier.c   | 233 +++++++++++++++++++++++++++
 include/configs/uniphier.h   |   3 +
 8 files changed, 640 insertions(+)
 create mode 100644 drivers/i2c/i2c-uniphier-f.c
 create mode 100644 drivers/i2c/i2c-uniphier.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/4 i2c: UniPhier: add driver for UniPhier i2c controller

This commit adds on-chip I2C driver used on some old Panasonic UniPhier SoCs.

---

Changes in v3: None
Changes in v2:
- Fix a typo. s/freqency/frequency/
- Add some comments to explain the formula calculating wait time.
- add comments on every register
- skip stop condition if the next message is read

 drivers/i2c/Kconfig        |  14 +++
 drivers/i2c/Makefile       |   1 +
 drivers/i2c/i2c-uniphier.c | 233 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+)
 create mode 100644 drivers/i2c/i2c-uniphier.c
drivers/i2c/Kconfig +14 -0
index e69de29..6a479ef 100644
@@ -0,0 +1,14 @@
+config DM_I2C
+	bool "Enable Driver Model for I2C drivers"
+	depends on DM
+	help
+	  If you want to use driver model for I2C drivers, say Y.
+	  To use legacy I2C drivers, say N.
+
+config SYS_I2C_UNIPHIER
+	bool "UniPhier I2C driver"
+	depends on ARCH_UNIPHIER && DM_I2C
+	default y
+	help
+	  Support for Panasonic UniPhier I2C controller driver.  This I2C
+	  controller is used on PH1-LD4, PH1-sLD8 or older UniPhier SoCs.
drivers/i2c/Makefile +1 -0
index 6f3c86c..e2fcd24 100644
@@ -31,4 +31,5 @@ obj-$(CONFIG_SYS_I2C_SANDBOX) += sandbox_i2c.o i2c-emul-uclass.o
 obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o
 obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o
 obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
+obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
 obj-$(CONFIG_SYS_I2C_ZYNQ) += zynq_i2c.o
drivers/i2c/i2c-uniphier.c new file +233 -0

233 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/4 i2c: UniPhier: add driver for UniPhier i2c controller

Hello Masahiro,

Am 26.12.2014 04:07, schrieb Masahiro Yamada:

Quoted 26 lines

This commit adds on-chip I2C driver used on some old Panasonic UniPhier SoCs.

---

Changes in v3: None
Changes in v2:
- Fix a typo. s/freqency/frequency/
- Add some comments to explain the formula calculating wait time.
- add comments on every register
- skip stop condition if the next message is read

  drivers/i2c/Kconfig        |  14 +++
  drivers/i2c/Makefile       |   1 +
  drivers/i2c/i2c-uniphier.c | 233 +++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 248 insertions(+)

create mode 100644 drivers/i2c/i2c-uniphier.c

drivers/i2c/Kconfig +0 -0
index e69de29..6a479ef 100644

drivers/i2c/Kconfig line 6

Quoted 6 lines
drivers/i2c/Kconfig +6 -0
@@ -0,0 +1,14 @@
+config DM_I2C
+	bool "Enable Driver Model for I2C drivers"
+	depends on DM
+	help
+	  If you want to use driver model for I2C drivers, say Y.
+	  To use legacy I2C drivers, say N.

This change seems not related to the "add driver for UniPhier i2c controller" topic ...

Beside of that, you can add my

to the hole serie. I think this should go to the u-boot-dm tree from Simon, as it depends on DM changes, or?

Simon? Is this OK for you?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH v3 1/4 i2c: UniPhier: add driver for UniPhier i2c controller

Hi Heiko,

2015-01-05 15:52 GMT+09:00 Heiko Schocher <[email protected]>:

Quoted 26 lines

Hello Masahiro,

Am 26.12.2014 04:07, schrieb Masahiro Yamada:

Quoted 22 lines

This commit adds on-chip I2C driver used on some old Panasonic UniPhier SoCs.

---

Changes in v3: None
Changes in v2:
- Fix a typo. s/freqency/frequency/
- Add some comments to explain the formula calculating wait time.
- add comments on every register
- skip stop condition if the next message is read

  drivers/i2c/Kconfig        |  14 +++
  drivers/i2c/Makefile       |   1 +
  drivers/i2c/i2c-uniphier.c | 233
+++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 248 insertions(+)

create mode 100644 drivers/i2c/i2c-uniphier.c

Quoted 15 lines

drivers/i2c/Kconfig line 6

Quoted 11 lines
drivers/i2c/Kconfig +6 -0
index e69de29..6a479ef 100644
@@ -0,0 +1,14 @@
+config DM_I2C
+       bool "Enable Driver Model for I2C drivers"
+       depends on DM
+       help
+         If you want to use driver model for I2C drivers, say Y.
+         To use legacy I2C drivers, say N.

This change seems not related to the "add driver for UniPhier i2c controller" topic ...

OK, I can split it into two patches.

Quoted 9 lines

Beside of that, you can add my

to the hole serie. I think this should go to the u-boot-dm tree from Simon, as it depends on DM changes, or?

Simon? Is this OK for you?

I do not mind if Simon is willing to apply it to u-boot-dm.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw

PATCH v3 1/4 i2c: UniPhier: add driver for UniPhier i2c controller

Hi,

Quoted 56 lines · Masahiro YAMADA

Hi Heiko,

2015-01-05 15:52 GMT+09:00 Heiko Schocher <[email protected]>:

Quoted 26 lines

Hello Masahiro,

Am 26.12.2014 04:07, schrieb Masahiro Yamada:

Quoted 22 lines

This commit adds on-chip I2C driver used on some old Panasonic UniPhier SoCs.

---

Changes in v3: None
Changes in v2:
- Fix a typo. s/freqency/frequency/
- Add some comments to explain the formula calculating wait time.
- add comments on every register
- skip stop condition if the next message is read

  drivers/i2c/Kconfig        |  14 +++
  drivers/i2c/Makefile       |   1 +
  drivers/i2c/i2c-uniphier.c | 233
+++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 248 insertions(+)

create mode 100644 drivers/i2c/i2c-uniphier.c

Quoted 15 lines

drivers/i2c/Kconfig line 6

Quoted 11 lines
drivers/i2c/Kconfig +6 -0
index e69de29..6a479ef 100644
@@ -0,0 +1,14 @@
+config DM_I2C
+       bool "Enable Driver Model for I2C drivers"
+       depends on DM
+       help
+         If you want to use driver model for I2C drivers, say Y.
+         To use legacy I2C drivers, say N.

This change seems not related to the "add driver for UniPhier i2c controller" topic ...

OK, I can split it into two patches.

Quoted 4 lines

Beside of that, you can add my

Quoted 8 lines
Quoted 5 lines

to the hole serie. I think this should go to the u-boot-dm tree from Simon, as it depends on DM changes, or?

Simon? Is this OK for you?

I do not mind if Simon is willing to apply it to u-boot-dm.

Yes, that's fine. But please do cc me as otherwise I miss messages. So much activity these days...

Regards,
Simon

#5 lore raw

PATCH v3 2/4 i2c: UniPhier: add driver for UniPhier FIFO-builtin i2c controller

In reply to Masahiro Yamada

This commit adds on-chip I2C driver used on newer SoCs of Panasonic UniPhier platform.

---

Changes in v3:
- Fix a bug in that device busy is checked even if the stop condition is not issued.

Changes in v2:
- Fix a typo. s/freqency/frequency/
- Rename the struct member for clarification. s/wait_us/timeout/
- Add comments on all the registers
- Skip stop condition if the next message is read

 drivers/i2c/Kconfig          |   8 +
 drivers/i2c/Makefile         |   1 +
 drivers/i2c/i2c-uniphier-f.c | 374 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 383 insertions(+)
 create mode 100644 drivers/i2c/i2c-uniphier-f.c
drivers/i2c/Kconfig +8 -0
index 6a479ef..202ea5d 100644
@@ -12,3 +12,11 @@ config SYS_I2C_UNIPHIER
 	help
 	  Support for Panasonic UniPhier I2C controller driver.  This I2C
 	  controller is used on PH1-LD4, PH1-sLD8 or older UniPhier SoCs.
+
+config SYS_I2C_UNIPHIER_F
+	bool "UniPhier FIFO-builtin I2C driver"
+	depends on ARCH_UNIPHIER && DM_I2C
+	default y
+	help
+	  Support for Panasonic UniPhier FIFO-builtin I2C controller driver.
+	  This I2C controller is used on PH1-Pro4 or newer UniPhier SoCs.
drivers/i2c/Makefile +1 -0
index e2fcd24..0e4c9f4 100644
@@ -32,4 +32,5 @@ obj-$(CONFIG_SYS_I2C_SH) += sh_i2c.o
 obj-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o
 obj-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
 obj-$(CONFIG_SYS_I2C_UNIPHIER) += i2c-uniphier.o
+obj-$(CONFIG_SYS_I2C_UNIPHIER_F) += i2c-uniphier-f.o
 obj-$(CONFIG_SYS_I2C_ZYNQ) += zynq_i2c.o
drivers/i2c/i2c-uniphier-f.c new file +374 -0

374 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 3/4 ARM: UniPhier: enable I2C for UniPhier SoCs

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 configs/ph1_ld4_defconfig  | 2 ++
 configs/ph1_pro4_defconfig | 2 ++
 configs/ph1_sld8_defconfig | 2 ++
 3 files changed, 6 insertions(+)
configs/ph1_ld4_defconfig +2 -0
index 2e9dd00..86b4b15 100644
@@ -18,6 +18,7 @@ CONFIG_CMD_LOADB=y
 CONFIG_CMD_LOADS=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_ECHO=y
 CONFIG_CMD_ITEST=y
@@ -34,6 +35,7 @@ CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
 CONFIG_DM_SERIAL=y
 CONFIG_UNIPHIER_SERIAL=y
+CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
configs/ph1_pro4_defconfig +2 -0
index 5dca64b..242bcf9 100644
@@ -18,6 +18,7 @@ CONFIG_CMD_LOADB=y
 CONFIG_CMD_LOADS=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_ECHO=y
 CONFIG_CMD_ITEST=y
@@ -34,6 +35,7 @@ CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
 CONFIG_DM_SERIAL=y
 CONFIG_UNIPHIER_SERIAL=y
+CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
configs/ph1_sld8_defconfig +2 -0
index 2a6e334..8e95f17 100644
@@ -18,6 +18,7 @@ CONFIG_CMD_LOADB=y
 CONFIG_CMD_LOADS=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_ECHO=y
 CONFIG_CMD_ITEST=y
@@ -34,6 +35,7 @@ CONFIG_SYS_NAND_DENALI_64BIT=y
 CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8
 CONFIG_DM_SERIAL=y
 CONFIG_UNIPHIER_SERIAL=y
+CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
Signature · 1 line
1.9.1
#7 lore raw

PATCH v3 4/4 ARM: UniPhier: enable CONFIG_I2C_EEPROM

In reply to Masahiro Yamada

---

To apply this commit, the following must be applied in advance:
http://patchwork.ozlabs.org/patch/422543/

Changes in v3: None
Changes in v2: None

 include/configs/uniphier.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/uniphier.h +3 -0
index 5a53c50..9ad47f6 100644
@@ -43,6 +43,9 @@
 #define CONFIG_SDRAM1_SIZE	0x10000000
 #endif
 
+#define CONFIG_I2C_EEPROM
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10
+
 /*
  * Support card address map
  */
Signature · 1 line
1.9.1