pxamci.c (e6027b467cd5b117b9ae2957c197a7cda9f5b932) pxamci.c (293b2da1b61136813fc2764f43304c66ff8040e9)
1/*
2 * linux/drivers/mmc/host/pxa.c - PXA MMCI driver
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

25#include <linux/dma-mapping.h>
26#include <linux/clk.h>
27#include <linux/err.h>
28#include <linux/mmc/host.h>
29#include <linux/io.h>
30#include <linux/regulator/consumer.h>
31#include <linux/gpio.h>
32#include <linux/gfp.h>
1/*
2 * linux/drivers/mmc/host/pxa.c - PXA MMCI driver
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

25#include <linux/dma-mapping.h>
26#include <linux/clk.h>
27#include <linux/err.h>
28#include <linux/mmc/host.h>
29#include <linux/io.h>
30#include <linux/regulator/consumer.h>
31#include <linux/gpio.h>
32#include <linux/gfp.h>
33#include <linux/of.h>
34#include <linux/of_gpio.h>
35#include <linux/of_device.h>
36
37#include <asm/sizes.h>
38
39#include <mach/hardware.h>
40#include <mach/dma.h>
33
34#include <asm/sizes.h>
35
36#include <mach/hardware.h>
37#include <mach/dma.h>
41#include <mach/mmc.h>
38#include <linux/platform_data/mmc-pxamci.h>
42
43#include "pxamci.h"
44
45#define DRIVER_NAME "pxa2xx-mci"
46
47#define NR_SG 1
48#define CLKRT_OFF (~0)
49

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

571static irqreturn_t pxamci_detect_irq(int irq, void *devid)
572{
573 struct pxamci_host *host = mmc_priv(devid);
574
575 mmc_detect_change(devid, msecs_to_jiffies(host->pdata->detect_delay_ms));
576 return IRQ_HANDLED;
577}
578
39
40#include "pxamci.h"
41
42#define DRIVER_NAME "pxa2xx-mci"
43
44#define NR_SG 1
45#define CLKRT_OFF (~0)
46

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

568static irqreturn_t pxamci_detect_irq(int irq, void *devid)
569{
570 struct pxamci_host *host = mmc_priv(devid);
571
572 mmc_detect_change(devid, msecs_to_jiffies(host->pdata->detect_delay_ms));
573 return IRQ_HANDLED;
574}
575
579#ifdef CONFIG_OF
580static const struct of_device_id pxa_mmc_dt_ids[] = {
581 { .compatible = "marvell,pxa-mmc" },
582 { }
583};
584
585MODULE_DEVICE_TABLE(of, pxa_mmc_dt_ids);
586
587static int __devinit pxamci_of_init(struct platform_device *pdev)
588{
589 struct device_node *np = pdev->dev.of_node;
590 struct pxamci_platform_data *pdata;
591 u32 tmp;
592
593 if (!np)
594 return 0;
595
596 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
597 if (!pdata)
598 return -ENOMEM;
599
600 pdata->gpio_card_detect =
601 of_get_named_gpio(np, "cd-gpios", 0);
602 pdata->gpio_card_ro =
603 of_get_named_gpio(np, "wp-gpios", 0);
604
605 /* pxa-mmc specific */
606 pdata->gpio_power =
607 of_get_named_gpio(np, "pxa-mmc,gpio-power", 0);
608
609 if (of_property_read_u32(np, "pxa-mmc,detect-delay-ms", &tmp) == 0)
610 pdata->detect_delay_ms = tmp;
611
612 pdev->dev.platform_data = pdata;
613
614 return 0;
615}
616#else
617static int __devinit pxamci_of_init(struct platform_device *pdev)
618{
619 return 0;
620}
621#endif
622
623static int pxamci_probe(struct platform_device *pdev)
624{
625 struct mmc_host *mmc;
626 struct pxamci_host *host = NULL;
627 struct resource *r, *dmarx, *dmatx;
628 int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
629
576static int pxamci_probe(struct platform_device *pdev)
577{
578 struct mmc_host *mmc;
579 struct pxamci_host *host = NULL;
580 struct resource *r, *dmarx, *dmatx;
581 int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
582
630 ret = pxamci_of_init(pdev);
631 if (ret)
632 return ret;
633
634 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
635 irq = platform_get_irq(pdev, 0);
636 if (!r || irq < 0)
637 return -ENXIO;
638
639 r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
640 if (!r)
641 return -EBUSY;

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

912#endif
913
914static struct platform_driver pxamci_driver = {
915 .probe = pxamci_probe,
916 .remove = pxamci_remove,
917 .driver = {
918 .name = DRIVER_NAME,
919 .owner = THIS_MODULE,
583 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
584 irq = platform_get_irq(pdev, 0);
585 if (!r || irq < 0)
586 return -ENXIO;
587
588 r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
589 if (!r)
590 return -EBUSY;

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

861#endif
862
863static struct platform_driver pxamci_driver = {
864 .probe = pxamci_probe,
865 .remove = pxamci_remove,
866 .driver = {
867 .name = DRIVER_NAME,
868 .owner = THIS_MODULE,
920 .of_match_table = of_match_ptr(pxa_mmc_dt_ids),
921#ifdef CONFIG_PM
922 .pm = &pxamci_pm_ops,
923#endif
924 },
925};
926
927module_platform_driver(pxamci_driver);
928
929MODULE_DESCRIPTION("PXA Multimedia Card Interface Driver");
930MODULE_LICENSE("GPL");
931MODULE_ALIAS("platform:pxa2xx-mci");
869#ifdef CONFIG_PM
870 .pm = &pxamci_pm_ops,
871#endif
872 },
873};
874
875module_platform_driver(pxamci_driver);
876
877MODULE_DESCRIPTION("PXA Multimedia Card Interface Driver");
878MODULE_LICENSE("GPL");
879MODULE_ALIAS("platform:pxa2xx-mci");