host.c (85a3685852d9ac7d92be9d824533c915a4597fa4) host.c (dfa13ebbe3340e538b988f5608efd9ff2ca7fc35)
1/*
2 * linux/drivers/mmc/core/host.c
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright (C) 2007-2008 Pierre Ossman
6 * Copyright (C) 2010 Linus Walleij
7 *
8 * This program is free software; you can redistribute it and/or modify

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

296}
297
298static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
299{
300}
301
302#endif
303
1/*
2 * linux/drivers/mmc/core/host.c
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright (C) 2007-2008 Pierre Ossman
6 * Copyright (C) 2010 Linus Walleij
7 *
8 * This program is free software; you can redistribute it and/or modify

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

296}
297
298static inline void mmc_host_clk_sysfs_init(struct mmc_host *host)
299{
300}
301
302#endif
303
304void mmc_retune_enable(struct mmc_host *host)
305{
306 host->can_retune = 1;
307 if (host->retune_period)
308 mod_timer(&host->retune_timer,
309 jiffies + host->retune_period * HZ);
310}
311
312void mmc_retune_disable(struct mmc_host *host)
313{
314 host->can_retune = 0;
315 del_timer_sync(&host->retune_timer);
316 host->retune_now = 0;
317 host->need_retune = 0;
318}
319
320void mmc_retune_timer_stop(struct mmc_host *host)
321{
322 del_timer_sync(&host->retune_timer);
323}
324EXPORT_SYMBOL(mmc_retune_timer_stop);
325
326void mmc_retune_hold(struct mmc_host *host)
327{
328 if (!host->hold_retune)
329 host->retune_now = 1;
330 host->hold_retune += 1;
331}
332
333void mmc_retune_release(struct mmc_host *host)
334{
335 if (host->hold_retune)
336 host->hold_retune -= 1;
337 else
338 WARN_ON(1);
339}
340
341int mmc_retune(struct mmc_host *host)
342{
343 int err;
344
345 if (host->retune_now)
346 host->retune_now = 0;
347 else
348 return 0;
349
350 if (!host->need_retune || host->doing_retune || !host->card)
351 return 0;
352
353 host->need_retune = 0;
354
355 host->doing_retune = 1;
356
357 err = mmc_execute_tuning(host->card);
358
359 host->doing_retune = 0;
360
361 return err;
362}
363
364static void mmc_retune_timer(unsigned long data)
365{
366 struct mmc_host *host = (struct mmc_host *)data;
367
368 mmc_retune_needed(host);
369}
370
304/**
305 * mmc_of_parse() - parse host's device-tree node
306 * @host: host whose node should be parsed.
307 *
308 * To keep the rest of the MMC subsystem unaware of whether DT has been
309 * used to to instantiate and configure this host instance or not, we
310 * parse the properties and set respective generic mmc-host flags and
311 * parameters.

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

499 mmc_host_clk_init(host);
500
501 spin_lock_init(&host->lock);
502 init_waitqueue_head(&host->wq);
503 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
504#ifdef CONFIG_PM
505 host->pm_notify.notifier_call = mmc_pm_notify;
506#endif
371/**
372 * mmc_of_parse() - parse host's device-tree node
373 * @host: host whose node should be parsed.
374 *
375 * To keep the rest of the MMC subsystem unaware of whether DT has been
376 * used to to instantiate and configure this host instance or not, we
377 * parse the properties and set respective generic mmc-host flags and
378 * parameters.

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

566 mmc_host_clk_init(host);
567
568 spin_lock_init(&host->lock);
569 init_waitqueue_head(&host->wq);
570 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
571#ifdef CONFIG_PM
572 host->pm_notify.notifier_call = mmc_pm_notify;
573#endif
574 setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host);
507
508 /*
509 * By default, hosts do not support SGIO or large requests.
510 * They have to set these according to their abilities.
511 */
512 host->max_segs = 1;
513 host->max_seg_size = PAGE_CACHE_SIZE;
514

--- 82 unchanged lines hidden ---
575
576 /*
577 * By default, hosts do not support SGIO or large requests.
578 * They have to set these according to their abilities.
579 */
580 host->max_segs = 1;
581 host->max_seg_size = PAGE_CACHE_SIZE;
582

--- 82 unchanged lines hidden ---