public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards.
@ 2015-07-09 21:26 Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 1/3] g_dnl: add missing declaration Steve Rae
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Steve Rae @ 2015-07-09 21:26 UTC (permalink / raw)
  To: u-boot

The OTG hardware is a DWC2 controller and this series uses the
existing gadget driver ("s3c_udc_otg.c").

Changes in v3:
- use static inline functions instead of macros
- update the delay (2ms) to match the kernel code
- use "SZ_1M"
- undefine the 8-bit phy interface

Changes in v2:
- rebased against u-boot-dfu

Jiandong Zheng and Steve Rae (2):
  usb: gadget: bcm_udc_otg files
  implement Fastboot via USB OTG on bcm28155_ap boards

Steve Rae (1):
  g_dnl: add missing declaration

 arch/arm/include/asm/arch-bcm281xx/sysmap.h |  7 ++++
 board/broadcom/bcm28155_ap/bcm28155_ap.c    | 40 ++++++++++++++++++++++
 drivers/usb/gadget/Makefile                 |  1 +
 drivers/usb/gadget/bcm_udc_otg.h            | 22 +++++++++++++
 drivers/usb/gadget/bcm_udc_otg_phy.c        | 51 +++++++++++++++++++++++++++++
 include/configs/bcm28155_ap.h               | 20 +++++++++++
 include/g_dnl.h                             |  1 +
 7 files changed, 142 insertions(+)
 create mode 100644 drivers/usb/gadget/bcm_udc_otg.h
 create mode 100644 drivers/usb/gadget/bcm_udc_otg_phy.c

-- 
1.8.5

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

* [U-Boot] [PATCH v3 1/3] g_dnl: add missing declaration
  2015-07-09 21:26 [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Steve Rae
@ 2015-07-09 21:26 ` Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 2/3] usb: gadget: bcm_udc_otg files Steve Rae
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Rae @ 2015-07-09 21:26 UTC (permalink / raw)
  To: u-boot

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

Changes in v3: None
Changes in v2: None

 include/g_dnl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/g_dnl.h b/include/g_dnl.h
index 4eeb5e4..ba49f1f 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -34,6 +34,7 @@ struct g_dnl_bind_callback {
 };
 
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
+int g_dnl_get_board_bcd_device_number(int gcnum);
 int g_dnl_board_usb_cable_connected(void);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
-- 
1.8.5

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

* [U-Boot] [PATCH v3 2/3] usb: gadget: bcm_udc_otg files
  2015-07-09 21:26 [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 1/3] g_dnl: add missing declaration Steve Rae
@ 2015-07-09 21:26 ` Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 3/3] implement Fastboot via USB OTG on bcm28155_ap boards Steve Rae
  2015-07-20  9:58 ` [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Lukasz Majewski
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Rae @ 2015-07-09 21:26 UTC (permalink / raw)
  To: u-boot

From: Jiandong Zheng <jdzheng@broadcom.com>

Add the required files for the Broadcom UDC OTG interface.

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

Changes in v3:
- use static inline functions instead of macros
- update the delay (2ms) to match the kernel code

Changes in v2: None

 arch/arm/include/asm/arch-bcm281xx/sysmap.h |  7 ++++
 drivers/usb/gadget/bcm_udc_otg.h            | 22 +++++++++++++
 drivers/usb/gadget/bcm_udc_otg_phy.c        | 51 +++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+)
 create mode 100644 drivers/usb/gadget/bcm_udc_otg.h
 create mode 100644 drivers/usb/gadget/bcm_udc_otg_phy.c

diff --git a/arch/arm/include/asm/arch-bcm281xx/sysmap.h b/arch/arm/include/asm/arch-bcm281xx/sysmap.h
index 93ebf34..dbcc88c 100644
--- a/arch/arm/include/asm/arch-bcm281xx/sysmap.h
+++ b/arch/arm/include/asm/arch-bcm281xx/sysmap.h
@@ -27,4 +27,11 @@
 #define SECWD2_BASE_ADDR	0x35002f40
 #define TIMER_BASE_ADDR		0x3e00d000
 
+#define HSOTG_DCTL_OFFSET					0x00000804
+#define    HSOTG_DCTL_SFTDISCON_MASK				0x00000002
+
+#define HSOTG_CTRL_PHY_P1CTL_OFFSET				0x00000008
+#define    HSOTG_CTRL_PHY_P1CTL_SOFT_RESET_MASK			0x00000002
+#define    HSOTG_CTRL_PHY_P1CTL_NON_DRIVING_MASK		0x00000001
+
 #endif
diff --git a/drivers/usb/gadget/bcm_udc_otg.h b/drivers/usb/gadget/bcm_udc_otg.h
new file mode 100644
index 0000000..d47aefa
--- /dev/null
+++ b/drivers/usb/gadget/bcm_udc_otg.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2015 Broadcom Corporation.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __BCM_UDC_OTG_H
+#define __BCM_UDC_OTG_H
+
+#include <common.h>
+
+static inline void wfld_set(uintptr_t addr, uint32_t fld_val, uint32_t fld_mask)
+{
+	writel(((readl(addr) & ~(fld_mask)) | (fld_val)), (addr));
+}
+
+static inline void wfld_clear(uintptr_t addr, uint32_t fld_mask)
+{
+	writel((readl(addr) & ~(fld_mask)), (addr));
+}
+
+#endif
diff --git a/drivers/usb/gadget/bcm_udc_otg_phy.c b/drivers/usb/gadget/bcm_udc_otg_phy.c
new file mode 100644
index 0000000..f8690b0
--- /dev/null
+++ b/drivers/usb/gadget/bcm_udc_otg_phy.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 Broadcom Corporation.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <config.h>
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/sysmap.h>
+
+#include <usb/s3c_udc.h>
+#include "bcm_udc_otg.h"
+
+void otg_phy_init(struct s3c_udc *dev)
+{
+	/* set Phy to driving mode */
+	wfld_clear(HSOTG_CTRL_BASE_ADDR + HSOTG_CTRL_PHY_P1CTL_OFFSET,
+		   HSOTG_CTRL_PHY_P1CTL_NON_DRIVING_MASK);
+
+	udelay(100);
+
+	/* clear Soft Disconnect */
+	wfld_clear(HSOTG_BASE_ADDR + HSOTG_DCTL_OFFSET,
+		   HSOTG_DCTL_SFTDISCON_MASK);
+
+	/* invoke Reset (active low) */
+	wfld_clear(HSOTG_CTRL_BASE_ADDR + HSOTG_CTRL_PHY_P1CTL_OFFSET,
+		   HSOTG_CTRL_PHY_P1CTL_SOFT_RESET_MASK);
+
+	/* Reset needs to be asserted for 2ms */
+	udelay(2000);
+
+	/* release Reset */
+	wfld_set(HSOTG_CTRL_BASE_ADDR + HSOTG_CTRL_PHY_P1CTL_OFFSET,
+		 HSOTG_CTRL_PHY_P1CTL_SOFT_RESET_MASK,
+		 HSOTG_CTRL_PHY_P1CTL_SOFT_RESET_MASK);
+}
+
+void otg_phy_off(struct s3c_udc *dev)
+{
+	/* Soft Disconnect */
+	wfld_set(HSOTG_BASE_ADDR + HSOTG_DCTL_OFFSET,
+		 HSOTG_DCTL_SFTDISCON_MASK,
+		 HSOTG_DCTL_SFTDISCON_MASK);
+
+	/* set Phy to non-driving (reset) mode */
+	wfld_set(HSOTG_CTRL_BASE_ADDR + HSOTG_CTRL_PHY_P1CTL_OFFSET,
+		 HSOTG_CTRL_PHY_P1CTL_NON_DRIVING_MASK,
+		 HSOTG_CTRL_PHY_P1CTL_NON_DRIVING_MASK);
+}
-- 
1.8.5

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

* [U-Boot] [PATCH v3 3/3] implement Fastboot via USB OTG on bcm28155_ap boards
  2015-07-09 21:26 [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 1/3] g_dnl: add missing declaration Steve Rae
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 2/3] usb: gadget: bcm_udc_otg files Steve Rae
@ 2015-07-09 21:26 ` Steve Rae
  2015-07-20  9:58 ` [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Lukasz Majewski
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Rae @ 2015-07-09 21:26 UTC (permalink / raw)
  To: u-boot

From: Jiandong Zheng <jdzheng@broadcom.com>

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

Changes in v3:
- use "SZ_1M"
- undefine the 8-bit phy interface

Changes in v2:
- rebased against u-boot-dfu

 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 4e15323..4c11a7e 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 # new USB gadget layer dependencies
 ifdef CONFIG_USB_GADGET
 obj-$(CONFIG_USB_GADGET_ATMEL_USBA) += atmel_usba_udc.o
+obj-$(CONFIG_USB_GADGET_BCM_UDC_OTG_PHY) += bcm_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 obj-$(CONFIG_USB_GADGET_S3C_UDC_OTG_PHY) += s3c_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
diff --git a/include/configs/bcm28155_ap.h b/include/configs/bcm28155_ap.h
index 900dc42..f023f27 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_USB_FUNCTION_FASTBOOT
+#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 - SZ_1M)
+#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_DOWNLOAD
+#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 */
-- 
1.8.5

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

* [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards.
  2015-07-09 21:26 [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Steve Rae
                   ` (2 preceding siblings ...)
  2015-07-09 21:26 ` [U-Boot] [PATCH v3 3/3] implement Fastboot via USB OTG on bcm28155_ap boards Steve Rae
@ 2015-07-20  9:58 ` Lukasz Majewski
  3 siblings, 0 replies; 5+ messages in thread
From: Lukasz Majewski @ 2015-07-20  9:58 UTC (permalink / raw)
  To: u-boot

Hi Steve,

> The OTG hardware is a DWC2 controller and this series uses the
> existing gadget driver ("s3c_udc_otg.c").
> 
> Changes in v3:
> - use static inline functions instead of macros
> - update the delay (2ms) to match the kernel code
> - use "SZ_1M"
> - undefine the 8-bit phy interface
> 
> Changes in v2:
> - rebased against u-boot-dfu
> 
> Jiandong Zheng and Steve Rae (2):
>   usb: gadget: bcm_udc_otg files
>   implement Fastboot via USB OTG on bcm28155_ap boards
> 
> Steve Rae (1):
>   g_dnl: add missing declaration
> 
>  arch/arm/include/asm/arch-bcm281xx/sysmap.h |  7 ++++
>  board/broadcom/bcm28155_ap/bcm28155_ap.c    | 40
> ++++++++++++++++++++++ drivers/usb/gadget/Makefile                 |
> 1 + drivers/usb/gadget/bcm_udc_otg.h            | 22 +++++++++++++
>  drivers/usb/gadget/bcm_udc_otg_phy.c        | 51
> +++++++++++++++++++++++++++++
> include/configs/bcm28155_ap.h               | 20 +++++++++++
> include/g_dnl.h                             |  1 + 7 files changed,
> 142 insertions(+) create mode 100644 drivers/usb/gadget/bcm_udc_otg.h
>  create mode 100644 drivers/usb/gadget/bcm_udc_otg_phy.c
> 

Applied to u-boot-dfu (the whole series).

Thanks for patches!


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

end of thread, other threads:[~2015-07-20  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 21:26 [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Steve Rae
2015-07-09 21:26 ` [U-Boot] [PATCH v3 1/3] g_dnl: add missing declaration Steve Rae
2015-07-09 21:26 ` [U-Boot] [PATCH v3 2/3] usb: gadget: bcm_udc_otg files Steve Rae
2015-07-09 21:26 ` [U-Boot] [PATCH v3 3/3] implement Fastboot via USB OTG on bcm28155_ap boards Steve Rae
2015-07-20  9:58 ` [U-Boot] [PATCH v3 0/3] This series implements fastboot on the "bcm28155_ap" boards Lukasz Majewski

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