[U-Boot] [PATCH] trats: usb: Add usb_cable_connected() function

Przemyslaw Marczak p.marczak at samsung.com
Wed Nov 13 11:54:06 CET 2013


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

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

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7f61d17..9ed70d3 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -500,6 +500,16 @@ void board_usb_init(void)
 	debug("USB_udc_probe\n");
 	s3c_udc_probe(&s5pc210_otg_data);
 }
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+	struct pmic *muic = pmic_get("MAX8997_MUIC");
+	int cable_connected = muic->chrg->chrg_type(muic);
+
+	return !!cable_connected;
+}
+#endif
 #endif
 
 static void pmic_reset(void)
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 24ea06b..7f8009e 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -300,6 +300,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



More information about the U-Boot mailing list