Kbuild: append missing-syscalls to the default target list
[pandora-kernel.git] / arch / arm / mach-exynos4 / mach-nuri.c
index d099951..43be71b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/i2c-gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/gpio.h>
+#include <linux/power/max8903_charger.h>
 #include <linux/power/max17042_battery.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
@@ -40,6 +41,8 @@
 #include <plat/clock.h>
 #include <plat/gpio-cfg.h>
 #include <plat/iic.h>
+#include <plat/mfc.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -59,6 +62,7 @@
 
 enum fixed_regulator_id {
        FIXED_REG_ID_MMC = 0,
+       FIXED_REG_ID_MAX8903,
 };
 
 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
@@ -981,10 +985,70 @@ static struct i2c_board_info i2c9_devs[] __initdata = {
        },
 };
 
+/* MAX8903 Secondary Charger */
+static struct regulator_consumer_supply supplies_max8903[] = {
+       REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
+};
+
+static struct regulator_init_data max8903_charger_en_data = {
+       .constraints = {
+               .name           = "VOUT_CHARGER",
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+               .boot_on        = 1,
+       },
+       .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
+       .consumer_supplies = supplies_max8903,
+};
+
+static struct fixed_voltage_config max8903_charger_en = {
+       .supply_name = "VOUT_CHARGER",
+       .microvolts = 5000000, /* Assume 5VDC */
+       .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
+       .enable_high = 0, /* Enable = Low */
+       .enabled_at_boot = 1,
+       .init_data = &max8903_charger_en_data,
+};
+
+static struct platform_device max8903_fixed_reg_dev = {
+       .name = "reg-fixed-voltage",
+       .id = FIXED_REG_ID_MAX8903,
+       .dev = { .platform_data = &max8903_charger_en },
+};
+
+static struct max8903_pdata nuri_max8903 = {
+       /*
+        * cen: don't control with the driver, let it be
+        * controlled by regulator above
+        */
+       .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
+       /* uok, usus: not connected */
+       .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
+       /* flt: vcc_1.8V_pda */
+       .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
+
+       .dc_valid = true,
+       .usb_valid = false, /* USB is not wired to MAX8903 */
+};
+
+static struct platform_device nuri_max8903_device = {
+       .name                   = "max8903-charger",
+       .dev                    = {
+               .platform_data  = &nuri_max8903,
+       },
+};
+
+static struct device *nuri_cm_devices[] = {
+       &s3c_device_i2c5.dev,
+       &s3c_device_adc.dev,
+       NULL, /* Reserved for UART */
+       NULL,
+};
+
 static void __init nuri_power_init(void)
 {
        int gpio;
        int irq_base = IRQ_GPIO_END + 1;
+       int ta_en = 0;
 
        nuri_max8997_pdata.irq_base = irq_base;
        irq_base += MAX8997_IRQ_NR;
@@ -998,6 +1062,20 @@ static void __init nuri_power_init(void)
        gpio_request(gpio, "FUEL_ALERT");
        s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
        s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+
+       gpio = nuri_max8903.dok;
+       gpio_request(gpio, "TA_nCONNECTED");
+       s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
+       s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       ta_en = gpio_get_value(gpio) ? 0 : 1;
+
+       gpio = nuri_max8903.chg;
+       gpio_request(gpio, "TA_nCHG");
+       gpio_direction_input(gpio);
+
+       gpio = nuri_max8903.dcm;
+       gpio_request(gpio, "CURR_ADJ");
+       gpio_direction_output(gpio, ta_en);
 }
 
 /* USB EHCI */
@@ -1023,11 +1101,18 @@ static struct platform_device *nuri_devices[] __initdata = {
        &s3c_device_i2c3,
        &i2c9_gpio,
        &s3c_device_adc,
+       &s3c_device_rtc,
+       &s5p_device_mfc,
+       &s5p_device_mfc_l,
+       &s5p_device_mfc_r,
+       &exynos4_device_pd[PD_MFC],
 
        /* NURI Devices */
        &nuri_gpio_keys,
        &nuri_lcd_device,
        &nuri_backlight_device,
+       &max8903_fixed_reg_dev,
+       &nuri_max8903_device,
 };
 
 static void __init nuri_map_io(void)
@@ -1037,6 +1122,11 @@ static void __init nuri_map_io(void)
        s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
 }
 
+static void __init nuri_reserve(void)
+{
+       s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
+}
+
 static void __init nuri_machine_init(void)
 {
        nuri_sdhci_init();
@@ -1057,6 +1147,7 @@ static void __init nuri_machine_init(void)
 
        /* Last */
        platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
+       s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
 }
 
 MACHINE_START(NURI, "NURI")
@@ -1066,4 +1157,5 @@ MACHINE_START(NURI, "NURI")
        .map_io         = nuri_map_io,
        .init_machine   = nuri_machine_init,
        .timer          = &exynos4_timer,
+       .reserve        = &nuri_reserve,
 MACHINE_END