int pmic_reg_read(struct pmic *p, u32 reg, u32 *val) { if (pmic_reg(p, reg, val, 0)) return -1; return 0; }
/*************************************** * update_flag=0, BOOT_NORMAL * update_flag=1, BOOT_SYSTEM_UPGRADE * update_flag=2, BOOT_OTA ****************************************/ int recovery_handle(void) { unsigned int val = 0; unsigned int reg1 = 0; unsigned int reg2 = 0; struct spi_slave *slave; if (share_region->flags.uboot_flag != BOOT_NORMAL) goto out; /* No power key any more*/ #if 0 slave = spi_pmic_probe(); val = pmic_reg(slave, 3, 0, 0); val = (val & 0x000004) >> 2; #endif mxc_request_iomux(MX50_PIN_KEY_COL3, IOMUX_CONFIG_ALT1); mxc_request_iomux(MX50_PIN_KEY_ROW0, IOMUX_CONFIG_ALT1); reg1 = readl(GPIO4_BASE_ADDR); reg1 &= 0x00000040; reg2 = readl(GPIO4_BASE_ADDR); reg2 &= 0x00000002; #if 0 printf("val = %d\n", val); if ((reg1 && reg2) != 1 && (val == 1)) clear_flags(); #endif if (1 == (reg1 && reg2)) share_region->flags.uboot_flag = BOOT_SYSTEM_UPGRADE; out: save_share_region(); printf("share_region = %d\n", share_region->flags.uboot_flag); return share_region->flags.uboot_flag; }
int pmic_reg_write(struct pmic *p, u32 reg, u32 val) { if (pmic_reg(p, reg, &val, 1)) return -1; return 0; }
void show_pmic_info(struct spi_slave *slave) { volatile u32 rev_id; if (!slave) return; rev_id = pmic_reg(slave, 7, 0, 0); debug("PMIC ID: 0x%08x [Rev: ", rev_id); switch (rev_id & 0x1F) { case 0x1: printf("1.0"); break; case 0x9: printf("1.1"); break; case 0xA: printf("1.2"); break; case 0x10: printf("2.0"); break; case 0x11: printf("2.1"); break; case 0x18: printf("3.0"); break; case 0x19: printf("3.1"); break; case 0x1A: printf("3.2"); break; case 0x2: printf("3.2A"); break; case 0x1B: printf("3.3"); break; case 0x1D: printf("3.5"); break; default: printf("unknown"); break; } printf("]\n"); }
int pmic_reg_read(struct pmic *p, u32 reg, u32 *val) { return pmic_reg(p, reg, val, 0); }
int pmic_reg_write(struct pmic *p, u32 reg, u32 val) { return pmic_reg(p, reg, &val, 1); }
u32 pmic_reg_read(u32 reg) { return pmic_reg(reg, 0, 0); }
void pmic_reg_write(u32 reg, u32 value) { pmic_reg(reg, value, 1); }