if (rev & NEPTUNE_BOARD)
board_rev &= ~(J1_B2_BOARD |
LIMO_UNIVERSAL_BOARD);
- } else
+ } else {
board_rev &= ~BOARD_MASK;
+ }
}
static unsigned int get_hw_revision(struct s5pc1xx_gpio_bank *bank, int hwrev3)
* ADDR = 0xE0200000 + OFF
*
* OFF Universal BB LRA LUA OA TT SS CYP
- * J1: 0x0264 0x10 0x10 0x00 0x00 0x00 0x00 0x00
- * J2: 0x0284 0x01 0x10 0x00
+ * J1: 0x0264 0x10 0x10 0x00 0x00 0x00 0x00 0x00
+ * J2: 0x0284 0x01 0x10 0x00
* H1: 0x0C24 W 0x28 0xA8 0x1C 0x0F
- * H3: 0x0C64 0x03 0x07 0x0F
+ * H3: 0x0C64 0x03 0x07 0x0F
* D1: 0x00C4 0x0F 0x3F 0x3F 0x0F 0xXC 0x3F
* I: 0x0224 0x02 0x00 0x08
* MP03: 0x0324 0x9x 0xbx 0x9x
}
gpio_set_pull(&gpio->gpio_j2, 2, GPIO_PULL_DOWN);
hwrev3 = 1;
- } else
+ } else {
gpio_direction_output(&gpio->gpio_mp0_5, 6, 0);
+ }
board_rev |= get_hw_revision(&gpio->gpio_j0, hwrev3);
}
gd->bd->bi_arch_number = C110_MACH_START + board;
else
gd->bd->bi_arch_number = C100_MACH_START + board;
- } else
+ } else {
gd->bd->bi_arch_number = board;
+ }
/* Architecture Common settings */
if (cpu_is_s5pc110()) {
if ((board_rev & 0xf) < 8)
s5pc1xx_set_cpu_rev(0);
}
- } else if (machine_is_kessler())
+ } else if (machine_is_kessler()) {
s5pc1xx_set_cpu_rev(1);
- else if (machine_is_geminus()) {
+ } else if (machine_is_geminus()) {
if ((board_rev & 0xf) < 1)
s5pc1xx_set_cpu_rev(0);
- } else if (machine_is_cypress())
+ } else if (machine_is_cypress()) {
s5pc1xx_set_cpu_rev(1);
- else
+ } else {
s5pc1xx_set_cpu_rev(0);
+ }
dprintf("HW Revision:\t%x (%s%s) %s\n",
board_rev, get_board_name(board),
if (machine_is_aquila() || machine_is_kessler()) {
/* volume down */
- if(row_state[1] & 0x2)
+ if (row_state[1] & 0x2)
display_info = 1;
if (board_is_neptune()) {
/* home & volume down */
return high_temp;
if (high_adc == USHRT_MAX)
return low_temp;
+
approximation = low_temp * (adc - low_adc) +
high_temp * (high_adc - adc);
approximation /= high_adc - low_adc;
+
return approximation;
}
sprintf(buf, "pmic ldo %d on", ldonum);
run_command(buf, 0);
+
writel(channel & 0xF, &adc->adcmux);
writel((1 << 14) | (49 << 6), &adc->adccon);
writel(1000 & 0xffff, &adc->adcdly);
udelay(10);
writel(readl(&adc->adccon) | (1 << 0), &adc->adccon); /* Enable */
udelay(10);
+
do {
udelay(1);
reg = readl(&adc->adccon);
} while (!reg & (1 << 15) && loop++ < 1000);
+
ret = readl(&adc->adcdat0) & 0xFFF;
sprintf(buf, "pmic ldo %d off", ldonum);
run_command(buf, 0);
for (i = 0; i < 7; i++) {
unsigned short measurement = get_adc_value(6);
sum += measurement;
- measured ++;
+ measured++;
if (min > measurement)
min = measurement;
if (max < measurement)
adc_to_temperature_centigrade(sum), sum);
return adc_to_temperature_centigrade(sum);
}
- else
- return 20; /* 20 Centigrade */
+
+ return 20; /* 20 Centigrade */
}
enum temperature_level {
lcd_power_on(0);
do {
- struct s5pc110_rtc *rtc = (struct s5pc110_rtc *) S5PC110_RTC_BASE;
+ struct s5pc110_rtc *rtc = (struct s5pc110_rtc *)S5PC110_RTC_BASE;
unsigned int org, org_ip3, org_tcfg0;
enum temperature_level previous_state = _TEMP_OK;
udelay(10);
reg = readl(&rtc->rtccon);
- reg &= ~( (1 << 8) | (0xF << 4));
+ reg &= ~((1 << 8) | (0xF << 4));
reg |= (1 << 8) | (0xD << 4); /* D: 4 Hz, 9: 64 Hz */
writel(reg, &rtc->rtccon);
previous_state = _TEMP_TOO_HIGH;
break;
case _TEMP_OK_LOW:
- if (previous_state == _TEMP_TOO_LOW)
+ if (previous_state == _TEMP_TOO_LOW) {
charger_en(0);
- else
- {
+ } else {
charger_en(charger_speed);
previous_state = _TEMP_OK;
}
break;
case _TEMP_OK_HIGH:
- if (previous_state == _TEMP_TOO_HIGH)
+ if (previous_state == _TEMP_TOO_HIGH) {
charger_en(0);
- else
- {
+ } else {
charger_en(charger_speed);
previous_state = _TEMP_OK;
}
i2c_set_bus_num(I2C_PMIC);
- if (machine_is_kessler())
+ if (machine_is_kessler()) {
i2c_set_bus_num(I2C_GPIO6);
- else if (machine_is_cypress()) {
+ } else if (machine_is_cypress()) {
i2c_set_bus_num(I2C_GPIO6);
} else if (machine_is_geminus()) {
if (hwrevision(1))
i2c_set_bus_num(I2C_GPIO6);
- } else if (machine_is_wmg160())
+ } else if (machine_is_wmg160()) {
i2c_set_bus_num(I2C_GPIO6);
+ }
if (i2c_probe(addr)) {
printf("Can't found fsa9480\n");
into_charge_mode();
else
charger_en(0);
- }
- else if (val[0] & FSA_DEV1_USB) {
+ } else if (val[0] & FSA_DEV1_USB) {
if (battery_soc < 100)
charger_en(475); /* enable charger and keep booting */
else
/* Support */;
} else if (machine_is_geminus()) {
/* Support */;
- } else
+ } else {
return;
+ }
if (machine_is_aquila()) {
/* Aquila rev 0.8 or lower */
}
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
val[0] &= ~(MAX8998_LDO17);
- val[0] |= MAX8998_LDO17; /* LDO17: VCC_3.0V_LCD */
+ val[0] |= MAX8998_LDO17; /* LDO17: VCC_3.0V_LCD */
i2c_write(addr, MAX8998_REG_ONOFF3, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
vid->vl_vbpd = 3;
vid->vl_vfpd = 28;
- if (machine_is_aquila() || machine_is_kessler() || machine_is_cypress()) {
+ if (machine_is_aquila() || machine_is_kessler()
+ || machine_is_cypress()) {
vid->cfg_gpio = lcd_cfg_gpio;
vid->reset_lcd = reset_lcd;
vid->backlight_on = backlight_on;
/* MHL off */
gpio_direction_output(&s5pc110_gpio->gpio_j2, 2, 0);
gpio_direction_output(&s5pc110_gpio->gpio_mp0_4, 7, 0);
- gpio_direction_output(&s5pc110_gpio->gpio_j2, 3, 0); /* MHL_ON for REV02 or higher */
-
-
+ /* MHL_ON for REV02 or higher */
+ gpio_direction_output(&s5pc110_gpio->gpio_j2, 3, 0);
}
+
void board_sleep_init(void)
{
unsigned char addr;
}
if (machine_is_kessler()) {
-
/* Set ONOFF1 */
i2c_read(addr, MAX8998_REG_ONOFF1, 1, val, 1);
saved_val[0][0] = val[0];
(1 << 1) | (1 << 0));
i2c_write(addr, MAX8998_REG_ONOFF1, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF1, 1, val, 1);
+
/* Set ONOFF2 */
i2c_read(addr, MAX8998_REG_ONOFF2, 1, val, 1);
saved_val[1][0] = val[0];
val[0] |= (1 << 7);
i2c_write(addr, MAX8998_REG_ONOFF2, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF2, 1, val, 1);
+
/* Set ONOFF3 */
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
saved_val[2][0] = val[0];
val[0] &= ~((1 << 7) | (1 << 6) | (1 << 5) | (1 << 4));
i2c_write(addr, MAX8998_REG_ONOFF3, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
+
/* Set ONOFF4 */
i2c_read(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
saved_val[3][0] = val[0];
val[0] &= ~((1 << 6) | (1 << 4));
i2c_write(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
+
printf("Turned off regulators with Kessler setting."
" Preparing to sleep. [%s:%d]\n",
__FILE__, __LINE__);
} else { /* Default */
-
/* Set ONOFF1 */
i2c_read(addr, MAX8998_REG_ONOFF1, 1, val, 1);
saved_val[0][0] = val[0];
(1 << 1) | (1 << 0));
i2c_write(addr, MAX8998_REG_ONOFF1, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF1, 1, val, 1);
+
/* Set ONOFF2 */
i2c_read(addr, MAX8998_REG_ONOFF2, 1, val, 1);
saved_val[1][0] = val[0];
val[0] |= (1 << 7);
i2c_write(addr, MAX8998_REG_ONOFF2, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF2, 1, val, 1);
+
/* Set ONOFF3 */
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
saved_val[2][0] = val[0];
val[0] &= ~((1 << 7) | (1 << 6) | (1 << 5) | (1 << 4));
i2c_write(addr, MAX8998_REG_ONOFF3, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF3, 1, val, 1);
+
/* Set ONOFF4 */
i2c_read(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
saved_val[3][0] = val[0];
val[0] &= ~((1 << 7) | (1 << 6) | (1 << 4));
i2c_write(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
i2c_read(addr, MAX8998_REG_ONOFF3+1, 1, val, 1);
+
printf("Turned off regulators with default(Aquila) setting."
" Preparing to sleep. [%s:%d]\n",
__FILE__, __LINE__);
static int status;
if (on && !status) {
-// printf("turning USB power on\n");
#ifdef CONFIG_CMD_PMIC
run_command("pmic ldo 3 on", 0);
#endif
micro_usb_switch(0);
status = 1;
} else if (!on && status) {
-// printf("turning USB power off\n");
#ifdef CONFIG_CMD_PMIC
run_command("pmic ldo 3 off", 0);
#endif