Beispiel #1
0
/*
set charge current
0. disable charging  
1. usb charging, 500mA
2. usb adapter charging, 2A
3. ac adapter charging , 3A
*/
int pmic_rk808_charger_setting(int current)
{
    debug("%s charger_type = %d\n",__func__,current);
    i2c_set_bus_num(rk808.pmic->bus);
    i2c_init (RK808_I2C_SPEED, 0x6b);
    debug("%s charge ic id = 0x%x\n",__func__,i2c_reg_read(0x6b,0x0a));
    switch (current){
    case 0:
        //disable charging
        break;
    case 1:
        //set charger current to 500ma
        break;
    case 2:
         //set charger current to 1.5A
        i2c_reg_write(0x6b,0,(i2c_reg_read(0x6b,0)&0xf8)|0x6);/* Input Current Limit  2A */
        break;
    case 3:
        //set charger current to 1.5A
        i2c_reg_write(0x6b,0,(i2c_reg_read(0x6b,0)&0xf8)|0x7);/* Input Current Limit 3A */
        break;
    default:
        break;
    }
    return 0;
}
Beispiel #2
0
/* program the regulator (MC34VR500) to support deep sleep */
void ls1twr_program_regulator(void)
{
	unsigned int i2c_bus;
	u8 i2c_device_id;

#define LS1TWR_I2C_BUS_MC34VR500	1
#define MC34VR500_ADDR			0x8
#define MC34VR500_DEVICEID		0x4
#define MC34VR500_DEVICEID_MASK		0x0f

	i2c_bus = i2c_get_bus_num();
	i2c_set_bus_num(LS1TWR_I2C_BUS_MC34VR500);
	i2c_device_id = i2c_reg_read(MC34VR500_ADDR, 0x0) &
					MC34VR500_DEVICEID_MASK;
	if (i2c_device_id != MC34VR500_DEVICEID) {
		printf("The regulator (MC34VR500) does not exist. The device does not support deep sleep.\n");
		return;
	}

	i2c_reg_write(MC34VR500_ADDR, 0x31, 0x4);
	i2c_reg_write(MC34VR500_ADDR, 0x4d, 0x4);
	i2c_reg_write(MC34VR500_ADDR, 0x6d, 0x38);
	i2c_reg_write(MC34VR500_ADDR, 0x6f, 0x37);
	i2c_reg_write(MC34VR500_ADDR, 0x71, 0x30);

	i2c_set_bus_num(i2c_bus);
}
/*
 * Reset Ethernet PHY.
 *
 * This function allows the re-configure the PHY after
 * changing its strap pins.
 */
void ethernut5_phy_reset(void)
{
    /* Do not modify anything, if we do not have a known version. */
    if (pwrman_major != 2)
        return;

    /*
     * Make sure that the Ethernet clock is enabled and the PHY reset
     * is disabled for at least 100 us.
     */
    i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_ENA, PWRMAN_ETHCLK);
    i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_DIS, PWRMAN_ETHRST);
    udelay(100);

    /*
     * LAN8710 strap pins are
     * PA14 => PHY MODE0
     * PA15 => PHY MODE1
     * PA17 => PHY MODE2 => 111b all capable
     * PA18 => PHY ADDR0 => 0b
     */
    at91_set_pio_input(AT91_PIO_PORTA, 14, 1);
    at91_set_pio_input(AT91_PIO_PORTA, 15, 1);
    at91_set_pio_input(AT91_PIO_PORTA, 17, 1);
    at91_set_pio_input(AT91_PIO_PORTA, 18, 0);

    /* Activate PHY reset for 100 us. */
    i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_ENA, PWRMAN_ETHRST);
    udelay(100);
    i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_DIS, PWRMAN_ETHRST);

    at91_set_pio_input(AT91_PIO_PORTA, 14, 1);
}
void pmic_ricoh619_shut_down(void)
{
    i2c_set_bus_num(ricoh619.pmic->bus);
    i2c_init (CONFIG_SYS_I2C_SPEED, ricoh619.pmic->hw.i2c.addr);
    i2c_set_bus_speed(CONFIG_SYS_I2C_SPEED);
    i2c_reg_write(ricoh619.pmic->hw.i2c.addr, 0xe0, i2c_reg_read(ricoh619.pmic->hw.i2c.addr,0xe0) & 0xfe);
    i2c_reg_write(ricoh619.pmic->hw.i2c.addr, 0x0f, i2c_reg_read(ricoh619.pmic->hw.i2c.addr,0x0f) & 0xfe);   
    i2c_reg_write(ricoh619.pmic->hw.i2c.addr, 0x0e, i2c_reg_read(ricoh619.pmic->hw.i2c.addr,0x0e) | 0x01);  
}
Beispiel #5
0
void vsc_wp_config(unsigned int vsc_addr)
{
	debug("VSC:Configuring VSC at address:0x%x for WP\n", vsc_addr);

	/* For new crosspoint configuration to occur, WP bit of
	 * CORE_CONFIG_REG should be set 1 and then reset to 0 */
	i2c_reg_write(vsc_addr, CORE_CONFIG_REG, 0x01);
	i2c_reg_write(vsc_addr, CORE_CONFIG_REG, 0x0);
}
static void rtc_write (uchar reg, uchar val, boolean_t set)
{
	if (set == TRUE) {
		val |= i2c_reg_read (CONFIG_SYS_I2C_RTC_ADDR, reg);
		i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val);
	} else {
		val = i2c_reg_read (CONFIG_SYS_I2C_RTC_ADDR, reg) & ~val;
		i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val);
	}
}
Beispiel #7
0
void pmic_rt5025_shut_down(void)
{
	i2c_set_bus_num(rt5025.pmic->bus);
    	i2c_init (RT5025_I2C_SPEED, rt5025.pmic->hw.i2c.addr);
    	i2c_set_bus_speed(RT5025_I2C_SPEED);
	i2c_reg_write(rt5025.pmic->hw.i2c.addr, RT5025_REG_CHANNELH, 0x00);
	i2c_reg_write(rt5025.pmic->hw.i2c.addr, RT5025_REG_CHANNELH, 0x80);
	i2c_reg_write(rt5025.pmic->hw.i2c.addr, RT5025_REG_MISC3, i2c_reg_read(rt5025.pmic->hw.i2c.addr, RT5025_REG_MISC3) | 0x80);

}
Beispiel #8
0
static void dp501_link_training(u8 addr)
{
	u8 val;

	val = i2c_reg_read(addr, 0x51);
	i2c_reg_write(addr, 0x5d, val); /* set link_bw */
	val = i2c_reg_read(addr, 0x52);
	i2c_reg_write(addr, 0x5e, val); /* set lane_cnt */
	val = i2c_reg_read(addr, 0x53);
	i2c_reg_write(addr, 0x5c, val); /* set downspread_ctl */

	i2c_reg_write(addr, 0x5f, 0x0d); /* start training */
}
Beispiel #9
0
int vsc3316_config(unsigned int vsc_addr, int8_t con_arr[][2],
		unsigned int num_con)
{
	unsigned int i;
	u8 rev_id = 0;
	int ret;

	debug("VSC:Initializing VSC3316 at I2C address 0x%2x"
		" for Tx\n", vsc_addr);

	ret = i2c_read(vsc_addr, REVISION_ID_REG, 1, &rev_id, 1);
	if (ret < 0) {
		printf("VSC:0x%x could not read REV_ID from device.\n",
			vsc_addr);
		return ret;
	}

	if (rev_id != 0xab) {
		printf("VSC: device at address 0x%x is not VSC3316/3308.\n",
			vsc_addr);
		return -ENODEV;
	}

	ret = vsc_if_enable(vsc_addr);
	if (ret) {
		printf("VSC:0x%x could not configured for 2-wire I/F.\n",
			vsc_addr);
		return ret;
	}

	/* config connections - page 0x00 */
	i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, CONNECTION_CONFIG_PAGE);

	/* Making crosspoint connections, by connecting required
	 * input to output */
	for (i = 0; i < num_con ; i++)
		i2c_reg_write(vsc_addr, con_arr[i][1], con_arr[i][0]);

	/* input state - page 0x13 */
	i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, INPUT_STATE_REG);
	/* Configuring the required input of the switch */
	for (i = 0; i < num_con ; i++)
		i2c_reg_write(vsc_addr, con_arr[i][0], 0x80);

	/* Setting Global Input LOS threshold value */
	i2c_reg_write(vsc_addr, GLOBAL_INPUT_LOS, 0x60);

	/* config output mode - page 0x23 */
	i2c_reg_write(vsc_addr, CURRENT_PAGE_REGISTER, OUTPUT_MODE_PAGE);
	/* Turn ON the Output driver correspond to required output*/
	for (i = 0; i < num_con ; i++)
		i2c_reg_write(vsc_addr,  con_arr[i][1], 0);

	/* configure global core control register, Turn on Global core power */
	i2c_reg_write(vsc_addr, GLOBAL_CORE_CNTRL, 0);

	vsc_wp_config(vsc_addr);

	return 0;
}
Beispiel #10
0
static int rk818_regulator_set_voltage(int num_regulator,
				  int min_uV, int max_uV)
{
	const int *vol_map;
	int min_vol = min_uV / 1000;
	u16 val;
	int num =0;

	if (num_regulator < 4){
		if (num_regulator == 2)
			return 0;
		val = rk818_dcdc_select_min_voltage(min_uV,max_uV,num_regulator);	
		i2c_reg_write(RK818_I2C_ADDR, rk818_BUCK_SET_VOL_REG(num_regulator),
			(i2c_reg_read(RK818_I2C_ADDR, rk818_BUCK_SET_VOL_REG(num_regulator)) & 0x3f) | val);
		debug("1 %s %d dcdc_vol = %08x\n", __func__, num_regulator, i2c_reg_read(RK818_I2C_ADDR, rk818_BUCK_SET_VOL_REG(num_regulator)));
		return 0;
	}else if (num_regulator == 6){
		vol_map = ldo3_voltage_map;
		num = 15;
	}
	else if (num_regulator == 9 || num_regulator == 10){
		vol_map = ldo6_voltage_map;
		num = 17;
	}
	else {
		vol_map = ldo_voltage_map;
		num = 16;
	}

	if (min_vol < vol_map[0] ||
	    min_vol > vol_map[num])
		return -EINVAL;

	for (val = 0; val <= num; val++){
		if (vol_map[val] >= min_vol)
			break;
        }

	if (num_regulator == 12) {
		i2c_reg_write(RK818_I2C_ADDR, rk818_LDO_SET_VOL_REG(num_regulator),
			((i2c_reg_read(RK818_I2C_ADDR, rk818_LDO_SET_VOL_REG(num_regulator)) & (~0x1f)) | val));
	}
	else
		i2c_reg_write(RK818_I2C_ADDR, rk818_LDO_SET_VOL_REG(num_regulator),
			((i2c_reg_read(RK818_I2C_ADDR, rk818_LDO_SET_VOL_REG(num_regulator)) & (~0x3f)) | val));
	
	debug("1 %s %d %d ldo_vol =%08x\n", __func__, num_regulator, val, i2c_reg_read(RK818_I2C_ADDR, rk818_LDO_SET_VOL_REG(num_regulator)));

	return 0;
}
/*
 * Enable Ethernut 5 power management.
 *
 * This function must be called during board initialization.
 * While we are using u-boot's I2C subsystem, it may be required
 * to enable the serial port before calling this function,
 * in particular when debugging is enabled.
 *
 * If board specific commands are not available, we will activate
 * all board components.
 */
void ethernut5_power_init(void)
{
    pwrman_minor = i2c_reg_read(PWRMAN_I2C_ADDR, PWRMAN_REG_VERS);
    pwrman_major = pwrman_minor >> 4;
    pwrman_minor &= 15;

#ifndef CONFIG_CMD_BSP
    /* Do not modify anything, if we do not have a known version. */
    if (pwrman_major == 2) {
        /* Without board specific commands we enable all features. */
        i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_ENA, ~PWRMAN_ETHRST);
        i2c_reg_write(PWRMAN_I2C_ADDR, PWRMAN_REG_DIS, PWRMAN_ETHRST);
    }
#endif
}
/* reset the DA9030 watchdog */
void hw_watchdog_reset(void)
{
	uchar addr = (uchar) DA9030_I2C_ADDR, val = 0;
	val = i2c_reg_read(addr, SYS_CONTROL_A);
	val |= SYS_CONTROL_A_WATCHDOG;
	i2c_reg_write(addr, SYS_CONTROL_A, val);
}
Beispiel #13
0
int platinum_setup_i2c(void)
{
	imx_iomux_v3_setup_multiple_pads(i2c0_mux_pads,
					 ARRAY_SIZE(i2c0_mux_pads));
	imx_iomux_v3_setup_multiple_pads(i2c2_mux_pads,
					 ARRAY_SIZE(i2c2_mux_pads));

	mdelay(10);

	/* Disable i2c mux 0 */
	gpio_direction_output(GPIO_I2C0_SEL0, 0);
	gpio_direction_output(GPIO_I2C0_SEL1, 0);
	gpio_direction_output(GPIO_I2C0_ENBN, 1);

	/* Disable i2c mux 1 */
	gpio_direction_output(GPIO_I2C2_SEL0, 0);
	gpio_direction_output(GPIO_I2C2_SEL1, 0);
	gpio_direction_output(GPIO_I2C2_ENBN, 1);

	udelay(10);

	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info0);
	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);

	/* Disable all leds */
	i2c_set_bus_num(0);
	i2c_reg_write(0x60, 0x05, 0x55);

	return 0;
}
Beispiel #14
0
int platinum_init_finished(void)
{
	/* Enable led 0 */
	i2c_set_bus_num(0);
	i2c_reg_write(0x60, 0x05, 0x54);

	return 0;
}
Beispiel #15
0
static void dp501_clrbits(u8 addr, u8 reg, u8 mask)
{
	u8 val;

	val = i2c_reg_read(addr, reg);
	clrbits_8(&val, mask);
	i2c_reg_write(addr, reg, val);
}
Beispiel #16
0
static int rt5025_pre_init(unsigned char bus,uchar addr)
{
	debug("%s,line=%d\n", __func__,__LINE__);
	 
	i2c_set_bus_num(bus);
	i2c_init(RT5025_I2C_SPEED, addr);
	i2c_set_bus_speed(RT5025_I2C_SPEED);

	i2c_reg_write(addr, RT5025_REG_CHGCTL2, i2c_reg_read(addr, RT5025_REG_CHGCTL2) | 0xf0); /*set chg time*/
	i2c_reg_write(addr, 0x17, i2c_reg_read(addr, 0x17) & 0x1f); /*power off 2.8v*/
 	i2c_reg_write(addr, 0x52,i2c_reg_read(addr,0x52)|0x02); /*no action when vref*/
	i2c_reg_write(addr, 0x08, (i2c_reg_read(addr,0x08) & 0x03) |0x40); /*set arm 1.1v*/
	i2c_reg_write(addr, 0x09, (i2c_reg_read(addr,0x09) & 0x01) |0x20); /*set logic 1.1v*/
// 	i2c_reg_write(addr, RT5025_REG_LDOONOFF,
//		i2c_reg_read(addr, RT5025_REG_LDOONOFF) |RT5025_LDOEN_MASK6); /*enable ldo6*/
	return 0;
}
Beispiel #17
0
void pmic_rk808_shut_down(void)
{
	u8 reg;
	i2c_set_bus_num(0);
	reg = i2c_reg_read(0x1b, 0x4b);
	i2c_reg_write(0x1b, 0x4b, (reg |(0x1 <<3)));

}
Beispiel #18
0
int misc_init_r(void)
{
#if defined(CONFIG_RTC_DS1307)
	/* enable trickle charge */
	i2c_reg_write(CONFIG_SYS_I2C_RTC_ADDR, 0x10, 0xaa);
#endif
	return 0;
}
Beispiel #19
0
/**
 * Once relocation has occurred and we're no longer running out of flash
 * we can re-enable polling.
 */
int late_board_init(void)
{
    debug("Enabling MCU TWSI polling\n");
    mdelay(10);
    i2c_set_bus_num(0);
    i2c_reg_write(BOARD_MCU_TWSI_ADDR, 0xF, 0);
    mdelay(10);
    return 0;
}
Beispiel #20
0
void reset_cpu(ulong addr)
{
#if defined(CONFIG_SYS_I2C) && defined(CONFIG_SYS_I2C_SH)
	i2c_reg_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x20, 0x80);
#else
	/* only CA57 ? */
	writel(RST_CODE, RST_CA57RESCNT);
#endif
}
Beispiel #21
0
/**
 * Due to bugs in the MCU I2C polling we disable it
 */
int board_early_init_f(void)
{
    mdelay(10);
    debug("Disabling MCU TWSI polling\n");
    i2c_set_bus_num(0);
    i2c_reg_write(BOARD_MCU_TWSI_ADDR, 0xF, 1);
    mdelay(10);
    return 0;
}
Beispiel #22
0
void pmic_rk818_shut_down(void)
{
	u8 reg;
	i2c_set_bus_num(rk818.pmic->bus);
    	i2c_init (RK818_I2C_SPEED, rk818.pmic->hw.i2c.addr);
    	i2c_set_bus_speed(RK818_I2C_SPEED);
	reg = i2c_reg_read(rk818.pmic->hw.i2c.addr, RK818_DEVCTRL_REG);
	i2c_reg_write(rk818.pmic->hw.i2c.addr, RK818_DEVCTRL_REG, (reg |(0x1 <<0)));

}
Beispiel #23
0
/**
 * Modify the device tree to remove all unused interface types.
 */
int board_fixup_fdt(void)
{
    const char *fdt_key;
    cvmx_mio_qlmx_cfg_t mio_qlmx;
    char *eptr;

    mio_qlmx.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(2));
    if (mio_qlmx.s.qlm_spd == 15) {
        fdt_key = "0,none";	/* Disabled */
    } else if (mio_qlmx.s.qlm_cfg == 3) {
        fdt_key = "0,xaui";
    } else if (mio_qlmx.s.qlm_cfg == 2) {
        fdt_key = "0,sgmii";
    }
    else {
        fdt_key = "0,none";	/* Disabled */
    }
    octeon_fdt_patch(working_fdt, fdt_key, NULL);

    mio_qlmx.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
    if (mio_qlmx.s.qlm_spd == 15) {
        fdt_key = "1,none";	/* Disabled */
    } else if (mio_qlmx.s.qlm_cfg == 3) {
        fdt_key = "1,xaui";
    } else if (mio_qlmx.s.qlm_cfg == 2) {
        fdt_key = "1,sgmii";
    } else {
        fdt_key = "1,none";
    }
    octeon_fdt_patch(working_fdt, fdt_key, NULL);


    /*
     * If 'enable_spi_eeprom' is set in the environment, clear bit
     * 2 of register 0x15 in the CPLD to enable the SPI EEPROM,
     * then hijack octeon_fdt_patch to enable/disable the eeprom
     * in the device tree.
     */
    eptr = getenv("enable_spi_eeprom");
    fdt_key = "9,none";
    if (eptr) {
        uchar rv;
        int ret;
        ret = i2c_read(0x6c, 0x15, 1, &rv, 1);
        if (ret == 0) {
            if (rv == 0)
                fdt_key = "9,eeprom";
            i2c_reg_write(0x6c, 0x15, rv);
        }
    }
    octeon_fdt_patch(working_fdt, fdt_key, NULL);

    return 0;
}
Beispiel #24
0
static int rk818_pre_init(unsigned char bus,uchar addr)
{
	debug("%s,line=%d\n", __func__,__LINE__);
	 
	i2c_set_bus_num(bus);
	i2c_init(RK818_I2C_SPEED, addr);
	i2c_set_bus_speed(RK818_I2C_SPEED);

	i2c_reg_write(addr, 0xa1,i2c_reg_read(addr,0xa1)|0x70); /*close charger when usb low then 3.4V*/
 	i2c_reg_write(addr, 0x52,i2c_reg_read(addr,0x52)|0x02); /*no action when vref*/
 	i2c_reg_write(addr, RK818_DCDC_EN_REG,
		i2c_reg_read(addr, RK818_DCDC_EN_REG) |0x60); /*enable switch & ldo9*/
//	i2c_reg_write(addr, RK818_LDO_EN_REG,
//		i2c_reg_read(addr, RK818_LDO_EN_REG) |0x28);
 	
	/**********enable clkout2****************/
        i2c_reg_write(addr,RK818_CLK32OUT_REG,0x01);
      
	return 0;
}
Beispiel #25
0
int rk818_regulator_enable(int num_regulator)
{

	if (num_regulator < 4)
		i2c_reg_write(RK818_I2C_ADDR, RK818_DCDC_EN_REG,
			i2c_reg_read(RK818_I2C_ADDR, RK818_DCDC_EN_REG) |(1 << num_regulator)); //enable dcdc
	else if (num_regulator == 12)
		i2c_reg_write(RK818_I2C_ADDR, RK818_DCDC_EN_REG,
			i2c_reg_read(RK818_I2C_ADDR,RK818_DCDC_EN_REG) |(1 << 5)); //enable ldo9
	else if (num_regulator == 13)
		i2c_reg_write(RK818_I2C_ADDR, RK818_DCDC_EN_REG,
			i2c_reg_read(RK818_I2C_ADDR,RK818_DCDC_EN_REG) |(1 << 6)); //enable ldo10
	else
	 	i2c_reg_write(RK818_I2C_ADDR, RK818_LDO_EN_REG,
			i2c_reg_read(RK818_I2C_ADDR,RK818_LDO_EN_REG) |(1 << (num_regulator -4))); //enable ldo

	debug("1 %s %d dcdc_en = %08x ldo_en =%08x\n", __func__, num_regulator, i2c_reg_read(RK818_I2C_ADDR,RK818_DCDC_EN_REG), i2c_reg_read(RK818_I2C_ADDR,RK818_LDO_EN_REG));

	 return 0;
}
Beispiel #26
0
int pmic_rk808_init(unsigned char bus)
{
	int ret;
	if (!rk808.pmic) {
		ret = rk808_parse_dt(gd->fdt_blob);
		if (ret < 0)
			return ret;
	}
	
	rk808.pmic->interface = PMIC_I2C;
	//enable lcdc power ldo, and enable other ldo 
	i2c_set_bus_num(rk808.pmic->bus);
	charger_init(0);
	i2c_init(RK808_I2C_SPEED, rk808.pmic->hw.i2c.addr);
	i2c_set_bus_speed(RK808_I2C_SPEED);
	i2c_reg_write(0x1b,0x23,i2c_reg_read(0x1b,0x23)|0x60);
	i2c_reg_write(0x1b,0x45,0x02);
	i2c_reg_write(0x1b,0x24,i2c_reg_read(0x1b,0x24)|0x28);

    return 0;
}
Beispiel #27
0
void status_set_status(int value)
{
	status=value;
	if(!hasTCA6507) {
		omap_set_gpio_dataout(GPIO_LED_AUX_RED, (value&(1 << 0)));
		omap_set_gpio_dataout(GPIO_LED_AUX_GREEN, (value&(1 << 1)));
		omap_set_gpio_dataout(GPIO_LED_POWER_RED, (value&(1 << 3)));
		omap_set_gpio_dataout(GPIO_LED_POWER_GREEN, (value&(1 << 4)));
		omap_set_gpio_dataout(GPIO_LED_VIBRA, (value&(1 << 6)));
		omap_set_gpio_dataout(GPIO_LED_UNUSED, (value&(1 << 7)));
		}
	else {
		value &= 0x3f;	// 6 LEDs only - 7th is reserved to reset the WLAN/BT chip
		i2c_set_bus_num(TCA6507_BUS);	// write I2C2
		// we could write a autoincrement address and all 3 bytes in a single message
		// we could set the TCA to do smooth transitions
#if defined(CONFIG_GOLDELICO_EXPANDER_B2)
		value |= (value >> 3) & 0x03;	// map power LEDs to AUX LEDs (we only have 2)
#endif
		i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT0, 0);
		i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT1, 0);
		i2c_reg_write(TCA6507_ADDRESS, TCA6507_SELECT2, value);	// 1 = on
	}
}
int pmic_ricoh619_init(unsigned char bus)
{
	int ret;
	if (!ricoh619.pmic) {
		ret = ricoh619_parse_dt(gd->fdt_blob);
		if (ret < 0)
			return ret;
	}
	//enable lcdc power ldo
	ricoh619.pmic->interface = PMIC_I2C;
	i2c_set_bus_num(ricoh619.pmic->bus);
	i2c_init (RICOH619_I2C_SPEED, 0);
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr, 0xff, 0x00); /*for i2c protect*/
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr ,0x10,0x4c);// DIS_OFF_PWRON_TIM bit 0; OFF_PRESS_PWRON 6s; OFF_JUDGE_PWRON bit 1; ON_PRESS_PWRON bit 2s
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x36,0xc8);// dcdc1 output 3.1v for vccio
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x30,0x03);
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x4c,0x54);// vout1 output 3.0v for vccio_pmu
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x51,0x30);// ldo6 output 1.8v for VCC18_LCD
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x52,0x04);//
	i2c_reg_write(ricoh619.pmic->hw.i2c.addr,0x44,i2c_reg_read(ricoh619.pmic->hw.i2c.addr,0x44)|(3<<5));//ldo6 enable
	fg_ricoh619_init(ricoh619.pmic->bus, ricoh619.pmic->hw.i2c.addr);
	return 0;
}
Beispiel #29
0
static int w83782d_hwmon_init(void)
{
	u8 buf;

	if (i2c_read(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_CFG, 1, &buf, 1))
		return -1;

	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_CFG, 0x80);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_BANK_SEL, 0);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_ADCCLK, 0x40);

	buf = i2c_reg_read(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_BEEP_CTRL);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_BEEP_CTRL,
		      buf | 0x80);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_BEEP_CTRL2, 0);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_PWMOUT1, 0x47);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_VBAT, 0x01);

	buf = i2c_reg_read(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_CFG);
	i2c_reg_write(CONFIG_SYS_I2C_W83782G_ADDR, W83782D_REG_CFG,
		      (buf & 0xf4) | 0x01);
	return 0;
}
Beispiel #30
0
int misc_init_r (void)
{
	uchar val;

	/*
	 * Make sure that RTC has clock output enabled (triggers watchdog!)
	 */
	val = i2c_reg_read (CONFIG_SYS_I2C_RTC_ADDR, 0x0D);
	val |= 0x80;
	i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, 0x0D, val);

	/*
	 * Configure PHY to setup LED's correctly and use 100MBit, FD
	 */
	mii_init();

	/* disable auto-negotiation, 100mbit, full-duplex */
	fec8xx_miiphy_write(NULL, 0, MII_BMCR, 0x2100);

	/* set LED's to Link, Transmit, Receive           */
	fec8xx_miiphy_write(NULL,  0, MII_NWAYTEST, 0x4122);

	return 0;
}