diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2016-01-14 14:06:26 +0100 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2016-01-21 07:30:01 +0100 |
commit | 9d0826879e13e8139a7b169c2365225e848ff57e (patch) | |
tree | b98b0a2fdac16b1c8b22f0d4b527509ed6b02d60 /arch/arm/cpu/armv7 | |
parent | 904dfbfd67fbdf4562236efb3f0769ecfe7a7e58 (diff) | |
download | u-boot-imx-9d0826879e13e8139a7b169c2365225e848ff57e.zip u-boot-imx-9d0826879e13e8139a7b169c2365225e848ff57e.tar.gz u-boot-imx-9d0826879e13e8139a7b169c2365225e848ff57e.tar.bz2 |
sunxi: Add support for the I2C controller which is part of the PRCM
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
[hdegoede@redhat.com: Minor cleanups]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
applied with fixing 2 checkpatch warnings:
WARNING: please, no space before tabs
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'arch/arm/cpu/armv7')
-rw-r--r-- | arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 10 | ||||
-rw-r--r-- | arch/arm/cpu/armv7/sunxi/prcm.c | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c index 4501884..1da5455 100644 --- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c +++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c @@ -77,6 +77,16 @@ int clock_twi_onoff(int port, int state) struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; + if (port == 5) { + if (state) + prcm_apb0_enable( + PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_I2C); + else + prcm_apb0_disable( + PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_I2C); + return 0; + } + /* set the apb clock gate for twi */ if (state) setbits_le32(&ccm->apb2_gate, diff --git a/arch/arm/cpu/armv7/sunxi/prcm.c b/arch/arm/cpu/armv7/sunxi/prcm.c index 19b4938..e1d091f 100644 --- a/arch/arm/cpu/armv7/sunxi/prcm.c +++ b/arch/arm/cpu/armv7/sunxi/prcm.c @@ -33,3 +33,15 @@ void prcm_apb0_enable(u32 flags) /* deassert reset for module */ setbits_le32(&prcm->apb0_reset, flags); } + +void prcm_apb0_disable(u32 flags) +{ + struct sunxi_prcm_reg *prcm = + (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE; + + /* assert reset for module */ + clrbits_le32(&prcm->apb0_reset, flags); + + /* close the clock for module */ + clrbits_le32(&prcm->apb0_gate, flags); +} |