public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy
@ 2018-02-04 10:18 Álvaro Fernández Rojas
  2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:18 UTC (permalink / raw)
  To: u-boot

Add support for BCM6348 usbh phy.

Álvaro Fernández Rojas (3):
  phy: add support for bcm6348 usbh phy
  mips: bmips: add support for bcm6348 usb
  mips: bmips: add ct-5361 usb support

 arch/mips/dts/brcm,bcm6348.dtsi       | 20 ++++++++
 arch/mips/dts/comtrend,ct-5361.dts    |  8 +++
 configs/comtrend_ct5361_ram_defconfig |  7 +++
 drivers/phy/Kconfig                   |  6 +++
 drivers/phy/Makefile                  |  1 +
 drivers/phy/bcm6348-usbh-phy.c        | 94 +++++++++++++++++++++++++++++++++++
 include/configs/bmips_bcm6348.h       |  5 ++
 7 files changed, 141 insertions(+)
 create mode 100644 drivers/phy/bcm6348-usbh-phy.c

-- 
2.11.0

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

* [U-Boot] [PATCH 1/3] phy: add support for bcm6348 usbh phy
  2018-02-04 10:18 [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Álvaro Fernández Rojas
@ 2018-02-04 10:18 ` Álvaro Fernández Rojas
  2018-02-04 18:35   ` Daniel Schwierzeck
  2018-03-17 19:30   ` Daniel Schwierzeck
  2018-02-04 10:18 ` [U-Boot] [PATCH 2/3] mips: bmips: add support for bcm6348 usb Álvaro Fernández Rojas
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:18 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/bcm6348-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+)
 create mode 100644 drivers/phy/bcm6348-usbh-phy.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 3b9a09ce18..cec2130c05 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -59,6 +59,12 @@ config SPL_NOP_PHY
 	  This is useful when a driver uses the PHY framework but no real PHY
 	  hardware exists.
 
+config BCM6348_USBH_PHY
+	bool "BCM6348 USBH PHY support"
+	depends on PHY && ARCH_BMIPS
+	help
+	  Support for the Broadcom MIPS BCM6348 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 668040b0bb..06e01e86eb 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -7,6 +7,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_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/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
new file mode 100644
index 0000000000..55e865c53d
--- /dev/null
+++ b/drivers/phy/bcm6348-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 <clk.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <reset.h>
+#include <asm/io.h>
+#include <dm/device.h>
+
+#define USBH_SETUP_PORT1_EN	BIT(0)
+
+struct bcm6348_usbh_priv {
+	void __iomem *regs;
+};
+
+static int bcm6348_usbh_init(struct phy *phy)
+{
+	struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
+
+	writel_be(USBH_SETUP_PORT1_EN, priv->regs);
+
+	return 0;
+}
+
+static struct phy_ops bcm6348_usbh_ops = {
+	.init = bcm6348_usbh_init,
+};
+
+static const struct udevice_id bcm6348_usbh_ids[] = {
+	{ .compatible = "brcm,bcm6348-usbh" },
+	{ /* sentinel */ }
+};
+
+static int bcm6348_usbh_probe(struct udevice *dev)
+{
+	struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
+	struct reset_ctl rst_ctl;
+	struct clk clk;
+	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);
+
+	/* enable usbh clock */
+	ret = clk_get_by_name(dev, "usbh", &clk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_enable(&clk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_free(&clk);
+	if (ret < 0)
+		return ret;
+
+	/* 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(bcm6348_usbh) = {
+	.name = "bcm6348-usbh",
+	.id = UCLASS_PHY,
+	.of_match = bcm6348_usbh_ids,
+	.ops = &bcm6348_usbh_ops,
+	.priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
+	.probe = bcm6348_usbh_probe,
+};
-- 
2.11.0

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

* [U-Boot] [PATCH 2/3] mips: bmips: add support for bcm6348 usb
  2018-02-04 10:18 [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Álvaro Fernández Rojas
  2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
@ 2018-02-04 10:18 ` Álvaro Fernández Rojas
  2018-02-04 10:18 ` [U-Boot] [PATCH 3/3] mips: bmips: add ct-5361 usb support Álvaro Fernández Rojas
  2018-03-18 23:55 ` [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Daniel Schwierzeck
  3 siblings, 0 replies; 8+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:18 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 arch/mips/dts/brcm,bcm6348.dtsi | 20 ++++++++++++++++++++
 include/configs/bmips_bcm6348.h |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6348.dtsi b/arch/mips/dts/brcm,bcm6348.dtsi
index 540b9fea5b..92fb91afc1 100644
--- a/arch/mips/dts/brcm,bcm6348.dtsi
+++ b/arch/mips/dts/brcm,bcm6348.dtsi
@@ -135,6 +135,26 @@
 			status = "disabled";
 		};
 
+		ohci: usb-controller at fffe1b00 {
+			compatible = "brcm,bcm6348-ohci", "generic-ohci";
+			reg = <0xfffe1b00 0x100>;
+			phys = <&usbh>;
+			big-endian;
+
+			status = "disabled";
+		};
+
+		usbh: usb-phy at fffe1c00 {
+			compatible = "brcm,bcm6348-usbh";
+			reg = <0xfffe1c00 0x4>;
+			#phy-cells = <0>;
+			clocks = <&periph_clk BCM6348_CLK_USBH>;
+			clock-names = "usbh";
+			resets = <&periph_rst BCM6348_RST_USBH>;
+
+			status = "disabled";
+		};
+
 		memory-controller at fffe2300 {
 			compatible = "brcm,bcm6338-mc";
 			reg = <0xfffe2300 0x38>;
diff --git a/include/configs/bmips_bcm6348.h b/include/configs/bmips_bcm6348.h
index e9f53d6811..6c9c33b822 100644
--- a/include/configs/bmips_bcm6348.h
+++ b/include/configs/bmips_bcm6348.h
@@ -14,6 +14,11 @@
 #define CONFIG_NR_DRAM_BANKS		1
 #define CONFIG_SYS_SDRAM_BASE		0x80000000
 
+/* USB */
+#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] 8+ messages in thread

* [U-Boot] [PATCH 3/3] mips: bmips: add ct-5361 usb support
  2018-02-04 10:18 [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Álvaro Fernández Rojas
  2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
  2018-02-04 10:18 ` [U-Boot] [PATCH 2/3] mips: bmips: add support for bcm6348 usb Álvaro Fernández Rojas
@ 2018-02-04 10:18 ` Álvaro Fernández Rojas
  2018-03-18 23:55 ` [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Daniel Schwierzeck
  3 siblings, 0 replies; 8+ messages in thread
From: Álvaro Fernández Rojas @ 2018-02-04 10:18 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 arch/mips/dts/comtrend,ct-5361.dts    | 8 ++++++++
 configs/comtrend_ct5361_ram_defconfig | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/arch/mips/dts/comtrend,ct-5361.dts b/arch/mips/dts/comtrend,ct-5361.dts
index c909a528a9..74dc09046c 100644
--- a/arch/mips/dts/comtrend,ct-5361.dts
+++ b/arch/mips/dts/comtrend,ct-5361.dts
@@ -39,6 +39,10 @@
 	status = "okay";
 };
 
+&ohci {
+	status = "okay";
+};
+
 &pflash {
 	status = "okay";
 };
@@ -47,3 +51,7 @@
 	u-boot,dm-pre-reloc;
 	status = "okay";
 };
+
+&usbh {
+	status = "okay";
+};
diff --git a/configs/comtrend_ct5361_ram_defconfig b/configs/comtrend_ct5361_ram_defconfig
index 1dfefcb379..8b842606f5 100644
--- a/configs/comtrend_ct5361_ram_defconfig
+++ b/configs/comtrend_ct5361_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,9 +38,15 @@ CONFIG_LED_GPIO=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_CFI_FLASH=y
+CONFIG_PHY=y
+CONFIG_BCM6348_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_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
 CONFIG_WDT_BCM6345=y
-- 
2.11.0

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

* [U-Boot] [PATCH 1/3] phy: add support for bcm6348 usbh phy
  2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
@ 2018-02-04 18:35   ` Daniel Schwierzeck
  2018-03-17 19:30   ` Daniel Schwierzeck
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Schwierzeck @ 2018-02-04 18:35 UTC (permalink / raw)
  To: u-boot



On 04.02.2018 11:18, Á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/bcm6348-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 101 insertions(+)
>  create mode 100644 drivers/phy/bcm6348-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/eb4f1030/attachment.sig>

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

* [U-Boot] [PATCH 1/3] phy: add support for bcm6348 usbh phy
  2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
  2018-02-04 18:35   ` Daniel Schwierzeck
@ 2018-03-17 19:30   ` Daniel Schwierzeck
  2018-03-18  8:13     ` Álvaro Fernández Rojas
  1 sibling, 1 reply; 8+ messages in thread
From: Daniel Schwierzeck @ 2018-03-17 19:30 UTC (permalink / raw)
  To: u-boot



On 04.02.2018 11:18, Á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/bcm6348-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 101 insertions(+)
>  create mode 100644 drivers/phy/bcm6348-usbh-phy.c
> 
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 3b9a09ce18..cec2130c05 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -59,6 +59,12 @@ config SPL_NOP_PHY
>  	  This is useful when a driver uses the PHY framework but no real PHY
>  	  hardware exists.
>  
> +config BCM6348_USBH_PHY
> +	bool "BCM6348 USBH PHY support"
> +	depends on PHY && ARCH_BMIPS
> +	help
> +	  Support for the Broadcom MIPS BCM6348 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 668040b0bb..06e01e86eb 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -7,6 +7,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_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/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
> new file mode 100644
> index 0000000000..55e865c53d
> --- /dev/null
> +++ b/drivers/phy/bcm6348-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 <clk.h>
> +#include <dm.h>
> +#include <generic-phy.h>
> +#include <reset.h>
> +#include <asm/io.h>
> +#include <dm/device.h>
> +
> +#define USBH_SETUP_PORT1_EN	BIT(0)
> +
> +struct bcm6348_usbh_priv {
> +	void __iomem *regs;
> +};
> +
> +static int bcm6348_usbh_init(struct phy *phy)
> +{
> +	struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
> +
> +	writel_be(USBH_SETUP_PORT1_EN, priv->regs);
> +
> +	return 0;
> +}
> +
> +static struct phy_ops bcm6348_usbh_ops = {
> +	.init = bcm6348_usbh_init,
> +};
> +
> +static const struct udevice_id bcm6348_usbh_ids[] = {
> +	{ .compatible = "brcm,bcm6348-usbh" },
> +	{ /* sentinel */ }
> +};
> +
> +static int bcm6348_usbh_probe(struct udevice *dev)
> +{
> +	struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
> +	struct reset_ctl rst_ctl;
> +	struct clk clk;
> +	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);

since you started to convert the other BMIPS related drivers to
live-tree, shall I pick up the current patches and you send a separate
patch for the conversion later? Or do you want to resend a v2?

> +
> +	/* enable usbh clock */
> +	ret = clk_get_by_name(dev, "usbh", &clk);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = clk_enable(&clk);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = clk_free(&clk);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* 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(bcm6348_usbh) = {
> +	.name = "bcm6348-usbh",
> +	.id = UCLASS_PHY,
> +	.of_match = bcm6348_usbh_ids,
> +	.ops = &bcm6348_usbh_ops,
> +	.priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
> +	.probe = bcm6348_usbh_probe,
> +};
> 

-- 
- 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/20180317/8ee72e00/attachment.sig>

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

* [U-Boot] [PATCH 1/3] phy: add support for bcm6348 usbh phy
  2018-03-17 19:30   ` Daniel Schwierzeck
@ 2018-03-18  8:13     ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 8+ messages in thread
From: Álvaro Fernández Rojas @ 2018-03-18  8:13 UTC (permalink / raw)
  To: u-boot

Hi Daniel,


El 17/03/2018 a las 20:30, Daniel Schwierzeck escribió:
>
> On 04.02.2018 11:18, Á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/bcm6348-usbh-phy.c | 94 ++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 101 insertions(+)
>>   create mode 100644 drivers/phy/bcm6348-usbh-phy.c
>>
>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>> index 3b9a09ce18..cec2130c05 100644
>> --- a/drivers/phy/Kconfig
>> +++ b/drivers/phy/Kconfig
>> @@ -59,6 +59,12 @@ config SPL_NOP_PHY
>>   	  This is useful when a driver uses the PHY framework but no real PHY
>>   	  hardware exists.
>>   
>> +config BCM6348_USBH_PHY
>> +	bool "BCM6348 USBH PHY support"
>> +	depends on PHY && ARCH_BMIPS
>> +	help
>> +	  Support for the Broadcom MIPS BCM6348 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 668040b0bb..06e01e86eb 100644
>> --- a/drivers/phy/Makefile
>> +++ b/drivers/phy/Makefile
>> @@ -7,6 +7,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_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/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
>> new file mode 100644
>> index 0000000000..55e865c53d
>> --- /dev/null
>> +++ b/drivers/phy/bcm6348-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 <clk.h>
>> +#include <dm.h>
>> +#include <generic-phy.h>
>> +#include <reset.h>
>> +#include <asm/io.h>
>> +#include <dm/device.h>
>> +
>> +#define USBH_SETUP_PORT1_EN	BIT(0)
>> +
>> +struct bcm6348_usbh_priv {
>> +	void __iomem *regs;
>> +};
>> +
>> +static int bcm6348_usbh_init(struct phy *phy)
>> +{
>> +	struct bcm6348_usbh_priv *priv = dev_get_priv(phy->dev);
>> +
>> +	writel_be(USBH_SETUP_PORT1_EN, priv->regs);
>> +
>> +	return 0;
>> +}
>> +
>> +static struct phy_ops bcm6348_usbh_ops = {
>> +	.init = bcm6348_usbh_init,
>> +};
>> +
>> +static const struct udevice_id bcm6348_usbh_ids[] = {
>> +	{ .compatible = "brcm,bcm6348-usbh" },
>> +	{ /* sentinel */ }
>> +};
>> +
>> +static int bcm6348_usbh_probe(struct udevice *dev)
>> +{
>> +	struct bcm6348_usbh_priv *priv = dev_get_priv(dev);
>> +	struct reset_ctl rst_ctl;
>> +	struct clk clk;
>> +	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);
> since you started to convert the other BMIPS related drivers to
> live-tree, shall I pick up the current patches and you send a separate
> patch for the conversion later? Or do you want to resend a v2?
You can pick the current patches and I will send a conversion patch 
later :).

>
>> +
>> +	/* enable usbh clock */
>> +	ret = clk_get_by_name(dev, "usbh", &clk);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	ret = clk_enable(&clk);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	ret = clk_free(&clk);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	/* 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(bcm6348_usbh) = {
>> +	.name = "bcm6348-usbh",
>> +	.id = UCLASS_PHY,
>> +	.of_match = bcm6348_usbh_ids,
>> +	.ops = &bcm6348_usbh_ops,
>> +	.priv_auto_alloc_size = sizeof(struct bcm6348_usbh_priv),
>> +	.probe = bcm6348_usbh_probe,
>> +};
>>

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

* [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy
  2018-02-04 10:18 [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Álvaro Fernández Rojas
                   ` (2 preceding siblings ...)
  2018-02-04 10:18 ` [U-Boot] [PATCH 3/3] mips: bmips: add ct-5361 usb support Álvaro Fernández Rojas
@ 2018-03-18 23:55 ` Daniel Schwierzeck
  3 siblings, 0 replies; 8+ messages in thread
From: Daniel Schwierzeck @ 2018-03-18 23:55 UTC (permalink / raw)
  To: u-boot



On 04.02.2018 11:18, Álvaro Fernández Rojas wrote:
> Add support for BCM6348 usbh phy.
> 
> Álvaro Fernández Rojas (3):
>   phy: add support for bcm6348 usbh phy
>   mips: bmips: add support for bcm6348 usb
>   mips: bmips: add ct-5361 usb support
> 
>  arch/mips/dts/brcm,bcm6348.dtsi       | 20 ++++++++
>  arch/mips/dts/comtrend,ct-5361.dts    |  8 +++
>  configs/comtrend_ct5361_ram_defconfig |  7 +++
>  drivers/phy/Kconfig                   |  6 +++
>  drivers/phy/Makefile                  |  1 +
>  drivers/phy/bcm6348-usbh-phy.c        | 94 +++++++++++++++++++++++++++++++++++
>  include/configs/bmips_bcm6348.h       |  5 ++
>  7 files changed, 141 insertions(+)
>  create mode 100644 drivers/phy/bcm6348-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/34e42b71/attachment.sig>

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

end of thread, other threads:[~2018-03-18 23:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-04 10:18 [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Álvaro Fernández Rojas
2018-02-04 10:18 ` [U-Boot] [PATCH 1/3] phy: " Álvaro Fernández Rojas
2018-02-04 18:35   ` Daniel Schwierzeck
2018-03-17 19:30   ` Daniel Schwierzeck
2018-03-18  8:13     ` Álvaro Fernández Rojas
2018-02-04 10:18 ` [U-Boot] [PATCH 2/3] mips: bmips: add support for bcm6348 usb Álvaro Fernández Rojas
2018-02-04 10:18 ` [U-Boot] [PATCH 3/3] mips: bmips: add ct-5361 usb support Álvaro Fernández Rojas
2018-03-18 23:55 ` [U-Boot] [PATCH 0/3] bmips: add support for bcm6348 usbh phy Daniel Schwierzeck

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