waterPressureDataPreprocessingThread.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * linux/arch/arm/mach-omap2/hsmmc.c
  3. *
  4. * Copyright (C) 2007-2008 Texas Instruments
  5. * Copyright (C) 2008 Nokia Corporation
  6. * Author: Texas Instruments
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/slab.h>
  14. #include <linux/string.h>
  15. #include <linux/delay.h>
  16. #include <linux/gpio.h>
  17. #include <linux/platform_data/gpio-omap.h>
  18. #include "soc.h"
  19. #include "omap_device.h"
  20. #include "omap-pm.h"
  21. #include "mux.h"
  22. #include "mmc.h"
  23. #include "hsmmc.h"
  24. #include "control.h"
  25. #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
  26. static u16 control_pbias_offset;
  27. static u16 control_devconf1_offset;
  28. static u16 control_mmc1;
  29. #define HSMMC_NAME_LEN 9
  30. #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
  31. static int hsmmc_get_context_loss(struct device *dev)
  32. {
  33. return omap_pm_get_dev_context_loss_count(dev);
  34. }
  35. #else
  36. #define hsmmc_get_context_loss NULL
  37. #endif
  38. static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
  39. int power_on, int vdd)
  40. {
  41. u32 reg, prog_io;
  42. struct omap_mmc_platform_data *mmc = dev->platform_data;
  43. if (mmc->slots[0].remux)
  44. mmc->slots[0].remux(dev, slot, power_on);
  45. /*
  46. * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
  47. * card with Vcc regulator (from twl4030 or whatever). OMAP has both
  48. * 1.8V and 3.0V modes, controlled by the PBIAS register.
  49. *
  50. * In 8-bit modes, OMAP VMMC1A (for DAT4..7) needs a supply, which
  51. * is most naturally TWL VSIM; those pins also use PBIAS.
  52. *
  53. * FIXME handle VMMC1A as needed ...
  54. */
  55. if (power_on) {
  56. if (cpu_is_omap2430()) {
  57. reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
  58. if ((1 << vdd) >= MMC_VDD_30_31)
  59. reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
  60. else
  61. reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
  62. omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
  63. }
  64. if (mmc->slots[0].internal_clock) {
  65. reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  66. reg |= OMAP2_MMCSDIO1ADPCLKISEL;