static void __init nexcoder_sensorboard_init(void) { // Initialize SCCB bus s3c2410_gpio_setpin(S3C2410_GPE(14), 1); // IICSCL s3c_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPIO_OUTPUT); s3c2410_gpio_setpin(S3C2410_GPE(15), 1); // IICSDA s3c_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPIO_OUTPUT); // Power up the sensor board s3c2410_gpio_setpin(S3C2410_GPF(1), 1); s3c_gpio_cfgpin(S3C2410_GPF(1), S3C2410_GPIO_OUTPUT); // CAM_GPIO7 => nLDO_PWRDN s3c2410_gpio_setpin(S3C2410_GPF(2), 0); s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); // CAM_GPIO6 => CAM_PWRDN }
static void __init nexcoder_sensorboard_init(void) { /* Initialize SCCB bus */ gpio_request_one(S3C2410_GPE(14), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPE(14)); /* IICSCL */ gpio_request_one(S3C2410_GPE(15), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPE(15)); /* IICSDA */ /* Power up the sensor board */ gpio_request_one(S3C2410_GPF(1), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPF(1)); /* CAM_GPIO7 => nLDO_PWRDN */ gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL); gpio_free(S3C2410_GPF(2)); /* CAM_GPIO6 => CAM_PWRDN */ }
static void amlm5900_init_pm(void) { int ret = 0; ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt, IRQF_TRIGGER_RISING | IRQF_SHARED, "amlm5900_wakeup", &amlm5900_wake_interrupt); if (ret != 0) { printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret); } else { enable_irq_wake(IRQ_EINT9); s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); s3c2410_gpio_pullup(S3C2410_GPF(2), 0); } }
int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state) { struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin); unsigned long offs = pin - chip->chip.base; unsigned long flags; unsigned long slpcon; offs *= 2; if (pin < S3C2410_GPB(0)) return -EINVAL; if (pin >= S3C2410_GPF(0) && pin <= S3C2410_GPG(16)) return -EINVAL; if (pin > S3C2410_GPH(16)) return -EINVAL; local_irq_save(flags); slpcon = __raw_readl(chip->base + 0x0C); slpcon &= ~(3 << offs); slpcon |= state << offs; __raw_writel(slpcon, chip->base + 0x0C); local_irq_restore(flags); return 0; }
void smdk2416_hsudc_gpio_init(void) { s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1)); s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0); }
static void amlm5900_init_pm(void) { int ret = 0; ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt, IRQF_TRIGGER_RISING | IRQF_SHARED, "amlm5900_wakeup", &amlm5900_wake_interrupt); if (ret != 0) { printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret); } else { enable_irq_wake(IRQ_EINT9); /* configure the suspend/resume status pin */ s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP); } }
void s3c_pm_configure_extint(void) { int pin; /* */ for (pin = S3C2410_GPF(0); pin <= S3C2410_GPF(7); pin++) { s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF(0)); } for (pin = S3C2410_GPG(0); pin <= S3C2410_GPG(7); pin++) { s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG(0))+8); } }
void s3c_pm_configure_extint(void) { int pin; /* for each of the external interrupts (EINT0..EINT15) we * need to check wether it is an external interrupt source, * and then configure it as an input if it is not */ for (pin = S3C2410_GPF(0); pin <= S3C2410_GPF(7); pin++) { s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF(0)); } for (pin = S3C2410_GPG(0); pin <= S3C2410_GPG(7); pin++) { s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG(0))+8); } }
static void __init smdk2413_machine_init(void) { s3c2410_gpio_setpin(S3C2410_GPF(2), 0); s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); s3c24xx_udc_set_platdata(&smdk2413_udc_cfg); s3c_i2c0_set_platdata(NULL); platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices)); smdk_machine_init(); }
static void smdk2413_udc_pullup(enum s3c2410_udc_cmd_e cmd) { printk(KERN_DEBUG "udc: pullup(%d)\n",cmd); switch (cmd) { case S3C2410_UDC_P_ENABLE : s3c2410_gpio_setpin(S3C2410_GPF(2), 1); break; case S3C2410_UDC_P_DISABLE : s3c2410_gpio_setpin(S3C2410_GPF(2), 0); break; case S3C2410_UDC_P_RESET : break; default: break; } }
static void __init smdk2413_machine_init(void) { /* Turn off suspend on both USB ports, and switch the * selectable USB port to USB device mode. */ s3c2410_gpio_setpin(S3C2410_GPF(2), 0); s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT); s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); s3c24xx_udc_set_platdata(&smdk2413_udc_cfg); s3c_i2c0_set_platdata(NULL); platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices)); smdk_machine_init(); }
static void __init smdk2413_machine_init(void) { /* Turn off suspend on both USB ports, and switch the * selectable USB port to USB device mode. */ WARN_ON(gpio_request(S3C2410_GPF(2), "udc pull")); gpio_direction_output(S3C2410_GPF(2), 0); s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); s3c24xx_udc_set_platdata(&smdk2413_udc_cfg); s3c_i2c0_set_platdata(NULL); platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices)); smdk_machine_init(); }
static void s3c2410_pm_prepare(void) { /* ensure at least GSTATUS3 has the resume address */ __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2410_GSTATUS3); S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); if (machine_is_h1940()) { void *base = phys_to_virt(H1940_SUSPEND_CHECK); unsigned long ptr; unsigned long calc = 0; /* generate check for the bootloader to check on resume */ for (ptr = 0; ptr < 0x40000; ptr += 0x400) calc += __raw_readl(base+ptr); __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); } /* RX3715 and RX1950 use similar to H1940 code and the * same offsets for resume and checksum pointers */ if (machine_is_rx3715() || machine_is_rx1950()) { void *base = phys_to_virt(H1940_SUSPEND_CHECK); unsigned long ptr; unsigned long calc = 0; /* generate check for the bootloader to check on resume */ for (ptr = 0; ptr < 0x40000; ptr += 0x4) calc += __raw_readl(base+ptr); __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); } if ( machine_is_aml_m5900() ) s3c2410_gpio_setpin(S3C2410_GPF(2), 1); if (machine_is_rx1950()) { /* According to S3C2442 user's manual, page 7-17, * when the system is operating in NAND boot mode, * the hardware pin configuration - EINT[23:21] – * must be set as input for starting up after * wakeup from sleep mode */ s3c_gpio_cfgpin(S3C2410_GPG(13), S3C2410_GPIO_INPUT); s3c_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPIO_INPUT); s3c_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPIO_INPUT); } }
static void s3c2410_pm_prepare(void) { /* ensure at least GSTATUS3 has the resume address */ { volatile unsigned long *ptr = phys_to_virt(0x30000900); *ptr = 0x55; } __raw_writel(0x7, S3C2410_GSTATUS2); S3C_PMDBG("GSTATUS2 0x%08x\n", __raw_readl(S3C2410_GSTATUS2)); __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2410_GSTATUS3); S3C_PMDBG("GSTATUS3 0x%08x\n", __raw_readl(S3C2410_GSTATUS3)); S3C_PMDBG("GSTATUS4 0x%08x\n", __raw_readl(S3C2410_GSTATUS4)); if (machine_is_h1940()) { void *base = phys_to_virt(H1940_SUSPEND_CHECK); unsigned long ptr; unsigned long calc = 0; /* generate check for the bootloader to check on resume */ for (ptr = 0; ptr < 0x40000; ptr += 0x400) calc += __raw_readl(base+ptr); __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); } /* the RX3715 uses similar code and the same H1940 and the * same offsets for resume and checksum pointers */ if (machine_is_rx3715()) { void *base = phys_to_virt(H1940_SUSPEND_CHECK); unsigned long ptr; unsigned long calc = 0; /* generate check for the bootloader to check on resume */ for (ptr = 0; ptr < 0x40000; ptr += 0x4) calc += __raw_readl(base+ptr); __raw_writel(calc, phys_to_virt(H1940_SUSPEND_CHECKSUM)); } if ( machine_is_aml_m5900() ) s3c2410_gpio_setpin(S3C2410_GPF(2), 1); }
static void s3c2410_pm_resume(void) { unsigned long tmp; /* unset the return-from-sleep flag, to ensure reset */ tmp = __raw_readl(S3C2410_GSTATUS2); tmp &= S3C2410_GSTATUS2_OFFRESET; __raw_writel(tmp, S3C2410_GSTATUS2); if ( machine_is_aml_m5900() ) s3c2410_gpio_setpin(S3C2410_GPF(2), 0); }
static void __init mini2440_machine_init(void) { s3c24xx_fb_set_platdata(&s3c24xx_fb_info); s3c_i2c0_set_platdata(NULL); s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); printk("S3C2410_GPA=%d\n",S3C2410_GPA(0)); printk("S3C2410_GPB=%d\n",S3C2410_GPB(0)); printk("S3C2410_GPC=%d\n",S3C2410_GPC(0)); printk("S3C2410_GPD=%d\n",S3C2410_GPD(0)); printk("S3C2410_GPE=%d\n",S3C2410_GPE(0)); printk("S3C2410_GPF=%d\n",S3C2410_GPF(0)); printk("S3C2410_GPG=%d\n",S3C2410_GPG(0)); printk("S3C2410_GPH=%d\n",S3C2410_GPH(0)); s3c_device_nand.dev.platform_data = &friendly_arm_nand_info; s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg; platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices)); platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); //GPIO resource MAP s3c_pm_init(); }
void __init smdk_machine_init(void) { s3c2410_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT); s3c2410_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT); s3c2410_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT); s3c2410_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT); s3c2410_gpio_setpin(S3C2410_GPF(4), 1); s3c2410_gpio_setpin(S3C2410_GPF(5), 1); s3c2410_gpio_setpin(S3C2410_GPF(6), 1); s3c2410_gpio_setpin(S3C2410_GPF(7), 1); if (machine_is_smdk2443()) smdk_nand_info.twrph0 = 50; s3c_device_nand.dev.platform_data = &smdk_nand_info; platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); s3c_pm_init(); }
void __init smdk_machine_init(void) { /* Configure the LEDs (even if we have no LED support)*/ s3c_gpio_cfgpin(S3C2410_GPF(4), S3C2410_GPIO_OUTPUT); s3c_gpio_cfgpin(S3C2410_GPF(5), S3C2410_GPIO_OUTPUT); s3c_gpio_cfgpin(S3C2410_GPF(6), S3C2410_GPIO_OUTPUT); s3c_gpio_cfgpin(S3C2410_GPF(7), S3C2410_GPIO_OUTPUT); s3c2410_gpio_setpin(S3C2410_GPF(4), 1); s3c2410_gpio_setpin(S3C2410_GPF(5), 1); s3c2410_gpio_setpin(S3C2410_GPF(6), 1); s3c2410_gpio_setpin(S3C2410_GPF(7), 1); if (machine_is_smdk2443()) smdk_nand_info.twrph0 = 50; s3c_nand_set_platdata(&smdk_nand_info); platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); s3c_pm_init(); }
static void power_supply_exit(struct device *dev) { gpio_free(S3C2410_GPF(2)); }
static int h1940_is_ac_online(void) { return !gpio_get_value(S3C2410_GPF(2)); }
static int power_supply_init(struct device *dev) { return gpio_request(S3C2410_GPF(2), "cable plugged"); }
void h1940_enable_charger(void) { gpio_set_value(H1940_LATCH_SM803_ENABLE, 1); } void h1940_disable_charger(void) { gpio_set_value(H1940_LATCH_SM803_ENABLE, 0); } static struct s3c_adc_bat_pdata h1940_bat_cfg = { .init = h1940_bat_init, .exit = h1940_bat_exit, .enable_charger = h1940_enable_charger, .disable_charger = h1940_disable_charger, .gpio_charge_finished = S3C2410_GPF(3), .gpio_inverted = 1, .lut_noac = bat_lut_noac, .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac), .lut_acin = bat_lut_acin, .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin), .volt_channel = 0, .current_channel = 1, .volt_mult = 4056, .current_mult = 1893, .internal_impedance = 200, .backup_volt_channel = 3, /* TODO Check backup volt multiplier */ .backup_volt_mult = 4056, .backup_volt_min = 0, .backup_volt_max = 4149288
}; static struct platform_device rx1950_leds = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = &rx1950_leds_pdata, }, }; static struct s3c_adc_bat_pdata rx1950_bat_cfg = { .init = rx1950_bat_init, .exit = rx1950_bat_exit, .enable_charger = rx1950_enable_charger, .disable_charger = rx1950_disable_charger, .gpio_charge_finished = S3C2410_GPF(3), .lut_noac = bat_lut_noac, .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac), .lut_acin = bat_lut_acin, .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin), .volt_channel = 0, .current_channel = 1, .volt_mult = 4235, .current_mult = 2900, .internal_impedance = 200, }; static struct platform_device rx1950_battery = { .name = "s3c-adc-battery", .id = -1, .dev = {
.chip = { .base = S3C2410_GPD(0), .owner = THIS_MODULE, .label = "GPIOD", .ngpio = 16, }, }, { .chip = { .base = S3C2410_GPE(0), .label = "GPIOE", .owner = THIS_MODULE, .ngpio = 16, }, }, { .chip = { .base = S3C2410_GPF(0), .owner = THIS_MODULE, .label = "GPIOF", .ngpio = 8, .to_irq = s3c24xx_gpiolib_fbank_to_irq, }, }, { .irq_base = IRQ_EINT8, .chip = { .base = S3C2410_GPG(0), .owner = THIS_MODULE, .label = "GPIOG", .ngpio = 16, .to_irq = samsung_gpiolib_to_irq, }, }, {
#include <asm/irq.h> #include <mach/regs-gpio.h> #include <mach/leds-gpio.h> #include <plat/nand.h> #include <plat/common-smdk.h> #include <plat/gpio-cfg.h> #include <plat/devs.h> #include <plat/pm.h> /* LED devices */ static struct s3c24xx_led_platdata smdk_pdata_led4 = { .gpio = S3C2410_GPF(4), .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, .name = "led4", .def_trigger = "timer", }; static struct s3c24xx_led_platdata smdk_pdata_led5 = { .gpio = S3C2410_GPF(5), .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE, .name = "led5", .def_trigger = "nand-disk", }; static struct s3c24xx_led_platdata smdk_pdata_led6 = { .gpio = S3C2410_GPF(6), .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.ulcon = 0x03, .ufcon = 0x51, }, /* IR port */ [2] = { .hwport = 2, .flags = 0, .ucon = 0x3c5, .ulcon = 0x43, .ufcon = 0x51, } }; static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = { .pullup_pin = S3C2410_GPF(2), }; static struct platform_device *smdk2413_devices[] __initdata = { &s3c_device_ohci, &s3c_device_wdt, &s3c_device_i2c0, &s3c_device_iis, &s3c_device_usbgadget, }; static void __init smdk2413_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) {
int major; static struct class *button_irq_class; static struct device *button_irq_dev; //static volatile unsigned long *rGPFCON = NULL; //static volatile unsigned long *rGPFDAT = NULL; struct pin_desc { unsigned int pin; unsigned int key_val; }; struct pin_desc pins_desc[6] = { { S3C2410_GPF(0), 0x04}, // K5 { S3C2410_GPF(1), 0x01}, // K2 { S3C2410_GPF(2), 0x05}, // K6 { S3C2410_GPF(3), 0x02}, // K3 { S3C2410_GPF(4), 0x06}, // K7 { S3C2410_GPF(5), 0x03}, // K4 }; static unsigned char keyval; static irqreturn_t buttons_irq(int irq, void *dev_id) { struct pin_desc *pindesc = (struct pin_desc *)dev_id; unsigned int pinval; //printk("pindesc->pin = %d\n", pindesc->pin);
.flags = 0, .ucon = 0x2c5, .ulcon = 0x03, .ufcon = 0x51, }, }; static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { .vbus_pin = S3C2410_GPG(1), .vbus_pin_inverted = 0, .pullup_pin = S3C2410_GPB(3), }; static struct gpio_keys_button n30_buttons[] = { { .gpio = S3C2410_GPF(0), .code = KEY_POWER, .desc = "Power", .active_low = 0, }, { .gpio = S3C2410_GPG(9), .code = KEY_UP, .desc = "Thumbwheel Up", .active_low = 0, }, { .gpio = S3C2410_GPG(8), .code = KEY_DOWN, .desc = "Thumbwheel Down", .active_low = 0,
/* MMC/SD */ static struct s3c24xx_mci_pdata gec2440_mmc_cfg = { .gpio_detect = S3C2410_GPG(8), .gpio_wprotect = S3C2410_GPH(8), .set_power = NULL, .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34, }; //LED #if defined(HARDWARE_VERSION_A) static struct gpio_led gec2440_led_pins[] = { { .name = "LED1", .gpio = S3C2410_GPF(5), .active_low = true, }, { .name = "LED2", .gpio = S3C2410_GPF(4) , .active_low = true, }, { .name = "LED3", .gpio = S3C2410_GPF(6), .active_low = true, }, { .name = "LED4", .gpio = S3C2410_GPF(7),
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); } } static struct s3c_fb_platdata smdk2416_fb_platdata = { .win[0] = &smdk2416_fb_win[0], .setup_gpio = s3c2416_fb_gpio_setup_24bpp, .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, }; static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = { .max_width = 4, .cd_type = S3C_SDHCI_CD_GPIO, .ext_cd_gpio = S3C2410_GPF(1), .ext_cd_gpio_invert = 1, }; static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = { .max_width = 4, .cd_type = S3C_SDHCI_CD_NONE, }; static struct platform_device *smdk2416_devices[] __initdata = { &s3c_device_fb, &s3c_device_wdt, &s3c_device_ohci, &s3c_device_i2c0, &s3c_device_hsmmc0, &s3c_device_hsmmc1,