Date: Tue, 07 Aug 2012 20:16:55 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r240179 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti arm/ti/twl boot/fdt/dts Message-ID: <20120807201655.8DBDD1065672@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: aleek Date: Tue Aug 7 20:16:54 2012 New Revision: 240179 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240179 Log: fixed twl driver issues. Now, TWL seems to work fine Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c Tue Aug 7 19:26:23 2012 (r240178) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c Tue Aug 7 20:16:54 2012 (r240179) @@ -180,6 +180,7 @@ static inline uint16_t ti_i2c_read_2(struct ti_i2c_softc *sc, bus_size_t off) { + //device_printf( sc->sc_dev, "%s offset 0x%02lx\n", __FUNCTION__, off ); return bus_read_2(sc->sc_mem_res, off); } @@ -198,6 +199,7 @@ static inline void ti_i2c_write_2(struct ti_i2c_softc *sc, bus_size_t off, uint16_t val) { + //device_printf( sc->sc_dev, "%s offset 0x%02lx\n", __FUNCTION__, off ); bus_write_2(sc->sc_mem_res, off, val); } @@ -218,6 +220,7 @@ ti_i2c_read_reg(struct ti_i2c_softc *sc, bus_size_t off) { /* XXXOMAP3: FIXME add registers mapping here */ + //device_printf( sc->sc_dev, "%s offset 0x%02lx\n", __FUNCTION__, off ); return bus_read_2(sc->sc_mem_res, off); } @@ -237,6 +240,7 @@ static inline void ti_i2c_write_reg(struct ti_i2c_softc *sc, bus_size_t off, uint16_t val) { + //device_printf( sc->sc_dev, "%s offset 0x%02lx\n", __FUNCTION__, off ); /* XXXOMAP3: FIXME add registers mapping here */ bus_write_2(sc->sc_mem_res, off, val); } @@ -260,9 +264,12 @@ ti_i2c_set_intr_enable(struct ti_i2c_softc *sc, uint16_t ie) { /* XXXOMAP3: FIXME */ + ti_i2c_write_2(sc, I2C_REG_IE, ie); + /* ti_i2c_write_2(sc, I2C_REG_IRQENABLE_CLR, 0xffff); if (ie) ti_i2c_write_2(sc, I2C_REG_IRQENABLE_SET, ie); + */ } /** @@ -1082,7 +1089,8 @@ /* XXXOMAP3: FIXME get proper revision here */ /* First read the version number of the I2C module */ - sc->sc_rev = ti_i2c_read_2(sc, I2C_REG_REVNB_HI) & 0xff; + //@todo aleek fix this change cause dmarion will be pissed ;) + sc->sc_rev = ti_i2c_read_2(sc, I2C_REG_REVNB_LO) & 0xff; device_printf(dev, "I2C revision %d.%d\n", sc->sc_rev >> 4, sc->sc_rev & 0xf); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.h Tue Aug 7 19:26:23 2012 (r240178) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.h Tue Aug 7 20:16:54 2012 (r240179) @@ -34,7 +34,7 @@ * Simply contains register bit flags. */ -#if defined(SOC_TI_AM37X) || defined(SOC_OMAP4) +#if defined(SOC_TI_AM335X) || defined(SOC_OMAP4) /* * OMAP4 I2C Registers, Summary 1 @@ -114,8 +114,8 @@ #elif defined( SOC_TI_AM37X ) || defined( SOC_OMAP3 ) -#define I2C_REV 0x00 -#define I2C_IE 0x04 +#define I2C_REG_REV 0x00 +#define I2C_REG_IE 0x04 #define I2C_IE_XDR (1UL << 14) /* Transmit draining interrupt */ #define I2C_IE_RDR (1UL << 13) /* Receive draining interrupt */ #define I2C_IE_AAS (1UL << 9) /* Addressed as Slave interrupt */ @@ -128,7 +128,7 @@ #define I2C_IE_ARDY (1UL << 2) /* Register Access Ready interrupt */ #define I2C_IE_NACK (1UL << 1) /* No Acknowledgment interrupt */ #define I2C_IE_AL (1UL << 0) /* Arbitration Lost interrupt */ -#define I2C_STAT 0x08 +#define I2C_REG_STAT 0x08 #define I2C_STAT_XDR (1UL << 14) #define I2C_STAT_RDR (1UL << 13) #define I2C_STAT_BB (1UL << 12) @@ -144,11 +144,11 @@ #define I2C_STAT_ARDY (1UL << 2) #define I2C_STAT_NACK (1UL << 1) #define I2C_STAT_AL (1UL << 0) -#define I2C_SYSS 0x10 -#define I2C_BUF 0x14 -#define I2C_CNT 0x18 -#define I2C_DATA 0x1C -#define I2C_CON 0x24 +#define I2C_REG_SYSS 0x10 +#define I2C_REG_BUF 0x14 +#define I2C_REG_CNT 0x18 +#define I2C_REG_DATA 0x1C +#define I2C_REG_CON 0x24 #define I2C_CON_I2C_EN (1UL << 15) #define I2C_CON_OPMODE_STD (0UL << 12) #define I2C_CON_OPMODE_HS (1UL << 12) @@ -165,21 +165,22 @@ #define I2C_CON_STP (1UL << 1) #define I2C_CON_STT (1UL << 0) -#define I2C_OA0 0x28 -#define I2C_SA 0x2C -#define I2C_PSC 0x30 -#define I2C_SCLL 0x34 -#define I2C_SCLH 0x38 -#define I2C_SYSTEST 0x3C -#define I2C_BUFSTAT 0x40 -#define I2C_OA1 0x44 -#define I2C_OA2 0x48 -#define I2C_OA3 0x4C -#define I2C_ACTOA 0x50 -#define I2C_SBLOCK 0x54 +#define I2C_REG_OA0 0x28 +#define I2C_REG_SA 0x2C +#define I2C_REG_PSC 0x30 +#define I2C_REG_SCLL 0x34 +#define I2C_REG_SCLH 0x38 +#define I2C_REG_SYSTEST 0x3C +#define I2C_REG_BUFSTAT 0x40 +#define I2C_REG_OA1 0x44 +#define I2C_REG_OA2 0x48 +#define I2C_REG_OA3 0x4C +#define I2C_REG_ACTOA 0x50 +#define I2C_REG_SBLOCK 0x54 -#define I2C_OMAP3_SYSC 0x20 -#define I2C_OMAP4_SYSC 0x10 +#define I2C_REG_SYSC 0x20 +#define I2C_REG_REVNB_LO 0x00 +#define I2C_REG_REVNB_HI 0x04 #endif Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Tue Aug 7 19:26:23 2012 (r240178) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Tue Aug 7 20:16:54 2012 (r240179) @@ -558,6 +558,7 @@ int err; uint8_t vsel; int xlocked; + device_printf( sc->sc_dev, "%s\n", __FUNCTION__ ); TWL_VREG_ASSERT_LOCKED(sc); @@ -626,6 +627,7 @@ int en = 0; int xlocked; uint8_t vsel; + device_printf( sc->sc_dev, "%s\n", __FUNCTION__ ); TWL_VREG_ASSERT_LOCKED(sc); @@ -829,12 +831,14 @@ struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); struct twl_regulator_entry *new; + device_printf( sc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ ); new = malloc(sizeof(struct twl_regulator_entry), M_DEVBUF, M_NOWAIT | M_ZERO); if (new == NULL) return (NULL); + device_printf( sc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ ); strncpy(new->name, name, TWL_VREG_MAX_NAMELEN); new->name[TWL_VREG_MAX_NAMELEN - 1] = '\0'; @@ -847,6 +851,7 @@ new->num_supp_voltages = num_voltages; + device_printf( sc->sc_dev, "%s:%d\n", __FUNCTION__, __LINE__ ); /* Add a sysctl entry for the voltage */ new->oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, name, CTLTYPE_INT | CTLFLAG_RD, sc, 0, Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Aug 7 19:26:23 2012 (r240178) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Tue Aug 7 20:16:54 2012 (r240179) @@ -186,7 +186,6 @@ mmchs-device-id = <1>; }; - i2c1: i2c@48070000 { #address-cells = <1>; #size-cells = <0>; @@ -195,9 +194,9 @@ interrupts = <56>; interrupt-parent = <&AINTC>; i2c-device-id = <1>; - pmic@24 { + pmic@48 { compatible = "ti,twl4030"; - reg = <0x24>; + reg = <0x48>; }; };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120807201655.8DBDD1065672>