ARM: sunxi: Add driver for sunxi usb phy + usb dts bindings
v3 cover ARM: sunxi: Add driver for sunxi usb phy + usb dts bindings
Hi Kishon, Maxime,
Here is v3 of my sunxi-usb-phy driver it addresses all review remarks made in response to v2, and as such this should be the final version, changes:
-Fix check for wrong variable in error handling path pointed out by wens -Switch to using reg-names to differentiate between the different register
ranges needed
Kishon, can you please queue up the 1st patch of this series for 3.15 ?
Maxime, can you please add patches 2-4 to your dt-for-3.15 branch? Note these are only the dtsi bits.
I'm holding back all the board .dts patches until it is clear how we want to deal with the ahci + usb regulator bits. Specifically I'm waiting for an answer to this question:
"I hope this helps explain my reasoning, as said I'm fine with either way, if you want to change over to a single file + explicit enabling, let me know and I'll respin the ahci dts patches. Note I'm going on vacation for a week starting Monday, so you likely won't get a new version until next weekend."
In my last reply to "[PATCH v6 17/18] ARM: sun4i: dt: Add ahci / sata support"
I've a feeling you (Maxime) want me to rework things in to a single dtsi for all common regulators + explicit enabling, which works for me, but before doing the necessary refactoring I would like to hear that this is what you want from you.
Regards,
Hans
p.s.
I'm going on vacation for 5 days leaving tomorrow, so I won't send the (refactored) board .dts file patches until next weekend.
PATCH v3 1/4 ARM: sunxi: Add driver for sunxi usb phy
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
--- .../devicetree/bindings/phy/sun4i-usb-phy.txt | 26 ++ drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-sun4i-usb.c | 329 +++++++++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt create mode 100644 drivers/phy/phy-sun4i-usb.c
Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt new file +26 -0
@@ -0,0 +1,26 @@ +Allwinner sun4i USB PHY +----------------------- + +Required properties: +- compatible : should be one of "allwinner,sun4i-a10-usb-phy", + "allwinner,sun5i-a13-usb-phy" or "allwinner,sun7i-a20-usb-phy" +- reg : a list of offset + length pairs +- reg-names : "phy_ctrl", "pmu1" and for sun4i or sun7i "pmu2" +- #phy-cells : from the generic phy bindings, must be 1 +- clocks : phandle + clock specifier for the phy clock +- clock-names : "usb_phy" +- resets : a list of phandle + reset specifier pairs +- reset-names : "usb0_reset", "usb1_reset" and for sun4i or sun7i "usb2_reset" + +Example: + usbphy: phy at 0x01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun4i-a10-usb-phy"; + /* phy base regs, phy1 pmu reg, phy2 pmu reg */ + reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>; + reg-names = "phy_ctrl", "pmu1", "pmu2"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>, <&usb_clk 2>; + reset-names = "usb1_reset", "usb2_reset"; + };
drivers/phy/Kconfig +11 -0
@@ -64,4 +64,15 @@ config BCM_KONA_USB2_PHY help Enable this to support the Broadcom Kona USB 2.0 PHY. +config PHY_SUN4I_USB + tristate "Allwinner sunxi SoC USB PHY driver" + depends on ARCH_SUNXI + select GENERIC_PHY + help + Enable this to support the transceiver that is part of Allwinner + sunxi SoCs. + + This driver controls the entire USB PHY block, both the USB OTG + parts, as well as the 2 regular USB 2 host PHYs. + endmenu
drivers/phy/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o
drivers/phy/phy-sun4i-usb.c new file +329 -0
329 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v3 1/4 ARM: sunxi: Add driver for sunxi usb phy
Hi,
Quoted 7 lines · Hans de Goede
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
Signed-off-by Hans de Goede <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140224/e447a37e/attachment.sig>
PATCH v3 1/4 ARM: sunxi: Add driver for sunxi usb phy
In reply to Hans de GoedeHi,
Quoted 53 lines · Hans de Goede
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
Signed-off-by Hans de Goede <[email protected]>--- .../devicetree/bindings/phy/sun4i-usb-phy.txt | 26 ++ drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-sun4i-usb.c | 329 +++++++++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt create mode 100644 drivers/phy/phy-sun4i-usb.cDocumentation/devicetree/bindings/phy/sun4i-usb-phy.txt new file +26
-0@@ -0,0 +1,26 @@ +Allwinner sun4i USB PHY +----------------------- + +Required properties: +- compatible : should be one of "allwinner,sun4i-a10-usb-phy", + "allwinner,sun5i-a13-usb-phy" or "allwinner,sun7i-a20-usb-phy" +- reg : a list of offset + length pairs +- reg-names : "phy_ctrl", "pmu1" and for sun4i or sun7i "pmu2" +- #phy-cells : from the generic phy bindings, must be 1 +- clocks : phandle + clock specifier for the phy clock +- clock-names : "usb_phy" +- resets : a list of phandle + reset specifier pairs +- reset-names : "usb0_reset", "usb1_reset" and for sun4i or sun7i "usb2_reset" + +Example: + usbphy: phy at 0x01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun4i-a10-usb-phy"; + /* phy base regs, phy1 pmu reg, phy2 pmu reg */ + reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>; + reg-names = "phy_ctrl", "pmu1", "pmu2"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>, <&usb_clk 2>; + reset-names = "usb1_reset", "usb2_reset"; + };drivers/phy/Kconfig +0
-0
drivers/phy/Kconfig config BCM_KONA_USB2_PHY · line 70
Quoted 7 lines
drivers/phy/Kconfig +4
-0@@ -64,4 +64,15 @@ config BCM_KONA_USB2_PHY help Enable this to support the Broadcom Kona USB 2.0 PHY. +config PHY_SUN4I_USB + tristate "Allwinner sunxi SoC USB PHY driver" + depends on ARCH_SUNXI + select GENERIC_PHY
recently some errors have been reported if you don't have depends on HAS_IOMEM. Also add depends on CONFIG_OF.
Quoted 125 lines
drivers/phy/Kconfig +7
-0+ help + Enable this to support the transceiver that is part of Allwinner + sunxi SoCs. + + This driver controls the entire USB PHY block, both the USB OTG + parts, as well as the 2 regular USB 2 host PHYs. + endmenudrivers/phy/Makefile +1
-0@@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.odrivers/phy/phy-sun4i-usb.c new file +101
-0@@ -0,0 +1,329 @@ +/* +* Allwinner sun4i USB phy driver +* +* Copyright (C) 2014 Hans de Goede <[email protected]> +* +* Based on code from +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* +* Modelled after: Samsung S5P/EXYNOS SoC series MIPI CSIS/DSIM DPHY driver +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* Author: Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/phy/phy.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> +#include <linux/reset.h> + +#define REG_ISCR 0x00 +#define REG_PHYCTL 0x04 +#define REG_PHYBIST 0x08 +#define REG_PHYTUNE 0x0c + +#define SUNXI_AHB_ICHR8_EN BIT(10) +#define SUNXI_AHB_INCR4_BURST_EN BIT(9) +#define SUNXI_AHB_INCRX_ALIGN_EN BIT(8) +#define SUNXI_ULPI_BYPASS_EN BIT(0) + +/* Common Control Bits for Both PHYs */ +#define PHY_PLL_BW 0x03 +#define PHY_RES45_CAL_EN 0x0c + +/* Private Control Bits for Each PHY */ +#define PHY_TX_AMPLITUDE_TUNE 0x20 +#define PHY_TX_SLEWRATE_TUNE 0x22 +#define PHY_VBUSVALID_TH_SEL 0x25 +#define PHY_PULLUP_RES_SEL 0x27 +#define PHY_OTG_FUNC_EN 0x28 +#define PHY_VBUS_DET_EN 0x29 +#define PHY_DISCON_TH_SEL 0x2a + +#define MAX_PHYS 3 + +struct sun4i_usb_phy_data { +struct clk *clk; +void __iomem *base; +struct mutex mutex; +int num_phys; +u32 disc_thresh; +struct sun4i_usb_phy { +struct phy *phy; +void __iomem *pmu; +struct regulator *vbus; +struct reset_control *reset; +int index; + } phys[MAX_PHYS ]; +}; + +#define to_sun4i_usb_phy_data (phy) \ + container_of((phy), struct sun4i_usb_phy_data, phys[(phy)->index]) + +static void sun4i_usb_phy_write (struct sun4i_usb_phy *phy,u32 addr,u32 data, +int len) +{ +struct sun4i_usb_phy_data *phy_data =to_sun4i_usb_phy_data (phy); +u32 temp, usbc_bit =BIT (phy->index *2 ); +int i; + +mutex_lock (&phy_data->mutex); + +for (i =0 ; i < len; i++) { + temp =readl (phy_data->base +REG_PHYCTL ); + +/* clear the address portion */ + temp &= ~(0xff <<8 ); + +/* set the address */ + temp |= ((addr + i) <<8 ); +writel (temp, phy_data->base +REG_PHYCTL ); + +/* set the data bit and clear usbc bit*/ + temp =readb (phy_data->base +REG_PHYCTL ); +if (data &0x1 ) + temp |=BIT (7 );
Quoted 1 line
From the comment, I assume it to be a data bit. Let's add a macro for it?
If you can fix these minor comments while changing the $subject (PHY: sunxi) it should be good to get merged.
Thanks
Kishon
[linux-sunxi] Re: [PATCH v3 1/4] ARM: sunxi: Add driver for sunxi usb phy
Hi,
Quoted 10 lines · Kishon Vijay Abraham I
Hi,
Quoted 7 lines · Hans de Goede
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
Signed-off-by Hans de Goede <[email protected]>
<snip>
Quoted 6 lines
Quoted 6 lines
drivers/phy/Kconfig +0
-0@@ -64,4 +64,15 @@ config BCM_KONA_USB2_PHY help Enable this to support the Broadcom Kona USB 2.0 PHY.
Quoted 7 lines
drivers/phy/Kconfig config BCM_KONA_USB2_PHY · line 70
Quoted 4 lines
drivers/phy/Kconfig +4
-0+config PHY_SUN4I_USB + tristate "Allwinner sunxi SoC USB PHY driver" + depends on ARCH_SUNXI + select GENERIC_PHYrecently some errors have been reported if you don't have depends on
HAS_IOMEM. Also add depends onCONFIG_OF.
Fixed for v4.
<snip>
Quoted 9 lines
drivers/phy/Kconfig config BCM_KONA_USB2_PHY · line 74
Quoted 4 lines
drivers/phy/Kconfig +4
-0+ /* set the data bit and clear usbc bit*/ + temp = readb(phy_data->base + REG_PHYCTL); + if (data & 0x1) + temp |= BIT(7);From the comment, I assume it to be a data bit. Let's add a macro for it?
If you can fix these minor comments while changing the $subject (PHY: sunxi) it should be good to get merged.
All fixed for v4.
Regards,
Hans
PATCH v3 1/4 ARM: sunxi: Add driver for sunxi usb phy
In reply to Hans de GoedeHi,
Quoted 16 lines · Hans de Goede
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
Signed-off-by Hans de Goede <[email protected]>--- .../devicetree/bindings/phy/sun4i-usb-phy.txt | 26 ++ drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-sun4i-usb.c | 329 +++++++++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt create mode 100644 drivers/phy/phy-sun4i-usb.c
[..]
Quoted 5 lines
drivers/phy/phy-sun4i-usb.c new file +0
-0
[..]
Quoted 44 lines
drivers/phy/phy-sun4i-usb.c new file +44
-0+static int sun4i_usb_phy_probe (struct platform_device *pdev) +{ +struct sun4i_usb_phy_data *data; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *pmu =NULL ; +struct phy_provider *phy_provider; +struct reset_control *reset; +struct regulator *vbus; +struct resource *res; +struct phy *phy; +char name[16 ]; +int i; + + data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + +mutex_init (&data->mutex); + +if (of_device_is_compatible (np,"allwinner,sun5i-a13-usb-phy" )) + data->num_phys =2 ; +else + data->num_phys =3 ; + +if (of_device_is_compatible (np,"allwinner,sun4i-a10-usb-phy" )) + data->disc_thresh =3 ; +else + data->disc_thresh =2 ; + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"phy_ctrl" ); + data->base =devm_ioremap_resource (dev, res); +if (IS_ERR (data->base)) +return PTR_ERR (data->base); + + data->clk =devm_clk_get (dev,"usb_phy" ); +if (IS_ERR (data->clk)) { +dev_err (dev,"could not get usb_phy clock\n" ); +return PTR_ERR (data->clk); + } + +/* Skip 0, 0 is the phy for otg which is not yet supported. */ +for (i =1 ; i < data->num_phys; i++) { +snprintf (name,sizeof (name),"usb%d_vbus" , i);
drivers/phy/phy-sun4i-usb.c line 273
Quoted 10 lines
drivers/phy/phy-sun4i-usb.c new file +10
-0+ vbus =devm_regulator_get_optional (dev, name); +if (IS_ERR (vbus)) { +if (PTR_ERR (vbus) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + vbus =NULL ; + } + +snprintf (name,sizeof (name),"usb%d_reset" , i); + reset =devm_reset_control_get (dev, name); +if (IS_ERR (reset)) {
I got around to rebasing my musb tree. I see you fixed the reset control error path. You got one.
drivers/phy/phy-sun4i-usb.c
Quoted 2 lines
drivers/phy/phy-sun4i-usb.c new file +2
-0+dev_err (dev,"failed to get reset %s\n" , name); +return PTR_ERR (phy);
But you missed one here. And phy is uninitialized until later, so this will break big time.
Cheers
ChenYu
Quoted 61 lines
drivers/phy/phy-sun4i-usb.c new file +54
-1+ } + +if (i) {/* No pmu for usbc0 */ +snprintf (name,sizeof (name),"pmu%d" , i); + res =platform_get_resource_byname (pdev, +IORESOURCE_MEM , name); + pmu =devm_ioremap_resource (dev, res); +if (IS_ERR (pmu)) +return PTR_ERR (pmu); + } + + phy =devm_phy_create (dev, &sun4i_usb_phy_ops,NULL ); +if (IS_ERR (phy)) { +dev_err (dev,"failed to create PHY %d\n" , i); +return PTR_ERR (phy); + } + + data->phys[i].phy = phy; + data->phys[i].pmu = pmu; + data->phys[i].vbus = vbus; + data->phys[i].reset = reset; + data->phys[i].index = i; +phy_set_drvdata (phy, &data->phys[i]); + } + +dev_set_drvdata (dev, data); + phy_provider =devm_of_phy_provider_register (dev, sun4i_usb_phy_xlate); +if (IS_ERR (phy_provider)) +return PTR_ERR (phy_provider); + +return 0 ; +} + +static const struct of_device_id sun4i_usb_phy_of_match[] = { + { .compatible ="allwinner,sun4i-a10-usb-phy" }, + { .compatible ="allwinner,sun5i-a13-usb-phy" }, + { .compatible ="allwinner,sun7i-a20-usb-phy" }, + { }, +}; +MODULE_DEVICE_TABLE (of, sun4i_usb_phy_of_match); + +static struct platform_driver sun4i_usb_phy_driver = { + .probe = sun4i_usb_phy_probe, + .driver = { + .of_match_table = sun4i_usb_phy_of_match, + .name ="sun4i-usb-phy" , + .owner =THIS_MODULE , + } +}; +module_platform_driver (sun4i_usb_phy_driver); + +MODULE_DESCRIPTION ("Allwinner sun4i USB phy driver" ); +MODULE_AUTHOR ("Hans de Goede <[email protected]>" ); +MODULE_LICENSE ("GPL v2" ); --1.9.0
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
PATCH v3 1/4 ARM: sunxi: Add driver for sunxi usb phy
Hi,
Quoted 84 lines · Chen-Yu Tsai
Hi,
Quoted 16 lines · Hans de Goede
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver.
Signed-off-by Hans de Goede <[email protected]>--- .../devicetree/bindings/phy/sun4i-usb-phy.txt | 26 ++ drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-sun4i-usb.c | 329 +++++++++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt create mode 100644 drivers/phy/phy-sun4i-usb.c[..]
Quoted 5 lines
drivers/phy/phy-sun4i-usb.c new file +0
-0[..]
Quoted 44 lines
drivers/phy/phy-sun4i-usb.c new file +44
-0+static int sun4i_usb_phy_probe (struct platform_device *pdev) +{ +struct sun4i_usb_phy_data *data; +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +void __iomem *pmu =NULL ; +struct phy_provider *phy_provider; +struct reset_control *reset; +struct regulator *vbus; +struct resource *res; +struct phy *phy; +char name[16 ]; +int i; + + data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + +mutex_init (&data->mutex); + +if (of_device_is_compatible (np,"allwinner,sun5i-a13-usb-phy" )) + data->num_phys =2 ; +else + data->num_phys =3 ; + +if (of_device_is_compatible (np,"allwinner,sun4i-a10-usb-phy" )) + data->disc_thresh =3 ; +else + data->disc_thresh =2 ; + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"phy_ctrl" ); + data->base =devm_ioremap_resource (dev, res); +if (IS_ERR (data->base)) +return PTR_ERR (data->base); + + data->clk =devm_clk_get (dev,"usb_phy" ); +if (IS_ERR (data->clk)) { +dev_err (dev,"could not get usb_phy clock\n" ); +return PTR_ERR (data->clk); + } + +/* Skip 0, 0 is the phy for otg which is not yet supported. */ +for (i =1 ; i < data->num_phys; i++) { +snprintf (name,sizeof (name),"usb%d_vbus" , i);drivers/phy/phy-sun4i-usb.c line 273
Quoted 10 lines
drivers/phy/phy-sun4i-usb.c new file +10
-0+ vbus =devm_regulator_get_optional (dev, name); +if (IS_ERR (vbus)) { +if (PTR_ERR (vbus) == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + vbus =NULL ; + } + +snprintf (name,sizeof (name),"usb%d_reset" , i); + reset =devm_reset_control_get (dev, name); +if (IS_ERR (reset)) {I got around to rebasing my musb tree. I see you fixed the reset control error path. You got one.
Quoted 5 lines
drivers/phy/phy-sun4i-usb.c
Quoted 2 lines
drivers/phy/phy-sun4i-usb.c new file +2
-0+dev_err (dev,"failed to get reset %s\n" , name); +return PTR_ERR (phy);But you missed one here. And phy is uninitialized until later, so this will break big time.
Ah, my bad, this is fixed now for v4 of the patch.
Regards,
Hans
PATCH v3 2/4 ARM: sun4i: dt: Add USB host bindings
In reply to Hans de GoedeFrom: Roman Byshko <[email protected]>
Add nodes for the usb-phy and ehci- and ohci-usb-host controllers.
--- arch/arm/boot/dts/sun4i-a10.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +52 -0
@@ -391,6 +391,38 @@ status = "disabled"; }; + usbphy: phy at 01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun4i-a10-usb-phy"; + reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>; + reg-names = "phy_ctrl", "pmu1", "pmu2"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>, <&usb_clk 2>; + reset-names = "usb1_reset", "usb2_reset"; + status = "disabled"; + }; + + ehci0: usb at 01c14000 { + compatible = "allwinner,sun4i-a10-ehci", "generic-ehci"; + reg = <0x01c14000 0x100>; + interrupts = <39>; + clocks = <&ahb_gates 1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci0: usb at 01c14400 { + compatible = "allwinner,sun4i-a10-ohci", "generic-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <64>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + ahci: sata at 01c18000 { compatible = "allwinner,sun4i-a10-ahci"; reg = <0x01c18000 0x1000>;
@@ -399,6 +431,26 @@ status = "disabled"; }; + ehci1: usb at 01c1c000 { + compatible = "allwinner,sun4i-a10-ehci", "generic-ehci"; + reg = <0x01c1c000 0x100>; + interrupts = <40>; + clocks = <&ahb_gates 3>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci1: usb at 01c1c400 { + compatible = "allwinner,sun4i-a10-ohci", "generic-ohci"; + reg = <0x01c1c400 0x100>; + interrupts = <65>; + clocks = <&usb_clk 7>, <&ahb_gates 4>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + intc: interrupt-controller at 01c20400 { compatible = "allwinner,sun4i-ic"; reg = <0x01c20400 0x400>;
Signature · 1 line
1.9.0
PATCH v3 3/4 ARM: sun5i: dt: Add USB host bindings
In reply to Hans de GoedeFrom: Roman Byshko <[email protected]>
Add nodes for the usb-phy and ehci- and ohci-usb-host controllers.
--- arch/arm/boot/dts/sun5i-a10s.dtsi | 32 ++++++++++++++++++++++++++++++++ arch/arm/boot/dts/sun5i-a13.dtsi | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
arch/arm/boot/dts/sun5i-a10s.dtsi +32 -0
@@ -341,6 +341,38 @@ status = "disabled"; }; + usbphy: phy at 01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun5i-a13-usb-phy"; + reg = <0x01c13400 0x10 0x01c14800 0x4>; + reg-names = "phy_ctrl", "pmu1"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>; + reset-names = "usb1_reset"; + status = "disabled"; + }; + + ehci0: usb at 01c14000 { + compatible = "allwinner,sun5i-a10s-ehci", "generic-ehci"; + reg = <0x01c14000 0x100>; + interrupts = <39>; + clocks = <&ahb_gates 1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci0: usb at 01c14400 { + compatible = "allwinner,sun5i-a10s-ohci", "generic-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <40>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + intc: interrupt-controller at 01c20400 { compatible = "allwinner,sun4i-ic"; reg = <0x01c20400 0x400>;
arch/arm/boot/dts/sun5i-a13.dtsi +32 -0
@@ -312,6 +312,38 @@ status = "disabled"; }; + usbphy: phy at 01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun5i-a13-usb-phy"; + reg = <0x01c13400 0x10 0x01c14800 0x4>; + reg-names = "phy_ctrl", "pmu1"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>; + reset-names = "usb1_reset"; + status = "disabled"; + }; + + ehci0: usb at 01c14000 { + compatible = "allwinner,sun5i-a13-ehci", "generic-ehci"; + reg = <0x01c14000 0x100>; + interrupts = <39>; + clocks = <&ahb_gates 1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci0: usb at 01c14400 { + compatible = "allwinner,sun5i-a13-ohci", "generic-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <40>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + intc: interrupt-controller at 01c20400 { compatible = "allwinner,sun4i-ic"; reg = <0x01c20400 0x400>;
Signature · 1 line
1.9.0
PATCH v3 4/4 ARM: sun7i: dt: Add USB host bindings
In reply to Hans de GoedeFrom: Roman Byshko <[email protected]>
Add nodes for the usb-phy and ehci- and ohci-usb-host controllers.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +52 -0
@@ -453,6 +453,38 @@ status = "disabled"; }; + usbphy: phy at 01c13400 { + #phy-cells = <1>; + compatible = "allwinner,sun7i-a20-usb-phy"; + reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>; + reg-names = "phy_ctrl", "pmu1", "pmu2"; + clocks = <&usb_clk 8>; + clock-names = "usb_phy"; + resets = <&usb_clk 1>, <&usb_clk 2>; + reset-names = "usb1_reset", "usb2_reset"; + status = "disabled"; + }; + + ehci0: usb at 01c14000 { + compatible = "allwinner,sun7i-a20-ehci", "generic-ehci"; + reg = <0x01c14000 0x100>; + interrupts = <0 39 4>; + clocks = <&ahb_gates 1>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci0: usb at 01c14400 { + compatible = "allwinner,sun7i-a20-ohci", "generic-ohci"; + reg = <0x01c14400 0x100>; + interrupts = <0 64 4>; + clocks = <&usb_clk 6>, <&ahb_gates 2>; + phys = <&usbphy 1>; + phy-names = "usb"; + status = "disabled"; + }; + ahci: sata at 01c18000 { compatible = "allwinner,sun4i-a10-ahci"; reg = <0x01c18000 0x1000>;
@@ -461,6 +493,26 @@ status = "disabled"; }; + ehci1: usb at 01c1c000 { + compatible = "allwinner,sun7i-a20-ehci", "generic-ehci"; + reg = <0x01c1c000 0x100>; + interrupts = <0 40 4>; + clocks = <&ahb_gates 3>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + + ohci1: usb at 01c1c400 { + compatible = "allwinner,sun7i-a20-ohci", "generic-ohci"; + reg = <0x01c1c400 0x100>; + interrupts = <0 65 4>; + clocks = <&usb_clk 7>, <&ahb_gates 4>; + phys = <&usbphy 2>; + phy-names = "usb"; + status = "disabled"; + }; + pio: pinctrl at 01c20800 { compatible = "allwinner,sun7i-a20-pinctrl"; reg = <0x01c20800 0x400>;
Signature · 1 line
1.9.0
v3 cover ARM: sunxi: Add driver for sunxi usb phy + usb dts bindings
In reply to Hans de GoedeHi,
Quoted 10 lines · Hans de Goede
Hi Kishon, Maxime,
Here is v3 of my sunxi-usb-phy driver it addresses all review remarks made in response to v2, and as such this should be the final version, changes:
(quoted diff) +0
-2-Fix check for wrong variable in error handling path pointed out by wens -Switch to using reg-names to differentiate between the different register ranges neededKishon, can you please queue up the 1st patch of this series for 3.15 ?
huh.. maybe I failed to notice that before but the $subject for that patch should be 'PHY: sunxi...' and not 'ARM: sunxi..'. Can you fix that up?
Thanks
Kishon
Quoted 32 lines
Maxime, can you please add patches 2-4 to your dt-for-3.15 branch? Note these are only the dtsi bits.
I'm holding back all the board .dts patches until it is clear how we want to deal with the ahci + usb regulator bits. Specifically I'm waiting for an answer to this question:
"I hope this helps explain my reasoning, as said I'm fine with either way, if you want to change over to a single file + explicit enabling, let me know and I'll respin the ahci dts patches. Note I'm going on vacation for a week starting Monday, so you likely won't get a new version until next weekend."
In my last reply to "[PATCH v6 17/18] ARM: sun4i: dt: Add ahci / sata support"
I've a feeling you (Maxime) want me to rework things in to a single dtsi for all common regulators + explicit enabling, which works for me, but before doing the necessary refactoring I would like to hear that this is what you want from you.
Regards,
Hans
p.s.
I'm going on vacation for 5 days leaving tomorrow, so I won't send the (refactored) board .dts file patches until next weekend.