Skip to contentSkip to conversation

samsung: dwc3: usb: Samsung specific code to handle dwc3

PATCH New Lukasz Majewski 2 participants 8 messages Mar 4, 2015 – Mar 8, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover samsung: dwc3: usb: Samsung specific code to handle dwc3

Those patches depend on following commits:

For the whole patch set please refer to -dfu u-boot repo, branch (devel/dwc3_gadget):
http://git.denx.de/?p=u-boot/u-boot-dfu.git;a=shortlog;h=refs/heads/devel/dwc3_gadget

And should be applied on top of them.

Inha Song (1):
ARM: exynos5420: Add dfu_alt_info board specific callbacks to support
DFU download

Joonyoung Shim (1):
arm: exynos5420: Adding support for board_usb_{init|cleanup}()
functions

Lukasz Majewski (2):
arm: exynos: USB3 PHY base definition for Exynos5 SoCs
samsung: usb: phy: Support for DWC3 PHY

 arch/arm/include/asm/arch-exynos/cpu.h |  2 +-
 board/samsung/smdk5420/smdk5420.c      | 67 +++++++++++++++++++++++++++++
 drivers/usb/dwc3/Makefile              |  1 +
 drivers/usb/dwc3/samsung_usb_phy.c     | 78 ++++++++++++++++++++++++++++++++++
 include/samsung-usb-phy-uboot.h        | 16 +++++++
 5 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/dwc3/samsung_usb_phy.c
 create mode 100644 include/samsung-usb-phy-uboot.h
Signature · 1 line
2.0.0.rc2
#1 lore raw

PATCH 1/4 arm: exynos: USB3 PHY base definition for Exynos5 SoCs

After that change it would be possible to call samsung_get_base_usb3_phy() function to get proper base address

---
 arch/arm/include/asm/arch-exynos/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-exynos/cpu.h +1 -1
index 5a7c827..8b0aa87 100644
@@ -167,6 +167,7 @@
 #define EXYNOS5420_USB_HOST_EHCI_BASE	0x12110000
 #define EXYNOS5420_MMC_BASE		0x12200000
 #define EXYNOS5420_SROMC_BASE		0x12250000
+#define EXYNOS5420_USB3PHY_BASE	0x12500000
 #define EXYNOS5420_UART_BASE		0x12C00000
 #define EXYNOS5420_I2C_BASE		0x12C60000
 #define EXYNOS5420_I2C_8910_BASE	0x12E00000
@@ -187,7 +188,6 @@
 #define EXYNOS5420_FIMD_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_ADC_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_MODEM_BASE		DEVICE_NOT_AVAILABLE
-#define EXYNOS5420_USB3PHY_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_USB_HOST_XHCI_BASE	DEVICE_NOT_AVAILABLE
 
 
Signature · 1 line
2.0.0.rc2
#2 lore raw

PATCH 2/4 samsung: usb: phy: Support for DWC3 PHY

In reply to Lukasz Majewski

New files, namely samsung_usb_phy.c and samsung-usb-phy-uboot.h have been added to u-boot to provide proper PHY handling at Exynos5 SoCs.

This code is used thereafter in the board_usb_init() call.

---
 drivers/usb/dwc3/Makefile          |  1 +
 drivers/usb/dwc3/samsung_usb_phy.c | 78 ++++++++++++++++++++++++++++++++++++++
 include/samsung-usb-phy-uboot.h    | 16 ++++++++
 3 files changed, 95 insertions(+)
 create mode 100644 drivers/usb/dwc3/samsung_usb_phy.c
 create mode 100644 include/samsung-usb-phy-uboot.h
drivers/usb/dwc3/Makefile +1 -0
index e455a52..02bb216 100644
@@ -6,3 +6,4 @@ dwc3-y					+= gadget.o ep0.o
 
 obj-$(CONFIG_USB_DWC3_OMAP)		+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_PHY_OMAP)		+= ti_usb_phy.o
+obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG)	+= samsung_usb_phy.o
drivers/usb/dwc3/samsung_usb_phy.c new file +78 -0

78 lines not on this page · raw message

include/samsung-usb-phy-uboot.h new file +16 -0
new file mode 100644
index 0000000..9f37560
@@ -0,0 +1,16 @@
+/* include/samsung-usb-phy-uboot.h
+ *
+ * Copyright (c) 2015 Samsung Electronics
+ *
+ * USB3 (DWC3) PHY uboot init
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __SAMSUNG_USB_PHY_UBOOT_H_
+#define __SAMSUNG_USB_PHY_UBOOT_H_
+
+#include <asm/arch/xhci-exynos.h>
+
+void exynos5_usb3_phy_init(struct exynos_usb3_phy *phy);
+#endif /* __SAMSUNG_USB_PHY_UBOOT_H_ */
Signature · 1 line
2.0.0.rc2
#3 lore raw

PATCH 3/4 arm: exynos5420: Adding support for board_usb_{init|cleanup}() functions

In reply to Lukasz Majewski

From: Joonyoung Shim <[email protected]>

Low level code to support proper usb operation has been added to smdk5420.c board file.

---
 board/samsung/smdk5420/smdk5420.c | 41 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
board/samsung/smdk5420/smdk5420.c +41 -0
index 1aca9fa..ecd9b97 100644
@@ -19,6 +19,12 @@
 #include <asm/arch/system.h>
 #include <asm/arch/dp_info.h>
 #include <power/tps65090_pmic.h>
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <mmc.h>
+#include <asm/arch/power.h>
+#include <samsung-usb-phy-uboot.h>
+#include <asm/arch/xhci-exynos.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -90,3 +96,38 @@ int board_get_revision(void)
 {
 	return 0;
 }
+
+static struct dwc3_device dwc3_device_data = {
+	.maximum_speed = USB_SPEED_SUPER,
+	.base = 0x12400000,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+	dwc3_uboot_handle_interrupt(0);
+	return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	struct exynos_usb3_phy *phy = (struct exynos_usb3_phy *)
+		samsung_get_base_usb3_phy();
+
+	if (!phy) {
+		error("usb3 phy not supported");
+		return -ENODEV;
+	}
+
+	set_usbdrd_phy_ctrl(POWER_USB_DRD_PHY_CTRL_EN);
+	exynos5_usb3_phy_init(phy);
+
+	return dwc3_uboot_init(&dwc3_device_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	dwc3_uboot_exit(index);
+	return 0;
+}
Signature · 1 line
2.0.0.rc2
#4 lore raw

PATCH 3/4 arm: exynos5420: Adding support for board_usb_{init|cleanup}() functions

Hi,

Quoted 31 lines · Lukasz Majewski

From: Joonyoung Shim <[email protected] <javascript:;>>

Low level code to support proper usb operation has been added to smdk5420.c board file.

Signed-off-by Joonyoung Shim <[email protected] <javascript:;>>
Signed-off-by Lukasz Majewski <[email protected] <javascript:;>>
---
 board/samsung/smdk5420/smdk5420.c | 41
+++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
board/samsung/smdk5420/smdk5420.c +6 -0
index 1aca9fa..ecd9b97 100644
@@ -19,6 +19,12 @@
 #include <asm/arch/system.h>
 #include <asm/arch/dp_info.h>
 #include <power/tps65090_pmic.h>
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <mmc.h>
+#include <asm/arch/power.h>
+#include <samsung-usb-phy-uboot.h>
+#include <asm/arch/xhci-exynos.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 

board/samsung/smdk5420/smdk5420.c int board_get_revision(void) · line 102

Quoted 7 lines
board/samsung/smdk5420/smdk5420.c +4 -0
@@ -90,3 +96,38 @@ int board_get_revision(void)
 {
        return 0;
 }
+
+static struct dwc3_device dwc3_device_data = {
+       .maximum_speed = USB_SPEED_SUPER,
+       .base = 0x12400000,

could you please define this value?

Quoted 34 lines
board/samsung/smdk5420/smdk5420.c +31 -1
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+       dwc3_uboot_handle_interrupt(0);
+       return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+       struct exynos_usb3_phy *phy = (struct exynos_usb3_phy *)
+               samsung_get_base_usb3_phy();
+
+       if (!phy) {
+               error("usb3 phy not supported");
+               return -ENODEV;
+       }
+
+       set_usbdrd_phy_ctrl(POWER_USB_DRD_PHY_CTRL_EN);
+       exynos5_usb3_phy_init(phy);
+
+       return dwc3_uboot_init(&dwc3_device_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       dwc3_uboot_exit(index);
+       return 0;
+}
--

2.0.0.rc2

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <javascript:;>
http://lists.denx.de/mailman/listinfo/u-boot

Thanks,
Minkyu Kang

Signature · 2 lines
Thanks.
Minkyu Kang.
#5 lore raw

PATCH 4/4 ARM: exynos5420: Add dfu_alt_info board specific callbacks to support DFU download

In reply to Lukasz Majewski

From: Inha Song <[email protected]>

This patch adds board specific code to provide dfu_alt_info handling for Exynos5420.

---
 board/samsung/smdk5420/smdk5420.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
board/samsung/smdk5420/smdk5420.c +26 -0
index ecd9b97..1df4b28 100644
@@ -131,3 +131,29 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 	dwc3_uboot_exit(index);
 	return 0;
 }
+
+#ifdef CONFIG_SET_DFU_ALT_INFO
+char *get_dfu_alt_system(void)
+{
+	return getenv("dfu_alt_system");
+}
+
+char *get_dfu_alt_boot(void)
+{
+	char *alt_boot;
+
+	switch (get_boot_mode()) {
+	case BOOT_MODE_SD:
+		alt_boot = CONFIG_DFU_ALT_BOOT_SD;
+		break;
+	case BOOT_MODE_EMMC:
+	case BOOT_MODE_EMMC_SD:
+		alt_boot = CONFIG_DFU_ALT_BOOT_EMMC;
+		break;
+	default:
+		alt_boot = NULL;
+		break;
+	}
+	return alt_boot;
+}
+#endif
Signature · 1 line
2.0.0.rc2
#6 lore raw

cover samsung: dwc3: usb: Samsung specific code to handle dwc3

In reply to Lukasz Majewski

Hi Minkyu,

Quoted 22 lines

Those patches depend on following commits:

For the whole patch set please refer to -dfu u-boot repo, branch (devel/dwc3_gadget):
http://git.denx.de/?p=u-boot/u-boot-dfu.git;a=shortlog;h=refs/heads/devel/dwc3_gadget

And should be applied on top of them.

Inha Song (1):
ARM: exynos5420: Add dfu_alt_info board specific callbacks to
support DFU download

Joonyoung Shim (1):
arm: exynos5420: Adding support for board_usb_{init|cleanup}()
functions

Lukasz Majewski (2):
arm: exynos: USB3 PHY base definition for Exynos5 SoCs
samsung: usb: phy: Support for DWC3 PHY

 arch/arm/include/asm/arch-exynos/cpu.h |  2 +-
 board/samsung/smdk5420/smdk5420.c      | 67
Quoted 8 lines

+++++++++++++++++++++++++++++ drivers/usb/dwc3/Makefile
| 1 + drivers/usb/dwc3/samsung_usb_phy.c | 78
++++++++++++++++++++++++++++++++++
include/samsung-usb-phy-uboot.h | 16 +++++++ 5 files changed,
163 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/dwc3/samsung_usb_phy.c create mode 100644 include/samsung-usb-phy-uboot.h

Could you review/ACK those patches? Since they are related to dwc3 driver, I would prefer them to go through the usb/dfu tree.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#7 lore raw

cover samsung: dwc3: usb: Samsung specific code to handle dwc3

Hi

Quoted 40 lines · Lukasz Majewski

Hi Minkyu,

Quoted 5 lines

Those patches depend on following commits:

For the whole patch set please refer to -dfu u-boot repo, branch (devel/dwc3_gadget):

http://git.denx.de/?p=u-boot/u-boot-dfu.git;a=shortlog;h=refs/heads/devel/dwc3_gadget

Quoted 17 lines

And should be applied on top of them.

Inha Song (1):
ARM: exynos5420: Add dfu_alt_info board specific callbacks to
support DFU download

Joonyoung Shim (1):
arm: exynos5420: Adding support for board_usb_{init|cleanup}()
functions

Lukasz Majewski (2):
arm: exynos: USB3 PHY base definition for Exynos5 SoCs
samsung: usb: phy: Support for DWC3 PHY

 arch/arm/include/asm/arch-exynos/cpu.h |  2 +-
 board/samsung/smdk5420/smdk5420.c      | 67
Quoted 8 lines

+++++++++++++++++++++++++++++ drivers/usb/dwc3/Makefile
| 1 + drivers/usb/dwc3/samsung_usb_phy.c | 78
++++++++++++++++++++++++++++++++++
include/samsung-usb-phy-uboot.h | 16 +++++++ 5 files changed,
163 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/dwc3/samsung_usb_phy.c create mode 100644 include/samsung-usb-phy-uboot.h

Could you review/ACK those patches? Since they are related to dwc3 driver, I would prefer them to go through the usb/dfu tree.

--
Best regards,

Quoted 8 lines

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <javascript:;>
http://lists.denx.de/mailman/listinfo/u-boot

Thanks,
Minkyu Kang

Signature · 2 lines
Thanks.
Minkyu Kang.