static void __init osiris_map_io(void) { unsigned long flags; s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); /* check for the newer revision boards with large page nand */ if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) { printk(KERN_INFO "OSIRIS-B detected (revision %d)\n", __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK); osiris_nand_sets[0].partitions = osiris_default_nand_part_large; osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large); } else { /* write-protect line to the NAND */ gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPA(0)); } /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */ local_irq_save(flags); __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON); local_irq_restore(flags); }
static void __init anubis_map_io(void) { /* initialise the clocks */ s3c24xx_dclk0.parent = &clk_upll; s3c24xx_dclk0.rate = 12*1000*1000; s3c24xx_dclk1.parent = &clk_upll; s3c24xx_dclk1.rate = 24*1000*1000; s3c24xx_clkout0.parent = &s3c24xx_dclk0; s3c24xx_clkout1.parent = &s3c24xx_dclk1; s3c24xx_uclk.parent = &s3c24xx_clkout1; s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks)); s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); s3c24xx_init_clocks(0); s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); /* check for the newer revision boards with large page nand */ if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) { printk(KERN_INFO "ANUBIS-B detected (revision %d)\n", __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK); anubis_nand_sets[0].partitions = anubis_default_nand_part_large; anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large); } else { /* ensure that the GPIO is setup */ gpio_request_one(S3C2410_GPA(0), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPA(0)); } }
static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) { s3c2410_gpio_setpin(S3C2410_GPA(21), 1); s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); return 0; }
static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) { /* ensure that an nRESET is not generated on resume. */ s3c2410_gpio_setpin(S3C2410_GPA(21), 1); s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); return 0; }
static int rx1950_spk_power(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { if (SND_SOC_DAPM_EVENT_ON(event)) gpio_set_value(S3C2410_GPA(1), 1); else gpio_set_value(S3C2410_GPA(1), 0); return 0; }
static void __exit rx1950_exit(void) { platform_device_unregister(s3c24xx_snd_device); snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), hp_jack_gpios); gpio_free(S3C2410_GPA(1)); }
static void __init anubis_map_io(void) { s3c24xx_dclk0.parent = &clk_upll; s3c24xx_dclk0.rate = 12*1000*1000; s3c24xx_dclk1.parent = &clk_upll; s3c24xx_dclk1.rate = 24*1000*1000; s3c24xx_clkout0.parent = &s3c24xx_dclk0; s3c24xx_clkout1.parent = &s3c24xx_dclk1; s3c24xx_uclk.parent = &s3c24xx_clkout1; s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks)); s3c_device_nand.dev.platform_data = &anubis_nand_info; s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); s3c24xx_init_clocks(0); s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) { printk(KERN_INFO "ANUBIS-B detected (revision %d)\n", __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK); anubis_nand_sets[0].partitions = anubis_default_nand_part_large; anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large); } else { s3c2410_gpio_setpin(S3C2410_GPA(0), 1); } }
static void __init rx1950_init_machine(void) { int i; s3c24xx_fb_set_platdata(&rx1950_lcd_cfg); s3c24xx_udc_set_platdata(&rx1950_udc_cfg); s3c24xx_ts_set_platdata(&rx1950_ts_cfg); s3c24xx_mci_set_platdata(&rx1950_mmc_cfg); s3c_i2c0_set_platdata(NULL); s3c_nand_set_platdata(&rx1950_nand_info); /* Turn off suspend on both USB ports, and switch the * selectable USB port to USB device mode. */ s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); /* mmc power is disabled by default */ WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power")); gpio_direction_output(S3C2410_GPJ(1), 0); for (i = 0; i < 8; i++) WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); for (i = 10; i < 16; i++) WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power")); for (i = 2; i < 8; i++) WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); for (i = 11; i < 16; i++) WARN_ON(gpio_request(S3C2410_GPD(i), "LCD power")); WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink")); WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink")); WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink")); gpio_direction_output(S3C2410_GPA(3), 0); gpio_direction_output(S3C2410_GPA(4), 0); gpio_direction_output(S3C2410_GPJ(6), 0); platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); i2c_register_board_info(0, rx1950_i2c_devices, ARRAY_SIZE(rx1950_i2c_devices)); }
int h1940_led_blink_set(unsigned gpio, int state, unsigned long *delay_on, unsigned long *delay_off) { int blink_gpio, check_gpio1, check_gpio2; switch (gpio) { case H1940_LATCH_LED_GREEN: blink_gpio = S3C2410_GPA(7); check_gpio1 = S3C2410_GPA(1); check_gpio2 = S3C2410_GPA(3); break; case H1940_LATCH_LED_RED: blink_gpio = S3C2410_GPA(1); check_gpio1 = S3C2410_GPA(7); check_gpio2 = S3C2410_GPA(3); break; default: blink_gpio = S3C2410_GPA(3); check_gpio1 = S3C2410_GPA(1); check_gpio1 = S3C2410_GPA(7); break; } if (delay_on && delay_off && !*delay_on && !*delay_off) *delay_on = *delay_off = 500; spin_lock(&h1940_blink_spin); switch (state) { case GPIO_LED_NO_BLINK_LOW: case GPIO_LED_NO_BLINK_HIGH: if (!gpio_get_value(check_gpio1) && !gpio_get_value(check_gpio2)) gpio_set_value(H1940_LATCH_LED_FLASH, 0); gpio_set_value(blink_gpio, 0); if (gpio_is_valid(gpio)) gpio_set_value(gpio, state); break; case GPIO_LED_BLINK: if (gpio_is_valid(gpio)) gpio_set_value(gpio, 0); gpio_set_value(H1940_LATCH_LED_FLASH, 1); gpio_set_value(blink_gpio, 1); break; } spin_unlock(&h1940_blink_spin); return 0; }
static void osiris_pm_resume(void) { if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8) __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1); __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); }
static int osiris_pm_suspend(void) { unsigned int tmp; pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0); tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL; /* ensure correct NAND slot is selected on resume */ if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0) tmp |= 2; __raw_writeb(tmp, OSIRIS_VA_CTRL0); /* ensure that an nRESET is not generated on resume. */ gpio_request_one(S3C2410_GPA(21), GPIOF_OUT_INIT_HIGH, NULL); gpio_free(S3C2410_GPA(21)); return 0; }
static int osiris_pm_suspend(void) { unsigned int tmp; pm_osiris_ctrl0 = __raw_readb(OSIRIS_VA_CTRL0); tmp = pm_osiris_ctrl0 & ~OSIRIS_CTRL0_NANDSEL; /* ensure correct NAND slot is selected on resume */ if ((pm_osiris_ctrl0 & OSIRIS_CTRL0_BOOT_INT) == 0) tmp |= 2; __raw_writeb(tmp, OSIRIS_VA_CTRL0); /* ensure that an nRESET is not generated on resume. */ s3c2410_gpio_setpin(S3C2410_GPA(21), 1); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPIO_OUTPUT); return 0; }
static int osiris_pm_resume(struct sys_device *sd) { if (pm_osiris_ctrl0 & OSIRIS_CTRL0_FIX8) __raw_writeb(OSIRIS_CTRL1_FIX8, OSIRIS_VA_CTRL1); __raw_writeb(pm_osiris_ctrl0, OSIRIS_VA_CTRL0); s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); return 0; }
static int __init rx1950_init(void) { int ret; if (!machine_is_rx1950()) return -ENODEV; ret = gpio_request(S3C2410_GPA(1), "speaker-power"); if (ret) goto err_gpio; ret = gpio_direction_output(S3C2410_GPA(1), 0); if (ret) goto err_gpio_conf; s3c24xx_snd_device = platform_device_alloc("soc-audio", -1); if (!s3c24xx_snd_device) { ret = -ENOMEM; goto err_plat_alloc; } platform_set_drvdata(s3c24xx_snd_device, &rx1950_asoc); ret = platform_device_add(s3c24xx_snd_device); if (ret) { platform_device_put(s3c24xx_snd_device); goto err_plat_add; } return 0; err_plat_add: err_plat_alloc: err_gpio_conf: gpio_free(S3C2410_GPA(1)); err_gpio: return ret; }
static void __init bast_init(void) { register_syscore_ops(&bast_pm_syscore_ops); s3c_i2c0_set_platdata(&bast_i2c_info); s3c_nand_set_platdata(&bast_nand_info); s3c24xx_fb_set_platdata(&bast_fb_info); platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); i2c_register_board_info(0, bast_i2c_devs, ARRAY_SIZE(bast_i2c_devs)); usb_simtec_init(); nor_simtec_init(); simtec_audio_add(NULL, true, &bast_audio); WARN_ON(gpio_request(S3C2410_GPA(21), "bast nreset")); s3c_cpufreq_setboard(&bast_cpufreq); }
static void __init osiris_map_io(void) { unsigned long flags; /* initialise the clocks */ s3c24xx_dclk0.parent = &clk_upll; s3c24xx_dclk0.rate = 12*1000*1000; s3c24xx_dclk1.parent = &clk_upll; s3c24xx_dclk1.rate = 24*1000*1000; s3c24xx_clkout0.parent = &s3c24xx_dclk0; s3c24xx_clkout1.parent = &s3c24xx_dclk1; s3c24xx_uclk.parent = &s3c24xx_clkout1; s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks)); s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); s3c24xx_init_clocks(0); s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); /* check for the newer revision boards with large page nand */ if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) { printk(KERN_INFO "OSIRIS-B detected (revision %d)\n", __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK); osiris_nand_sets[0].partitions = osiris_default_nand_part_large; osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large); } else { /* write-protect line to the NAND */ s3c2410_gpio_setpin(S3C2410_GPA(0), 1); } /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */ local_irq_save(flags); __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON); local_irq_restore(flags); }
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(); }
static int rx1950_led_blink_set(unsigned gpio, int state, unsigned long *delay_on, unsigned long *delay_off) { int blink_gpio, check_gpio; switch (gpio) { case S3C2410_GPA(6): blink_gpio = S3C2410_GPA(4); check_gpio = S3C2410_GPA(3); break; case S3C2410_GPA(7): blink_gpio = S3C2410_GPA(3); check_gpio = S3C2410_GPA(4); break; default: return -EINVAL; break; } if (delay_on && delay_off && !*delay_on && !*delay_off) *delay_on = *delay_off = 500; spin_lock(&rx1950_blink_spin); switch (state) { case GPIO_LED_NO_BLINK_LOW: case GPIO_LED_NO_BLINK_HIGH: if (!gpio_get_value(check_gpio)) gpio_set_value(S3C2410_GPJ(6), 0); gpio_set_value(blink_gpio, 0); gpio_set_value(gpio, state); break; case GPIO_LED_BLINK: gpio_set_value(gpio, 0); gpio_set_value(S3C2410_GPJ(6), 1); gpio_set_value(blink_gpio, 1); break; } spin_unlock(&rx1950_blink_spin); return 0; }
static void __exit rx1950_exit(void) { platform_device_unregister(s3c24xx_snd_device); gpio_free(S3C2410_GPA(1)); }
static int bast_pm_suspend(struct sys_device *sd, pm_message_t state) { /* ensure that an nRESET is not generated on resume. */ gpio_direction_output(S3C2410_GPA(21), 1); return 0; }
static int bast_pm_suspend(void) { /* ensure that an nRESET is not generated on resume. */ gpio_direction_output(S3C2410_GPA(21), 1); return 0; }
static void bast_pm_resume(void) { s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); }
static int bast_pm_resume(struct sys_device *sd) { s3c2410_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); return 0; }
static void __init h1940_init(void) { u32 tmp; s3c24xx_fb_set_platdata(&h1940_fb_info); s3c24xx_mci_set_platdata(&h1940_mmc_cfg); s3c24xx_udc_set_platdata(&h1940_udc_cfg); s3c24xx_ts_set_platdata(&h1940_ts_cfg); s3c_i2c0_set_platdata(NULL); /* Turn off suspend on both USB ports, and switch the * selectable USB port to USB device mode. */ s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); tmp = (0x78 << S3C24XX_PLLCON_MDIVSHIFT) | (0x02 << S3C24XX_PLLCON_PDIVSHIFT) | (0x03 << S3C24XX_PLLCON_SDIVSHIFT); writel(tmp, S3C2410_UPLLCON); gpio_request(S3C2410_GPC(0), "LCD power"); gpio_request(S3C2410_GPC(1), "LCD power"); gpio_request(S3C2410_GPC(4), "LCD power"); gpio_request(S3C2410_GPC(5), "LCD power"); gpio_request(S3C2410_GPC(6), "LCD power"); gpio_request(H1940_LATCH_LCD_P0, "LCD power"); gpio_request(H1940_LATCH_LCD_P1, "LCD power"); gpio_request(H1940_LATCH_LCD_P2, "LCD power"); gpio_request(H1940_LATCH_LCD_P3, "LCD power"); gpio_request(H1940_LATCH_LCD_P4, "LCD power"); gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power"); gpio_direction_output(S3C2410_GPC(0), 0); gpio_direction_output(S3C2410_GPC(1), 0); gpio_direction_output(S3C2410_GPC(4), 0); gpio_direction_output(S3C2410_GPC(5), 0); gpio_direction_input(S3C2410_GPC(6)); gpio_direction_output(H1940_LATCH_LCD_P0, 0); gpio_direction_output(H1940_LATCH_LCD_P1, 0); gpio_direction_output(H1940_LATCH_LCD_P2, 0); gpio_direction_output(H1940_LATCH_LCD_P3, 0); gpio_direction_output(H1940_LATCH_LCD_P4, 0); gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0); gpio_request(H1940_LATCH_SD_POWER, "SD power"); gpio_direction_output(H1940_LATCH_SD_POWER, 0); platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); gpio_request(S3C2410_GPA(1), "Red LED blink"); gpio_request(S3C2410_GPA(3), "Blue LED blink"); gpio_request(S3C2410_GPA(7), "Green LED blink"); gpio_request(H1940_LATCH_LED_FLASH, "LED blink"); gpio_direction_output(S3C2410_GPA(1), 0); gpio_direction_output(S3C2410_GPA(3), 0); gpio_direction_output(S3C2410_GPA(7), 0); gpio_direction_output(H1940_LATCH_LED_FLASH, 0); i2c_register_board_info(0, h1940_i2c_devices, ARRAY_SIZE(h1940_i2c_devices)); }
{ return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO; } static int s3c64xx_gpiolib_lbank_to_irq(struct gpio_chip *chip, unsigned pin) { return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO; } #endif struct samsung_gpio_chip s3c24xx_gpios[] = { #ifdef CONFIG_PLAT_S3C24XX { .config = &s3c24xx_gpiocfg_banka, .chip = { .base = S3C2410_GPA(0), .owner = THIS_MODULE, .label = "GPIOA", .ngpio = 27, .direction_input = s3c24xx_gpiolib_banka_input, .direction_output = s3c24xx_gpiolib_banka_output, }, }, { .chip = { .base = S3C2410_GPB(0), .owner = THIS_MODULE, .label = "GPIOB", .ngpio = 11, }, }, { .chip = {
} } static struct plat_lcd_data h1940_lcd_power_data = { .set_power = h1940_lcd_power_set, }; static struct platform_device h1940_lcd_powerdev = { .name = "platform-lcd", .dev.parent = &s3c_device_lcd.dev, .dev.platform_data = &h1940_lcd_power_data, }; static struct uda1380_platform_data uda1380_info = { .gpio_power = H1940_LATCH_UDA_POWER, .gpio_reset = S3C2410_GPA(12), .dac_clk = UDA1380_DAC_CLK_SYSCLK, }; static struct i2c_board_info h1940_i2c_devices[] = { { I2C_BOARD_INFO("uda1380", 0x1a), .platform_data = &uda1380_info, }, }; #define DECLARE_BUTTON(p, k, n, w) \ { \ .gpio = p, \ .code = k, \ .desc = n, \
gpio_set_value(gpio, 0); gpio_set_value(S3C2410_GPJ(6), 1); gpio_set_value(blink_gpio, 1); break; } spin_unlock(&rx1950_blink_spin); return 0; } static struct gpio_led rx1950_leds_desc[] = { { .name = "Green", .default_trigger = "main-battery-full", .gpio = S3C2410_GPA(6), .retain_state_suspended = 1, }, { .name = "Red", .default_trigger = "main-battery-charging-blink-full-solid", .gpio = S3C2410_GPA(7), .retain_state_suspended = 1, }, { .name = "Blue", .default_trigger = "rx1950-acx-mem", .gpio = S3C2410_GPA(11), .retain_state_suspended = 1, },