Changes:
- define function usb_cable_connected() in trats board file
  which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

Changes v2:
- add muic avaibility check

Signed-off-by: Przemyslaw Marczak <p.marc...@samsung.com>
Cc: Minkyu Kang <mk7.k...@samsung.com>
---
 board/samsung/trats/trats.c |   11 +++++++++++
 include/configs/trats.h     |    1 +
 2 files changed, 12 insertions(+)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7012c13..6bd106e 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -501,6 +501,17 @@ int board_usb_init(int index, enum usb_init_type init)
        debug("USB_udc_probe\n");
        return s3c_udc_probe(&s5pc210_otg_data);
 }
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+       struct pmic *muic = pmic_get("MAX8997_MUIC");
+       if (!muic)
+               return 0;
+
+       return !!muic->chrg->chrg_type(muic);
+}
+#endif
 #endif
 
 static void pmic_reset(void)
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 3d080c4..8ff9800 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -308,6 +308,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW    2
+#define CONFIG_USB_CABLE_CHECK
 
 /* LCD */
 #define CONFIG_EXYNOS_FB
-- 
1.7.9.5

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to