diff options
author | andrew <andrew@FreeBSD.org> | 2016-02-15 15:11:26 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2016-02-15 15:11:26 +0000 |
commit | 3245bc3a66dfd5daa4971aeb91f5d5a8acdf4ddf (patch) | |
tree | 91c814f874e439be5341e83637416d7106d54d30 /sys/arm | |
parent | 355920c5b7ac9de10746af1c20c16d1ab082faa1 (diff) | |
download | FreeBSD-src-3245bc3a66dfd5daa4971aeb91f5d5a8acdf4ddf.zip FreeBSD-src-3245bc3a66dfd5daa4971aeb91f5d5a8acdf4ddf.tar.gz |
Add support for the Allwinner i2c device. This is similar to the existing
Marvell twsi part, however uses different register locations, as such split
the existing driver into Marvell and Allwinner attachments.
While here clean a few style issues.
Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D4846
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/allwinner/a10_clk.c | 23 | ||||
-rw-r--r-- | sys/arm/allwinner/a10_clk.h | 4 | ||||
-rw-r--r-- | sys/arm/allwinner/files.allwinner | 1 | ||||
-rw-r--r-- | sys/arm/conf/A10 | 5 | ||||
-rw-r--r-- | sys/arm/conf/A20 | 5 | ||||
-rw-r--r-- | sys/arm/mv/files.mv | 1 |
6 files changed, 35 insertions, 4 deletions
diff --git a/sys/arm/allwinner/a10_clk.c b/sys/arm/allwinner/a10_clk.c index d49e6d0..177e5a3 100644 --- a/sys/arm/allwinner/a10_clk.c +++ b/sys/arm/allwinner/a10_clk.c @@ -401,6 +401,29 @@ a10_clk_mmc_cfg(int devid, int freq) } int +a10_clk_i2c_activate(int devid) +{ + struct a10_ccm_softc *sc; + uint32_t reg_value; + + sc = a10_ccm_sc; + if (sc == NULL) + return (ENXIO); + + a10_clk_pll6_enable(); + + /* Gating APB clock for I2C/TWI */ + reg_value = ccm_read_4(sc, CCM_APB1_GATING); + if (devid == 4) + reg_value |= CCM_APB1_GATING_TWI << 15; + else + reg_value |= CCM_APB1_GATING_TWI << devid; + ccm_write_4(sc, CCM_APB1_GATING, reg_value); + + return (0); +} + +int a10_clk_dmac_activate(void) { struct a10_ccm_softc *sc; diff --git a/sys/arm/allwinner/a10_clk.h b/sys/arm/allwinner/a10_clk.h index 4df87cc..5cc8863 100644 --- a/sys/arm/allwinner/a10_clk.h +++ b/sys/arm/allwinner/a10_clk.h @@ -121,6 +121,9 @@ /* AHB_GATING_REG1 */ #define CCM_AHB_GATING_GMAC (1 << 17) +/* APB1_GATING_REG */ +#define CCM_APB1_GATING_TWI (1 << 0) + #define CCM_USB_PHY (1 << 8) #define CCM_USB0_RESET (1 << 0) #define CCM_USB1_RESET (1 << 1) @@ -166,6 +169,7 @@ int a10_clk_gmac_activate(phandle_t); int a10_clk_ahci_activate(void); int a10_clk_mmc_activate(int); int a10_clk_mmc_cfg(int, int); +int a10_clk_i2c_activate(int); int a10_clk_dmac_activate(void); int a10_clk_codec_activate(unsigned int); diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index 5157850..2db0da5 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -12,4 +12,5 @@ arm/allwinner/a10_wdog.c standard arm/allwinner/a20/a20_cpu_cfg.c standard arm/allwinner/allwinner_machdep.c standard arm/allwinner/if_emac.c optional emac +dev/iicbus/twsi/a10_twsi.c optional twsi #arm/allwinner/console.c standard diff --git a/sys/arm/conf/A10 b/sys/arm/conf/A10 index 31073c7..577fa60 100644 --- a/sys/arm/conf/A10 +++ b/sys/arm/conf/A10 @@ -66,8 +66,9 @@ device md device random # Entropy device # I2C support -#device iicbus -#device iic +device iicbus +device iic +device twsi # GPIO device gpio diff --git a/sys/arm/conf/A20 b/sys/arm/conf/A20 index cd07264..ded074a 100644 --- a/sys/arm/conf/A20 +++ b/sys/arm/conf/A20 @@ -75,8 +75,9 @@ device md device random # Entropy device # I2C support -#device iicbus -#device iic +device iicbus +device iic +device twsi # GPIO device gpio diff --git a/sys/arm/mv/files.mv b/sys/arm/mv/files.mv index e605aab..29edffb 100644 --- a/sys/arm/mv/files.mv +++ b/sys/arm/mv/files.mv @@ -21,6 +21,7 @@ arm/mv/mv_ts.c standard arm/mv/timer.c standard dev/cesa/cesa.c optional cesa +dev/iicbus/twsi/mv_twsi.c optional twsi dev/mge/if_mge.c optional mge dev/nand/nfc_mv.c optional nand dev/mvs/mvs_soc.c optional mvs |