mbox series

[v3,0/3] Add I2C support on TH1520

Message ID 20240618-i2c-th1520-v3-0-3042590a16b1@bootlin.com (mailing list archive)
Headers show
Series Add I2C support on TH1520 | expand

Message

Thomas Bonnefille June 18, 2024, 7:42 a.m. UTC
This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
and a default configuration for the BeagleV-Ahead. It appears that the
TH1520 I2C is already supported in the upstream kernel through the
Synopsis Designware I2C adapter driver.

This patch depends on the clock patch from Drew Fustini
Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
and the pinctrl patch from Emil Renner Berthing
Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com

Changed from v1:
1. Remove redundant example for Synopsis DesignWare-I2C bindings
2. Remove Node Ordering commit as it has already been taken
3. Remove EEPROM label
4. Rebase on pinctrl and clock driver patches
5. Add pinctrl configuration
6. Replaced the fixed-clock with a correct configuration

Changed from v2:
1. Reorder nodes to conserve ascending register node ordering
2. Add support for I2C2 as it probably use the same controller
3. Format comments to match kernel coding style
4. Reorder nodes to conserve alphabetical node ordering
6. Declare I2C2
6. Set pinctrl pull-up resistor to the highest value

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
Thomas Bonnefille (3):
      dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
      riscv: dts: thead: Add TH1520 I2C nodes
      riscv: dts: thead: Enable I2C on the BeagleV-Ahead

 .../bindings/i2c/snps,designware-i2c.yaml          |  4 ++
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 84 ++++++++++++++++++++++
 arch/riscv/boot/dts/thead/th1520.dtsi              | 60 ++++++++++++++++
 3 files changed, 148 insertions(+)
---
base-commit: c7cdaf7e82015e7037131381bec6ba4b2b1eface
change-id: 20240425-i2c-th1520-fc3ce1a8b472

Best regards,

Comments

Drew Fustini June 25, 2024, 9:28 p.m. UTC | #1
On Tue, Jun 18, 2024 at 09:42:37AM +0200, Thomas Bonnefille wrote:
> This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
> and a default configuration for the BeagleV-Ahead. It appears that the
> TH1520 I2C is already supported in the upstream kernel through the
> Synopsis Designware I2C adapter driver.
> 
> This patch depends on the clock patch from Drew Fustini
> Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
> and the pinctrl patch from Emil Renner Berthing
> Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com
> 
> Changed from v1:
> 1. Remove redundant example for Synopsis DesignWare-I2C bindings
> 2. Remove Node Ordering commit as it has already been taken
> 3. Remove EEPROM label
> 4. Rebase on pinctrl and clock driver patches
> 5. Add pinctrl configuration
> 6. Replaced the fixed-clock with a correct configuration
> 
> Changed from v2:
> 1. Reorder nodes to conserve ascending register node ordering
> 2. Add support for I2C2 as it probably use the same controller
> 3. Format comments to match kernel coding style
> 4. Reorder nodes to conserve alphabetical node ordering
> 6. Declare I2C2
> 6. Set pinctrl pull-up resistor to the highest value
> 
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
> Thomas Bonnefille (3):
>       dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
>       riscv: dts: thead: Add TH1520 I2C nodes
>       riscv: dts: thead: Enable I2C on the BeagleV-Ahead
> 
>  .../bindings/i2c/snps,designware-i2c.yaml          |  4 ++
>  arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 84 ++++++++++++++++++++++
>  arch/riscv/boot/dts/thead/th1520.dtsi              | 60 ++++++++++++++++
>  3 files changed, 148 insertions(+)

The I2C controllers and the EEPROM probe okay on the BeagleV Ahead:

[    3.834654] i2c_dev: i2c /dev entries driver
[    4.037875] at24 0-0050: supply vcc not found, using dummy regulator
[    4.050303] at24 0-0050: 4096 byte 24c32 EEPROM, writable, 1 bytes/write

The EEPROM on I2C0 is working correctly:

# hexdump -C /sys/class/i2c-dev/i2c-0/device/0-0050/eeprom
[  196.438252] random: crng init done
00000000  42 45 41 47 4c 45 56 2d  41 48 45 41 44 2d 41 30  |BEAGLEV-AHEAD-A0|
00000010  0a ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00001000

I did have to modify the .config to enable the necessary drivers.

Could you add patch that includes these in arch/riscv/configs/defconfig?

CONFIG_I2C_DESIGNWARE_CORE
CONFIG_I2C_DESIGNWARE_PLATFORM 
CONFIG_EEPROM_AT24

Thanks,
Drew
Andi Shyti June 28, 2024, 9:30 a.m. UTC | #2
Hi,

On Tue, Jun 18, 2024 at 09:42:37AM GMT, Thomas Bonnefille wrote:
> This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
> and a default configuration for the BeagleV-Ahead. It appears that the
> TH1520 I2C is already supported in the upstream kernel through the
> Synopsis Designware I2C adapter driver.
> 
> This patch depends on the clock patch from Drew Fustini
> Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
> and the pinctrl patch from Emil Renner Berthing
> Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com

I think after these two go in...

> Changed from v1:
> 1. Remove redundant example for Synopsis DesignWare-I2C bindings
> 2. Remove Node Ordering commit as it has already been taken
> 3. Remove EEPROM label
> 4. Rebase on pinctrl and clock driver patches
> 5. Add pinctrl configuration
> 6. Replaced the fixed-clock with a correct configuration
> 
> Changed from v2:
> 1. Reorder nodes to conserve ascending register node ordering
> 2. Add support for I2C2 as it probably use the same controller
> 3. Format comments to match kernel coding style
> 4. Reorder nodes to conserve alphabetical node ordering
> 6. Declare I2C2
> 6. Set pinctrl pull-up resistor to the highest value
> 
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
> Thomas Bonnefille (3):
>       dt-bindings: i2c: dw: Document compatible thead,th1520-i2c

... this goes throught i2c...

>       riscv: dts: thead: Add TH1520 I2C nodes
>       riscv: dts: thead: Enable I2C on the BeagleV-Ahead

... and these two go thrhough Conor's branches.

Do you mind sending a ping when Drew's patches are included in
the merge window? I can put the first patch on a special branch
to keep it under my watch.

Andi
Conor Dooley June 28, 2024, 10:49 a.m. UTC | #3
On Fri, Jun 28, 2024 at 11:30:28AM +0200, Andi Shyti wrote:
> Hi,
> 
> On Tue, Jun 18, 2024 at 09:42:37AM GMT, Thomas Bonnefille wrote:
> > This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
> > and a default configuration for the BeagleV-Ahead. It appears that the
> > TH1520 I2C is already supported in the upstream kernel through the
> > Synopsis Designware I2C adapter driver.
> > 
> > This patch depends on the clock patch from Drew Fustini
> > Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
> > and the pinctrl patch from Emil Renner Berthing
> > Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com
> 
> I think after these two go in...
> 
> > Changed from v1:
> > 1. Remove redundant example for Synopsis DesignWare-I2C bindings
> > 2. Remove Node Ordering commit as it has already been taken
> > 3. Remove EEPROM label
> > 4. Rebase on pinctrl and clock driver patches
> > 5. Add pinctrl configuration
> > 6. Replaced the fixed-clock with a correct configuration
> > 
> > Changed from v2:
> > 1. Reorder nodes to conserve ascending register node ordering
> > 2. Add support for I2C2 as it probably use the same controller
> > 3. Format comments to match kernel coding style
> > 4. Reorder nodes to conserve alphabetical node ordering
> > 6. Declare I2C2
> > 6. Set pinctrl pull-up resistor to the highest value
> > 
> > Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> > ---
> > Thomas Bonnefille (3):
> >       dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
> 
> ... this goes throught i2c...
> 
> >       riscv: dts: thead: Add TH1520 I2C nodes
> >       riscv: dts: thead: Enable I2C on the BeagleV-Ahead
> 
> ... and these two go thrhough Conor's branches.
> 
> Do you mind sending a ping when Drew's patches are included in
> the merge window? I can put the first patch on a special branch
> to keep it under my watch.

I think you can apply the binding whenever you want actually, there's no
need for the i2c binding (or driver changes, were there to be any) to
be held until the clock binding/driver is accepted.

Thanks,
Conor.
Andi Shyti July 10, 2024, 7:48 a.m. UTC | #4
Hi

On Tue, 18 Jun 2024 09:42:37 +0200, Thomas Bonnefille wrote:
> This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
> and a default configuration for the BeagleV-Ahead. It appears that the
> TH1520 I2C is already supported in the upstream kernel through the
> Synopsis Designware I2C adapter driver.
> 
> This patch depends on the clock patch from Drew Fustini
> Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
> and the pinctrl patch from Emil Renner Berthing
> Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com
> 
> [...]

Applied to i2c/i2c-host on

git://git.kernel.org/pub/scm/linux/kernel/git/local tree

Thank you,
Andi

Patches applied
===============
[1/3] dt-bindings: i2c: dw: Document compatible thead,th1520-i2c
      commit: 00fa2450c11138c1c3171224cd2727a3a6240bae
Krzysztof Kozlowski July 10, 2024, 8:21 a.m. UTC | #5
On 10/07/2024 09:48, Andi Shyti wrote:
> Hi
> 
> On Tue, 18 Jun 2024 09:42:37 +0200, Thomas Bonnefille wrote:
>> This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
>> and a default configuration for the BeagleV-Ahead. It appears that the
>> TH1520 I2C is already supported in the upstream kernel through the
>> Synopsis Designware I2C adapter driver.
>>
>> This patch depends on the clock patch from Drew Fustini
>> Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
>> and the pinctrl patch from Emil Renner Berthing
>> Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com
>>
>> [...]
> 
> Applied to i2c/i2c-host on
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/local tree

Something got odd in the git repo above in your ty letters.

Best regards,
Krzysztof
Andi Shyti July 10, 2024, 1:01 p.m. UTC | #6
Hi Krzysztof,

On Wed, Jul 10, 2024 at 10:21:57AM GMT, Krzysztof Kozlowski wrote:
> On 10/07/2024 09:48, Andi Shyti wrote:
> > Hi
> > 
> > On Tue, 18 Jun 2024 09:42:37 +0200, Thomas Bonnefille wrote:
> >> This adds I2C support in the device tree of the T-Head TH1520 RISCV-SoC
> >> and a default configuration for the BeagleV-Ahead. It appears that the
> >> TH1520 I2C is already supported in the upstream kernel through the
> >> Synopsis Designware I2C adapter driver.
> >>
> >> This patch depends on the clock patch from Drew Fustini
> >> Link: https://lore.kernel.org/linux-riscv/20240615-th1520-clk-v1-0-3ba4978c4d6b@tenstorrent.com
> >> and the pinctrl patch from Emil Renner Berthing
> >> Link: https://lore.kernel.org/linux-riscv/20240103132852.298964-1-emil.renner.berthing@canonical.com
> >>
> >> [...]
> > 
> > Applied to i2c/i2c-host on
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/local tree
> 
> Something got odd in the git repo above in your ty letters.

yes, I also noticed that sometimes b4 ty is not able to resolve
to the right repo. I haven't had the time to check what goes
wrong.

Anyway, thanks, the right repo is:

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Andi