static int spitz_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_spitz; int ret; if (machine_is_akita()) spitz_mic_gpio = AKITA_GPIO_MIC_BIAS; else spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS; ret = gpio_request(spitz_mic_gpio, "MIC GPIO"); if (ret) goto err1; ret = gpio_direction_output(spitz_mic_gpio, 0); if (ret) goto err2; card->dev = &pdev->dev; ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); goto err2; } return 0; err2: gpio_free(spitz_mic_gpio); err1: return ret; }
static void __init common_init(void) { init_gpio_reset(SPITZ_GPIO_ON_RESET, 1); pm_power_off = spitz_poweroff; arm_pm_restart = spitz_restart; if (machine_is_spitz()) { sharpsl_nand_partitions[1].size = 5 * 1024 * 1024; } else if (machine_is_akita()) { sharpsl_nand_partitions[1].size = 58 * 1024 * 1024; } else if (machine_is_borzoi()) { sharpsl_nand_partitions[1].size = 32 * 1024 * 1024; } PMCR = 0x00; /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ PCFR |= PCFR_OPDE; pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config)); spitz_init_spi(); platform_add_devices(devices, ARRAY_SIZE(devices)); pxa_set_mci_info(&spitz_mci_platform_data); pxa_set_ohci_info(&spitz_ohci_platform_data); pxa_set_ficp_info(&spitz_ficp_platform_data); set_pxa_fb_info(&spitz_pxafb_info); pxa_set_i2c_info(NULL); }
static void spitz_presuspend(void) { spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); /* GPIO Sleep Register */ PGSR0 = 0x00144018; PGSR1 = 0x00EF0000; if (machine_is_akita()) { PGSR2 = 0x2121C000; PGSR3 = 0x00600400; } else { PGSR2 = 0x0121C000; PGSR3 = 0x00600000; } PGSR0 &= ~SPITZ_GPIO_G0_STROBE_BIT; PGSR1 &= ~SPITZ_GPIO_G1_STROBE_BIT; PGSR2 &= ~SPITZ_GPIO_G2_STROBE_BIT; PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT; PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0); pxa_gpio_mode(GPIO18_RDY|GPIO_OUT | GPIO_DFLT_HIGH); PRER = GPIO_bit(SPITZ_GPIO_KEY_INT); PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC; PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); PKSR = 0xffffffff; // clear /* nRESET_OUT Disable */ PSLR |= PSLR_SL_ROD; /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ PCFR = PCFR_GPR_EN | PCFR_OPDE; }
static void __init spitz_pcmcia_init(void) { /* Akita has only one PCMCIA slot used */ if (machine_is_akita()) spitz_pcmcia_config.num_devs = 1; platform_scoop_config = &spitz_pcmcia_config; }
static void __init spitz_scoop_init(void) { platform_device_register(&spitz_scoop_1_device); /* Akita doesn't have the second SCOOP chip */ if (!machine_is_akita()) platform_device_register(&spitz_scoop_2_device); }
static void __init spitz_irda_init(void) { if (machine_is_akita()) spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON; else spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON; pxa_set_ficp_info(&spitz_ficp_platform_data); }
static void __init spitz_init_spi(void) { if (machine_is_akita()) { spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; } pxa2xx_set_spi_info(2, &spitz_spi_info); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); }
static void __init spitz_spi_init(void) { struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info; if (machine_is_akita()) { lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; } pxa2xx_set_spi_info(2, &spitz_spi_info); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); }
static int spitz_mic_bias(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { if (machine_is_borzoi() || machine_is_spitz()) gpio_set_value(SPITZ_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); if (machine_is_akita()) gpio_set_value(AKITA_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); return 0; }
static void __init spitz_i2c_init(void) { int size = ARRAY_SIZE(spitz_i2c_devs); /* Only Akita has the max7310 chip */ if (!machine_is_akita()) size--; pxa_set_i2c_info(NULL); pxa27x_set_i2c_power_info(NULL); i2c_register_board_info(0, spitz_i2c_devs, size); i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs)); }
int __init init_sharpsl(void) { struct mtd_partition *parts; int nb_parts = 0; char *part_type = "static"; printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR); sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); if (!sharpsl_map.virt) { printk("Failed to ioremap\n"); return -EIO; } simple_map_init(&sharpsl_map); mymtd = do_map_probe("map_rom", &sharpsl_map); if (!mymtd) { iounmap(sharpsl_map.virt); return -ENXIO; } mymtd->owner = THIS_MODULE; if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky() || machine_is_poodle()) { sharpsl_partitions[0].size=0x006d0000; sharpsl_partitions[0].offset=0x00120000; } else if (machine_is_tosa()) { sharpsl_partitions[0].size=0x006a0000; sharpsl_partitions[0].offset=0x00160000; } else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) { sharpsl_partitions[0].size=0x006b0000; sharpsl_partitions[0].offset=0x00140000; } else { map_destroy(mymtd); iounmap(sharpsl_map.virt); return -ENODEV; } parts = sharpsl_partitions; nb_parts = ARRAY_SIZE(sharpsl_partitions); printk(KERN_NOTICE "Using %s partition definition\n", part_type); add_mtd_partitions(mymtd, parts, nb_parts); return 0; }
static void __init spitz_nand_init(void) { if (machine_is_spitz()) { spitz_nand_partitions[1].size = 5 * 1024 * 1024; } else if (machine_is_akita()) { spitz_nand_partitions[1].size = 58 * 1024 * 1024; spitz_nand_bbt.len = 1; spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops; } else if (machine_is_borzoi()) { spitz_nand_partitions[1].size = 32 * 1024 * 1024; spitz_nand_bbt.len = 1; spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops; } platform_device_register(&spitz_nand_device); }
static int __init spitz_init(void) { int ret; if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) return -ENODEV; spitz_snd_device = platform_device_alloc("soc-audio", -1); if (!spitz_snd_device) return -ENOMEM; platform_set_drvdata(spitz_snd_device, &snd_soc_spitz); ret = platform_device_add(spitz_snd_device); if (ret) platform_device_put(spitz_snd_device); return ret; }
static int spitzled_probe(struct platform_device *pdev) { int ret; if (machine_is_akita()) { spitz_green_led.name = "spitz:green:mail"; spitz_green_led.default_trigger = "nand-disk"; } ret = led_classdev_register(&pdev->dev, &spitz_amber_led); if (ret < 0) return ret; ret = led_classdev_register(&pdev->dev, &spitz_green_led); if (ret < 0) led_classdev_unregister(&spitz_amber_led); return ret; }
static void __init spitz_init_spi(void) { int err; err = gpio_request(SPITZ_GPIO_ADS7846_CS, "ADS7846_CS"); if (err) return; err = gpio_request(SPITZ_GPIO_LCDCON_CS, "LCDCON_CS"); if (err) goto err_free_1; err = gpio_request(SPITZ_GPIO_MAX1111_CS, "MAX1111_CS"); if (err) goto err_free_2; err = gpio_direction_output(SPITZ_GPIO_ADS7846_CS, 1); if (err) goto err_free_3; err = gpio_direction_output(SPITZ_GPIO_LCDCON_CS, 1); if (err) goto err_free_3; err = gpio_direction_output(SPITZ_GPIO_MAX1111_CS, 1); if (err) goto err_free_3; if (machine_is_akita()) { spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; } pxa2xx_set_spi_info(2, &spitz_spi_info); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); return; err_free_3: gpio_free(SPITZ_GPIO_MAX1111_CS); err_free_2: gpio_free(SPITZ_GPIO_LCDCON_CS); err_free_1: gpio_free(SPITZ_GPIO_ADS7846_CS); }
static int __devinit spitzpm_init(void) { int ret; if (!machine_is_spitz() && !machine_is_akita() && !machine_is_borzoi()) return -ENODEV; spitzpm_device = platform_device_alloc("sharpsl-pm", -1); if (!spitzpm_device) return -ENOMEM; spitzpm_device->dev.platform_data = &spitz_pm_machinfo; ret = platform_device_add(spitzpm_device); if (ret) platform_device_put(spitzpm_device); return ret; }
static int spitz_mic_bias(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { if (machine_is_borzoi() || machine_is_spitz()) { if (SND_SOC_DAPM_EVENT_ON(event)) set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); else reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); } if (machine_is_akita()) { if (SND_SOC_DAPM_EVENT_ON(event)) akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_MIC_BIAS); else akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_MIC_BIAS); } return 0; }
static void spitz_presuspend(void) { spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); /* GPIO Sleep Register */ PGSR0 = 0x00144018; PGSR1 = 0x00EF0000; if (machine_is_akita()) { PGSR2 = 0x2121C000; PGSR3 = 0x00600400; } else { PGSR2 = 0x0121C000; PGSR3 = 0x00600000; } PGSR0 &= ~SPITZ_GPIO_G0_STROBE_BIT; PGSR1 &= ~SPITZ_GPIO_G1_STROBE_BIT; PGSR2 &= ~SPITZ_GPIO_G2_STROBE_BIT; PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT; PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0); pxa2xx_mfp_config(&gpio18_config[0], 1); gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown"); gpio_free(18); PRER = GPIO_bit(SPITZ_GPIO_KEY_INT); PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); PWER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET) | PWER_RTC; PKWR = GPIO_bit(SPITZ_GPIO_SYNC) | GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); PKSR = 0xffffffff; /* clear */ /* nRESET_OUT Disable */ PSLR |= PSLR_SL_ROD; /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ PCFR = PCFR_GPR_EN | PCFR_OPDE; }
/* * Main initialization routine */ static int __init sharpsl_nand_init(void) { struct nand_chip *this; struct mtd_partition *sharpsl_partition_info; int err = 0; /* Allocate memory for MTD device structure and private data */ sharpsl_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); if (!sharpsl_mtd) { printk("Unable to allocate SharpSL NAND MTD device structure.\n"); return -ENOMEM; } /* map physical address */ sharpsl_io_base = ioremap(sharpsl_phys_base, 0x1000); if (!sharpsl_io_base) { printk("ioremap to access Sharp SL NAND chip failed\n"); kfree(sharpsl_mtd); return -EIO; } /* Get pointer to private data */ this = (struct nand_chip *)(&sharpsl_mtd[1]); /* Initialize structures */ memset(sharpsl_mtd, 0, sizeof(struct mtd_info)); memset(this, 0, sizeof(struct nand_chip)); /* Link the private data with the MTD structure */ sharpsl_mtd->priv = this; sharpsl_mtd->owner = THIS_MODULE; /* * PXA initialize */ writeb(readb(FLASHCTL) | FLWP, FLASHCTL); /* Set address of NAND IO lines */ this->IO_ADDR_R = FLASHIO; this->IO_ADDR_W = FLASHIO; /* Set address of hardware control function */ this->cmd_ctrl = sharpsl_nand_hwcontrol; this->dev_ready = sharpsl_nand_dev_ready; /* 15 us command delay time */ this->chip_delay = 15; /* set eccmode using hardware ECC */ this->ecc.mode = NAND_ECC_HW; this->ecc.size = 256; this->ecc.bytes = 3; this->badblock_pattern = &sharpsl_bbt; if (machine_is_akita() || machine_is_borzoi()) { this->badblock_pattern = &sharpsl_akita_bbt; this->ecc.layout = &akita_oobinfo; } this->ecc.hwctl = sharpsl_nand_enable_hwecc; this->ecc.calculate = sharpsl_nand_calculate_ecc; this->ecc.correct = nand_correct_data; /* Scan to find existence of the device */ err = nand_scan(sharpsl_mtd, 1); if (err) { iounmap(sharpsl_io_base); kfree(sharpsl_mtd); return err; } /* Register the partitions */ sharpsl_mtd->name = "sharpsl-nand"; nr_partitions = parse_mtd_partitions(sharpsl_mtd, part_probes, &sharpsl_partition_info, 0); if (nr_partitions <= 0) { nr_partitions = DEFAULT_NUM_PARTITIONS; sharpsl_partition_info = sharpsl_nand_default_partition_info; if (machine_is_poodle()) { sharpsl_partition_info[1].size = 22 * 1024 * 1024; } else if (machine_is_corgi() || machine_is_shepherd()) { sharpsl_partition_info[1].size = 25 * 1024 * 1024; } else if (machine_is_husky()) { sharpsl_partition_info[1].size = 53 * 1024 * 1024; } else if (machine_is_spitz()) { sharpsl_partition_info[1].size = 5 * 1024 * 1024; } else if (machine_is_akita()) { sharpsl_partition_info[1].size = 58 * 1024 * 1024; } else if (machine_is_borzoi()) { sharpsl_partition_info[1].size = 32 * 1024 * 1024; } } add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions); /* Return happy */ return 0; }
static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) { unsigned long flags; struct device *scoop = SCOOP_DEV[skt->nr].dev; unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr; switch (state->Vcc) { case 0: break; case 33: break; case 50: break; default: printk(KERN_ERR "sharpsl_pcmcia_configure_socket(): bad Vcc %u\n", state->Vcc); return -1; } if ((state->Vpp!=state->Vcc) && (state->Vpp!=0)) { printk(KERN_ERR "CF slot cannot support Vpp %u\n", state->Vpp); return -1; } local_irq_save(flags); nmcr = (mcr = read_scoop_reg(scoop, SCOOP_MCR)) & ~0x0010; ncpr = (cpr = read_scoop_reg(scoop, SCOOP_CPR)) & ~0x0083; nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080; nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E; if ((machine_is_spitz() || machine_is_borzoi() || machine_is_akita()) && skt->nr == 0) { ncpr |= (state->Vcc == 33) ? 0x0002 : (state->Vcc == 50) ? 0x0002 : 0; } else { ncpr |= (state->Vcc == 33) ? 0x0001 : (state->Vcc == 50) ? 0x0002 : 0; } nmcr |= (state->flags&SS_IOCARD) ? 0x0010 : 0; ncpr |= (state->flags&SS_OUTPUT_ENA) ? 0x0080 : 0; nccr |= (state->flags&SS_RESET)? 0x0080: 0; nimr |= ((skt->status&SS_DETECT) ? 0x0004 : 0)| ((skt->status&SS_READY) ? 0x0002 : 0)| ((skt->status&SS_BATDEAD)? 0x0010 : 0)| ((skt->status&SS_BATWARN)? 0x0020 : 0)| ((skt->status&SS_STSCHG) ? 0x0010 : 0)| ((skt->status&SS_WRPROT) ? 0x0008 : 0); if (!(ncpr & 0x0003)) { SCOOP_DEV[skt->nr].keep_rd = 0; } else if (!SCOOP_DEV[skt->nr].keep_rd) { if (nccr & 0x0080) SCOOP_DEV[skt->nr].keep_rd = 1; else nccr |= 0x0080; } if (mcr != nmcr) write_scoop_reg(scoop, SCOOP_MCR, nmcr); if (cpr != ncpr) { if (platform_scoop_config->power_ctrl) platform_scoop_config->power_ctrl(scoop, ncpr , skt->nr); else write_scoop_reg(scoop, SCOOP_CPR, ncpr); } if (ccr != nccr) write_scoop_reg(scoop, SCOOP_CCR, nccr); if (imr != nimr) write_scoop_reg(scoop, SCOOP_IMR, nimr); local_irq_restore(flags); return 0; }