power.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * Donghwa Lee <dh09.lee@samsung.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/io.h>
  25. #include <asm/arch/power.h>
  26. static void exynos4_mipi_phy_control(unsigned int dev_index,
  27. unsigned int enable)
  28. {
  29. struct exynos4_power *pmu =
  30. (struct exynos4_power *)samsung_get_base_power();
  31. unsigned int addr, cfg = 0;
  32. if (dev_index == 0)
  33. addr = (unsigned int)&pmu->mipi_phy0_control;
  34. else
  35. addr = (unsigned int)&pmu->mipi_phy1_control;
  36. cfg = readl(addr);
  37. if (enable)
  38. cfg |= (EXYNOS_MIPI_PHY_MRESETN | EXYNOS_MIPI_PHY_ENABLE);
  39. else
  40. cfg &= ~(EXYNOS_MIPI_PHY_MRESETN | EXYNOS_MIPI_PHY_ENABLE);
  41. writel(cfg, addr);
  42. }
  43. void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable)
  44. {
  45. if (cpu_is_exynos4())
  46. exynos4_mipi_phy_control(dev_index, enable);
  47. }
  48. void exynos5_set_usbhost_phy_ctrl(unsigned int enable)
  49. {
  50. struct exynos5_power *power =
  51. (struct exynos5_power *)samsung_get_base_power();
  52. if (enable) {
  53. /* Enabling USBHOST_PHY */
  54. setbits_le32(&power->usbhost_phy_control,
  55. POWER_USB_HOST_PHY_CTRL_EN);
  56. } else {
  57. /* Disabling USBHOST_PHY */
  58. clrbits_le32(&power->usbhost_phy_control,
  59. POWER_USB_HOST_PHY_CTRL_EN);
  60. }
  61. }
  62. void set_usbhost_phy_ctrl(unsigned int enable)
  63. {
  64. if (cpu_is_exynos5())
  65. exynos5_set_usbhost_phy_ctrl(enable);
  66. }