static int tmio_resume(struct platform_device *dev) { struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data; tmio_hw_init(dev, platform_get_drvdata(dev)); if (cell->resume) cell->resume(dev); return 0; }
static int tmio_resume(struct platform_device *dev) { const struct mfd_cell *cell = mfd_get_cell(dev); /* FIXME - is this required or merely another attack of the broken * SHARP platform? Looks suspicious. */ tmio_hw_init(dev, platform_get_drvdata(dev)); if (cell->resume) cell->resume(dev); return 0; }
static int tmio_probe(struct platform_device *dev) { struct tmio_nand_data *data = dev_get_platdata(&dev->dev); struct resource *fcr = platform_get_resource(dev, IORESOURCE_MEM, 0); struct resource *ccr = platform_get_resource(dev, IORESOURCE_MEM, 1); int irq = platform_get_irq(dev, 0); struct tmio_nand *tmio; struct mtd_info *mtd; struct nand_chip *nand_chip; int retval; if (data == NULL) dev_warn(&dev->dev, "NULL platform data!\n"); tmio = kzalloc(sizeof *tmio, GFP_KERNEL); if (!tmio) { retval = -ENOMEM; goto err_kzalloc; } tmio->dev = dev; platform_set_drvdata(dev, tmio); mtd = &tmio->mtd; nand_chip = &tmio->chip; mtd->priv = nand_chip; mtd->name = "tmio-nand"; tmio->ccr = ioremap(ccr->start, resource_size(ccr)); if (!tmio->ccr) { retval = -EIO; goto err_iomap_ccr; } tmio->fcr_base = fcr->start & 0xfffff; tmio->fcr = ioremap(fcr->start, resource_size(fcr)); if (!tmio->fcr) { retval = -EIO; goto err_iomap_fcr; } retval = tmio_hw_init(dev, tmio); if (retval) goto err_hwinit; /* Set address of NAND IO lines */ nand_chip->IO_ADDR_R = tmio->fcr; nand_chip->IO_ADDR_W = tmio->fcr; /* Set address of hardware control function */ nand_chip->cmd_ctrl = tmio_nand_hwcontrol; nand_chip->dev_ready = tmio_nand_dev_ready; nand_chip->read_byte = tmio_nand_read_byte; nand_chip->write_buf = tmio_nand_write_buf; nand_chip->read_buf = tmio_nand_read_buf; /* set eccmode using hardware ECC */ nand_chip->ecc.mode = NAND_ECC_HW; nand_chip->ecc.size = 512; nand_chip->ecc.bytes = 6; nand_chip->ecc.strength = 2; nand_chip->ecc.hwctl = tmio_nand_enable_hwecc; nand_chip->ecc.calculate = tmio_nand_calculate_ecc; nand_chip->ecc.correct = tmio_nand_correct_data; if (data) nand_chip->badblock_pattern = data->badblock_pattern; /* 15 us command delay time */ nand_chip->chip_delay = 15; retval = request_irq(irq, &tmio_irq, IRQF_DISABLED, dev_name(&dev->dev), tmio); if (retval) { dev_err(&dev->dev, "request_irq error %d\n", retval); goto err_irq; } tmio->irq = irq; nand_chip->waitfunc = tmio_nand_wait; /* Scan to find existence of the device */ if (nand_scan(mtd, 1)) { retval = -ENODEV; goto err_scan; } /* Register the partitions */ retval = mtd_device_parse_register(mtd, NULL, NULL, data ? data->partition : NULL, data ? data->num_partitions : 0); if (!retval) return retval; nand_release(mtd); err_scan: if (tmio->irq) free_irq(tmio->irq, tmio); err_irq: tmio_hw_stop(dev, tmio); err_hwinit: iounmap(tmio->fcr); err_iomap_fcr: iounmap(tmio->ccr); err_iomap_ccr: kfree(tmio); err_kzalloc: return retval; }
static int tmio_probe(struct platform_device *dev) { struct mfd_cell *cell = (struct mfd_cell *)dev->dev.platform_data; struct tmio_nand_data *data = cell->driver_data; struct resource *fcr = platform_get_resource(dev, IORESOURCE_MEM, 0); struct resource *ccr = platform_get_resource(dev, IORESOURCE_MEM, 1); int irq = platform_get_irq(dev, 0); struct tmio_nand *tmio; struct mtd_info *mtd; struct nand_chip *nand_chip; #ifdef CONFIG_MTD_PARTITIONS struct mtd_partition *parts; int nbparts = 0; #endif int retval; if (data == NULL) dev_warn(&dev->dev, "NULL platform data!\n"); tmio = kzalloc(sizeof *tmio, GFP_KERNEL); if (!tmio) { retval = -ENOMEM; goto err_kzalloc; } tmio->dev = dev; platform_set_drvdata(dev, tmio); mtd = &tmio->mtd; nand_chip = &tmio->chip; mtd->priv = nand_chip; mtd->name = "tmio-nand"; tmio->ccr = ioremap(ccr->start, ccr->end - ccr->start + 1); if (!tmio->ccr) { retval = -EIO; goto err_iomap_ccr; } tmio->fcr_base = fcr->start & 0xfffff; tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1); if (!tmio->fcr) { retval = -EIO; goto err_iomap_fcr; } retval = tmio_hw_init(dev, tmio); if (retval) goto err_hwinit; nand_chip->IO_ADDR_R = tmio->fcr; nand_chip->IO_ADDR_W = tmio->fcr; nand_chip->cmd_ctrl = tmio_nand_hwcontrol; nand_chip->dev_ready = tmio_nand_dev_ready; nand_chip->read_byte = tmio_nand_read_byte; nand_chip->write_buf = tmio_nand_write_buf; nand_chip->read_buf = tmio_nand_read_buf; nand_chip->verify_buf = tmio_nand_verify_buf; nand_chip->ecc.mode = NAND_ECC_HW; nand_chip->ecc.size = 512; nand_chip->ecc.bytes = 6; nand_chip->ecc.hwctl = tmio_nand_enable_hwecc; nand_chip->ecc.calculate = tmio_nand_calculate_ecc; nand_chip->ecc.correct = tmio_nand_correct_data; if (data) nand_chip->badblock_pattern = data->badblock_pattern; nand_chip->chip_delay = 15; retval = request_irq(irq, &tmio_irq, IRQF_DISABLED, dev_name(&dev->dev), tmio); if (retval) { dev_err(&dev->dev, "request_irq error %d\n", retval); goto err_irq; } tmio->irq = irq; nand_chip->waitfunc = tmio_nand_wait; if (nand_scan(mtd, 1)) { retval = -ENODEV; goto err_scan; } #ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_CMDLINE_PARTS nbparts = parse_mtd_partitions(mtd, part_probes, &parts, 0); #endif if (nbparts <= 0 && data) { parts = data->partition; nbparts = data->num_partitions; } if (nbparts) retval = add_mtd_partitions(mtd, parts, nbparts); else #endif retval = add_mtd_device(mtd); if (!retval) return retval; nand_release(mtd); err_scan: if (tmio->irq) free_irq(tmio->irq, tmio); err_irq: tmio_hw_stop(dev, tmio); err_hwinit: iounmap(tmio->fcr); err_iomap_fcr: iounmap(tmio->ccr); err_iomap_ccr: kfree(tmio); err_kzalloc: return retval; }