aboutsummaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3288/include
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2015-02-09 17:40:58 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-17 09:59:19 +0200
commit7f70ad610b23ef389c73b61a73d0920b77da4460 (patch)
tree0fcf96145528beed79a76f2031b38625ef51e82c /src/soc/rockchip/rk3288/include
parent1c2748d113014e7e675e6ece17c6e916a6a4ec7d (diff)
rk3288: Add software I2C support
This patch adds the necessary platform glue to allow the use of software-driven I2C bit banging on the RK3288. This is just a debugging feature that can be used to reproduce certain I2C failure cases. Also fix Makefile verstage linking for the feature and add some new rk3288 IOMUX macros as needed. BRANCH=None BUG=None TEST=Added "CONFIG_SOFTWARE_I2C=y" to configs/config.veyron_jerry, wrapped Jerry's bootblock and verstage in software_i2c_attach/detach() calls, confirmed that both PMIC and TPM could be driven correctly with software I2C driver. Tried out different combinations of software_i2c_wedge_ack() and software_i2c_wedge_read() on the PMIC and observed transfer results with the hardware controller after reboot... the worst that would happen is that the first register read-modify-write (DCDC_ILMAX) would fail to read, but all later transfers would be fine. Since that register is written twice (due to current BUCK1 ramp implementation) and is not terribily important anyway, I think we don't need to worry about wedging problems. Change-Id: Iba801ee61d30fb1fd3aef8300612c67fa50c441b Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 24dfca9bab38a20c40ef0c2dd4c775b8d8f47487 Original-Change-Id: I96777300a57c85471bad20e23a455551e9970222 Original-Signed-off-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/247890 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9757 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/rockchip/rk3288/include')
-rw-r--r--src/soc/rockchip/rk3288/include/soc/grf.h7
-rw-r--r--src/soc/rockchip/rk3288/include/soc/i2c.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/soc/rockchip/rk3288/include/soc/grf.h b/src/soc/rockchip/rk3288/include/soc/grf.h
index 9126aed834..b8c46b5c01 100644
--- a/src/soc/rockchip/rk3288/include/soc/grf.h
+++ b/src/soc/rockchip/rk3288/include/soc/grf.h
@@ -221,4 +221,9 @@ static struct rk3288_sgrf_regs * const rk3288_sgrf = (void *)GRF_SECURE_BASE;
#define IOMUX_EMMCCMD RK_CLRSETBITS(0x3f, 2 << 4 | 2 << 2 | 2 << 0)
#define IOMUX_PWM1 RK_SETBITS(1 << 2)
#define IOMUX_EDP_HOTPLUG RK_CLRSETBITS(0x3 << 6, 0x2 << 6)
-#endif
+
+/* Use to mux a pin back to GPIO function. Since the selector for that is always
+ * 0, we can just reuse RK mask/value patterns and mask out the "value" part. */
+#define IOMUX_GPIO(iomux_clrsetbits) ((iomux_clrsetbits) & (0xffff << 16))
+
+#endif /* __SOC_ROCKCHIP_RK3288_GRF_H__ */
diff --git a/src/soc/rockchip/rk3288/include/soc/i2c.h b/src/soc/rockchip/rk3288/include/soc/i2c.h
index 84d9b7587b..5472423d3c 100644
--- a/src/soc/rockchip/rk3288/include/soc/i2c.h
+++ b/src/soc/rockchip/rk3288/include/soc/i2c.h
@@ -21,6 +21,8 @@
#define __SOC_ROCKCHIP_RK3288_I2C_H__
void i2c_init(unsigned int bus, unsigned int hz);
+void software_i2c_attach(unsigned bus);
+void software_i2c_detach(unsigned bus);
#endif