]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/armv7/exynos/power.c
Merge branch 'buildman' of git://git.denx.de/u-boot-x86
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / exynos / power.c
index 5d3bda2ad8ca45ec552d1b72b32fb3bbb09212a0..1520d642c5d0d944fac86dbfdf531d97081ce095 100644 (file)
@@ -2,23 +2,7 @@
  * Copyright (C) 2012 Samsung Electronics
  * Donghwa Lee <dh09.lee@samsung.com>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -69,10 +53,59 @@ void exynos5_set_usbhost_phy_ctrl(unsigned int enable)
        }
 }
 
+void exynos4412_set_usbhost_phy_ctrl(unsigned int enable)
+{
+       struct exynos4412_power *power =
+               (struct exynos4412_power *)samsung_get_base_power();
+
+       if (enable) {
+               /* Enabling USBHOST_PHY */
+               setbits_le32(&power->usbhost_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+               setbits_le32(&power->hsic1_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+               setbits_le32(&power->hsic2_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+       } else {
+               /* Disabling USBHOST_PHY */
+               clrbits_le32(&power->usbhost_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+               clrbits_le32(&power->hsic1_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+               clrbits_le32(&power->hsic2_phy_control,
+                            POWER_USB_HOST_PHY_CTRL_EN);
+       }
+}
+
 void set_usbhost_phy_ctrl(unsigned int enable)
 {
        if (cpu_is_exynos5())
                exynos5_set_usbhost_phy_ctrl(enable);
+       else if (cpu_is_exynos4())
+               if (proid_is_exynos4412())
+                       exynos4412_set_usbhost_phy_ctrl(enable);
+}
+
+static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
+{
+       struct exynos5_power *power =
+               (struct exynos5_power *)samsung_get_base_power();
+
+       if (enable) {
+               /* Enabling USBDRD_PHY */
+               setbits_le32(&power->usbdrd_phy_control,
+                               POWER_USB_DRD_PHY_CTRL_EN);
+       } else {
+               /* Disabling USBDRD_PHY */
+               clrbits_le32(&power->usbdrd_phy_control,
+                               POWER_USB_DRD_PHY_CTRL_EN);
+       }
+}
+
+void set_usbdrd_phy_ctrl(unsigned int enable)
+{
+       if (cpu_is_exynos5())
+               exynos5_set_usbdrd_phy_ctrl(enable);
 }
 
 static void exynos5_dp_phy_control(unsigned int enable)
@@ -106,6 +139,12 @@ static void exynos5_set_ps_hold_ctrl(void)
                        EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
 }
 
+/*
+ * Set ps_hold data driving value high
+ * This enables the machine to stay powered on
+ * after the initial power-on condition goes away
+ * (e.g. power button).
+ */
 void set_ps_hold_ctrl(void)
 {
        if (cpu_is_exynos5())
@@ -190,3 +229,10 @@ void power_exit_wakeup(void)
        else
                exynos4_power_exit_wakeup();
 }
+
+unsigned int get_boot_mode(void)
+{
+       unsigned int om_pin = samsung_get_base_power();
+
+       return readl(om_pin) & OM_PIN_MASK;
+}