i2c: Add a DM_I2C driver for the sun6i P2WI controller
authorSamuel Holland <samuel@sholland.org>
Fri, 8 Oct 2021 05:17:20 +0000 (00:17 -0500)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 12 Oct 2021 08:50:56 +0000 (09:50 +0100)
commit104950a7feae7926e40676f27cfbd279a43b4bc3
treece45115b87c8d40491d8b1e3e44fcb1aaf050901
parent4ab39e74b640799748dfdef49f099b416a5ae497
i2c: Add a DM_I2C driver for the sun6i P2WI controller

This bus controller is used to communicate with an X-Powers AXP PMIC.
Currently, various drivers access PMIC registers through a platform-
specific non-DM "pmic_bus" interface, which depends on the legacy I2C
framework. In order to convert those drivers to use DM_PMIC, this bus
needs a DM_I2C driver.

Refactor the p2wi functions to take the base address as a parameter,
and implement both the existing interface (which is still needed in
SPL) and the DM_I2C interface on top of them.

The register for switching between I2C/P2WI/RSB mode is the same across
all PMIC variants. Move that to the common header, so it can be used by
both interface implementations.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-sunxi/Makefile
arch/arm/mach-sunxi/p2wi.c [deleted file]
arch/arm/mach-sunxi/pmic_bus.c
drivers/i2c/Kconfig
drivers/i2c/Makefile
drivers/i2c/sun6i_p2wi.c [new file with mode: 0644]
include/axp_pmic.h