Add OpenCores I2C controller driver
Subsystems (3)
v3 cover Add OpenCores I2C controller driver
This driver has been tested on HiFive Unleashed with a PMOD based RTCC sensor connected to I2C pins J1 header of the board.
This series is available here [1] for testing
[1] https://github.com/pragnesh26992/u-boot/tree/i2c
Changes in v3:
- Rebase to master and add missing #include <dm/device_compat.h>
Changes in v2:
- Remove TYPE_SIFIVE_REV0 flag
- Update the Opencores I2C Controller Link
U-Boot Logs for reference:
Hit any key to stop autoboot: 0
=> i2c dev 0
Setting bus to 0
=> i2c probe
Valid chip addresses: 57 6F
=> i2c md 0x57 0x0 1
0000: a5 .
=> i2c mw 0x57 0x0 0x5a 1
=> i2c md 0x57 0x0 1
0000: 5a Z
=> i2c md 0x57 0x2 1
0002: 99 .
=> i2c mw 0x57 0x2 0xa9 1
=> i2c md 0x57 0x2 1
0002: a9 .
=> i2c md 0x6f 0x20 1
0020: 5a Z
=> i2c md 0x6f 0x5f 1
005f: a5 .
=> i2c mw 0x6f 0x20 0xa9 1
=> i2c mw 0x6f 0x5f 0xa9 1
=> i2c md 0x6f 0x20 1
0020: a9 .
=> i2c md 0x6f 0x5f 1
005f: a9 .
=>
Pragnesh Patel (2):
i2c: ocores: add i2c driver for OpenCores I2C controller
riscv: sifive/fu540: kconfig: Enable support for Opencores I2C
controller
arch/riscv/cpu/fu540/Kconfig | 2 + board/sifive/fu540/Kconfig | 1 + drivers/i2c/Kconfig | 7 + drivers/i2c/Makefile | 1 + drivers/i2c/ocores_i2c.c | 637 +++++++++++++++++++++++++++++++++++ 5 files changed, 648 insertions(+) create mode 100644 drivers/i2c/ocores_i2c.c
Signature · 1 line
2.17.1
PATCH v3 1/2 i2c: ocores: add i2c driver for OpenCores I2C controller
Add support for the OpenCores I2C controller IP core (See http://www.opencores.org/projects.cgi/web/i2c/overview).
This driver implementation is inspired from the Linux OpenCores I2C driver available.
Thanks to Peter Korsgaard <[email protected]> for writing Linux OpenCores I2C driver.
---
Changes in v3:
- Rebase to master and add missing #include <dm/device_compat.h>
Changes in v2:
- Remove TYPE_SIFIVE_REV0 flag
- Update the Opencores I2C Controller Link
drivers/i2c/Kconfig | 7 + drivers/i2c/Makefile | 1 + drivers/i2c/ocores_i2c.c | 637 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 645 insertions(+) create mode 100644 drivers/i2c/ocores_i2c.c
drivers/i2c/Kconfig +7 -0
@@ -342,6 +342,13 @@ config SYS_I2C_NEXELL have several I2C ports and all are provided, controlled by the device tree. +config SYS_I2C_OCORES + bool "ocores I2C driver" + depends on DM_I2C + help + Add support for ocores I2C controller. For details see + https://opencores.org/projects/i2c + config SYS_I2C_OMAP24XX bool "TI OMAP2+ I2C driver" depends on ARCH_OMAP2PLUS || ARCH_K3
drivers/i2c/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_SYS_I2C_MESON) += meson_i2c.o obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_NEXELL) += nx_i2c.o +obj-$(CONFIG_SYS_I2C_OCORES) += ocores_i2c.o obj-$(CONFIG_SYS_I2C_OCTEON) += octeon_i2c.o obj-$(CONFIG_SYS_I2C_OMAP24XX) += omap24xx_i2c.o obj-$(CONFIG_SYS_I2C_RCAR_I2C) += rcar_i2c.o
drivers/i2c/ocores_i2c.c new file +637 -0
637 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/2 riscv: sifive/fu540: kconfig: Enable support for Opencores I2C controller
In reply to Pragnesh PatelEnable support for SiFive FU540 Opencores I2C master controller.
---
(no changes since v1)
arch/riscv/cpu/fu540/Kconfig | 2 ++ board/sifive/fu540/Kconfig | 1 + 2 files changed, 3 insertions(+)
arch/riscv/cpu/fu540/Kconfig +2 -0
@@ -35,6 +35,8 @@ config SIFIVE_FU540 imply SIFIVE_OTP imply DM_PWM imply PWM_SIFIVE + imply DM_I2C + imply SYS_I2C_OCORES if ENV_IS_IN_SPI_FLASH
board/sifive/fu540/Kconfig +1 -0
@@ -47,5 +47,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply SPI_FLASH_ISSI imply SYSRESET imply SYSRESET_GPIO + imply CMD_I2C endif
Signature · 1 line
2.17.1
v3 cover Add OpenCores I2C controller driver
In reply to Pragnesh PatelHello Pragnesh,
Am 14.11.20 um 10:12 schrieb Pragnesh Patel:
Quoted 49 lines
This driver has been tested on HiFive Unleashed with a PMOD based RTCC sensor connected to I2C pins J1 header of the board.
This series is available here [1] for testing
[1] https://github.com/pragnesh26992/u-boot/tree/i2cTested-by Sagar Shrikant Kadam <[email protected]>Changes in v3:
- Rebase to master and add missing #include <dm/device_compat.h>Changes in v2:
- RemoveTYPE_SIFIVE_REV0flag
- Update the Opencores I2C Controller LinkU-Boot Logs for reference:
Hit any key to stop autoboot: 0
=> i2c dev 0
Setting bus to 0
=> i2c probe
Valid chip addresses: 57 6F
=> i2c md0x570x01
0000: a5 .
=> i2c mw0x570x00x5a1
=> i2c md0x570x01
0000: 5a Z
=> i2c md0x570x21
0002: 99 .
=> i2c mw0x570x20xa91
=> i2c md0x570x21
0002: a9 .
=> i2c md0x6f0x201
0020: 5a Z
=> i2c md0x6f0x5f1
005f: a5 .
=> i2c mw0x6f0x200xa91
=> i2c mw0x6f0x5f0xa91
=> i2c md0x6f0x201
0020: a9 .
=> i2c md0x6f0x5f1
005f: a9 .
=>Pragnesh Patel (2):
i2c: ocores: add i2c driver for OpenCores I2C controller
riscv: sifive/fu540: kconfig: Enable support for Opencores I2C
controller
Quoted 7 lines
arch/riscv/cpu/fu540/Kconfig | 2 + board/sifive/fu540/Kconfig | 1 + drivers/i2c/Kconfig | 7 + drivers/i2c/Makefile | 1 + drivers/i2c/ocores_i2c.c | 637 +++++++++++++++++++++++++++++++++++ 5 files changed, 648 insertions(+) create mode 100644 drivers/i2c/ocores_i2c.c
Series applied to u-boot-i2c
Thanks!
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de