diff mbox

[U-Boot,4/4] implement Fastboot via USB OTG on bcm28155_ap boards

Message ID 1436201570-12862-5-git-send-email-srae@broadcom.com
State Superseded
Headers show

Commit Message

Steve Rae July 6, 2015, 4:52 p.m. UTC
From: "JD (Jiandong) Zheng" <jdzheng@broadcom.com>

Signed-off-by: Steve Rae <srae@broadcom.com>
---

 board/broadcom/bcm28155_ap/bcm28155_ap.c | 40 ++++++++++++++++++++++++++++++++
 drivers/usb/gadget/Makefile              |  1 +
 include/configs/bcm28155_ap.h            | 20 ++++++++++++++++
 3 files changed, 61 insertions(+)

Comments

Paul Kocialkowski July 6, 2015, 6:22 p.m. UTC | #1
Hi,

Le lundi 06 juillet 2015 à 09:52 -0700, Steve Rae a écrit :
> From: "JD (Jiandong) Zheng" <jdzheng@broadcom.com>
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
>  board/broadcom/bcm28155_ap/bcm28155_ap.c | 40 ++++++++++++++++++++++++++++++++
>  drivers/usb/gadget/Makefile              |  1 +
>  include/configs/bcm28155_ap.h            | 20 ++++++++++++++++
>  3 files changed, 61 insertions(+)
> 
> diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
> index 940a1c2..20eb191 100644
> --- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
> +++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
> @@ -12,12 +12,20 @@
>  #include <asm/kona-common/clk.h>
>  #include <asm/arch/sysmap.h>
>  
> +#include <usb.h>
> +#include <usb/s3c_udc.h>
> +#include <g_dnl.h>
> +
>  #define SECWATCHDOG_SDOGCR_OFFSET	0x00000000
>  #define SECWATCHDOG_SDOGCR_EN_SHIFT	27
>  #define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT	26
>  #define SECWATCHDOG_SDOGCR_CLKS_SHIFT	20
>  #define SECWATCHDOG_SDOGCR_LD_SHIFT	0
>  
> +#ifndef CONFIG_USB_SERIALNO
> +#define CONFIG_USB_SERIALNO "1234567890"
> +#endif
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  /*
> @@ -85,3 +93,35 @@ int board_mmc_init(bd_t *bis)
>  	return ret;
>  }
>  #endif
> +
> +#ifdef CONFIG_USB_GADGET
> +static struct s3c_plat_otg_data bcm_otg_data = {
> +	.regs_otg	= HSOTG_BASE_ADDR
> +};
> +
> +int board_usb_init(int index, enum usb_init_type init)
> +{
> +	debug("%s: performing s3c_udc_probe\n", __func__);
> +	return s3c_udc_probe(&bcm_otg_data);
> +}
> +
> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> +{
> +	debug("%s\n", __func__);
> +	if (!getenv("serial#"))
> +		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
> +	return 0;
> +}
> +
> +int g_dnl_get_board_bcd_device_number(int gcnum)
> +{
> +	debug("%s\n", __func__);
> +	return 1;
> +}
> +
> +int board_usb_cleanup(int index, enum usb_init_type init)
> +{
> +	debug("%s\n", __func__);
> +	return 0;
> +}
> +#endif
> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index 70bb550..d370f1c 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -20,6 +20,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
>  obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o
>  obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
>  obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o
> +obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
>  endif
>  ifdef CONFIG_USB_ETHER
>  obj-y += ether.o
> diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
> index 900dc42..e5fdc90 100644
> --- a/include/configs/bcm28155_ap.h
> +++ b/include/configs/bcm28155_ap.h
> @@ -109,6 +109,7 @@
>   * for example.
>   */
>  #define CONFIG_DOS_PARTITION
> +#define CONFIG_EFI_PARTITION
>  
>  /* version string, parser, etc */
>  #define CONFIG_VERSION_VARIABLE
> @@ -136,4 +137,23 @@
>  
>  #undef CONFIG_CMD_NFS
>  
> +/* Fastboot and USB OTG */
> +#define CONFIG_CMD_FASTBOOT
> +#define CONFIG_FASTBOOT_FLASH
> +#define CONFIG_FASTBOOT_FLASH_MMC_DEV	0
> +#define CONFIG_SYS_CACHELINE_SIZE	64
> +#define CONFIG_USB_FASTBOOT_BUF_SIZE	(CONFIG_SYS_SDRAM_SIZE - (1024 * 1024))
> +#define CONFIG_USB_FASTBOOT_BUF_ADDR	CONFIG_SYS_SDRAM_BASE
> +#define CONFIG_USB_GADGET
> +#define CONFIG_USB_GADGET_DUALSPEED
> +#define CONFIG_USB_GADGET_VBUS_DRAW	0
> +#define CONFIG_USB_GADGET_S3C_UDC_OTG
> +#define CONFIG_USB_GADGET_BCM_UDC_OTG_PHY
> +#define CONFIG_USB_GADGET_PHY_8_BIT
> +#define CONFIG_USBDOWNLOAD_GADGET

You should probably rebase this against u-boot-dfu's latest HEAD, and
adapt for the renames I made (for consistency)!

> +#define CONFIG_USBID_ADDR		0x34052c46
> +#define CONFIG_G_DNL_VENDOR_NUM		0x18d1	/* google */
> +#define CONFIG_G_DNL_PRODUCT_NUM	0x0d02	/* nexus one */
> +#define CONFIG_G_DNL_MANUFACTURER	"Broadcom Corporation"
> +
>  #endif /* __BCM28155_AP_H */
Steve Rae July 6, 2015, 7:22 p.m. UTC | #2
On 15-07-06 11:22 AM, Paul Kocialkowski wrote:
> Hi,
>
> Le lundi 06 juillet 2015 à 09:52 -0700, Steve Rae a écrit :
>> From: "JD (Jiandong) Zheng" <jdzheng@broadcom.com>
>>
>> Signed-off-by: Steve Rae <srae@broadcom.com>
>> ---
>>
>>   board/broadcom/bcm28155_ap/bcm28155_ap.c | 40 ++++++++++++++++++++++++++++++++
>>   drivers/usb/gadget/Makefile              |  1 +
>>   include/configs/bcm28155_ap.h            | 20 ++++++++++++++++
>>   3 files changed, 61 insertions(+)
>>
>> diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
>> index 940a1c2..20eb191 100644
>> --- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
>> +++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
>> @@ -12,12 +12,20 @@
>>   #include <asm/kona-common/clk.h>
>>   #include <asm/arch/sysmap.h>
>>
>> +#include <usb.h>
>> +#include <usb/s3c_udc.h>
>> +#include <g_dnl.h>
>> +
>>   #define SECWATCHDOG_SDOGCR_OFFSET	0x00000000
>>   #define SECWATCHDOG_SDOGCR_EN_SHIFT	27
>>   #define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT	26
>>   #define SECWATCHDOG_SDOGCR_CLKS_SHIFT	20
>>   #define SECWATCHDOG_SDOGCR_LD_SHIFT	0
>>
>> +#ifndef CONFIG_USB_SERIALNO
>> +#define CONFIG_USB_SERIALNO "1234567890"
>> +#endif
>> +
>>   DECLARE_GLOBAL_DATA_PTR;
>>
>>   /*
>> @@ -85,3 +93,35 @@ int board_mmc_init(bd_t *bis)
>>   	return ret;
>>   }
>>   #endif
>> +
>> +#ifdef CONFIG_USB_GADGET
>> +static struct s3c_plat_otg_data bcm_otg_data = {
>> +	.regs_otg	= HSOTG_BASE_ADDR
>> +};
>> +
>> +int board_usb_init(int index, enum usb_init_type init)
>> +{
>> +	debug("%s: performing s3c_udc_probe\n", __func__);
>> +	return s3c_udc_probe(&bcm_otg_data);
>> +}
>> +
>> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
>> +{
>> +	debug("%s\n", __func__);
>> +	if (!getenv("serial#"))
>> +		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
>> +	return 0;
>> +}
>> +
>> +int g_dnl_get_board_bcd_device_number(int gcnum)
>> +{
>> +	debug("%s\n", __func__);
>> +	return 1;
>> +}
>> +
>> +int board_usb_cleanup(int index, enum usb_init_type init)
>> +{
>> +	debug("%s\n", __func__);
>> +	return 0;
>> +}
>> +#endif
>> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
>> index 70bb550..d370f1c 100644
>> --- a/drivers/usb/gadget/Makefile
>> +++ b/drivers/usb/gadget/Makefile
>> @@ -20,6 +20,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
>>   obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o
>>   obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
>>   obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o
>> +obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
>>   endif
>>   ifdef CONFIG_USB_ETHER
>>   obj-y += ether.o
>> diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
>> index 900dc42..e5fdc90 100644
>> --- a/include/configs/bcm28155_ap.h
>> +++ b/include/configs/bcm28155_ap.h
>> @@ -109,6 +109,7 @@
>>    * for example.
>>    */
>>   #define CONFIG_DOS_PARTITION
>> +#define CONFIG_EFI_PARTITION
>>
>>   /* version string, parser, etc */
>>   #define CONFIG_VERSION_VARIABLE
>> @@ -136,4 +137,23 @@
>>
>>   #undef CONFIG_CMD_NFS
>>
>> +/* Fastboot and USB OTG */
>> +#define CONFIG_CMD_FASTBOOT
>> +#define CONFIG_FASTBOOT_FLASH
>> +#define CONFIG_FASTBOOT_FLASH_MMC_DEV	0
>> +#define CONFIG_SYS_CACHELINE_SIZE	64
>> +#define CONFIG_USB_FASTBOOT_BUF_SIZE	(CONFIG_SYS_SDRAM_SIZE - (1024 * 1024))
>> +#define CONFIG_USB_FASTBOOT_BUF_ADDR	CONFIG_SYS_SDRAM_BASE
>> +#define CONFIG_USB_GADGET
>> +#define CONFIG_USB_GADGET_DUALSPEED
>> +#define CONFIG_USB_GADGET_VBUS_DRAW	0
>> +#define CONFIG_USB_GADGET_S3C_UDC_OTG
>> +#define CONFIG_USB_GADGET_BCM_UDC_OTG_PHY
>> +#define CONFIG_USB_GADGET_PHY_8_BIT
>> +#define CONFIG_USBDOWNLOAD_GADGET
>
> You should probably rebase this against u-boot-dfu's latest HEAD, and
> adapt for the renames I made (for consistency)!
OK -- see v2
>
>> +#define CONFIG_USBID_ADDR		0x34052c46
>> +#define CONFIG_G_DNL_VENDOR_NUM		0x18d1	/* google */
>> +#define CONFIG_G_DNL_PRODUCT_NUM	0x0d02	/* nexus one */
>> +#define CONFIG_G_DNL_MANUFACTURER	"Broadcom Corporation"
>> +
>>   #endif /* __BCM28155_AP_H */
>
diff mbox

Patch

diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index 940a1c2..20eb191 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -12,12 +12,20 @@ 
 #include <asm/kona-common/clk.h>
 #include <asm/arch/sysmap.h>
 
+#include <usb.h>
+#include <usb/s3c_udc.h>
+#include <g_dnl.h>
+
 #define SECWATCHDOG_SDOGCR_OFFSET	0x00000000
 #define SECWATCHDOG_SDOGCR_EN_SHIFT	27
 #define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT	26
 #define SECWATCHDOG_SDOGCR_CLKS_SHIFT	20
 #define SECWATCHDOG_SDOGCR_LD_SHIFT	0
 
+#ifndef CONFIG_USB_SERIALNO
+#define CONFIG_USB_SERIALNO "1234567890"
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -85,3 +93,35 @@  int board_mmc_init(bd_t *bis)
 	return ret;
 }
 #endif
+
+#ifdef CONFIG_USB_GADGET
+static struct s3c_plat_otg_data bcm_otg_data = {
+	.regs_otg	= HSOTG_BASE_ADDR
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("%s: performing s3c_udc_probe\n", __func__);
+	return s3c_udc_probe(&bcm_otg_data);
+}
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+	debug("%s\n", __func__);
+	if (!getenv("serial#"))
+		g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
+	return 0;
+}
+
+int g_dnl_get_board_bcd_device_number(int gcnum)
+{
+	debug("%s\n", __func__);
+	return 1;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	debug("%s\n", __func__);
+	return 0;
+}
+#endif
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 70bb550..d370f1c 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -20,6 +20,7 @@  obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o
 obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
 obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o
+obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
 endif
 ifdef CONFIG_USB_ETHER
 obj-y += ether.o
diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
index 900dc42..e5fdc90 100644
--- a/include/configs/bcm28155_ap.h
+++ b/include/configs/bcm28155_ap.h
@@ -109,6 +109,7 @@ 
  * for example.
  */
 #define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
 
 /* version string, parser, etc */
 #define CONFIG_VERSION_VARIABLE
@@ -136,4 +137,23 @@ 
 
 #undef CONFIG_CMD_NFS
 
+/* Fastboot and USB OTG */
+#define CONFIG_CMD_FASTBOOT
+#define CONFIG_FASTBOOT_FLASH
+#define CONFIG_FASTBOOT_FLASH_MMC_DEV	0
+#define CONFIG_SYS_CACHELINE_SIZE	64
+#define CONFIG_USB_FASTBOOT_BUF_SIZE	(CONFIG_SYS_SDRAM_SIZE - (1024 * 1024))
+#define CONFIG_USB_FASTBOOT_BUF_ADDR	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW	0
+#define CONFIG_USB_GADGET_S3C_UDC_OTG
+#define CONFIG_USB_GADGET_BCM_UDC_OTG_PHY
+#define CONFIG_USB_GADGET_PHY_8_BIT
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_USBID_ADDR		0x34052c46
+#define CONFIG_G_DNL_VENDOR_NUM		0x18d1	/* google */
+#define CONFIG_G_DNL_PRODUCT_NUM	0x0d02	/* nexus one */
+#define CONFIG_G_DNL_MANUFACTURER	"Broadcom Corporation"
+
 #endif /* __BCM28155_AP_H */