spi-mpc52xx.c (53279f36dccffc26ff536003fd6bb97cc21c3b82) spi-mpc52xx.c (fd4a319bc933ae93e68935b21924a9ca4ba2d060)
1/*
2 * MPC52xx SPI bus driver.
3 *
4 * Copyright (C) 2008 Secret Lab Technologies Ltd.
5 *
6 * This file is released under the GPLv2
7 *
8 * This is the driver for the MPC5200's dedicated SPI controller.

--- 376 unchanged lines hidden (view full) ---

385 schedule_work(&ms->work);
386
387 return 0;
388}
389
390/*
391 * OF Platform Bus Binding
392 */
1/*
2 * MPC52xx SPI bus driver.
3 *
4 * Copyright (C) 2008 Secret Lab Technologies Ltd.
5 *
6 * This file is released under the GPLv2
7 *
8 * This is the driver for the MPC5200's dedicated SPI controller.

--- 376 unchanged lines hidden (view full) ---

385 schedule_work(&ms->work);
386
387 return 0;
388}
389
390/*
391 * OF Platform Bus Binding
392 */
393static int __devinit mpc52xx_spi_probe(struct platform_device *op)
393static int mpc52xx_spi_probe(struct platform_device *op)
394{
395 struct spi_master *master;
396 struct mpc52xx_spi *ms;
397 void __iomem *regs;
398 u8 ctrl1;
399 int rc, i = 0;
400 int gpio_cs;
401

--- 120 unchanged lines hidden (view full) ---

522 err_alloc_gpio:
523 spi_master_put(master);
524 err_alloc:
525 err_init:
526 iounmap(regs);
527 return rc;
528}
529
394{
395 struct spi_master *master;
396 struct mpc52xx_spi *ms;
397 void __iomem *regs;
398 u8 ctrl1;
399 int rc, i = 0;
400 int gpio_cs;
401

--- 120 unchanged lines hidden (view full) ---

522 err_alloc_gpio:
523 spi_master_put(master);
524 err_alloc:
525 err_init:
526 iounmap(regs);
527 return rc;
528}
529
530static int __devexit mpc52xx_spi_remove(struct platform_device *op)
530static int mpc52xx_spi_remove(struct platform_device *op)
531{
532 struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev));
533 struct mpc52xx_spi *ms = spi_master_get_devdata(master);
534 int i;
535
536 free_irq(ms->irq0, ms);
537 free_irq(ms->irq1, ms);
538
539 for (i = 0; i < ms->gpio_cs_count; i++)
540 gpio_free(ms->gpio_cs[i]);
541
542 kfree(ms->gpio_cs);
543 spi_unregister_master(master);
544 iounmap(ms->regs);
545 spi_master_put(master);
546
547 return 0;
548}
549
531{
532 struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev));
533 struct mpc52xx_spi *ms = spi_master_get_devdata(master);
534 int i;
535
536 free_irq(ms->irq0, ms);
537 free_irq(ms->irq1, ms);
538
539 for (i = 0; i < ms->gpio_cs_count; i++)
540 gpio_free(ms->gpio_cs[i]);
541
542 kfree(ms->gpio_cs);
543 spi_unregister_master(master);
544 iounmap(ms->regs);
545 spi_master_put(master);
546
547 return 0;
548}
549
550static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
550static const struct of_device_id mpc52xx_spi_match[] = {
551 { .compatible = "fsl,mpc5200-spi", },
552 {}
553};
554MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);
555
556static struct platform_driver mpc52xx_spi_of_driver = {
557 .driver = {
558 .name = "mpc52xx-spi",
559 .owner = THIS_MODULE,
560 .of_match_table = mpc52xx_spi_match,
561 },
562 .probe = mpc52xx_spi_probe,
551 { .compatible = "fsl,mpc5200-spi", },
552 {}
553};
554MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);
555
556static struct platform_driver mpc52xx_spi_of_driver = {
557 .driver = {
558 .name = "mpc52xx-spi",
559 .owner = THIS_MODULE,
560 .of_match_table = mpc52xx_spi_match,
561 },
562 .probe = mpc52xx_spi_probe,
563 .remove = __devexit_p(mpc52xx_spi_remove),
563 .remove = mpc52xx_spi_remove,
564};
565module_platform_driver(mpc52xx_spi_of_driver);
564};
565module_platform_driver(mpc52xx_spi_of_driver);