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 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 sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { unsigned short cpr, csr; struct device *scoop = SCOOP_DEV[skt->nr].dev; cpr = read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR); write_scoop_reg(scoop, SCOOP_IRM, 0x00FF); write_scoop_reg(scoop, SCOOP_ISR, 0x0000); write_scoop_reg(scoop, SCOOP_IRM, 0x0000); csr = read_scoop_reg(scoop, SCOOP_CSR); if (csr & 0x0004) { /* card eject */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS; } else if (!(SCOOP_DEV[skt->nr].keep_vs & NO_KEEP_VS)) { /* keep vs1,vs2 */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); csr |= SCOOP_DEV[skt->nr].keep_vs; } else if (cpr & 0x0003) { /* power on */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); SCOOP_DEV[skt->nr].keep_vs = (csr & 0x00C0); } else { /* card detect */ if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 1) { write_scoop_reg(scoop, SCOOP_CDR, 0x0000); } else { write_scoop_reg(scoop, SCOOP_CDR, 0x0002); } } state->detect = (csr & 0x0004) ? 0 : 1; state->ready = (csr & 0x0002) ? 1 : 0; state->bvd1 = (csr & 0x0010) ? 1 : 0; state->bvd2 = (csr & 0x0020) ? 1 : 0; state->wrprot = (csr & 0x0008) ? 1 : 0; state->vs_3v = (csr & 0x0040) ? 0 : 1; state->vs_Xv = (csr & 0x0080) ? 0 : 1; if ((cpr & 0x0080) && ((cpr & 0x8040) != 0x8040)) { printk(KERN_ERR "sharpsl_pcmcia_socket_state(): CPR=%04X, Low voltage!\n", cpr); } }
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 __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; }
/* * 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; }