public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12
@ 2013-11-06 13:46 Piotr Wilczek
  2013-11-06 13:46 ` [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-06 13:46 UTC (permalink / raw)
  To: u-boot

This patch add new defines for usb phy for Exynos4x12.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes for v2:
 - no changes

 drivers/usb/gadget/regs-otg.h    |    5 +++++
 drivers/usb/gadget/s3c_udc_otg.c |   10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
index 84bfcc5..ac5d112 100644
--- a/drivers/usb/gadget/regs-otg.h
+++ b/drivers/usb/gadget/regs-otg.h
@@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
 #define CLK_SEL_12MHZ                   (0x2 << 0)
 #define CLK_SEL_48MHZ                   (0x0 << 0)
 
+#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
+#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
+#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
+#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
+
 /* Device Configuration Register DCFG */
 #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
 #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 7e20209..cecd280 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -36,6 +36,7 @@
 #include "regs-otg.h"
 #include <usb/lin_gadget_compat.h>
 
+
 /***********************************************************/
 
 #define OTG_DMA_MODE		1
@@ -167,8 +168,13 @@ void otg_phy_init(struct s3c_udc *dev)
 		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
 			&~FORCE_SUSPEND_0), &phy->phypwr);
 
-	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
-	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
+	if (s5p_cpu_id == 0x4412)
+		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
+			EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
+		       &phy->phyclk); /* PLL 24Mhz */
+	else
+		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
+		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
 
 	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
 	       | PHY_SW_RST0, &phy->rstcon);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2
  2013-11-06 13:46 [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
@ 2013-11-06 13:46 ` Piotr Wilczek
  2013-11-07  4:46   ` Jaehoon Chung
  2013-11-07  4:48 ` [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Jaehoon Chung
  2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
  2 siblings, 1 reply; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-06 13:46 UTC (permalink / raw)
  To: u-boot

This patch adds support for USB and enables 'ums' command on Trats2 board.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
This patch depends on the lated u-boot-usb/master.

Changes for v2:
 - rebased on current USB tree
 - removed unnecessary pmic probing

 board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
 include/configs/trats2.h      |   18 ++++++++
 2 files changed, 110 insertions(+)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index d44d825..41a7310 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -25,6 +25,9 @@
 #include <power/max77693_fg.h>
 #include <libtizen.h>
 #include <errno.h>
+#include <usb.h>
+#include <usb/s3c_udc.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
 	return err0 & err2;
 }
 
+#ifdef CONFIG_USB_GADGET
+static int s5pc210_phy_control(int on)
+{
+	int ret = 0;
+	unsigned int val;
+	struct pmic *p, *p_pmic, *p_muic;
+
+	p_pmic = pmic_get("MAX77686_PMIC");
+	if (!p_pmic)
+		return -ENODEV;
+
+	if (pmic_probe(p_pmic))
+		return -1;
+
+	p_muic = pmic_get("MAX77693_MUIC");
+	if (!p_muic)
+		return -ENODEV;
+
+	if (pmic_probe(p_muic))
+		return -1;
+
+	if (on) {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
+		if (ret)
+			return -1;
+
+		p = pmic_get("MAX77693_PMIC");
+		if (!p)
+			return -ENODEV;
+
+		if (pmic_probe(p))
+			return -1;
+
+		/* SAFEOUT */
+		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
+		if (ret)
+			return -1;
+
+		val |= MAX77693_ENSAFEOUT1;
+		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
+		if (ret)
+			return -1;
+
+		/* PATH: USB */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_DN1DP2);
+
+	} else {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
+		if (ret)
+			return -1;
+
+		/* PATH: UART */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_UT1UR2);
+	}
+
+	if (ret)
+		return -1;
+
+
+	return 0;
+}
+
+struct s3c_plat_otg_data s5pc210_otg_data = {
+	.phy_control	= s5pc210_phy_control,
+	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
+	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
+	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
+	.usb_flags	= PHY0_SLEEP,
+};
+
+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("MAX77693_MUIC");
+	int cable_connected = muic->chrg->chrg_type(muic);
+
+	return !!cable_connected;
+}
+#endif
+#endif
+
 static int pmic_init_max77686(void)
 {
 	struct pmic *p = pmic_get("MAX77686_PMIC");
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 0e93836..66b1c95 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -113,6 +113,16 @@
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
+
 /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
 #undef CONFIG_CMD_NET
 
@@ -293,6 +303,11 @@
 #define CONFIG_POWER_MUIC_MAX77693
 #define CONFIG_POWER_FG_MAX77693
 #define CONFIG_POWER_BATTERY_TRATS2
+#define CONFIG_USB_GADGET
+#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
@@ -305,6 +320,9 @@
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
 
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+
 /* Pass open firmware flat tree */
 #define CONFIG_OF_LIBFDT    1
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2
  2013-11-06 13:46 ` [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-11-07  4:46   ` Jaehoon Chung
  0 siblings, 0 replies; 16+ messages in thread
From: Jaehoon Chung @ 2013-11-07  4:46 UTC (permalink / raw)
  To: u-boot

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 11/06/2013 10:46 PM, Piotr Wilczek wrote:
> This patch adds support for USB and enables 'ums' command on Trats2 board.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> This patch depends on the lated u-boot-usb/master.
> 
> Changes for v2:
>  - rebased on current USB tree
>  - removed unnecessary pmic probing
> 
>  board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
>  include/configs/trats2.h      |   18 ++++++++
>  2 files changed, 110 insertions(+)
> 
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index d44d825..41a7310 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -25,6 +25,9 @@
>  #include <power/max77693_fg.h>
>  #include <libtizen.h>
>  #include <errno.h>
> +#include <usb.h>
> +#include <usb/s3c_udc.h>
> +#include <usb_mass_storage.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
>  	return err0 & err2;
>  }
>  
> +#ifdef CONFIG_USB_GADGET
> +static int s5pc210_phy_control(int on)
> +{
> +	int ret = 0;
> +	unsigned int val;
> +	struct pmic *p, *p_pmic, *p_muic;
> +
> +	p_pmic = pmic_get("MAX77686_PMIC");
> +	if (!p_pmic)
> +		return -ENODEV;
> +
> +	if (pmic_probe(p_pmic))
> +		return -1;
> +
> +	p_muic = pmic_get("MAX77693_MUIC");
> +	if (!p_muic)
> +		return -ENODEV;
> +
> +	if (pmic_probe(p_muic))
> +		return -1;
> +
> +	if (on) {
> +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
> +		if (ret)
> +			return -1;
> +
> +		p = pmic_get("MAX77693_PMIC");
> +		if (!p)
> +			return -ENODEV;
> +
> +		if (pmic_probe(p))
> +			return -1;
> +
> +		/* SAFEOUT */
> +		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
> +		if (ret)
> +			return -1;
> +
> +		val |= MAX77693_ENSAFEOUT1;
> +		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
> +		if (ret)
> +			return -1;
> +
> +		/* PATH: USB */
> +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> +			MAX77693_MUIC_CTRL1_DN1DP2);
> +
> +	} else {
> +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
> +		if (ret)
> +			return -1;
> +
> +		/* PATH: UART */
> +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> +			MAX77693_MUIC_CTRL1_UT1UR2);
> +	}
> +
> +	if (ret)
> +		return -1;
> +
> +
> +	return 0;
> +}
> +
> +struct s3c_plat_otg_data s5pc210_otg_data = {
> +	.phy_control	= s5pc210_phy_control,
> +	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
> +	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
> +	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
> +	.usb_flags	= PHY0_SLEEP,
> +};
> +
> +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("MAX77693_MUIC");
> +	int cable_connected = muic->chrg->chrg_type(muic);
> +
> +	return !!cable_connected;
> +}
> +#endif
> +#endif
> +
>  static int pmic_init_max77686(void)
>  {
>  	struct pmic *p = pmic_get("MAX77686_PMIC");
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 0e93836..66b1c95 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -113,6 +113,16 @@
>  #define CONFIG_CMD_EXT4
>  #define CONFIG_CMD_EXT4_WRITE
>  
> +/* USB Composite download gadget - g_dnl */
> +#define CONFIG_USBDOWNLOAD_GADGET
> +#define CONFIG_DFU_FUNCTION
> +#define CONFIG_DFU_MMC
> +
> +/* USB Samsung's IDs */
> +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
> +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
> +#define CONFIG_G_DNL_MANUFACTURER "Samsung"
> +
>  /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
>  #undef CONFIG_CMD_NET
>  
> @@ -293,6 +303,11 @@
>  #define CONFIG_POWER_MUIC_MAX77693
>  #define CONFIG_POWER_FG_MAX77693
>  #define CONFIG_POWER_BATTERY_TRATS2
> +#define CONFIG_USB_GADGET
> +#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
> @@ -305,6 +320,9 @@
>  #define CONFIG_VIDEO_BMP_GZIP
>  #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
>  
> +#define CONFIG_CMD_USB_MASS_STORAGE
> +#define CONFIG_USB_GADGET_MASS_STORAGE
> +
>  /* Pass open firmware flat tree */
>  #define CONFIG_OF_LIBFDT    1
>  
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-06 13:46 [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
  2013-11-06 13:46 ` [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-11-07  4:48 ` Jaehoon Chung
  2013-11-07  6:42   ` Piotr Wilczek
  2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
  2 siblings, 1 reply; 16+ messages in thread
From: Jaehoon Chung @ 2013-11-07  4:48 UTC (permalink / raw)
  To: u-boot

Dear Piotr.

On 11/06/2013 10:46 PM, Piotr Wilczek wrote:
> This patch add new defines for usb phy for Exynos4x12.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes for v2:
>  - no changes
> 
>  drivers/usb/gadget/regs-otg.h    |    5 +++++
>  drivers/usb/gadget/s3c_udc_otg.c |   10 ++++++++--
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
> index 84bfcc5..ac5d112 100644
> --- a/drivers/usb/gadget/regs-otg.h
> +++ b/drivers/usb/gadget/regs-otg.h
> @@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
>  #define CLK_SEL_12MHZ                   (0x2 << 0)
>  #define CLK_SEL_48MHZ                   (0x0 << 0)
>  
> +#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
> +#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
> +#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
> +#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
> +
>  /* Device Configuration Register DCFG */
>  #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
>  #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
> diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
> index 7e20209..cecd280 100644
> --- a/drivers/usb/gadget/s3c_udc_otg.c
> +++ b/drivers/usb/gadget/s3c_udc_otg.c
> @@ -36,6 +36,7 @@
>  #include "regs-otg.h"
>  #include <usb/lin_gadget_compat.h>
>  
> +
remove white-space.

>  /***********************************************************/
>  
>  #define OTG_DMA_MODE		1
> @@ -167,8 +168,13 @@ void otg_phy_init(struct s3c_udc *dev)
>  		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
>  			&~FORCE_SUSPEND_0), &phy->phypwr);
>  
> -	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
> -	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> +	if (s5p_cpu_id == 0x4412)
> +		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
> +			EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
> +		       &phy->phyclk); /* PLL 24Mhz */
> +	else
> +		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
> +		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
>  
>  	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
>  	       | PHY_SW_RST0, &phy->rstcon);
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-07  4:48 ` [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Jaehoon Chung
@ 2013-11-07  6:42   ` Piotr Wilczek
  0 siblings, 0 replies; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-07  6:42 UTC (permalink / raw)
  To: u-boot

Dear Jaehoon,

> -----Original Message-----
> From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
> Sent: Thursday, November 07, 2013 5:49 AM
> To: Piotr Wilczek; u-boot at lists.denx.de
> Cc: Kyungmin Park
> Subject: Re: [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support
> for Exynos4x12
> 
> Dear Piotr.
> 
> On 11/06/2013 10:46 PM, Piotr Wilczek wrote:
> > This patch add new defines for usb phy for Exynos4x12.
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> > ---
> > Changes for v2:
> >  - no changes
> >
> >  drivers/usb/gadget/regs-otg.h    |    5 +++++
> >  drivers/usb/gadget/s3c_udc_otg.c |   10 ++++++++--
> >  2 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/regs-otg.h
> > b/drivers/usb/gadget/regs-otg.h index 84bfcc5..ac5d112 100644
> > --- a/drivers/usb/gadget/regs-otg.h
> > +++ b/drivers/usb/gadget/regs-otg.h
> > @@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
> >  #define CLK_SEL_12MHZ                   (0x2 << 0)
> >  #define CLK_SEL_48MHZ                   (0x0 << 0)
> >
> > +#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
> > +#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
> > +#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
> > +#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
> > +
> >  /* Device Configuration Register DCFG */
> >  #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
> >  #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
> > diff --git a/drivers/usb/gadget/s3c_udc_otg.c
> > b/drivers/usb/gadget/s3c_udc_otg.c
> > index 7e20209..cecd280 100644
> > --- a/drivers/usb/gadget/s3c_udc_otg.c
> > +++ b/drivers/usb/gadget/s3c_udc_otg.c
> > @@ -36,6 +36,7 @@
> >  #include "regs-otg.h"
> >  #include <usb/lin_gadget_compat.h>
> >
> > +
> remove white-space.
I will, thanks for review.

> 
> >  /***********************************************************/
> >
> >  #define OTG_DMA_MODE		1
> > @@ -167,8 +168,13 @@ void otg_phy_init(struct s3c_udc *dev)
> >  		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 |
> ANALOG_PWRDOWN)
> >  			&~FORCE_SUSPEND_0), &phy->phypwr);
> >
> > -	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
> > -	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> > +	if (s5p_cpu_id == 0x4412)
> > +		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
> > +			EXYNOS4X12_COMMON_ON_N0)) |
EXYNOS4X12_CLK_SEL_24MHZ,
> > +		       &phy->phyclk); /* PLL 24Mhz */
> > +	else
> > +		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0))
> |
> > +		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> >
> >  	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
> >  	       | PHY_SW_RST0, &phy->rstcon);
> >

Best regards,
Piotr Wilczek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-06 13:46 [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
  2013-11-06 13:46 ` [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
  2013-11-07  4:48 ` [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Jaehoon Chung
@ 2013-11-07 15:00 ` Piotr Wilczek
  2013-11-07 15:00   ` [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
                     ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-07 15:00 UTC (permalink / raw)
  To: u-boot

This patch add new defines for usb phy for Exynos4x12.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---

Chnages for v3:
 - removed unnecessary empty line

Changes for v2:
 - no changes

 drivers/usb/gadget/regs-otg.h    |    5 +++++
 drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
index 84bfcc5..ac5d112 100644
--- a/drivers/usb/gadget/regs-otg.h
+++ b/drivers/usb/gadget/regs-otg.h
@@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
 #define CLK_SEL_12MHZ                   (0x2 << 0)
 #define CLK_SEL_48MHZ                   (0x0 << 0)
 
+#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
+#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
+#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
+#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
+
 /* Device Configuration Register DCFG */
 #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
 #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 7e20209..ba17a04 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
 		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
 			&~FORCE_SUSPEND_0), &phy->phypwr);
 
-	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
-	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
+	if (s5p_cpu_id == 0x4412)
+		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
+			EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
+		       &phy->phyclk); /* PLL 24Mhz */
+	else
+		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
+		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
 
 	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
 	       | PHY_SW_RST0, &phy->rstcon);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2
  2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
@ 2013-11-07 15:00   ` Piotr Wilczek
  2013-11-21  8:24     ` Minkyu Kang
  2013-11-21  8:10   ` [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
  2013-11-21 14:46   ` [U-Boot] [PATCH V4 " Piotr Wilczek
  2 siblings, 1 reply; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-07 15:00 UTC (permalink / raw)
  To: u-boot

This patch adds support for USB and enables 'ums' command on Trats2 board.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
---
This patch depends on the lated u-boot-usb/master.

Changes for v3:
 - no changes

Changes for v2:
 - rebased on current USB tree
 - removed unnecessary pmic probing

 board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
 include/configs/trats2.h      |   18 ++++++++
 2 files changed, 110 insertions(+)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index d44d825..41a7310 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -25,6 +25,9 @@
 #include <power/max77693_fg.h>
 #include <libtizen.h>
 #include <errno.h>
+#include <usb.h>
+#include <usb/s3c_udc.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
 	return err0 & err2;
 }
 
+#ifdef CONFIG_USB_GADGET
+static int s5pc210_phy_control(int on)
+{
+	int ret = 0;
+	unsigned int val;
+	struct pmic *p, *p_pmic, *p_muic;
+
+	p_pmic = pmic_get("MAX77686_PMIC");
+	if (!p_pmic)
+		return -ENODEV;
+
+	if (pmic_probe(p_pmic))
+		return -1;
+
+	p_muic = pmic_get("MAX77693_MUIC");
+	if (!p_muic)
+		return -ENODEV;
+
+	if (pmic_probe(p_muic))
+		return -1;
+
+	if (on) {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
+		if (ret)
+			return -1;
+
+		p = pmic_get("MAX77693_PMIC");
+		if (!p)
+			return -ENODEV;
+
+		if (pmic_probe(p))
+			return -1;
+
+		/* SAFEOUT */
+		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
+		if (ret)
+			return -1;
+
+		val |= MAX77693_ENSAFEOUT1;
+		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
+		if (ret)
+			return -1;
+
+		/* PATH: USB */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_DN1DP2);
+
+	} else {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
+		if (ret)
+			return -1;
+
+		/* PATH: UART */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_UT1UR2);
+	}
+
+	if (ret)
+		return -1;
+
+
+	return 0;
+}
+
+struct s3c_plat_otg_data s5pc210_otg_data = {
+	.phy_control	= s5pc210_phy_control,
+	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
+	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
+	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
+	.usb_flags	= PHY0_SLEEP,
+};
+
+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("MAX77693_MUIC");
+	int cable_connected = muic->chrg->chrg_type(muic);
+
+	return !!cable_connected;
+}
+#endif
+#endif
+
 static int pmic_init_max77686(void)
 {
 	struct pmic *p = pmic_get("MAX77686_PMIC");
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 0e93836..66b1c95 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -113,6 +113,16 @@
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
+
 /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
 #undef CONFIG_CMD_NET
 
@@ -293,6 +303,11 @@
 #define CONFIG_POWER_MUIC_MAX77693
 #define CONFIG_POWER_FG_MAX77693
 #define CONFIG_POWER_BATTERY_TRATS2
+#define CONFIG_USB_GADGET
+#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
@@ -305,6 +320,9 @@
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
 
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+
 /* Pass open firmware flat tree */
 #define CONFIG_OF_LIBFDT    1
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
  2013-11-07 15:00   ` [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-11-21  8:10   ` Minkyu Kang
  2013-11-21  8:40     ` Piotr Wilczek
  2013-11-21 14:46   ` [U-Boot] [PATCH V4 " Piotr Wilczek
  2 siblings, 1 reply; 16+ messages in thread
From: Minkyu Kang @ 2013-11-21  8:10 UTC (permalink / raw)
  To: u-boot

Dear Piotr,

On 08/11/13 00:00, Piotr Wilczek wrote:
> This patch add new defines for usb phy for Exynos4x12.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> 
> Chnages for v3:
>  - removed unnecessary empty line
> 
> Changes for v2:
>  - no changes
> 
>  drivers/usb/gadget/regs-otg.h    |    5 +++++
>  drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
> index 84bfcc5..ac5d112 100644
> --- a/drivers/usb/gadget/regs-otg.h
> +++ b/drivers/usb/gadget/regs-otg.h
> @@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
>  #define CLK_SEL_12MHZ                   (0x2 << 0)
>  #define CLK_SEL_48MHZ                   (0x0 << 0)
>  
> +#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
> +#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
> +#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
> +#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
> +
>  /* Device Configuration Register DCFG */
>  #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
>  #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
> diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
> index 7e20209..ba17a04 100644
> --- a/drivers/usb/gadget/s3c_udc_otg.c
> +++ b/drivers/usb/gadget/s3c_udc_otg.c
> @@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
>  		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
>  			&~FORCE_SUSPEND_0), &phy->phypwr);
>  
> -	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
> -	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> +	if (s5p_cpu_id == 0x4412)

proid_is_exynos4412()

> +		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
> +			EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
> +		       &phy->phyclk); /* PLL 24Mhz */
> +	else
> +		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
> +		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
>  
>  	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
>  	       | PHY_SW_RST0, &phy->rstcon);
> 

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2
  2013-11-07 15:00   ` [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-11-21  8:24     ` Minkyu Kang
  2013-11-21  8:42       ` Piotr Wilczek
  0 siblings, 1 reply; 16+ messages in thread
From: Minkyu Kang @ 2013-11-21  8:24 UTC (permalink / raw)
  To: u-boot

Dear Piotr Wilczek,

On 08/11/13 00:00, Piotr Wilczek wrote:
> This patch adds support for USB and enables 'ums' command on Trats2 board.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> 
> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
> This patch depends on the lated u-boot-usb/master.
> 
> Changes for v3:
>  - no changes
> 
> Changes for v2:
>  - rebased on current USB tree
>  - removed unnecessary pmic probing
> 
>  board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
>  include/configs/trats2.h      |   18 ++++++++
>  2 files changed, 110 insertions(+)
> 
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index d44d825..41a7310 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -25,6 +25,9 @@
>  #include <power/max77693_fg.h>
>  #include <libtizen.h>
>  #include <errno.h>
> +#include <usb.h>
> +#include <usb/s3c_udc.h>
> +#include <usb_mass_storage.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
>  	return err0 & err2;
>  }
>  
> +#ifdef CONFIG_USB_GADGET
> +static int s5pc210_phy_control(int on)
> +{
> +	int ret = 0;
> +	unsigned int val;
> +	struct pmic *p, *p_pmic, *p_muic;
> +
> +	p_pmic = pmic_get("MAX77686_PMIC");
> +	if (!p_pmic)
> +		return -ENODEV;
> +
> +	if (pmic_probe(p_pmic))
> +		return -1;
> +
> +	p_muic = pmic_get("MAX77693_MUIC");
> +	if (!p_muic)
> +		return -ENODEV;
> +
> +	if (pmic_probe(p_muic))
> +		return -1;
> +
> +	if (on) {
> +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
> +		if (ret)
> +			return -1;
> +
> +		p = pmic_get("MAX77693_PMIC");
> +		if (!p)
> +			return -ENODEV;
> +
> +		if (pmic_probe(p))
> +			return -1;
> +
> +		/* SAFEOUT */
> +		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
> +		if (ret)
> +			return -1;
> +
> +		val |= MAX77693_ENSAFEOUT1;
> +		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
> +		if (ret)
> +			return -1;
> +
> +		/* PATH: USB */
> +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> +			MAX77693_MUIC_CTRL1_DN1DP2);
> +
> +	} else {
> +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
> +		if (ret)
> +			return -1;
> +
> +		/* PATH: UART */
> +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> +			MAX77693_MUIC_CTRL1_UT1UR2);
> +	}
> +
> +	if (ret)
> +		return -1;
> +

please remove blank line.

> +
> +	return 0;
> +}
> +
> +struct s3c_plat_otg_data s5pc210_otg_data = {
> +	.phy_control	= s5pc210_phy_control,
> +	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
> +	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
> +	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
> +	.usb_flags	= PHY0_SLEEP,
> +};
> +
> +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("MAX77693_MUIC");
> +	int cable_connected = muic->chrg->chrg_type(muic);

Please check that muic is available.

> +
> +	return !!cable_connected;

I think, cable_connected is unnecessary.

return !!muic->chrg->chrg_type(muic);

> +}
> +#endif
> +#endif
> +
>  static int pmic_init_max77686(void)
>  {
>  	struct pmic *p = pmic_get("MAX77686_PMIC");
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 0e93836..66b1c95 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -113,6 +113,16 @@
>  #define CONFIG_CMD_EXT4
>  #define CONFIG_CMD_EXT4_WRITE
>  
> +/* USB Composite download gadget - g_dnl */
> +#define CONFIG_USBDOWNLOAD_GADGET
> +#define CONFIG_DFU_FUNCTION
> +#define CONFIG_DFU_MMC
> +
> +/* USB Samsung's IDs */
> +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
> +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
> +#define CONFIG_G_DNL_MANUFACTURER "Samsung"
> +
>  /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
>  #undef CONFIG_CMD_NET
>  
> @@ -293,6 +303,11 @@
>  #define CONFIG_POWER_MUIC_MAX77693
>  #define CONFIG_POWER_FG_MAX77693
>  #define CONFIG_POWER_BATTERY_TRATS2
> +#define CONFIG_USB_GADGET
> +#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
> @@ -305,6 +320,9 @@
>  #define CONFIG_VIDEO_BMP_GZIP
>  #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
>  
> +#define CONFIG_CMD_USB_MASS_STORAGE
> +#define CONFIG_USB_GADGET_MASS_STORAGE
> +
>  /* Pass open firmware flat tree */
>  #define CONFIG_OF_LIBFDT    1
>  
> 

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-21  8:10   ` [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
@ 2013-11-21  8:40     ` Piotr Wilczek
  2013-11-21  9:09       ` Minkyu Kang
  0 siblings, 1 reply; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-21  8:40 UTC (permalink / raw)
  To: u-boot

Dear Minkyu Kang,

> -----Original Message-----
> From: Minkyu Kang [mailto:mk7.kang at samsung.com]
> Sent: Thursday, November 21, 2013 9:10 AM
> To: Piotr Wilczek
> Cc: u-boot at lists.denx.de; Kyungmin Park
> Subject: Re: [PATCH V3 1/2] driver:usb:s3c_udc: add support for
> Exynos4x12
> 
> Dear Piotr,
> 
> On 08/11/13 00:00, Piotr Wilczek wrote:
> > This patch add new defines for usb phy for Exynos4x12.
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> > ---
> >
> > Chnages for v3:
> >  - removed unnecessary empty line
> >
> > Changes for v2:
> >  - no changes
> >
> >  drivers/usb/gadget/regs-otg.h    |    5 +++++
> >  drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/regs-otg.h
> > b/drivers/usb/gadget/regs-otg.h index 84bfcc5..ac5d112 100644
> > --- a/drivers/usb/gadget/regs-otg.h
> > +++ b/drivers/usb/gadget/regs-otg.h
> > @@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
> >  #define CLK_SEL_12MHZ                   (0x2 << 0)
> >  #define CLK_SEL_48MHZ                   (0x0 << 0)
> >
> > +#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
> > +#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
> > +#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
> > +#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
> > +
> >  /* Device Configuration Register DCFG */
> >  #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
> >  #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
> > diff --git a/drivers/usb/gadget/s3c_udc_otg.c
> > b/drivers/usb/gadget/s3c_udc_otg.c
> > index 7e20209..ba17a04 100644
> > --- a/drivers/usb/gadget/s3c_udc_otg.c
> > +++ b/drivers/usb/gadget/s3c_udc_otg.c
> > @@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
> >  		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 |
> ANALOG_PWRDOWN)
> >  			&~FORCE_SUSPEND_0), &phy->phypwr);
> >
> > -	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
> > -	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> > +	if (s5p_cpu_id == 0x4412)
> 
> proid_is_exynos4412()
Ok but, proid_is_exynos4412() is not available for s5pc1**, ex the Goni
board.

> 
> > +		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
> > +			EXYNOS4X12_COMMON_ON_N0)) |
EXYNOS4X12_CLK_SEL_24MHZ,
> > +		       &phy->phyclk); /* PLL 24Mhz */
> > +	else
> > +		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0))
> |
> > +		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
> >
> >  	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
> >  	       | PHY_SW_RST0, &phy->rstcon);
> >
> 
> Thanks,
> Minkyu Kang.

Best regards
Piotr Wilczek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2
  2013-11-21  8:24     ` Minkyu Kang
@ 2013-11-21  8:42       ` Piotr Wilczek
  0 siblings, 0 replies; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-21  8:42 UTC (permalink / raw)
  To: u-boot

Dear Minkyu Kang,

> -----Original Message-----
> From: Minkyu Kang [mailto:mk7.kang at samsung.com]
> Sent: Thursday, November 21, 2013 9:24 AM
> To: Piotr Wilczek
> Cc: u-boot at lists.denx.de; Kyungmin Park
> Subject: Re: [PATCH V3 2/2] trats2: enable ums support on Trats2
> 
> Dear Piotr Wilczek,
> 
> On 08/11/13 00:00, Piotr Wilczek wrote:
> > This patch adds support for USB and enables 'ums' command on Trats2
> board.
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> >
> > Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> > ---
> > This patch depends on the lated u-boot-usb/master.
> >
> > Changes for v3:
> >  - no changes
> >
> > Changes for v2:
> >  - rebased on current USB tree
> >  - removed unnecessary pmic probing
> >
> >  board/samsung/trats2/trats2.c |   92
> +++++++++++++++++++++++++++++++++++++++++
> >  include/configs/trats2.h      |   18 ++++++++
> >  2 files changed, 110 insertions(+)
> >
> > diff --git a/board/samsung/trats2/trats2.c
> > b/board/samsung/trats2/trats2.c index d44d825..41a7310 100644
> > --- a/board/samsung/trats2/trats2.c
> > +++ b/board/samsung/trats2/trats2.c
> > @@ -25,6 +25,9 @@
> >  #include <power/max77693_fg.h>
> >  #include <libtizen.h>
> >  #include <errno.h>
> > +#include <usb.h>
> > +#include <usb/s3c_udc.h>
> > +#include <usb_mass_storage.h>
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > @@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
> >  	return err0 & err2;
> >  }
> >
> > +#ifdef CONFIG_USB_GADGET
> > +static int s5pc210_phy_control(int on) {
> > +	int ret = 0;
> > +	unsigned int val;
> > +	struct pmic *p, *p_pmic, *p_muic;
> > +
> > +	p_pmic = pmic_get("MAX77686_PMIC");
> > +	if (!p_pmic)
> > +		return -ENODEV;
> > +
> > +	if (pmic_probe(p_pmic))
> > +		return -1;
> > +
> > +	p_muic = pmic_get("MAX77693_MUIC");
> > +	if (!p_muic)
> > +		return -ENODEV;
> > +
> > +	if (pmic_probe(p_muic))
> > +		return -1;
> > +
> > +	if (on) {
> > +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
> > +		if (ret)
> > +			return -1;
> > +
> > +		p = pmic_get("MAX77693_PMIC");
> > +		if (!p)
> > +			return -ENODEV;
> > +
> > +		if (pmic_probe(p))
> > +			return -1;
> > +
> > +		/* SAFEOUT */
> > +		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
> > +		if (ret)
> > +			return -1;
> > +
> > +		val |= MAX77693_ENSAFEOUT1;
> > +		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
> > +		if (ret)
> > +			return -1;
> > +
> > +		/* PATH: USB */
> > +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> > +			MAX77693_MUIC_CTRL1_DN1DP2);
> > +
> > +	} else {
> > +		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
> > +		if (ret)
> > +			return -1;
> > +
> > +		/* PATH: UART */
> > +		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
> > +			MAX77693_MUIC_CTRL1_UT1UR2);
> > +	}
> > +
> > +	if (ret)
> > +		return -1;
> > +
> 
> please remove blank line.
Ok

> 
> > +
> > +	return 0;
> > +}
> > +
> > +struct s3c_plat_otg_data s5pc210_otg_data = {
> > +	.phy_control	= s5pc210_phy_control,
> > +	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
> > +	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
> > +	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
> > +	.usb_flags	= PHY0_SLEEP,
> > +};
> > +
> > +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("MAX77693_MUIC");
> > +	int cable_connected = muic->chrg->chrg_type(muic);
> 
> Please check that muic is available.
Ok

> 
> > +
> > +	return !!cable_connected;
> 
> I think, cable_connected is unnecessary.
> 
> return !!muic->chrg->chrg_type(muic);
> 
Ok

> > +}
> > +#endif
> > +#endif
> > +
> >  static int pmic_init_max77686(void)
> >  {
> >  	struct pmic *p = pmic_get("MAX77686_PMIC"); diff --git
> > a/include/configs/trats2.h b/include/configs/trats2.h index
> > 0e93836..66b1c95 100644
> > --- a/include/configs/trats2.h
> > +++ b/include/configs/trats2.h
> > @@ -113,6 +113,16 @@
> >  #define CONFIG_CMD_EXT4
> >  #define CONFIG_CMD_EXT4_WRITE
> >
> > +/* USB Composite download gadget - g_dnl */ #define
> > +CONFIG_USBDOWNLOAD_GADGET #define CONFIG_DFU_FUNCTION #define
> > +CONFIG_DFU_MMC
> > +
> > +/* USB Samsung's IDs */
> > +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8 #define
> > +CONFIG_G_DNL_PRODUCT_NUM 0x6601 #define CONFIG_G_DNL_MANUFACTURER
> > +"Samsung"
> > +
> >  /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
> > #undef CONFIG_CMD_NET
> >
> > @@ -293,6 +303,11 @@
> >  #define CONFIG_POWER_MUIC_MAX77693
> >  #define CONFIG_POWER_FG_MAX77693
> >  #define CONFIG_POWER_BATTERY_TRATS2
> > +#define CONFIG_USB_GADGET
> > +#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
> > @@ -305,6 +320,9 @@
> >  #define CONFIG_VIDEO_BMP_GZIP
> >  #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
> >
> > +#define CONFIG_CMD_USB_MASS_STORAGE
> > +#define CONFIG_USB_GADGET_MASS_STORAGE
> > +
> >  /* Pass open firmware flat tree */
> >  #define CONFIG_OF_LIBFDT    1
> >
> >
> 
> Thanks,
> Minkyu Kang.

Best regards,
Piotr Wilczek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-21  8:40     ` Piotr Wilczek
@ 2013-11-21  9:09       ` Minkyu Kang
  0 siblings, 0 replies; 16+ messages in thread
From: Minkyu Kang @ 2013-11-21  9:09 UTC (permalink / raw)
  To: u-boot

On 21/11/13 17:40, Piotr Wilczek wrote:
> Dear Minkyu Kang,
> 
>> -----Original Message-----
>> From: Minkyu Kang [mailto:mk7.kang at samsung.com]
>> Sent: Thursday, November 21, 2013 9:10 AM
>> To: Piotr Wilczek
>> Cc: u-boot at lists.denx.de; Kyungmin Park
>> Subject: Re: [PATCH V3 1/2] driver:usb:s3c_udc: add support for
>> Exynos4x12
>>
>> Dear Piotr,
>>
>> On 08/11/13 00:00, Piotr Wilczek wrote:
>>> This patch add new defines for usb phy for Exynos4x12.
>>>
>>> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>> CC: Minkyu Kang <mk7.kang@samsung.com>
>>> ---
>>>
>>> Chnages for v3:
>>>  - removed unnecessary empty line
>>>
>>> Changes for v2:
>>>  - no changes
>>>
>>>  drivers/usb/gadget/regs-otg.h    |    5 +++++
>>>  drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
>>>  2 files changed, 12 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/gadget/regs-otg.h
>>> b/drivers/usb/gadget/regs-otg.h index 84bfcc5..ac5d112 100644
>>> --- a/drivers/usb/gadget/regs-otg.h
>>> +++ b/drivers/usb/gadget/regs-otg.h
>>> @@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
>>>  #define CLK_SEL_12MHZ                   (0x2 << 0)
>>>  #define CLK_SEL_48MHZ                   (0x0 << 0)
>>>
>>> +#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
>>> +#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
>>> +#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
>>> +#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
>>> +
>>>  /* Device Configuration Register DCFG */
>>>  #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
>>>  #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
>>> diff --git a/drivers/usb/gadget/s3c_udc_otg.c
>>> b/drivers/usb/gadget/s3c_udc_otg.c
>>> index 7e20209..ba17a04 100644
>>> --- a/drivers/usb/gadget/s3c_udc_otg.c
>>> +++ b/drivers/usb/gadget/s3c_udc_otg.c
>>> @@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
>>>  		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 |
>> ANALOG_PWRDOWN)
>>>  			&~FORCE_SUSPEND_0), &phy->phypwr);
>>>
>>> -	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
>>> -	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
>>> +	if (s5p_cpu_id == 0x4412)
>>
>> proid_is_exynos4412()
> Ok but, proid_is_exynos4412() is not available for s5pc1**, ex the Goni
> board.

Right..
just keep going.
I'll fix it later.

> 
>>
>>> +		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
>>> +			EXYNOS4X12_COMMON_ON_N0)) |
> EXYNOS4X12_CLK_SEL_24MHZ,
>>> +		       &phy->phyclk); /* PLL 24Mhz */
>>> +	else
>>> +		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0))
>> |
>>> +		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
>>>
>>>  	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
>>>  	       | PHY_SW_RST0, &phy->rstcon);
>>>
>>
>> Thanks,
>> Minkyu Kang.
> 
> Best regards
> Piotr Wilczek
> 
> 
> 
> 

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V4 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
  2013-11-07 15:00   ` [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
  2013-11-21  8:10   ` [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
@ 2013-11-21 14:46   ` Piotr Wilczek
  2013-11-21 14:46     ` [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
  2013-12-02  2:27     ` [U-Boot] [PATCH V4 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
  2 siblings, 2 replies; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-21 14:46 UTC (permalink / raw)
  To: u-boot

This patch add new defines for usb phy for Exynos4x12.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Chnages for v4:
 - no changes

Chnages for v3:
 - removed unnecessary empty line

Changes for v2:
 - no changes
 
 drivers/usb/gadget/regs-otg.h    |    5 +++++
 drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
index 84bfcc5..ac5d112 100644
--- a/drivers/usb/gadget/regs-otg.h
+++ b/drivers/usb/gadget/regs-otg.h
@@ -226,6 +226,11 @@ struct s3c_usbotg_reg {
 #define CLK_SEL_12MHZ                   (0x2 << 0)
 #define CLK_SEL_48MHZ                   (0x0 << 0)
 
+#define EXYNOS4X12_ID_PULLUP0		(0x01 << 3)
+#define EXYNOS4X12_COMMON_ON_N0	(0x01 << 4)
+#define EXYNOS4X12_CLK_SEL_12MHZ	(0x02 << 0)
+#define EXYNOS4X12_CLK_SEL_24MHZ	(0x05 << 0)
+
 /* Device Configuration Register DCFG */
 #define DEV_SPEED_HIGH_SPEED_20         (0x0 << 0)
 #define DEV_SPEED_FULL_SPEED_20         (0x1 << 0)
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index 7e20209..ba17a04 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -167,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
 		writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
 			&~FORCE_SUSPEND_0), &phy->phypwr);
 
-	writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
-	       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
+	if (s5p_cpu_id == 0x4412)
+		writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
+			EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
+		       &phy->phyclk); /* PLL 24Mhz */
+	else
+		writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
+		       CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
 
 	writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
 	       | PHY_SW_RST0, &phy->rstcon);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2
  2013-11-21 14:46   ` [U-Boot] [PATCH V4 " Piotr Wilczek
@ 2013-11-21 14:46     ` Piotr Wilczek
  2013-12-02  2:27       ` Minkyu Kang
  2013-12-02  2:27     ` [U-Boot] [PATCH V4 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
  1 sibling, 1 reply; 16+ messages in thread
From: Piotr Wilczek @ 2013-11-21 14:46 UTC (permalink / raw)
  To: u-boot

This patch adds support for USB and enables 'ums' command on Trats2 board.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
---
Changes for v4:
 - removed empty line
 - added check if muic is available
 - removed cable_connected

Changes for v3:
 - no changes

Changes for v2:
 - rebased on current USB tree
 - removed unnecessary pmic probing

 board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
 include/configs/trats2.h      |   18 ++++++++
 2 files changed, 110 insertions(+)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index d44d825..b932a60 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -25,6 +25,9 @@
 #include <power/max77693_fg.h>
 #include <libtizen.h>
 #include <errno.h>
+#include <usb.h>
+#include <usb/s3c_udc.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -308,6 +311,95 @@ int board_mmc_init(bd_t *bis)
 	return err0 & err2;
 }
 
+#ifdef CONFIG_USB_GADGET
+static int s5pc210_phy_control(int on)
+{
+	int ret = 0;
+	unsigned int val;
+	struct pmic *p, *p_pmic, *p_muic;
+
+	p_pmic = pmic_get("MAX77686_PMIC");
+	if (!p_pmic)
+		return -ENODEV;
+
+	if (pmic_probe(p_pmic))
+		return -1;
+
+	p_muic = pmic_get("MAX77693_MUIC");
+	if (!p_muic)
+		return -ENODEV;
+
+	if (pmic_probe(p_muic))
+		return -1;
+
+	if (on) {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
+		if (ret)
+			return -1;
+
+		p = pmic_get("MAX77693_PMIC");
+		if (!p)
+			return -ENODEV;
+
+		if (pmic_probe(p))
+			return -1;
+
+		/* SAFEOUT */
+		ret = pmic_reg_read(p, MAX77693_SAFEOUT, &val);
+		if (ret)
+			return -1;
+
+		val |= MAX77693_ENSAFEOUT1;
+		ret = pmic_reg_write(p, MAX77693_SAFEOUT, val);
+		if (ret)
+			return -1;
+
+		/* PATH: USB */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_DN1DP2);
+
+	} else {
+		ret = max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
+		if (ret)
+			return -1;
+
+		/* PATH: UART */
+		ret = pmic_reg_write(p_muic, MAX77693_MUIC_CONTROL1,
+			MAX77693_MUIC_CTRL1_UT1UR2);
+	}
+
+	if (ret)
+		return -1;
+
+	return 0;
+}
+
+struct s3c_plat_otg_data s5pc210_otg_data = {
+	.phy_control	= s5pc210_phy_control,
+	.regs_phy	= EXYNOS4X12_USBPHY_BASE,
+	.regs_otg	= EXYNOS4X12_USBOTG_BASE,
+	.usb_phy_ctrl	= EXYNOS4X12_USBPHY_CONTROL,
+	.usb_flags	= PHY0_SLEEP,
+};
+
+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("MAX77693_MUIC");
+	if (!muic)
+		return 0;
+
+	return !!muic->chrg->chrg_type(muic);
+}
+#endif
+#endif
+
 static int pmic_init_max77686(void)
 {
 	struct pmic *p = pmic_get("MAX77686_PMIC");
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 0e93836..66b1c95 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -113,6 +113,16 @@
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
+
 /* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
 #undef CONFIG_CMD_NET
 
@@ -293,6 +303,11 @@
 #define CONFIG_POWER_MUIC_MAX77693
 #define CONFIG_POWER_FG_MAX77693
 #define CONFIG_POWER_BATTERY_TRATS2
+#define CONFIG_USB_GADGET
+#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
@@ -305,6 +320,9 @@
 #define CONFIG_VIDEO_BMP_GZIP
 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
 
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+
 /* Pass open firmware flat tree */
 #define CONFIG_OF_LIBFDT    1
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V4 1/2] driver:usb:s3c_udc: add support for Exynos4x12
  2013-11-21 14:46   ` [U-Boot] [PATCH V4 " Piotr Wilczek
  2013-11-21 14:46     ` [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-12-02  2:27     ` Minkyu Kang
  1 sibling, 0 replies; 16+ messages in thread
From: Minkyu Kang @ 2013-12-02  2:27 UTC (permalink / raw)
  To: u-boot

On 21/11/13 23:46, Piotr Wilczek wrote:
> This patch add new defines for usb phy for Exynos4x12.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Chnages for v4:
>  - no changes
> 
> Chnages for v3:
>  - removed unnecessary empty line
> 
> Changes for v2:
>  - no changes
>  
>  drivers/usb/gadget/regs-otg.h    |    5 +++++
>  drivers/usb/gadget/s3c_udc_otg.c |    9 +++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2
  2013-11-21 14:46     ` [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
@ 2013-12-02  2:27       ` Minkyu Kang
  0 siblings, 0 replies; 16+ messages in thread
From: Minkyu Kang @ 2013-12-02  2:27 UTC (permalink / raw)
  To: u-boot

On 21/11/13 23:46, Piotr Wilczek wrote:
> This patch adds support for USB and enables 'ums' command on Trats2 board.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> 
> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
> Changes for v4:
>  - removed empty line
>  - added check if muic is available
>  - removed cable_connected
> 
> Changes for v3:
>  - no changes
> 
> Changes for v2:
>  - rebased on current USB tree
>  - removed unnecessary pmic probing
> 
>  board/samsung/trats2/trats2.c |   92 +++++++++++++++++++++++++++++++++++++++++
>  include/configs/trats2.h      |   18 ++++++++
>  2 files changed, 110 insertions(+)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-12-02  2:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 13:46 [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
2013-11-06 13:46 ` [U-Boot] [PATCH V2 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
2013-11-07  4:46   ` Jaehoon Chung
2013-11-07  4:48 ` [U-Boot] [PATCH V2 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Jaehoon Chung
2013-11-07  6:42   ` Piotr Wilczek
2013-11-07 15:00 ` [U-Boot] [PATCH V3 " Piotr Wilczek
2013-11-07 15:00   ` [U-Boot] [PATCH V3 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
2013-11-21  8:24     ` Minkyu Kang
2013-11-21  8:42       ` Piotr Wilczek
2013-11-21  8:10   ` [U-Boot] [PATCH V3 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang
2013-11-21  8:40     ` Piotr Wilczek
2013-11-21  9:09       ` Minkyu Kang
2013-11-21 14:46   ` [U-Boot] [PATCH V4 " Piotr Wilczek
2013-11-21 14:46     ` [U-Boot] [PATCH V4 2/2] trats2: enable ums support on Trats2 Piotr Wilczek
2013-12-02  2:27       ` Minkyu Kang
2013-12-02  2:27     ` [U-Boot] [PATCH V4 1/2] driver:usb:s3c_udc: add support for Exynos4x12 Minkyu Kang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox