~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/mmc/host/sh_mmcif.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        struct dma_chan         *chan_rx;
170
170
        struct dma_chan         *chan_tx;
171
171
        struct completion       dma_complete;
172
 
        unsigned int            dma_sglen;
 
172
        bool                    dma_active;
173
173
};
174
174
 
175
175
static inline void sh_mmcif_bitset(struct sh_mmcif_host *host,
194
194
                return;
195
195
 
196
196
        if (host->data->flags & MMC_DATA_READ)
197
 
                dma_unmap_sg(&host->pd->dev, host->data->sg, host->dma_sglen,
 
197
                dma_unmap_sg(host->chan_rx->device->dev,
 
198
                             host->data->sg, host->data->sg_len,
198
199
                             DMA_FROM_DEVICE);
199
200
        else
200
 
                dma_unmap_sg(&host->pd->dev, host->data->sg, host->dma_sglen,
 
201
                dma_unmap_sg(host->chan_tx->device->dev,
 
202
                             host->data->sg, host->data->sg_len,
201
203
                             DMA_TO_DEVICE);
202
204
 
203
205
        complete(&host->dma_complete);
211
213
        dma_cookie_t cookie = -EINVAL;
212
214
        int ret;
213
215
 
214
 
        ret = dma_map_sg(&host->pd->dev, sg, host->data->sg_len, DMA_FROM_DEVICE);
 
216
        ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
 
217
                         DMA_FROM_DEVICE);
215
218
        if (ret > 0) {
216
 
                host->dma_sglen = ret;
 
219
                host->dma_active = true;
217
220
                desc = chan->device->device_prep_slave_sg(chan, sg, ret,
218
221
                        DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
219
222
        }
221
224
        if (desc) {
222
225
                desc->callback = mmcif_dma_complete;
223
226
                desc->callback_param = host;
224
 
                cookie = desc->tx_submit(desc);
225
 
                if (cookie < 0) {
226
 
                        desc = NULL;
227
 
                        ret = cookie;
228
 
                } else {
229
 
                        sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_DMAREN);
230
 
                        chan->device->device_issue_pending(chan);
231
 
                }
 
227
                cookie = dmaengine_submit(desc);
 
228
                sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_DMAREN);
 
229
                dma_async_issue_pending(chan);
232
230
        }
233
231
        dev_dbg(&host->pd->dev, "%s(): mapped %d -> %d, cookie %d\n",
234
232
                __func__, host->data->sg_len, ret, cookie);
238
236
                if (ret >= 0)
239
237
                        ret = -EIO;
240
238
                host->chan_rx = NULL;
241
 
                host->dma_sglen = 0;
 
239
                host->dma_active = false;
242
240
                dma_release_channel(chan);
243
241
                /* Free the Tx channel too */
244
242
                chan = host->chan_tx;
263
261
        dma_cookie_t cookie = -EINVAL;
264
262
        int ret;
265
263
 
266
 
        ret = dma_map_sg(&host->pd->dev, sg, host->data->sg_len, DMA_TO_DEVICE);
 
264
        ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
 
265
                         DMA_TO_DEVICE);
267
266
        if (ret > 0) {
268
 
                host->dma_sglen = ret;
 
267
                host->dma_active = true;
269
268
                desc = chan->device->device_prep_slave_sg(chan, sg, ret,
270
269
                        DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
271
270
        }
273
272
        if (desc) {
274
273
                desc->callback = mmcif_dma_complete;
275
274
                desc->callback_param = host;
276
 
                cookie = desc->tx_submit(desc);
277
 
                if (cookie < 0) {
278
 
                        desc = NULL;
279
 
                        ret = cookie;
280
 
                } else {
281
 
                        sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_DMAWEN);
282
 
                        chan->device->device_issue_pending(chan);
283
 
                }
 
275
                cookie = dmaengine_submit(desc);
 
276
                sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_DMAWEN);
 
277
                dma_async_issue_pending(chan);
284
278
        }
285
279
        dev_dbg(&host->pd->dev, "%s(): mapped %d -> %d, cookie %d\n",
286
280
                __func__, host->data->sg_len, ret, cookie);
290
284
                if (ret >= 0)
291
285
                        ret = -EIO;
292
286
                host->chan_tx = NULL;
293
 
                host->dma_sglen = 0;
 
287
                host->dma_active = false;
294
288
                dma_release_channel(chan);
295
289
                /* Free the Rx channel too */
296
290
                chan = host->chan_rx;
317
311
static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
318
312
                                 struct sh_mmcif_plat_data *pdata)
319
313
{
320
 
        host->dma_sglen = 0;
 
314
        host->dma_active = false;
321
315
 
322
316
        /* We can only either use DMA for both Tx and Rx or not use it at all */
323
317
        if (pdata->dma) {
364
358
                dma_release_channel(chan);
365
359
        }
366
360
 
367
 
        host->dma_sglen = 0;
 
361
        host->dma_active = false;
368
362
}
369
363
 
370
364
static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
753
747
        }
754
748
        sh_mmcif_get_response(host, cmd);
755
749
        if (host->data) {
756
 
                if (!host->dma_sglen) {
 
750
                if (!host->dma_active) {
757
751
                        ret = sh_mmcif_data_trans(host, mrq, cmd->opcode);
758
752
                } else {
759
753
                        long time =
765
759
                                ret = time;
766
760
                        sh_mmcif_bitclr(host, MMCIF_CE_BUF_ACC,
767
761
                                        BUF_ACC_DMAREN | BUF_ACC_DMAWEN);
768
 
                        host->dma_sglen = 0;
 
762
                        host->dma_active = false;
769
763
                }
770
764
                if (ret < 0)
771
765
                        mrq->data->bytes_xfered = 0;
850
844
        struct sh_mmcif_host *host = mmc_priv(mmc);
851
845
        struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;
852
846
 
853
 
        if (ios->power_mode == MMC_POWER_OFF) {
 
847
        if (ios->power_mode == MMC_POWER_UP) {
 
848
                if (p->set_pwr)
 
849
                        p->set_pwr(host->pd, ios->power_mode);
 
850
        } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {
854
851
                /* clock stop */
855
852
                sh_mmcif_clock_control(host, 0);
856
 
                if (p->down_pwr)
 
853
                if (ios->power_mode == MMC_POWER_OFF && p->down_pwr)
857
854
                        p->down_pwr(host->pd);
858
855
                return;
859
 
        } else if (ios->power_mode == MMC_POWER_UP) {
860
 
                if (p->set_pwr)
861
 
                        p->set_pwr(host->pd, ios->power_mode);
862
856
        }
863
857
 
864
858
        if (ios->clock)