socsvn commit: r240464 - in
soc2012/aleek/beaglexm-armv6/sys/arm/ti: . omap3 twl
aleek at FreeBSD.org
aleek at FreeBSD.org
Fri Aug 17 11:31:34 UTC 2012
Author: aleek
Date: Fri Aug 17 11:31:31 2012
New Revision: 240464
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240464
Log:
reverted TWL function to the original state. In this way, twl setup (voltage and clocks) is done after the bootup, but before root mounting. Also fixed few bugs
Modified:
soc2012/aleek/beaglexm-armv6/sys/arm/ti/common.c
soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c
soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c
soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl.c
soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_clks.c
soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/common.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/common.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/common.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -70,7 +70,7 @@
}
#endif
-#if defined( SOC_TI_AM335X ) || defined( SOC_TI_AM37X )
+#if defined( SOC_TI_AM335X ) || defined( SOC_OMAP3 )
static int
fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
int *pol)
@@ -91,7 +91,7 @@
#ifdef SOC_OMAP4
&fdt_gic_decode_ic,
#endif
-#if defined( SOC_TI_AM335X ) || defined( SOC_TI_AM37X )
+#if defined( SOC_TI_AM335X ) || defined( SOC_OMAP3 )
&fdt_aintc_decode_ic,
#endif
NULL
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -756,8 +756,6 @@
sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | RF_SHAREABLE); //@TODO XXX Why shareable?
sc->profile = OMAP_GPTIMER_PROFILE_OMAP3;
- //device_printf( dev, "done!\n" );
-
return 0;
}
@@ -892,7 +890,7 @@
/* Restore interrupt state */
restore_interrupts(oldirqstate);
- omap3_gptimer_et.et_name = "AM37x EventTimer0",
+ omap3_gptimer_et.et_name = "OMAP3 EventTimer0",
omap3_gptimer_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
omap3_gptimer_et.et_quality = 1000;
omap3_gptimer_et.et_frequency = tick; //@todo XXX FIXIT
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_i2c.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -180,7 +180,6 @@
static inline uint16_t
ti_i2c_read_2(struct ti_i2c_softc *sc, bus_size_t off)
{
- device_printf(sc->sc_dev, "%s\n", __func__);
return bus_read_2(sc->sc_mem_res, off);
}
@@ -199,7 +198,6 @@
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\n", __func__);
bus_write_2(sc->sc_mem_res, off, val);
}
@@ -219,7 +217,6 @@
static inline uint16_t
ti_i2c_read_reg(struct ti_i2c_softc *sc, bus_size_t off)
{
- device_printf(sc->sc_dev, "%s\n", __func__);
return bus_read_2(sc->sc_mem_res, off);
}
@@ -239,7 +236,6 @@
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\n", __func__);
bus_write_2(sc->sc_mem_res, off, val);
}
@@ -289,8 +285,6 @@
struct ti_i2c_clock_config *clkcfg;
uint16_t con_reg;
- device_printf(dev, "%s\n", __func__);
-
clkcfg = ti_i2c_clock_configs;
while (clkcfg->speed != -1) {
if (clkcfg->speed == speed)
@@ -355,8 +349,6 @@
struct ti_i2c_softc *sc = (struct ti_i2c_softc*) arg;
uint16_t status;
- device_printf(sc->sc_dev, "%s\n", __func__);
-
status = ti_i2c_read_reg(sc, I2C_REG_STAT);
if (status == 0)
return;
@@ -403,16 +395,13 @@
int start_ticks = ticks;
int rc;
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
TI_I2C_ASSERT_LOCKED(sc);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* check if the condition has already occured, the interrupt routine will
* clear the status flags.
*/
if ((sc->sc_stat_flags & flags) == 0) {
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* condition(s) haven't occured so sleep on the IRQ */
while (waittime > 0) {
@@ -434,7 +423,6 @@
}
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* copy the actual status bits */
if (statp != NULL)
*statp = sc->sc_stat_flags;
@@ -509,14 +497,12 @@
uint32_t sofar = 0;
uint32_t i;
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* wait for the bus to become free */
err = ti_i2c_wait_for_free_bus(sc, timo);
if (err != 0) {
device_printf(sc->sc_dev, "bus never freed\n");
return (err);
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* set the events to wait for */
events = I2C_IE_RDR | /* Receive draining interrupt */
@@ -528,11 +514,9 @@
/* enable interrupts for the events we want */
ti_i2c_set_intr_enable(sc, events);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* write the number of bytes to read */
ti_i2c_write_reg(sc, I2C_REG_CNT, len);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* clear the write bit and initiate the read transaction. Setting the STT
* (start) bit initiates the transfer.
*/
@@ -541,18 +525,14 @@
con_reg |= I2C_CON_MST | I2C_CON_STT | I2C_CON_STP;
ti_i2c_write_reg(sc, I2C_REG_CON, con_reg);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* reading loop */
while (1) {
-
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* wait for an event */
err = ti_i2c_wait(sc, events, &status, timo);
if (err != 0) {
break;
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* check for the error conditions */
if (status & I2C_STAT_NACK) {
/* no ACK from slave */
@@ -611,7 +591,6 @@
ti_i2c_write_reg(sc, I2C_REG_STAT, I2C_STAT_RDR | I2C_STAT_RRDY);
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* reset the registers regardless if there was an error or not */
ti_i2c_set_intr_enable(sc, 0x0000);
ti_i2c_write_reg(sc, I2C_REG_CON, I2C_CON_I2C_EN | I2C_CON_MST | I2C_CON_STP);
@@ -646,12 +625,10 @@
uint32_t sofar = 0;
uint32_t i;
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* wait for the bus to become free */
err = ti_i2c_wait_for_free_bus(sc, timo);
if (err != 0)
return (err);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* set the events to wait for */
events = I2C_IE_XDR | /* Transmit draining interrupt */
@@ -663,11 +640,9 @@
/* enable interrupts for the events we want*/
ti_i2c_set_intr_enable(sc, events);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* write the number of bytes to write */
ti_i2c_write_reg(sc, I2C_REG_CNT, len);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* set the write bit and initiate the write transaction. Setting the STT
* (start) bit initiates the transfer.
*/
@@ -678,7 +653,6 @@
/* writing loop */
while (1) {
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* wait for an event */
err = ti_i2c_wait(sc, events, &status, timo);
if (err != 0) {
@@ -771,8 +745,6 @@
uint16_t len;
uint8_t *buf;
- device_printf(sc->sc_dev, "%s\n", __func__);
-
TI_I2C_LOCK(sc);
for (i = 0; i < nmsgs; i++) {
@@ -820,7 +792,6 @@
ti_i2c_callback(device_t dev, int index, caddr_t data)
{
int error = 0;
- device_printf(dev, "%s\n", __func__);
switch (index) {
case IIC_REQUEST_BUS:
@@ -1121,7 +1092,6 @@
device_printf(dev, "I2C revision %d.%d\n", sc->sc_rev >> 4,
sc->sc_rev & 0xf);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Activate the H/W */
err = ti_i2c_activate(dev);
if (err) {
@@ -1129,23 +1099,19 @@
goto out;
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* activate the interrupt */
err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
NULL, ti_i2c_intr, sc, &sc->sc_irq_h);
if (err)
goto out;
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Attach to the iicbus */
if ((sc->sc_iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
device_printf(dev, "could not allocate iicbus instance\n");
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Probe and attach the iicbus */
bus_generic_attach(dev);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
out:
if (err) {
ti_i2c_deactivate(dev);
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -177,7 +177,6 @@
int rc;
sc = device_get_softc(dev);
- device_printf(sc->sc_dev, "%s\n", __func__);
TWL_LOCK(sc);
addr = sc->sc_subaddr_map[nsub];
@@ -238,7 +237,6 @@
memcpy(&tmp_buf[1], buf, cnt);
sc = device_get_softc(dev);
- device_printf(sc->sc_dev, "%s\n", __func__);
TWL_LOCK(sc);
addr = sc->sc_subaddr_map[nsub];
@@ -280,7 +278,6 @@
{
struct iic_msg msg;
uint8_t tmp;
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Set the address to read from */
msg.slave = addr;
@@ -291,7 +288,6 @@
if (iicbus_transfer(sc->sc_dev, &msg, 1) != 0)
return (EIO);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
return (0);
}
@@ -314,7 +310,7 @@
uint8_t base = TWL_CHIP_ID0;
sc = device_get_softc((device_t)dev);
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
+ device_printf(sc->sc_dev, "Running %s\n", __func__);
memset(devs, TWL_INVALID_CHIP_ID, TWL_MAX_SUBADDRS);
@@ -327,14 +323,13 @@
device_printf(sc->sc_dev, "Found (sub)device at 0x%02x\n", (base + i));
}
}
- device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
TWL_LOCK(sc);
memcpy(sc->sc_subaddr_map, devs, TWL_MAX_SUBADDRS);
TWL_UNLOCK(sc);
/* Finished with the interrupt hook */
- //config_intrhook_disestablish(&sc->sc_scan_hook);
+ config_intrhook_disestablish(&sc->sc_scan_hook);
}
/**
@@ -418,12 +413,11 @@
/* We have to wait until interrupts are enabled. I2C read and write
* only works if the interrupts are available.
*/
- //sc->sc_scan_hook.ich_func = twl_scan;
- //sc->sc_scan_hook.ich_arg = dev;
+ sc->sc_scan_hook.ich_func = twl_scan;
+ sc->sc_scan_hook.ich_arg = dev;
- //if (config_intrhook_establish(&sc->sc_scan_hook) != 0)
- // return (ENOMEM);
- twl_scan( dev );
+ if (config_intrhook_establish(&sc->sc_scan_hook) != 0)
+ return (ENOMEM);
/* FIXME: should be in DTS file */
if ((sc->sc_vreg = device_add_child(dev, "twl_vreg", -1)) == NULL)
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_clks.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_clks.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_clks.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -586,6 +586,7 @@
struct twl_clks_softc *sc;
sc = device_get_softc((device_t)dev);
+ device_printf(sc->sc_dev, "Running %s\n", __func__);
if (twl_is_4030(sc->sc_pdev))
twl_clks_add_clocks(sc, twl4030_clocks);
Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c
==============================================================================
--- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Fri Aug 17 05:51:46 2012 (r240463)
+++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Fri Aug 17 11:31:31 2012 (r240464)
@@ -280,7 +280,6 @@
twl_vreg_read_1(struct twl_vreg_softc *sc, struct twl_regulator_entry *regulator,
uint8_t off, uint8_t *val)
{
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
return (twl_read(sc->sc_pdev, regulator->sub_dev,
regulator->reg_off + off, val, 1));
}
@@ -289,7 +288,6 @@
twl_vreg_write_1(struct twl_vreg_softc *sc, struct twl_regulator_entry *regulator,
uint8_t off, uint8_t val)
{
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
return (twl_write(sc->sc_pdev, regulator->sub_dev,
regulator->reg_off + off, &val, 1));
}
@@ -373,8 +371,6 @@
uint8_t state;
int xlocked;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
-
if (enabled == NULL)
return (EINVAL);
@@ -448,8 +444,6 @@
uint8_t grp;
int xlocked;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
-
TWL_VREG_ASSERT_LOCKED(sc);
xlocked = sx_xlocked(&sc->sc_sx);
@@ -513,8 +507,6 @@
uint8_t grp;
int xlocked;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
-
TWL_VREG_ASSERT_LOCKED(sc);
xlocked = sx_xlocked(&sc->sc_sx);
@@ -581,8 +573,6 @@
uint8_t vsel;
int xlocked;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
-
TWL_VREG_ASSERT_LOCKED(sc);
/* If millivolts is zero then we simply disable the output */
@@ -651,29 +641,23 @@
int xlocked;
uint8_t vsel;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, regulator->name);
TWL_VREG_ASSERT_LOCKED(sc);
- //device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Need to upgrade the lock because checking enabled state and voltage
* should be atomic.
*/
- //device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
xlocked = sx_xlocked(&sc->sc_sx);
if (!xlocked)
TWL_VREG_LOCK_UPGRADE(sc);
- //device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
/* Check if the regulator is currently enabled */
- //device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
err = twl_vreg_is_regulator_enabled(sc, regulator, &en);
if (err)
{
device_printf( sc->sc_dev, "Regulator %s is not enabled\n", regulator->name );
goto done;
}
- //device_printf(sc->sc_dev, "%s:%d\n", __func__, __LINE__);
*millivolts = 0;
if (!en)
@@ -741,8 +725,6 @@
sc = device_get_softc(dev);
- device_printf(sc->sc_dev, "%s - %s\n", __func__, name);
-
TWL_VREG_SLOCK(sc);
LIST_FOREACH(regulator, &sc->sc_vreg_list, entries) {
@@ -783,7 +765,6 @@
sc = device_get_softc(dev);
- device_printf(sc->sc_dev, "%s - %s\n", __func__, name);
TWL_VREG_SLOCK(sc);
@@ -871,8 +852,6 @@
struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
struct twl_regulator_entry *new;
- device_printf(sc->sc_dev, "%s - %s\n", __func__, name);
-
new = malloc(sizeof(struct twl_regulator_entry), M_DEVBUF, M_NOWAIT | M_ZERO);
if (new == NULL)
return (NULL);
@@ -929,7 +908,6 @@
int len = 0, prop_len;
- device_printf(sc->sc_dev, "%s\n", __func__);
/* Add the regulators from the list */
walker = ®ulators[0];
while (walker->name != NULL) {
@@ -970,7 +948,6 @@
}
}
}
- device_printf(sc->sc_dev, "%s\n", __func__);
#if 0
twl_vreg_set_voltage(sc->sc_dev, "vusb1v5", 1500);
twl_vreg_set_voltage(sc->sc_dev, "vusb1v8", 1800);
@@ -1005,7 +982,7 @@
struct twl_vreg_softc *sc;
sc = device_get_softc((device_t)dev);
- device_printf(dev, "%s\n", __func__);
+ device_printf(sc->sc_dev, "Running %s\n", __func__);
TWL_VREG_XLOCK(sc);
@@ -1016,7 +993,7 @@
TWL_VREG_XUNLOCK(sc);
- //config_intrhook_disestablish(&sc->sc_init_hook);
+ config_intrhook_disestablish(&sc->sc_init_hook);
}
static int
@@ -1049,12 +1026,11 @@
/* We have to wait until interrupts are enabled. I2C read and write
* only works if the interrupts are available.
*/
- //sc->sc_init_hook.ich_func = twl_vreg_init;
- //sc->sc_init_hook.ich_arg = dev;
+ sc->sc_init_hook.ich_func = twl_vreg_init;
+ sc->sc_init_hook.ich_arg = dev;
- //if (config_intrhook_establish(&sc->sc_init_hook) != 0)
- // return (ENOMEM);
- twl_vreg_init( dev );
+ if (config_intrhook_establish(&sc->sc_init_hook) != 0)
+ return (ENOMEM);
return (0);
}
More information about the svn-soc-all
mailing list