wbsd.c (0433c14356702e296f474f77ebd42f0a9d9a5487) wbsd.c (c3be1efd41a97f93be390240387d356a07b664c7)
1/*
2 * linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver
3 *
4 * Copyright (C) 2004-2007 Pierre Ossman, 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or (at

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

1191 * Device initialisation and shutdown *
1192 * *
1193\*****************************************************************************/
1194
1195/*
1196 * Allocate/free MMC structure.
1197 */
1198
1/*
2 * linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver
3 *
4 * Copyright (C) 2004-2007 Pierre Ossman, 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or (at

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

1191 * Device initialisation and shutdown *
1192 * *
1193\*****************************************************************************/
1194
1195/*
1196 * Allocate/free MMC structure.
1197 */
1198
1199static int __devinit wbsd_alloc_mmc(struct device *dev)
1199static int wbsd_alloc_mmc(struct device *dev)
1200{
1201 struct mmc_host *mmc;
1202 struct wbsd_host *host;
1203
1204 /*
1205 * Allocate MMC structure.
1206 */
1207 mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev);

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

1283
1284 dev_set_drvdata(dev, NULL);
1285}
1286
1287/*
1288 * Scan for known chip id:s
1289 */
1290
1200{
1201 struct mmc_host *mmc;
1202 struct wbsd_host *host;
1203
1204 /*
1205 * Allocate MMC structure.
1206 */
1207 mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev);

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

1283
1284 dev_set_drvdata(dev, NULL);
1285}
1286
1287/*
1288 * Scan for known chip id:s
1289 */
1290
1291static int __devinit wbsd_scan(struct wbsd_host *host)
1291static int wbsd_scan(struct wbsd_host *host)
1292{
1293 int i, j, k;
1294 int id;
1295
1296 /*
1297 * Iterate through all ports, all codes to
1298 * find hardware that is in our known list.
1299 */

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

1339
1340 return -ENODEV;
1341}
1342
1343/*
1344 * Allocate/free io port ranges
1345 */
1346
1292{
1293 int i, j, k;
1294 int id;
1295
1296 /*
1297 * Iterate through all ports, all codes to
1298 * find hardware that is in our known list.
1299 */

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

1339
1340 return -ENODEV;
1341}
1342
1343/*
1344 * Allocate/free io port ranges
1345 */
1346
1347static int __devinit wbsd_request_region(struct wbsd_host *host, int base)
1347static int wbsd_request_region(struct wbsd_host *host, int base)
1348{
1349 if (base & 0x7)
1350 return -EINVAL;
1351
1352 if (!request_region(base, 8, DRIVER_NAME))
1353 return -EIO;
1354
1355 host->base = base;

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

1369
1370 host->config = 0;
1371}
1372
1373/*
1374 * Allocate/free DMA port and buffer
1375 */
1376
1348{
1349 if (base & 0x7)
1350 return -EINVAL;
1351
1352 if (!request_region(base, 8, DRIVER_NAME))
1353 return -EIO;
1354
1355 host->base = base;

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

1369
1370 host->config = 0;
1371}
1372
1373/*
1374 * Allocate/free DMA port and buffer
1375 */
1376
1377static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
1377static void wbsd_request_dma(struct wbsd_host *host, int dma)
1378{
1379 if (dma < 0)
1380 return;
1381
1382 if (request_dma(dma, DRIVER_NAME))
1383 goto err;
1384
1385 /*

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

1447 host->dma_buffer = NULL;
1448 host->dma_addr = 0;
1449}
1450
1451/*
1452 * Allocate/free IRQ.
1453 */
1454
1378{
1379 if (dma < 0)
1380 return;
1381
1382 if (request_dma(dma, DRIVER_NAME))
1383 goto err;
1384
1385 /*

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

1447 host->dma_buffer = NULL;
1448 host->dma_addr = 0;
1449}
1450
1451/*
1452 * Allocate/free IRQ.
1453 */
1454
1455static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1455static int wbsd_request_irq(struct wbsd_host *host, int irq)
1456{
1457 int ret;
1458
1459 /*
1460 * Set up tasklets. Must be done before requesting interrupt.
1461 */
1462 tasklet_init(&host->card_tasklet, wbsd_tasklet_card,
1463 (unsigned long)host);

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

1497 tasklet_kill(&host->timeout_tasklet);
1498 tasklet_kill(&host->finish_tasklet);
1499}
1500
1501/*
1502 * Allocate all resources for the host.
1503 */
1504
1456{
1457 int ret;
1458
1459 /*
1460 * Set up tasklets. Must be done before requesting interrupt.
1461 */
1462 tasklet_init(&host->card_tasklet, wbsd_tasklet_card,
1463 (unsigned long)host);

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

1497 tasklet_kill(&host->timeout_tasklet);
1498 tasklet_kill(&host->finish_tasklet);
1499}
1500
1501/*
1502 * Allocate all resources for the host.
1503 */
1504
1505static int __devinit wbsd_request_resources(struct wbsd_host *host,
1505static int wbsd_request_resources(struct wbsd_host *host,
1506 int base, int irq, int dma)
1507{
1508 int ret;
1509
1510 /*
1511 * Allocate I/O ports.
1512 */
1513 ret = wbsd_request_region(host, base);

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

1639}
1640
1641/*****************************************************************************\
1642 * *
1643 * Devices setup and shutdown *
1644 * *
1645\*****************************************************************************/
1646
1506 int base, int irq, int dma)
1507{
1508 int ret;
1509
1510 /*
1511 * Allocate I/O ports.
1512 */
1513 ret = wbsd_request_region(host, base);

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

1639}
1640
1641/*****************************************************************************\
1642 * *
1643 * Devices setup and shutdown *
1644 * *
1645\*****************************************************************************/
1646
1647static int __devinit wbsd_init(struct device *dev, int base, int irq, int dma,
1647static int wbsd_init(struct device *dev, int base, int irq, int dma,
1648 int pnp)
1649{
1650 struct wbsd_host *host = NULL;
1651 struct mmc_host *mmc = NULL;
1652 int ret;
1653
1654 ret = wbsd_alloc_mmc(dev);
1655 if (ret)

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

1757
1758 wbsd_free_mmc(dev);
1759}
1760
1761/*
1762 * Non-PnP
1763 */
1764
1648 int pnp)
1649{
1650 struct wbsd_host *host = NULL;
1651 struct mmc_host *mmc = NULL;
1652 int ret;
1653
1654 ret = wbsd_alloc_mmc(dev);
1655 if (ret)

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

1757
1758 wbsd_free_mmc(dev);
1759}
1760
1761/*
1762 * Non-PnP
1763 */
1764
1765static int __devinit wbsd_probe(struct platform_device *dev)
1765static int wbsd_probe(struct platform_device *dev)
1766{
1767 /* Use the module parameters for resources */
1768 return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0);
1769}
1770
1771static int __devexit wbsd_remove(struct platform_device *dev)
1772{
1773 wbsd_shutdown(&dev->dev, 0);
1774
1775 return 0;
1776}
1777
1778/*
1779 * PnP
1780 */
1781
1782#ifdef CONFIG_PNP
1783
1766{
1767 /* Use the module parameters for resources */
1768 return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0);
1769}
1770
1771static int __devexit wbsd_remove(struct platform_device *dev)
1772{
1773 wbsd_shutdown(&dev->dev, 0);
1774
1775 return 0;
1776}
1777
1778/*
1779 * PnP
1780 */
1781
1782#ifdef CONFIG_PNP
1783
1784static int __devinit
1784static int
1785wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id)
1786{
1787 int io, irq, dma;
1788
1789 /*
1790 * Get resources from PnP layer.
1791 */
1792 io = pnp_port_start(pnpdev, 0);

--- 255 unchanged lines hidden ---
1785wbsd_pnp_probe(struct pnp_dev *pnpdev, const struct pnp_device_id *dev_id)
1786{
1787 int io, irq, dma;
1788
1789 /*
1790 * Get resources from PnP layer.
1791 */
1792 io = pnp_port_start(pnpdev, 0);

--- 255 unchanged lines hidden ---