atmel-mci.c (91de76e661a266731fc2889a398ad1694df9d523) atmel-mci.c (2ee4f6200597bda9713e28a9c1e65a392615b4b5)
1/*
2 * Atmel MultiMedia Card Interface driver
3 *
4 * Copyright (C) 2004-2008 Atmel Corporation
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.

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

727 offset = 1;
728
729 if (maxburst > 1)
730 return fls(maxburst) - offset;
731 else
732 return 0;
733}
734
1/*
2 * Atmel MultiMedia Card Interface driver
3 *
4 * Copyright (C) 2004-2008 Atmel Corporation
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.

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

727 offset = 1;
728
729 if (maxburst > 1)
730 return fls(maxburst) - offset;
731 else
732 return 0;
733}
734
735static void atmci_timeout_timer(unsigned long data)
735static void atmci_timeout_timer(struct timer_list *t)
736{
737 struct atmel_mci *host;
738
736{
737 struct atmel_mci *host;
738
739 host = (struct atmel_mci *)data;
739 host = from_timer(host, t, timer);
740
741 dev_dbg(&host->pdev->dev, "software timeout\n");
742
743 if (host->mrq->cmd->data) {
744 host->mrq->cmd->data->error = -ETIMEDOUT;
745 host->data = NULL;
746 /*
747 * With some SDIO modules, sometimes DMA transfer hangs. If

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

1656 if (host->caps.need_blksz_mul_4) {
1657 cmd->error = -EINVAL;
1658 host->need_reset = 1;
1659 }
1660 } else
1661 cmd->error = 0;
1662}
1663
740
741 dev_dbg(&host->pdev->dev, "software timeout\n");
742
743 if (host->mrq->cmd->data) {
744 host->mrq->cmd->data->error = -ETIMEDOUT;
745 host->data = NULL;
746 /*
747 * With some SDIO modules, sometimes DMA transfer hangs. If

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

1656 if (host->caps.need_blksz_mul_4) {
1657 cmd->error = -EINVAL;
1658 host->need_reset = 1;
1659 }
1660 } else
1661 cmd->error = 0;
1662}
1663
1664static void atmci_detect_change(unsigned long data)
1664static void atmci_detect_change(struct timer_list *t)
1665{
1665{
1666 struct atmel_mci_slot *slot = (struct atmel_mci_slot *)data;
1666 struct atmel_mci_slot *slot = from_timer(slot, t, detect_timer);
1667 bool present;
1668 bool present_old;
1669
1670 /*
1671 * atmci_cleanup_slot() sets the ATMCI_SHUTDOWN flag before
1672 * freeing the interrupt. We must not re-enable the interrupt
1673 * if it has been freed, and if we're shutting down, it
1674 * doesn't really matter whether the card is present or not.

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

2344
2345 host->slot[id] = slot;
2346 mmc_regulator_get_supply(mmc);
2347 mmc_add_host(mmc);
2348
2349 if (gpio_is_valid(slot->detect_pin)) {
2350 int ret;
2351
1667 bool present;
1668 bool present_old;
1669
1670 /*
1671 * atmci_cleanup_slot() sets the ATMCI_SHUTDOWN flag before
1672 * freeing the interrupt. We must not re-enable the interrupt
1673 * if it has been freed, and if we're shutting down, it
1674 * doesn't really matter whether the card is present or not.

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

2344
2345 host->slot[id] = slot;
2346 mmc_regulator_get_supply(mmc);
2347 mmc_add_host(mmc);
2348
2349 if (gpio_is_valid(slot->detect_pin)) {
2350 int ret;
2351
2352 setup_timer(&slot->detect_timer, atmci_detect_change,
2353 (unsigned long)slot);
2352 timer_setup(&slot->detect_timer, atmci_detect_change, 0);
2354
2355 ret = request_irq(gpio_to_irq(slot->detect_pin),
2356 atmci_detect_interrupt,
2357 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
2358 "mmc-detect", slot);
2359 if (ret) {
2360 dev_dbg(&mmc->class_dev,
2361 "could not request IRQ %d for detect pin\n",

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

2558 dev_info(&pdev->dev, "using PIO\n");
2559 host->prepare_data = &atmci_prepare_data;
2560 host->submit_data = &atmci_submit_data;
2561 host->stop_transfer = &atmci_stop_transfer;
2562 }
2563
2564 platform_set_drvdata(pdev, host);
2565
2353
2354 ret = request_irq(gpio_to_irq(slot->detect_pin),
2355 atmci_detect_interrupt,
2356 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
2357 "mmc-detect", slot);
2358 if (ret) {
2359 dev_dbg(&mmc->class_dev,
2360 "could not request IRQ %d for detect pin\n",

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

2557 dev_info(&pdev->dev, "using PIO\n");
2558 host->prepare_data = &atmci_prepare_data;
2559 host->submit_data = &atmci_submit_data;
2560 host->stop_transfer = &atmci_stop_transfer;
2561 }
2562
2563 platform_set_drvdata(pdev, host);
2564
2566 setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host);
2565 timer_setup(&host->timer, atmci_timeout_timer, 0);
2567
2568 pm_runtime_get_noresume(&pdev->dev);
2569 pm_runtime_set_active(&pdev->dev);
2570 pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_DELAY);
2571 pm_runtime_use_autosuspend(&pdev->dev);
2572 pm_runtime_enable(&pdev->dev);
2573
2574 /* We need at least one slot to succeed */

--- 141 unchanged lines hidden ---
2566
2567 pm_runtime_get_noresume(&pdev->dev);
2568 pm_runtime_set_active(&pdev->dev);
2569 pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_DELAY);
2570 pm_runtime_use_autosuspend(&pdev->dev);
2571 pm_runtime_enable(&pdev->dev);
2572
2573 /* We need at least one slot to succeed */

--- 141 unchanged lines hidden ---