All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy
@ 2018-02-04 10:19 Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 1/4] phy: " Álvaro Fernández Rojas
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:19 UTC (permalink / raw)
  To: u-boot

Add support for BCM6358 usbh phy.

Álvaro Fernández Rojas (4):
  phy: add support for bcm6358 usbh phy
  mips: bmips: add support for bcm6358 usb
  mips: bmips: add hg556a usb support
  mips: bmips: add nb4-ser usb support

 arch/mips/dts/brcm,bcm6358.dtsi     | 27 +++++++++++
 arch/mips/dts/huawei,hg556a.dts     | 12 +++++
 arch/mips/dts/sfr,nb4-ser.dts       | 12 +++++
 configs/huawei_hg556a_ram_defconfig |  9 ++++
 configs/sfr_nb4-ser_ram_defconfig   |  9 ++++
 drivers/phy/Kconfig                 |  6 +++
 drivers/phy/Makefile                |  1 +
 drivers/phy/bcm6358-usbh-phy.c      | 94 +++++++++++++++++++++++++++++++++++++
 include/configs/bmips_bcm6358.h     |  7 +++
 9 files changed, 177 insertions(+)
 create mode 100644 drivers/phy/bcm6358-usbh-phy.c

-- 
2.11.0

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

* [U-Boot] [PATCH 1/4] phy: add support for bcm6358 usbh phy
  2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
@ 2018-02-04 10:19 ` Álvaro Fernández Rojas
  2018-02-04 18:34   ` Daniel Schwierzeck
  2018-02-04 10:19 ` [U-Boot] [PATCH 2/4] mips: bmips: add support for bcm6358 usb Álvaro Fernández Rojas
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:19 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/phy/Kconfig            |  6 +++
 drivers/phy/Makefile           |  1 +
 drivers/phy/bcm6358-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+)
 create mode 100644 drivers/phy/bcm6358-usbh-phy.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index cec2130c05..43fb4c9bfd 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -65,6 +65,12 @@ config BCM6348_USBH_PHY
 	help
 	  Support for the Broadcom MIPS BCM6348 USBH PHY.
 
+config BCM6358_USBH_PHY
+	bool "BCM6358 USBH PHY support"
+	depends on PHY && ARCH_BMIPS
+	help
+	  Support for the Broadcom MIPS BCM6358 USBH PHY.
+
 config PIPE3_PHY
 	bool "Support omap's PIPE3 PHY"
 	depends on PHY && ARCH_OMAP2PLUS
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 06e01e86eb..04843fd49b 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o
 obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o
 obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o
+obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
 obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
 obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
 obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c
new file mode 100644
index 0000000000..9583717a8c
--- /dev/null
+++ b/drivers/phy/bcm6358-usbh-phy.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2018 Álvaro Fernández Rojas <noltari@gmail.com>
+ *
+ * Derived from linux/arch/mips/bcm63xx/usb-common.c:
+ *	Copyright 2008 Maxime Bizon <mbizon@freebox.fr>
+ *	Copyright 2013 Florian Fainelli <florian@openwrt.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <reset.h>
+#include <asm/io.h>
+#include <dm/device.h>
+
+/* USBH Swap Control register */
+#define USBH_SWAP_REG		0x00
+#define USBH_SWAP_OHCI_DATA	BIT(0)
+#define USBH_SWAP_OHCI_ENDIAN	BIT(1)
+#define USBH_SWAP_EHCI_DATA	BIT(3)
+#define USBH_SWAP_EHCI_ENDIAN	BIT(4)
+
+/* USBH Test register */
+#define USBH_TEST_REG		0x24
+#define USBH_TEST_PORT_CTL	0x1c0020
+
+struct bcm6358_usbh_priv {
+	void __iomem *regs;
+};
+
+static int bcm6358_usbh_init(struct phy *phy)
+{
+	struct bcm6358_usbh_priv *priv = dev_get_priv(phy->dev);
+
+	/* configure to work in native cpu endian */
+	clrsetbits_be32(priv->regs + USBH_SWAP_REG,
+			USBH_SWAP_EHCI_ENDIAN | USBH_SWAP_OHCI_ENDIAN,
+			USBH_SWAP_EHCI_DATA | USBH_SWAP_OHCI_DATA);
+
+	/* test port control */
+	writel_be(USBH_TEST_PORT_CTL, priv->regs + USBH_TEST_REG);
+
+	return 0;
+}
+
+static struct phy_ops bcm6358_usbh_ops = {
+	.init = bcm6358_usbh_init,
+};
+
+static const struct udevice_id bcm6358_usbh_ids[] = {
+	{ .compatible = "brcm,bcm6358-usbh" },
+	{ /* sentinel */ }
+};
+
+static int bcm6358_usbh_probe(struct udevice *dev)
+{
+	struct bcm6358_usbh_priv *priv = dev_get_priv(dev);
+	struct reset_ctl rst_ctl;
+	fdt_addr_t addr;
+	fdt_size_t size;
+	int ret;
+
+	addr = devfdt_get_addr_size_index(dev, 0, &size);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	priv->regs = ioremap(addr, size);
+
+	/* perform reset */
+	ret = reset_get_by_index(dev, 0, &rst_ctl);
+	if (ret < 0)
+		return ret;
+
+	ret = reset_deassert(&rst_ctl);
+	if (ret < 0)
+		return ret;
+
+	ret = reset_free(&rst_ctl);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+U_BOOT_DRIVER(bcm6358_usbh) = {
+	.name = "bcm6358-usbh",
+	.id = UCLASS_PHY,
+	.of_match = bcm6358_usbh_ids,
+	.ops = &bcm6358_usbh_ops,
+	.priv_auto_alloc_size = sizeof(struct bcm6358_usbh_priv),
+	.probe = bcm6358_usbh_probe,
+};
-- 
2.11.0

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

* [U-Boot] [PATCH 2/4] mips: bmips: add support for bcm6358 usb
  2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 1/4] phy: " Álvaro Fernández Rojas
@ 2018-02-04 10:19 ` Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 3/4] mips: bmips: add hg556a usb support Álvaro Fernández Rojas
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:19 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 arch/mips/dts/brcm,bcm6358.dtsi | 27 +++++++++++++++++++++++++++
 include/configs/bmips_bcm6358.h |  7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 1662783279..b63b53baee 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -164,5 +164,32 @@
 			reg = <0xfffe1200 0x4c>;
 			u-boot,dm-pre-reloc;
 		};
+
+		ehci: usb-controller at fffe1300 {
+			compatible = "brcm,bcm6358-ehci", "generic-ehci";
+			reg = <0xfffe1300 0x100>;
+			phys = <&usbh>;
+			big-endian;
+
+			status = "disabled";
+		};
+
+		ohci: usb-controller at fffe1400 {
+			compatible = "brcm,bcm6358-ohci", "generic-ohci";
+			reg = <0xfffe1400 0x100>;
+			phys = <&usbh>;
+			big-endian;
+
+			status = "disabled";
+		};
+
+		usbh: usb-phy at fffe1500 {
+			compatible = "brcm,bcm6358-usbh";
+			reg = <0xfffe1500 0x28>;
+			#phy-cells = <0>;
+			resets = <&periph_rst BCM6358_RST_USBH>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/include/configs/bmips_bcm6358.h b/include/configs/bmips_bcm6358.h
index 5d018a3481..e3113ee309 100644
--- a/include/configs/bmips_bcm6358.h
+++ b/include/configs/bmips_bcm6358.h
@@ -14,6 +14,13 @@
 #define CONFIG_NR_DRAM_BANKS		1
 #define CONFIG_SYS_SDRAM_BASE		0x80000000
 
+/* USB */
+#define CONFIG_EHCI_DESC_BIG_ENDIAN
+#define CONFIG_EHCI_MMIO_BIG_ENDIAN
+#define CONFIG_SYS_OHCI_SWAP_REG_ACCESS
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
+#define CONFIG_USB_OHCI_NEW
+
 /* U-Boot */
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_SDRAM_BASE + 0x100000
 
-- 
2.11.0

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

* [U-Boot] [PATCH 3/4] mips: bmips: add hg556a usb support
  2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 1/4] phy: " Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 2/4] mips: bmips: add support for bcm6358 usb Álvaro Fernández Rojas
@ 2018-02-04 10:19 ` Álvaro Fernández Rojas
  2018-02-04 10:19 ` [U-Boot] [PATCH 4/4] mips: bmips: add nb4-ser " Álvaro Fernández Rojas
  2018-03-19  0:21 ` [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Daniel Schwierzeck
  4 siblings, 0 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:19 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 arch/mips/dts/huawei,hg556a.dts     | 12 ++++++++++++
 configs/huawei_hg556a_ram_defconfig |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/mips/dts/huawei,hg556a.dts b/arch/mips/dts/huawei,hg556a.dts
index 31c7d7ed5c..a1e9c15ab9 100644
--- a/arch/mips/dts/huawei,hg556a.dts
+++ b/arch/mips/dts/huawei,hg556a.dts
@@ -90,10 +90,18 @@
 	};
 };
 
+&ehci {
+	status = "okay";
+};
+
 &gpio0 {
 	status = "okay";
 };
 
+&ohci {
+	status = "okay";
+};
+
 &pflash {
 	status = "okay";
 };
@@ -102,3 +110,7 @@
 	u-boot,dm-pre-reloc;
 	status = "okay";
 };
+
+&usbh {
+	status = "okay";
+};
diff --git a/configs/huawei_hg556a_ram_defconfig b/configs/huawei_hg556a_ram_defconfig
index 12ced3ef27..7f7f34ed61 100644
--- a/configs/huawei_hg556a_ram_defconfig
+++ b/configs/huawei_hg556a_ram_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 # CONFIG_CMD_MISC is not set
@@ -37,8 +38,16 @@ CONFIG_LED_GPIO=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_CFI_FLASH=y
+CONFIG_PHY=y
+CONFIG_BCM6358_USBH_PHY=y
 CONFIG_DM_RESET=y
 CONFIG_RESET_BCM6345=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DM_SERIAL=y
 CONFIG_BCM6345_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
-- 
2.11.0

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

* [U-Boot] [PATCH 4/4] mips: bmips: add nb4-ser usb support
  2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
                   ` (2 preceding siblings ...)
  2018-02-04 10:19 ` [U-Boot] [PATCH 3/4] mips: bmips: add hg556a usb support Álvaro Fernández Rojas
@ 2018-02-04 10:19 ` Álvaro Fernández Rojas
  2018-03-19  0:21 ` [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Daniel Schwierzeck
  4 siblings, 0 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:19 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 arch/mips/dts/sfr,nb4-ser.dts     | 12 ++++++++++++
 configs/sfr_nb4-ser_ram_defconfig |  9 +++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/mips/dts/sfr,nb4-ser.dts b/arch/mips/dts/sfr,nb4-ser.dts
index f2092e9f99..473372faa1 100644
--- a/arch/mips/dts/sfr,nb4-ser.dts
+++ b/arch/mips/dts/sfr,nb4-ser.dts
@@ -50,6 +50,10 @@
 	};
 };
 
+&ehci {
+	status = "okay";
+};
+
 &gpio0 {
 	status = "okay";
 };
@@ -83,6 +87,10 @@
 	};
 };
 
+&ohci {
+	status = "okay";
+};
+
 &pflash {
 	status = "okay";
 };
@@ -91,3 +99,7 @@
 	u-boot,dm-pre-reloc;
 	status = "okay";
 };
+
+&usbh {
+	status = "okay";
+};
diff --git a/configs/sfr_nb4-ser_ram_defconfig b/configs/sfr_nb4-ser_ram_defconfig
index 6218465ede..fc323d879d 100644
--- a/configs/sfr_nb4-ser_ram_defconfig
+++ b/configs/sfr_nb4-ser_ram_defconfig
@@ -26,6 +26,7 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FPGA is not set
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_USB=y
 # CONFIG_CMD_NET is not set
 # CONFIG_CMD_NFS is not set
 # CONFIG_CMD_MISC is not set
@@ -39,8 +40,16 @@ CONFIG_LED_GPIO=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_CFI_FLASH=y
+CONFIG_PHY=y
+CONFIG_BCM6358_USBH_PHY=y
 CONFIG_DM_RESET=y
 CONFIG_RESET_BCM6345=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DM_SERIAL=y
 CONFIG_BCM6345_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
-- 
2.11.0

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

* [U-Boot] [PATCH 1/4] phy: add support for bcm6358 usbh phy
  2018-02-04 10:19 ` [U-Boot] [PATCH 1/4] phy: " Álvaro Fernández Rojas
@ 2018-02-04 18:34   ` Daniel Schwierzeck
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Schwierzeck @ 2018-02-04 18:34 UTC (permalink / raw)
  To: u-boot



On 04.02.2018 11:19, Álvaro Fernández Rojas wrote:
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  drivers/phy/Kconfig            |  6 +++
>  drivers/phy/Makefile           |  1 +
>  drivers/phy/bcm6358-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 101 insertions(+)
>  create mode 100644 drivers/phy/bcm6358-usbh-phy.c
> 

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180204/609db104/attachment.sig>

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

* [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy
  2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
                   ` (3 preceding siblings ...)
  2018-02-04 10:19 ` [U-Boot] [PATCH 4/4] mips: bmips: add nb4-ser " Álvaro Fernández Rojas
@ 2018-03-19  0:21 ` Daniel Schwierzeck
  4 siblings, 0 replies; 7+ messages in thread
From: Daniel Schwierzeck @ 2018-03-19  0:21 UTC (permalink / raw)
  To: u-boot



On 04.02.2018 11:19, Álvaro Fernández Rojas wrote:
> Add support for BCM6358 usbh phy.
> 
> Álvaro Fernández Rojas (4):
>   phy: add support for bcm6358 usbh phy
>   mips: bmips: add support for bcm6358 usb
>   mips: bmips: add hg556a usb support
>   mips: bmips: add nb4-ser usb support
> 
>  arch/mips/dts/brcm,bcm6358.dtsi     | 27 +++++++++++
>  arch/mips/dts/huawei,hg556a.dts     | 12 +++++
>  arch/mips/dts/sfr,nb4-ser.dts       | 12 +++++
>  configs/huawei_hg556a_ram_defconfig |  9 ++++
>  configs/sfr_nb4-ser_ram_defconfig   |  9 ++++
>  drivers/phy/Kconfig                 |  6 +++
>  drivers/phy/Makefile                |  1 +
>  drivers/phy/bcm6358-usbh-phy.c      | 94 +++++++++++++++++++++++++++++++++++++
>  include/configs/bmips_bcm6358.h     |  7 +++
>  9 files changed, 177 insertions(+)
>  create mode 100644 drivers/phy/bcm6358-usbh-phy.c
> 

applied to u-boot-mips, thanks.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180319/c89055b6/attachment.sig>

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

end of thread, other threads:[~2018-03-19  0:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 10:19 [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Álvaro Fernández Rojas
2018-02-04 10:19 ` [U-Boot] [PATCH 1/4] phy: " Álvaro Fernández Rojas
2018-02-04 18:34   ` Daniel Schwierzeck
2018-02-04 10:19 ` [U-Boot] [PATCH 2/4] mips: bmips: add support for bcm6358 usb Álvaro Fernández Rojas
2018-02-04 10:19 ` [U-Boot] [PATCH 3/4] mips: bmips: add hg556a usb support Álvaro Fernández Rojas
2018-02-04 10:19 ` [U-Boot] [PATCH 4/4] mips: bmips: add nb4-ser " Álvaro Fernández Rojas
2018-03-19  0:21 ` [U-Boot] [PATCH 0/4] bmips: add support for bcm6358 usbh phy Daniel Schwierzeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.