int pmic_bus_init(void) { /* This cannot be 0 because it is used in SPL before BSS is ready */ static int needs_init = 1; __maybe_unused int ret; if (!needs_init) return 0; #if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I p2wi_init(); ret = p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR, AXP221_CTRL_ADDR, AXP221_INIT_DATA); # else ret = rsb_init(); if (ret) return ret; ret = rsb_set_device_address(AXP223_DEVICE_ADDR, AXP223_RUNTIME_ADDR); # endif if (ret) return ret; #endif needs_init = 0; return 0; }
static int init_func_pmubus(void) { tick_printf("pmbus: "); #if defined(CONFIG_SUNXI_I2C) i2c_init(CONFIG_SYS_I2C_SPEED,CONFIG_SYS_I2C_SLAVE); #elif defined(CONFIG_SUNXI_P2WI) p2wi_init(); #else sunxi_rsb_init(0); #endif puts("ready\n"); return (0); }
/* * The axp221 uses the p2wi bus, the axp223 is identical (for all registers * used sofar) but uses the rsb bus. These functions abstract this. */ static int pmic_bus_init(void) { #ifdef CONFIG_MACH_SUN6I p2wi_init(); return p2wi_change_to_p2wi_mode(AXP221_CHIP_ADDR, AXP221_CTRL_ADDR, AXP221_INIT_DATA); #else int ret; rsb_init(); ret = rsb_set_device_mode(AXP223_DEVICE_MODE_DATA); if (ret) return ret; return rsb_set_device_address(AXP223_DEVICE_ADDR, AXP223_RUNTIME_ADDR); #endif }
static int init_func_pmubus(void) { tick_printf("pmbus: "); #if defined(CONFIG_SUNXI_I2C) i2c_init(0, CONFIG_SYS_I2C_SPEED,CONFIG_SYS_I2C_SLAVE); //twi0 #if (defined(CONFIG_ARCH_HOMELET) && defined(CONFIG_ARCH_SUN9IW1P1)) i2c_init(1, CONFIG_SYS_I2C_SPEED,CONFIG_SYS_I2C_SLAVE); //twi1 for cvbs #endif #endif #if defined(CONFIG_SUNXI_P2WI) p2wi_init(); #endif #if defined(CONFIG_SUNXI_RSB) sunxi_rsb_init(0); #endif puts("ready\n"); return (0); }