Skip to contentSkip to conversation

phy: for 4.3

GIT PULL New Kishon Vijay Abraham I 2 participants 21 messages Aug 11, 2015 – Aug 14, 2015

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

Hi Greg,

Please find the pull request for 4.3 merge window below. This contains a new NXP phy driver, extcon support and few fixes in phy-sun4i-usb driver and other trivial code cleanups.

Let me know if I have to change something.

Thanks
Kishon

The following changes since commit d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754:

Linux 4.2-rc1 (2015-07-05 11:01:52 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.3

for you to fetch changes up to cfd093bbb5fe84ec8c7bb069fe618159a8b601f5:

phy: lpc18xx-usb-otg: fix clock order in phy init (2015-08-10 20:11:58 +0530)

----------------------------------------------------------------
phy: for 4.3

*) Add new NXP USB OTG PHY driver
*) Add vbus/id detection, extcon support and fixes in phy-sun4i-usb
driver
*) Add support to use phy-sun4i-usb driver for sun8i-a23 and sun8i-a33
SoCs
*) Other trivial code cleanups, dropping .owner assignment and constify
phy_ops

----------------------------------------------------------------
Axel Lin (2):
phy: ulpi_phy: Add const qualifier to ops
phy: Constify struct phy_ops variables

Hans de Goede (9):
phy-sun4i-usb: Add id and vbus detection support for the otg phy

    (phy0)

phy-sun4i-usb: Add extcon support for the otg phy (phy0)
phy-sun4i-usb: Swap check for disconnect threshold
phy-sun4i-usb: Add support for the usb-phys on the sun8i-a23 SoC
phy-sun4i-usb: Add support for the usb-phys on the sun8i-a33 SoC
phy-sun4i-usb: Add support for boards with broken Vusb-detection
phy-sun4i-usb: Add support for monitoring vbus via a power-supply
phy-sun4i-sub: Move vbus-detect helper functions up in the file
phy-sun4i-usb: Only check vbus-det on power-on on boards with
vbus-det

Joachim Eastwood (3):
phy: add lpc18xx usb otg phy driver
phy: dt bindings: add NXP LPC18xx/43xx USB OTG PHY bindings
phy: lpc18xx-usb-otg: fix clock order in phy init

Krzysztof Kozlowski (2):
phy: Drop owner assignment from i2c_driver
phy: Drop owner assignment from platform_driver

Michal Simek (3):
phy: berlin: .owner field is setup by core
phy: berlin: Do not use sata name in usb phy driver
phy: berlin: Trivial coding style cleanup

 .../bindings/phy/phy-lpc18xx-usb-otg.txt           |   26 ++
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |   22 +-
 drivers/phy/Kconfig                                |   13 +
 drivers/phy/Makefile                               |    1 +
 drivers/phy/phy-armada375-usb2.c                   |    3 +-
 drivers/phy/phy-bcm-kona-usb2.c                    |    2 +-
 drivers/phy/phy-berlin-sata.c                      |    2 +-
 drivers/phy/phy-berlin-usb.c                       |   13 +-
 drivers/phy/phy-brcmstb-sata.c                     |    2 +-
 drivers/phy/phy-dm816x-usb.c                       |    2 +-
 drivers/phy/phy-exynos-dp-video.c                  |    2 +-
 drivers/phy/phy-exynos-mipi-video.c                |    2 +-
 drivers/phy/phy-exynos5-usbdrd.c                   |    2 +-
 drivers/phy/phy-exynos5250-sata.c                  |    2 +-
 drivers/phy/phy-hix5hd2-sata.c                     |    2 +-
 drivers/phy/phy-lpc18xx-usb-otg.c                  |  143 +++++++
 drivers/phy/phy-miphy28lp.c                        |    3 +-
 drivers/phy/phy-miphy365x.c                        |    2 +-
 drivers/phy/phy-mvebu-sata.c                       |    2 +-
 drivers/phy/phy-omap-usb2.c                        |    2 +-
 drivers/phy/phy-qcom-apq8064-sata.c                |    2 +-
 drivers/phy/phy-qcom-ipq806x-sata.c                |    2 +-
 drivers/phy/phy-qcom-ufs-i.h                       |    2 +-
 drivers/phy/phy-qcom-ufs-qmp-14nm.c                |    3 +-
 drivers/phy/phy-qcom-ufs-qmp-20nm.c                |    3 +-
 drivers/phy/phy-qcom-ufs.c                         |    2 +-
 drivers/phy/phy-rcar-gen2.c                        |    2 +-
 drivers/phy/phy-rockchip-usb.c                     |    3 +-
 drivers/phy/phy-samsung-usb2.c                     |    2 +-
 drivers/phy/phy-spear1310-miphy.c                  |    2 +-
 drivers/phy/phy-spear1340-miphy.c                  |    2 +-
 drivers/phy/phy-stih41x-usb.c                      |    2 +-
 drivers/phy/phy-sun4i-usb.c                        |  423 ++++++++++++++++++--
 drivers/phy/phy-sun9i-usb.c                        |    2 +-
 drivers/phy/phy-ti-pipe3.c                         |    2 +-
 drivers/phy/phy-tusb1210.c                         |    2 +-
 drivers/phy/ulpi_phy.h                             |    2 +-
 37 files changed, 636 insertions(+), 70 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-lpc18xx-usb-otg.txt
 create mode 100644 drivers/phy/phy-lpc18xx-usb-otg.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/19 phy: add lpc18xx usb otg phy driver

From: Joachim Eastwood <[email protected]>

Add PHY driver for the internal USB OTG PHY found on NXP LPC18xx and LPC43xx devices. This driver takes care of enabling the PHY in CREG (syscon) and setting the required clock frequency.

---
 drivers/phy/Kconfig               |   11 +++
 drivers/phy/Makefile              |    1 +
 drivers/phy/phy-lpc18xx-usb-otg.c |  143 +++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 drivers/phy/phy-lpc18xx-usb-otg.c
drivers/phy/Kconfig +11 -0
index c0e6ede..e2f2a4d 100644
@@ -54,6 +54,17 @@ config PHY_EXYNOS_MIPI_VIDEO
 	  Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P
 	  and EXYNOS SoCs.
 
+config PHY_LPC18XX_USB_OTG
+	tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver"
+	depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
+	depends on MFD_SYSCON
+	select GENERIC_PHY
+	help
+	  Enable this to support NXP LPC18xx/43xx internal USB OTG PHY.
+
+	  This driver is need for USB0 support on LPC18xx/43xx and takes
+	  care of enabling and clock setup.
+
 config PHY_PXA_28NM_HSIC
 	tristate "Marvell USB HSIC 28nm PHY Driver"
 	select GENERIC_PHY
drivers/phy/Makefile +1 -0
index f344e1b..a5b18c1 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY)	+= phy-armada375-usb2.o
 obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)	+= phy-exynos-dp-video.o
 obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
+obj-$(CONFIG_PHY_LPC18XX_USB_OTG)	+= phy-lpc18xx-usb-otg.o
 obj-$(CONFIG_PHY_PXA_28NM_USB2)		+= phy-pxa-28nm-usb2.o
 obj-$(CONFIG_PHY_PXA_28NM_HSIC)		+= phy-pxa-28nm-hsic.o
 obj-$(CONFIG_PHY_MVEBU_SATA)		+= phy-mvebu-sata.o
drivers/phy/phy-lpc18xx-usb-otg.c new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/19 phy: dt bindings: add NXP LPC18xx/43xx USB OTG PHY bindings

In reply to Kishon Vijay Abraham I

From: Joachim Eastwood <[email protected]>

Add binding documentation for NXP LPC18xx/43xx USB OTG PHY. This PHY can found on NXP LPC18xx and LPC43xx devices with USB support.

---
 .../bindings/phy/phy-lpc18xx-usb-otg.txt           |   26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-lpc18xx-usb-otg.txt
Documentation/devicetree/bindings/phy/phy-lpc18xx-usb-otg.txt new file +26 -0
new file mode 100644
index 0000000..bd61b46
@@ -0,0 +1,26 @@
+NXP LPC18xx/43xx internal USB OTG PHY binding
+---------------------------------------------
+
+This file contains documentation for the internal USB OTG PHY found
+in NXP LPC18xx and LPC43xx SoCs.
+
+Required properties:
+- compatible	: must be "nxp,lpc1850-usb-otg-phy"
+- clocks	: must be exactly one entry
+See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+- #phy-cells	: must be 0 for this phy
+See: Documentation/devicetree/bindings/phy/phy-bindings.txt
+
+The phy node must be a child of the creg syscon node.
+
+Example:
+creg: syscon@40043000 {
+	compatible = "nxp,lpc1850-creg", "syscon", "simple-mfd";
+	reg = <0x40043000 0x1000>;
+
+	usb0_otg_phy: phy@004 {
+		compatible = "nxp,lpc1850-usb-otg-phy";
+		clocks = <&ccu1 CLK_USB0>;
+		#phy-cells = <0>;
+	};
+};
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/19 phy-sun4i-usb: Add id and vbus detection support for the otg phy (phy0)

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

The usb0 phy is connected to an OTG controller, and as such needs some special handling:

1) It allows explicit control over the pullups, enable these on phy_init and disable them on phy_exit.

2) It has bits to signal id and vbus detect to the musb-core, add support for for monitoring id and vbus detect gpio-s for use in dual role mode, and set these bits to the correct values for operating in host only mode when no gpios are specified in the devicetree.

While updating the devicetree binding documentation also add documentation for the sofar undocumented usage of regulators for vbus for all 3 phys.

---
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |   18 +-
 drivers/phy/phy-sun4i-usb.c                        |  250 +++++++++++++++++++-
 2 files changed, 256 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt +16 -2
index 16528b9..557fa99 100644
@@ -23,6 +23,13 @@ Required properties:
   * "usb1_reset"
   * "usb2_reset" for sun4i, sun6i or sun7i
 
+Optional properties:
+- usb0_id_det-gpios : gpio phandle for reading the otg id pin value
+- usb0_vbus_det-gpios : gpio phandle for detecting the presence of usb0 vbus
+- usb0_vbus-supply : regulator phandle for controller usb0 vbus
+- usb1_vbus-supply : regulator phandle for controller usb1 vbus
+- usb2_vbus-supply : regulator phandle for controller usb2 vbus
+
 Example:
 	usbphy: phy@0x01c13400 {
 		#phy-cells = <1>;
@@ -32,6 +39,13 @@ Example:
 		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";
+		resets = <&usb_clk 0>, <&usb_clk 1>, <&usb_clk 2>;
+		reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
+		usb0_id_det-gpios = <&pio 7 19 GPIO_ACTIVE_HIGH>; /* PH19 */
+		usb0_vbus_det-gpios = <&pio 7 22 GPIO_ACTIVE_HIGH>; /* PH22 */
+		usb0_vbus-supply = <&reg_usb0_vbus>;
+		usb1_vbus-supply = <&reg_usb1_vbus>;
+		usb2_vbus-supply = <&reg_usb2_vbus>;
 	};
drivers/phy/phy-sun4i-usb.c +240 -10

367 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/19 phy-sun4i-usb: Add extcon support for the otg phy (phy0)

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

The sunxi musb glue needs to know if a host or normal usb cable is plugged in, add extcon support so that the musb glue can monitor the host status.

---
 drivers/phy/Kconfig         |    1 +
 drivers/phy/phy-sun4i-usb.c |   32 +++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)
drivers/phy/Kconfig +1 -0
index e2f2a4d..c0c1ad2 100644
@@ -208,6 +208,7 @@ config PHY_SUN4I_USB
 	tristate "Allwinner sunxi SoC USB PHY driver"
 	depends on ARCH_SUNXI && HAS_IOMEM && OF
 	depends on RESET_CONTROLLER
+	depends on EXTCON
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
drivers/phy/phy-sun4i-usb.c +31 -1
index 37f52f7..a6ea2e6 100644
@@ -23,6 +23,7 @@
 
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/extcon.h>
 #include <linux/io.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -99,6 +100,7 @@ struct sun4i_usb_phy_data {
 		int index;
 	} phys[MAX_PHYS];
 	/* phy0 / otg related variables */
+	struct extcon_dev *extcon;
 	bool phy0_init;
 	bool phy0_poll;
 	struct gpio_desc *id_det_gpio;
@@ -343,7 +345,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	struct sun4i_usb_phy_data *data =
 		container_of(work, struct sun4i_usb_phy_data, detect.work);
 	struct phy *phy0 = data->phys[0].phy;
-	int id_det, vbus_det;
+	int id_det, vbus_det, id_notify = 0, vbus_notify = 0;
 
 	id_det = gpiod_get_value_cansleep(data->id_det_gpio);
 	vbus_det = gpiod_get_value_cansleep(data->vbus_det_gpio);
@@ -358,15 +360,24 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	if (id_det != data->id_det) {
 		sun4i_usb_phy0_set_id_detect(phy0, id_det);
 		data->id_det = id_det;
+		id_notify = 1;
 	}
 
 	if (vbus_det != data->vbus_det) {
 		sun4i_usb_phy0_set_vbus_detect(phy0, vbus_det);
 		data->vbus_det = vbus_det;
+		vbus_notify = 1;
 	}
 
 	mutex_unlock(&phy0->mutex);
 
+	if (id_notify)
+		extcon_set_cable_state_(data->extcon, EXTCON_USB_HOST,
+					!id_det);
+
+	if (vbus_notify)
+		extcon_set_cable_state_(data->extcon, EXTCON_USB, vbus_det);
+
 	if (data->phy0_poll)
 		queue_delayed_work(system_wq, &data->detect, POLL_TIME);
 }
@@ -407,6 +418,12 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const unsigned int sun4i_usb_phy0_cable[] = {
+	EXTCON_USB,
+	EXTCON_USB_HOST,
+	EXTCON_NONE,
+};
+
 static int sun4i_usb_phy_probe(struct platform_device *pdev)
 {
 	struct sun4i_usb_phy_data *data;
@@ -466,6 +483,19 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	if (data->id_det_gpio) {
+		data->extcon = devm_extcon_dev_allocate(dev,
+							sun4i_usb_phy0_cable);
+		if (IS_ERR(data->extcon))
+			return PTR_ERR(data->extcon);
+
+		ret = devm_extcon_dev_register(dev, data->extcon);
+		if (ret) {
+			dev_err(dev, "failed to register extcon: %d\n", ret);
+			return ret;
+		}
+	}
+
 	for (i = 0; i < data->num_phys; i++) {
 		struct sun4i_usb_phy *phy = data->phys + i;
 		char name[16];
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 5/19 phy-sun4i-usb: Swap check for disconnect threshold

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

Before this commit the code for determining the disconnect threshold was checking for "allwinner,sun4i-a10-usb-phy" or "allwinner,sun6i-a31-usb-phy" assuming that those where the exception and then newer SoCs would use a disconnect threshold of 2 like sun7i does. But it turns out that newer SoCs use a disconnect threshold of 3 and sun5i and sun7i are the exceptions, so check for those instead.

Here are the settings from the various Allwinner SDK sources:
sun4i-a10: USBC_Phy_Write(usbc_no, 0x2a, 3, 2);
sun5i-a13: USBC_Phy_Write(usbc_no, 0x2a, 2, 2);
sun6i-a31: USBC_Phy_Write(usbc_no, 0x2a, 3, 2);
sun7i-a20: USBC_Phy_Write(usbc_no, 0x2a, 2, 2);
sun8i-a23: USBC_Phy_Write(usbc_no, 0x2a, 3, 2);
sun8i-h3: USBC_Phy_Write(usbc_no, 0x2a, 3, 2);
sun9i-a80: USBC_Phy_Write(usbc_no, 0x2a, 3, 2);

Note this commit makes no functional changes as currently we only support sun4i - sun7i.

---
 drivers/phy/phy-sun4i-usb.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/phy-sun4i-usb.c +4 -4
index a6ea2e6..50ecab9 100644
@@ -447,11 +447,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	else
 		data->num_phys = 3;
 
-	if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy") ||
-	    of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy"))
-		data->disc_thresh = 3;
-	else
+	if (of_device_is_compatible(np, "allwinner,sun5i-a13-usb-phy") ||
+	    of_device_is_compatible(np, "allwinner,sun7i-a20-usb-phy"))
 		data->disc_thresh = 2;
+	else
+		data->disc_thresh = 3;
 
 	if (of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy"))
 		dedicated_clocks = true;
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 6/19 phy-sun4i-usb: Add support for the usb-phys on the sun8i-a23 SoC

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

The usb-phys on the sun8i-a23 SoC have the same setup wrt clocks as on the sun6i-a31 SoC, but there are only 2 instead of 3 like on the sun5i-a13 SoC.

---
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |    2 ++
 drivers/phy/phy-sun4i-usb.c                        |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt +2 -0
index 557fa99..f0c640a 100644
@@ -7,6 +7,7 @@ Required properties:
   * allwinner,sun5i-a13-usb-phy
   * allwinner,sun6i-a31-usb-phy
   * allwinner,sun7i-a20-usb-phy
+  * allwinner,sun8i-a23-usb-phy
 - reg : a list of offset + length pairs
 - reg-names :
   * "phy_ctrl"
@@ -17,6 +18,7 @@ Required properties:
 - clock-names :
   * "usb_phy" for sun4i, sun5i or sun7i
   * "usb0_phy", "usb1_phy" and "usb2_phy" for sun6i
+  * "usb0_phy", "usb1_phy" for sun8i
 - resets : a list of phandle + reset specifier pairs
 - reset-names :
   * "usb0_reset"
drivers/phy/phy-sun4i-usb.c +5 -2
index 50ecab9..00424dd 100644
@@ -442,7 +442,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	INIT_DELAYED_WORK(&data->detect, sun4i_usb_phy0_id_vbus_det_scan);
 	dev_set_drvdata(dev, data);
 
-	if (of_device_is_compatible(np, "allwinner,sun5i-a13-usb-phy"))
+	if (of_device_is_compatible(np, "allwinner,sun5i-a13-usb-phy") ||
+	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy"))
 		data->num_phys = 2;
 	else
 		data->num_phys = 3;
@@ -453,7 +454,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	else
 		data->disc_thresh = 3;
 
-	if (of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy"))
+	if (of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy") ||
+	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy"))
 		dedicated_clocks = true;
 	else
 		dedicated_clocks = false;
@@ -588,6 +590,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun5i-a13-usb-phy" },
 	{ .compatible = "allwinner,sun6i-a31-usb-phy" },
 	{ .compatible = "allwinner,sun7i-a20-usb-phy" },
+	{ .compatible = "allwinner,sun8i-a23-usb-phy" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 7/19 phy-sun4i-usb: Add support for the usb-phys on the sun8i-a33 SoC

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

The usb-phys on the sun8i-a33 SoC are mostly the same as sun8i-a23 but for some reason (hw bug?) the phyctl register was moved to a different address and is not initialized to 0 on reset.

---
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |    1 +
 drivers/phy/phy-sun4i-usb.c                        |   39 ++++++++++++++------
 2 files changed, 29 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt +1 -0
index f0c640a..5f48979 100644
@@ -8,6 +8,7 @@ Required properties:
   * allwinner,sun6i-a31-usb-phy
   * allwinner,sun7i-a20-usb-phy
   * allwinner,sun8i-a23-usb-phy
+  * allwinner,sun8i-a33-usb-phy
 - reg : a list of offset + length pairs
 - reg-names :
   * "phy_ctrl"
drivers/phy/phy-sun4i-usb.c +28 -11
index 00424dd..ddc3995 100644
@@ -40,9 +40,10 @@
 #include <linux/workqueue.h>
 
 #define REG_ISCR			0x00
-#define REG_PHYCTL			0x04
+#define REG_PHYCTL_A10			0x04
 #define REG_PHYBIST			0x08
 #define REG_PHYTUNE			0x0c
+#define REG_PHYCTL_A33			0x10
 
 #define PHYCTL_DATA			BIT(7)
 
@@ -90,6 +91,7 @@ struct sun4i_usb_phy_data {
 	struct mutex mutex;
 	int num_phys;
 	u32 disc_thresh;
+	bool has_a33_phyctl;
 	struct sun4i_usb_phy {
 		struct phy *phy;
 		void __iomem *pmu;
@@ -152,37 +154,46 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
 {
 	struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy);
 	u32 temp, usbc_bit = BIT(phy->index * 2);
+	void *phyctl;
 	int i;
 
 	mutex_lock(&phy_data->mutex);
 
+	if (phy_data->has_a33_phyctl) {
+		phyctl = phy_data->base + REG_PHYCTL_A33;
+		/* A33 needs us to set phyctl to 0 explicitly */
+		writel(0, phyctl);
+	} else {
+		phyctl = phy_data->base + REG_PHYCTL_A10;
+	}
+
 	for (i = 0; i < len; i++) {
-		temp = readl(phy_data->base + REG_PHYCTL);
+		temp = readl(phyctl);
 
 		/* clear the address portion */
 		temp &= ~(0xff << 8);
 
 		/* set the address */
 		temp |= ((addr + i) << 8);
-		writel(temp, phy_data->base + REG_PHYCTL);
+		writel(temp, phyctl);
 
 		/* set the data bit and clear usbc bit*/
-		temp = readb(phy_data->base + REG_PHYCTL);
+		temp = readb(phyctl);
 		if (data & 0x1)
 			temp |= PHYCTL_DATA;
 		else
 			temp &= ~PHYCTL_DATA;
 		temp &= ~usbc_bit;
-		writeb(temp, phy_data->base + REG_PHYCTL);
+		writeb(temp, phyctl);
 
 		/* pulse usbc_bit */
-		temp = readb(phy_data->base + REG_PHYCTL);
+		temp = readb(phyctl);
 		temp |= usbc_bit;
-		writeb(temp, phy_data->base + REG_PHYCTL);
+		writeb(temp, phyctl);
 
-		temp = readb(phy_data->base + REG_PHYCTL);
+		temp = readb(phyctl);
 		temp &= ~usbc_bit;
-		writeb(temp, phy_data->base + REG_PHYCTL);
+		writeb(temp, phyctl);
 
 		data >>= 1;
 	}
@@ -443,7 +454,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	dev_set_drvdata(dev, data);
 
 	if (of_device_is_compatible(np, "allwinner,sun5i-a13-usb-phy") ||
-	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy"))
+	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy") ||
+	    of_device_is_compatible(np, "allwinner,sun8i-a33-usb-phy"))
 		data->num_phys = 2;
 	else
 		data->num_phys = 3;
@@ -455,11 +467,15 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		data->disc_thresh = 3;
 
 	if (of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy") ||
-	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy"))
+	    of_device_is_compatible(np, "allwinner,sun8i-a23-usb-phy") ||
+	    of_device_is_compatible(np, "allwinner,sun8i-a33-usb-phy"))
 		dedicated_clocks = true;
 	else
 		dedicated_clocks = false;
 
+	if (of_device_is_compatible(np, "allwinner,sun8i-a33-usb-phy"))
+		data->has_a33_phyctl = true;
+
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy_ctrl");
 	data->base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(data->base))
@@ -591,6 +607,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun6i-a31-usb-phy" },
 	{ .compatible = "allwinner,sun7i-a20-usb-phy" },
 	{ .compatible = "allwinner,sun8i-a23-usb-phy" },
+	{ .compatible = "allwinner,sun8i-a33-usb-phy" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 8/19 phy-sun4i-usb: Add support for boards with broken Vusb-detection

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

On some boards we cannot detect the presence of an external Vusb, because e.g. the 5V of the otg connector is directly connected to the 5V of the board, and thus is always high.

This commit adds support for using such boards by only looking at the id-detection pin.

---
 drivers/phy/phy-sun4i-usb.c |   44 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 8 deletions(-)
drivers/phy/phy-sun4i-usb.c +36 -8
index ddc3995..4ba9856 100644
@@ -22,6 +22,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/extcon.h>
 #include <linux/io.h>
@@ -309,7 +310,7 @@ static int sun4i_usb_phy_power_on(struct phy *_phy)
 	phy->regulator_on = true;
 
 	/* We must report Vbus high within OTG_TIME_A_WAIT_VRISE msec. */
-	if (phy->index == 0 && data->phy0_poll)
+	if (phy->index == 0 && data->vbus_det_gpio && data->phy0_poll)
 		mod_delayed_work(system_wq, &data->detect, DEBOUNCE_TIME);
 
 	return 0;
@@ -330,7 +331,7 @@ static int sun4i_usb_phy_power_off(struct phy *_phy)
 	 * phy0 vbus typically slowly discharges, sometimes this causes the
 	 * Vbus gpio to not trigger an edge irq on Vbus off, so force a rescan.
 	 */
-	if (phy->index == 0 && !data->phy0_poll)
+	if (phy->index == 0 && data->vbus_det_gpio && !data->phy0_poll)
 		mod_delayed_work(system_wq, &data->detect, POLL_TIME);
 
 	return 0;
@@ -359,7 +360,10 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	int id_det, vbus_det, id_notify = 0, vbus_notify = 0;
 
 	id_det = gpiod_get_value_cansleep(data->id_det_gpio);
-	vbus_det = gpiod_get_value_cansleep(data->vbus_det_gpio);
+	if (data->vbus_det_gpio)
+		vbus_det = gpiod_get_value_cansleep(data->vbus_det_gpio);
+	else
+		vbus_det = 1; /* Report vbus as high */
 
 	mutex_lock(&phy0->mutex);
 
@@ -369,6 +373,16 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 	}
 
 	if (id_det != data->id_det) {
+		/*
+		 * When a host cable (id == 0) gets plugged in on systems
+		 * without vbus detection report vbus low for long enough for
+		 * the musb-ip to end the current device session.
+		 */
+		if (!data->vbus_det_gpio && id_det == 0) {
+			sun4i_usb_phy0_set_vbus_detect(phy0, 0);
+			msleep(200);
+			sun4i_usb_phy0_set_vbus_detect(phy0, 1);
+		}
 		sun4i_usb_phy0_set_id_detect(phy0, id_det);
 		data->id_det = id_det;
 		id_notify = 1;
@@ -382,9 +396,22 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 
 	mutex_unlock(&phy0->mutex);
 
-	if (id_notify)
+	if (id_notify) {
 		extcon_set_cable_state_(data->extcon, EXTCON_USB_HOST,
 					!id_det);
+		/*
+		 * When a host cable gets unplugged (id == 1) on systems
+		 * without vbus detection report vbus low for long enough to
+		 * the musb-ip to end the current host session.
+		 */
+		if (!data->vbus_det_gpio && id_det == 1) {
+			mutex_lock(&phy0->mutex);
+			sun4i_usb_phy0_set_vbus_detect(phy0, 0);
+			msleep(1000);
+			sun4i_usb_phy0_set_vbus_detect(phy0, 1);
+			mutex_unlock(&phy0->mutex);
+		}
+	}
 
 	if (vbus_notify)
 		extcon_set_cable_state_(data->extcon, EXTCON_USB, vbus_det);
@@ -495,9 +522,9 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		data->vbus_det_gpio = NULL;
 	}
 
-	/* We either want both gpio pins or neither (when in host mode) */
-	if (!data->id_det_gpio != !data->vbus_det_gpio) {
-		dev_err(dev, "failed to get id or vbus detect pin\n");
+	/* vbus_det without id_det makes no sense, and is not supported */
+	if (data->vbus_det_gpio && !data->id_det_gpio) {
+		dev_err(dev, "usb0_id_det missing or invalid\n");
 		return -ENODEV;
 	}
 
@@ -565,7 +592,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 
 	data->id_det_irq = gpiod_to_irq(data->id_det_gpio);
 	data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio);
-	if (data->id_det_irq  < 0 || data->vbus_det_irq < 0)
+	if ((data->id_det_gpio && data->id_det_irq < 0) ||
+	    (data->vbus_det_gpio && data->vbus_det_irq < 0))
 		data->phy0_poll = true;
 
 	if (data->id_det_irq >= 0) {
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 9/19 phy-sun4i-usb: Add support for monitoring vbus via a power-supply

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

On some boards there is no vbus_det gpio pin, instead vbus-detection for otg can be done via the pmic.

This commit adds support for monitoring vbus_det via the power_supply exported by the pmic, enabling support for otg on these boards.

---
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |    1 +
 drivers/phy/Kconfig                                |    1 +
 drivers/phy/phy-sun4i-usb.c                        |   76 ++++++++++++++++++--
 3 files changed, 71 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt +1 -0
index 5f48979..0cebf74 100644
@@ -29,6 +29,7 @@ Required properties:
 Optional properties:
 - usb0_id_det-gpios : gpio phandle for reading the otg id pin value
 - usb0_vbus_det-gpios : gpio phandle for detecting the presence of usb0 vbus
+- usb0_vbus_power-supply: power-supply phandle for usb0 vbus presence detect
 - usb0_vbus-supply : regulator phandle for controller usb0 vbus
 - usb1_vbus-supply : regulator phandle for controller usb1 vbus
 - usb2_vbus-supply : regulator phandle for controller usb2 vbus
drivers/phy/Kconfig +1 -0
index c0c1ad2..0fe9bff 100644
@@ -209,6 +209,7 @@ config PHY_SUN4I_USB
 	depends on ARCH_SUNXI && HAS_IOMEM && OF
 	depends on RESET_CONTROLLER
 	depends on EXTCON
+	depends on POWER_SUPPLY
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
drivers/phy/phy-sun4i-usb.c +69 -7

137 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 10/19 phy: berlin: .owner field is setup by core

In reply to Kishon Vijay Abraham I

From: Michal Simek <[email protected]>

There was big cleanup in past to remove this unneeded setting.

---
 drivers/phy/phy-berlin-usb.c |    1 -
 1 file changed, 1 deletion(-)
drivers/phy/phy-berlin-usb.c +0 -1
index c6fc95b..d7431f6 100644
@@ -207,7 +207,6 @@ static struct platform_driver phy_berlin_usb_driver = {
 	.probe	= phy_berlin_usb_probe,
 	.driver	= {
 		.name		= "phy-berlin-usb",
-		.owner		= THIS_MODULE,
 		.of_match_table	= phy_berlin_sata_of_match,
 	 },
 };
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 11/19 phy: berlin: Do not use sata name in usb phy driver

In reply to Kishon Vijay Abraham I

From: Michal Simek <[email protected]>

copy and paste error from berlin sata phy driver.

---
 drivers/phy/phy-berlin-usb.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/phy-berlin-usb.c +4 -4
index d7431f6..762f0fb 100644
@@ -152,7 +152,7 @@ static struct phy_ops phy_berlin_usb_ops = {
 	.owner		= THIS_MODULE,
 };
 
-static const struct of_device_id phy_berlin_sata_of_match[] = {
+static const struct of_device_id phy_berlin_usb_of_match[] = {
 	{
 		.compatible = "marvell,berlin2-usb-phy",
 		.data = &phy_berlin_pll_dividers[0],
@@ -163,12 +163,12 @@ static const struct of_device_id phy_berlin_sata_of_match[] = {
 	},
 	{ },
 };
-MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
+MODULE_DEVICE_TABLE(of, phy_berlin_usb_of_match);
 
 static int phy_berlin_usb_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match =
-		of_match_device(phy_berlin_sata_of_match, &pdev->dev);
+		of_match_device(phy_berlin_usb_of_match, &pdev->dev);
 	struct phy_berlin_usb_priv *priv;
 	struct resource *res;
 	struct phy *phy;
@@ -207,7 +207,7 @@ static struct platform_driver phy_berlin_usb_driver = {
 	.probe	= phy_berlin_usb_probe,
 	.driver	= {
 		.name		= "phy-berlin-usb",
-		.of_match_table	= phy_berlin_sata_of_match,
+		.of_match_table	= phy_berlin_usb_of_match,
 	 },
 };
 module_platform_driver(phy_berlin_usb_driver);
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 12/19 phy: berlin: Trivial coding style cleanup

In reply to Kishon Vijay Abraham I

From: Michal Simek <[email protected]>

Remove unneeded space after tab.

---
 drivers/phy/phy-berlin-usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-berlin-usb.c +1 -1
index 762f0fb..0fe0d81 100644
@@ -208,7 +208,7 @@ static struct platform_driver phy_berlin_usb_driver = {
 	.driver	= {
 		.name		= "phy-berlin-usb",
 		.of_match_table	= phy_berlin_usb_of_match,
-	 },
+	},
 };
 module_platform_driver(phy_berlin_usb_driver);
 
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 13/19 phy: Drop owner assignment from i2c_driver

In reply to Kishon Vijay Abraham I

From: Krzysztof Kozlowski <[email protected]>

i2c_driver does not need to set an owner because i2c_register_driver() will set it.

---
 drivers/phy/phy-armada375-usb2.c |    1 -
 1 file changed, 1 deletion(-)
drivers/phy/phy-armada375-usb2.c +0 -1
index 8ccc395..39c7d21 100644
@@ -149,7 +149,6 @@ static struct platform_driver armada375_usb_phy_driver = {
 	.driver = {
 		.of_match_table	= of_usb_cluster_table,
 		.name  = "armada-375-usb-cluster",
-		.owner = THIS_MODULE,
 	}
 };
 module_platform_driver(armada375_usb_phy_driver);
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 14/19 phy: Drop owner assignment from platform_driver

In reply to Kishon Vijay Abraham I

From: Krzysztof Kozlowski <[email protected]>

platform_driver does not need to set an owner because platform_driver_register() will set it.

---
 drivers/phy/phy-miphy28lp.c         |    1 -
 drivers/phy/phy-qcom-ufs-qmp-14nm.c |    1 -
 drivers/phy/phy-qcom-ufs-qmp-20nm.c |    1 -
 drivers/phy/phy-rockchip-usb.c      |    1 -
 4 files changed, 4 deletions(-)
drivers/phy/phy-miphy28lp.c +0 -1
index 5e257ef..677c290 100644
@@ -1268,7 +1268,6 @@ static struct platform_driver miphy28lp_driver = {
 	.probe = miphy28lp_probe,
 	.driver = {
 		.name = "miphy28lp-phy",
-		.owner = THIS_MODULE,
 		.of_match_table = miphy28lp_of_match,
 	}
 };
drivers/phy/phy-qcom-ufs-qmp-14nm.c +0 -1
index f5fc50a..e1eea1b 100644
@@ -191,7 +191,6 @@ static struct platform_driver ufs_qcom_phy_qmp_14nm_driver = {
 	.driver = {
 		.of_match_table = ufs_qcom_phy_qmp_14nm_of_match,
 		.name = "ufs_qcom_phy_qmp_14nm",
-		.owner = THIS_MODULE,
 	},
 };
 
drivers/phy/phy-qcom-ufs-qmp-20nm.c +0 -1
index 8332f96..fde8c87 100644
@@ -247,7 +247,6 @@ static struct platform_driver ufs_qcom_phy_qmp_20nm_driver = {
 	.driver = {
 		.of_match_table = ufs_qcom_phy_qmp_20nm_of_match,
 		.name = "ufs_qcom_phy_qmp_20nm",
-		.owner = THIS_MODULE,
 	},
 };
 
drivers/phy/phy-rockchip-usb.c +0 -1
index 7d4c336..bf78721 100644
@@ -146,7 +146,6 @@ static struct platform_driver rockchip_usb_driver = {
 	.probe		= rockchip_usb_phy_probe,
 	.driver		= {
 		.name	= "rockchip-usb-phy",
-		.owner	= THIS_MODULE,
 		.of_match_table = rockchip_usb_phy_dt_ids,
 	},
 };
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 15/19 phy-sun4i-sub: Move vbus-detect helper functions up in the file

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

Move vbus-detect helper functions up in the file, just moving some code around, no functional changes what so ever.

---
 drivers/phy/phy-sun4i-usb.c |   48 +++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/phy/phy-sun4i-usb.c +24 -24
index 5138843..27ae89e 100644
@@ -294,6 +294,30 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
 	return 0;
 }
 
+static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
+{
+	if (data->vbus_det_gpio)
+		return gpiod_get_value_cansleep(data->vbus_det_gpio);
+
+	if (data->vbus_power_supply) {
+		union power_supply_propval val;
+		int r;
+
+		r = power_supply_get_property(data->vbus_power_supply,
+					      POWER_SUPPLY_PROP_PRESENT, &val);
+		if (r == 0)
+			return val.intval;
+	}
+
+	/* Fallback: report vbus as high */
+	return 1;
+}
+
+static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
+{
+	return data->vbus_det_gpio || data->vbus_power_supply;
+}
+
 static int sun4i_usb_phy_power_on(struct phy *_phy)
 {
 	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
@@ -356,30 +380,6 @@ static struct phy_ops sun4i_usb_phy_ops = {
 	.owner		= THIS_MODULE,
 };
 
-static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
-{
-	if (data->vbus_det_gpio)
-		return gpiod_get_value_cansleep(data->vbus_det_gpio);
-
-	if (data->vbus_power_supply) {
-		union power_supply_propval val;
-		int r;
-
-		r = power_supply_get_property(data->vbus_power_supply,
-					      POWER_SUPPLY_PROP_PRESENT, &val);
-		if (r == 0)
-			return val.intval;
-	}
-
-	/* Fallback: report vbus as high */
-	return 1;
-}
-
-static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
-{
-	return data->vbus_det_gpio || data->vbus_power_supply;
-}
-
 static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
 {
 	struct sun4i_usb_phy_data *data =
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH 16/19 phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-det

In reply to Kishon Vijay Abraham I

From: Hans de Goede <[email protected]>

data->vbus_det is always 1 on boards without a (working) vbus-det, skip the vbus_det test on such boards.

This fixes the sun4i usb phy code never turning on Vbus on such boards.

---
 drivers/phy/phy-sun4i-usb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/phy-sun4i-usb.c +2 -1
index 27ae89e..e2eb688d 100644
@@ -328,7 +328,8 @@ static int sun4i_usb_phy_power_on(struct phy *_phy)
 		return 0;
 
 	/* For phy0 only turn on Vbus if we don't have an ext. Vbus */
-	if (phy->index == 0 && data->vbus_det)
+	if (phy->index == 0 && sun4i_usb_phy0_have_vbus_det(data) &&
+				data->vbus_det)
 		return 0;
 
 	ret = regulator_enable(phy->vbus);
Signature · 1 line
1.7.9.5
#17 lore raw

PATCH 17/19 phy: ulpi_phy: Add const qualifier to ops

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

The ops is never changed in ulpi_phy_create(), so make it const.

---
 drivers/phy/ulpi_phy.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/ulpi_phy.h +1 -1
index ac49fb6..f2ebe49 100644
@@ -5,7 +5,7 @@
  * and it's controller, which is always the parent.
  */
 static inline struct phy
-*ulpi_phy_create(struct ulpi *ulpi, struct phy_ops *ops)
+*ulpi_phy_create(struct ulpi *ulpi, const struct phy_ops *ops)
 {
 	struct phy *phy;
 	int ret;
Signature · 1 line
1.7.9.5
#18 lore raw

PATCH 18/19 phy: Constify struct phy_ops variables

In reply to Kishon Vijay Abraham I

From: Axel Lin <[email protected]>

The phy_ops variables are never modified after initialized in these drivers, so make them const.

---
 drivers/phy/phy-armada375-usb2.c    |    2 +-
 drivers/phy/phy-bcm-kona-usb2.c     |    2 +-
 drivers/phy/phy-berlin-sata.c       |    2 +-
 drivers/phy/phy-berlin-usb.c        |    2 +-
 drivers/phy/phy-brcmstb-sata.c      |    2 +-
 drivers/phy/phy-dm816x-usb.c        |    2 +-
 drivers/phy/phy-exynos-dp-video.c   |    2 +-
 drivers/phy/phy-exynos-mipi-video.c |    2 +-
 drivers/phy/phy-exynos5-usbdrd.c    |    2 +-
 drivers/phy/phy-exynos5250-sata.c   |    2 +-
 drivers/phy/phy-hix5hd2-sata.c      |    2 +-
 drivers/phy/phy-miphy28lp.c         |    2 +-
 drivers/phy/phy-miphy365x.c         |    2 +-
 drivers/phy/phy-mvebu-sata.c        |    2 +-
 drivers/phy/phy-omap-usb2.c         |    2 +-
 drivers/phy/phy-qcom-apq8064-sata.c |    2 +-
 drivers/phy/phy-qcom-ipq806x-sata.c |    2 +-
 drivers/phy/phy-qcom-ufs-i.h        |    2 +-
 drivers/phy/phy-qcom-ufs-qmp-14nm.c |    2 +-
 drivers/phy/phy-qcom-ufs-qmp-20nm.c |    2 +-
 drivers/phy/phy-qcom-ufs.c          |    2 +-
 drivers/phy/phy-rcar-gen2.c         |    2 +-
 drivers/phy/phy-rockchip-usb.c      |    2 +-
 drivers/phy/phy-samsung-usb2.c      |    2 +-
 drivers/phy/phy-spear1310-miphy.c   |    2 +-
 drivers/phy/phy-spear1340-miphy.c   |    2 +-
 drivers/phy/phy-stih41x-usb.c       |    2 +-
 drivers/phy/phy-sun4i-usb.c         |    2 +-
 drivers/phy/phy-sun9i-usb.c         |    2 +-
 drivers/phy/phy-ti-pipe3.c          |    2 +-
 drivers/phy/phy-tusb1210.c          |    2 +-
 31 files changed, 31 insertions(+), 31 deletions(-)
drivers/phy/phy-armada375-usb2.c +1 -1
index 39c7d21..1a3db28 100644
@@ -51,7 +51,7 @@ static int armada375_usb_phy_init(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops armada375_usb_phy_ops = {
+static const struct phy_ops armada375_usb_phy_ops = {
 	.init = armada375_usb_phy_init,
 	.owner = THIS_MODULE,
 };
drivers/phy/phy-bcm-kona-usb2.c +1 -1
index ef2dc1a..7b67fe4 100644
@@ -91,7 +91,7 @@ static int bcm_kona_usb_phy_power_off(struct phy *gphy)
 	return 0;
 }
 
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
 	.init		= bcm_kona_usb_phy_init,
 	.power_on	= bcm_kona_usb_phy_power_on,
 	.power_off	= bcm_kona_usb_phy_power_off,
drivers/phy/phy-berlin-sata.c +1 -1
index 6f3e06d..0062027 100644
@@ -176,7 +176,7 @@ static struct phy *phy_berlin_sata_phy_xlate(struct device *dev,
 	return priv->phys[i]->phy;
 }
 
-static struct phy_ops phy_berlin_sata_ops = {
+static const struct phy_ops phy_berlin_sata_ops = {
 	.power_on	= phy_berlin_sata_power_on,
 	.power_off	= phy_berlin_sata_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-berlin-usb.c +1 -1
index 0fe0d81..204ee59 100644
@@ -147,7 +147,7 @@ static int phy_berlin_usb_power_on(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops phy_berlin_usb_ops = {
+static const struct phy_ops phy_berlin_usb_ops = {
 	.power_on	= phy_berlin_usb_power_on,
 	.owner		= THIS_MODULE,
 };
drivers/phy/phy-brcmstb-sata.c +1 -1
index b7e303d..8a2cb16 100644
@@ -122,7 +122,7 @@ static int brcm_sata_phy_init(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops phy_ops_28nm = {
+static const struct phy_ops phy_ops_28nm = {
 	.init		= brcm_sata_phy_init,
 	.owner		= THIS_MODULE,
 };
drivers/phy/phy-dm816x-usb.c +1 -1
index 7b42555..b4bbef6 100644
@@ -113,7 +113,7 @@ static int dm816x_usb_phy_init(struct phy *x)
 	return 0;
 }
 
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
 	.init		= dm816x_usb_phy_init,
 	.owner		= THIS_MODULE,
 };
drivers/phy/phy-exynos-dp-video.c +1 -1
index 179cbf9..34b0615 100644
@@ -48,7 +48,7 @@ static int exynos_dp_video_phy_power_off(struct phy *phy)
 				  EXYNOS5_PHY_ENABLE, 0);
 }
 
-static struct phy_ops exynos_dp_video_phy_ops = {
+static const struct phy_ops exynos_dp_video_phy_ops = {
 	.power_on	= exynos_dp_video_phy_power_on,
 	.power_off	= exynos_dp_video_phy_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-exynos-mipi-video.c +1 -1
index df7519a..2a54cab 100644
@@ -124,7 +124,7 @@ static struct phy *exynos_mipi_video_phy_xlate(struct device *dev,
 	return state->phys[args->args[0]].phy;
 }
 
-static struct phy_ops exynos_mipi_video_phy_ops = {
+static const struct phy_ops exynos_mipi_video_phy_ops = {
 	.power_on	= exynos_mipi_video_phy_power_on,
 	.power_off	= exynos_mipi_video_phy_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-exynos5-usbdrd.c +1 -1
index d72ef15..20696f5 100644
@@ -537,7 +537,7 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
 	return phy_drd->phys[args->args[0]].phy;
 }
 
-static struct phy_ops exynos5_usbdrd_phy_ops = {
+static const struct phy_ops exynos5_usbdrd_phy_ops = {
 	.init		= exynos5_usbdrd_phy_init,
 	.exit		= exynos5_usbdrd_phy_exit,
 	.power_on	= exynos5_usbdrd_phy_power_on,
drivers/phy/phy-exynos5250-sata.c +1 -1
index bc858cc..60e13af 100644
@@ -154,7 +154,7 @@ static int exynos_sata_phy_init(struct phy *phy)
 	return ret;
 }
 
-static struct phy_ops exynos_sata_phy_ops = {
+static const struct phy_ops exynos_sata_phy_ops = {
 	.init		= exynos_sata_phy_init,
 	.power_on	= exynos_sata_phy_power_on,
 	.power_off	= exynos_sata_phy_power_off,
drivers/phy/phy-hix5hd2-sata.c +1 -1
index d6b2265..e5ab3aa 100644
@@ -129,7 +129,7 @@ static int hix5hd2_sata_phy_init(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops hix5hd2_sata_phy_ops = {
+static const struct phy_ops hix5hd2_sata_phy_ops = {
 	.init		= hix5hd2_sata_phy_init,
 	.owner		= THIS_MODULE,
 };
drivers/phy/phy-miphy28lp.c +1 -1
index 677c290..c47b56b 100644
@@ -1132,7 +1132,7 @@ static struct phy *miphy28lp_xlate(struct device *dev,
 	return miphy_phy->phy;
 }
 
-static struct phy_ops miphy28lp_ops = {
+static const struct phy_ops miphy28lp_ops = {
 	.init = miphy28lp_init,
 	.owner = THIS_MODULE,
 };
drivers/phy/phy-miphy365x.c +1 -1
index 0ff354d..00a686a 100644
@@ -510,7 +510,7 @@ static struct phy *miphy365x_xlate(struct device *dev,
 	return miphy_phy->phy;
 }
 
-static struct phy_ops miphy365x_ops = {
+static const struct phy_ops miphy365x_ops = {
 	.init		= miphy365x_init,
 	.owner		= THIS_MODULE,
 };
drivers/phy/phy-mvebu-sata.c +1 -1
index 03b94f9..768ce92 100644
@@ -75,7 +75,7 @@ static int phy_mvebu_sata_power_off(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops phy_mvebu_sata_ops = {
+static const struct phy_ops phy_mvebu_sata_ops = {
 	.power_on	= phy_mvebu_sata_power_on,
 	.power_off	= phy_mvebu_sata_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-omap-usb2.c +1 -1
index c1a4686..0fe8058 100644
@@ -137,7 +137,7 @@ static int omap_usb_init(struct phy *x)
 	return 0;
 }
 
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
 	.init		= omap_usb_init,
 	.power_on	= omap_usb_power_on,
 	.power_off	= omap_usb_power_off,
drivers/phy/phy-qcom-apq8064-sata.c +1 -1
index 4b243f7..69ce2af 100644
@@ -204,7 +204,7 @@ static int qcom_apq8064_sata_phy_exit(struct phy *generic_phy)
 	return 0;
 }
 
-static struct phy_ops qcom_apq8064_sata_phy_ops = {
+static const struct phy_ops qcom_apq8064_sata_phy_ops = {
 	.init		= qcom_apq8064_sata_phy_init,
 	.exit		= qcom_apq8064_sata_phy_exit,
 	.owner		= THIS_MODULE,
drivers/phy/phy-qcom-ipq806x-sata.c +1 -1
index 6f2fe26..0ad127c 100644
@@ -126,7 +126,7 @@ static int qcom_ipq806x_sata_phy_exit(struct phy *generic_phy)
 	return 0;
 }
 
-static struct phy_ops qcom_ipq806x_sata_phy_ops = {
+static const struct phy_ops qcom_ipq806x_sata_phy_ops = {
 	.init		= qcom_ipq806x_sata_phy_init,
 	.exit		= qcom_ipq806x_sata_phy_exit,
 	.owner		= THIS_MODULE,
drivers/phy/phy-qcom-ufs-i.h +1 -1
index 591a391..2bd5ce4 100644
@@ -150,7 +150,7 @@ int ufs_qcom_phy_remove(struct phy *generic_phy,
 		       struct ufs_qcom_phy *ufs_qcom_phy);
 struct phy *ufs_qcom_phy_generic_probe(struct platform_device *pdev,
 			struct ufs_qcom_phy *common_cfg,
-			struct phy_ops *ufs_qcom_phy_gen_ops,
+			const struct phy_ops *ufs_qcom_phy_gen_ops,
 			struct ufs_qcom_phy_specific_ops *phy_spec_ops);
 int ufs_qcom_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy,
 			struct ufs_qcom_phy_calibration *tbl_A, int tbl_size_A,
drivers/phy/phy-qcom-ufs-qmp-14nm.c +1 -1
index e1eea1b..56631e7 100644
@@ -115,7 +115,7 @@ static int ufs_qcom_phy_qmp_14nm_is_pcs_ready(struct ufs_qcom_phy *phy_common)
 	return err;
 }
 
-static struct phy_ops ufs_qcom_phy_qmp_14nm_phy_ops = {
+static const struct phy_ops ufs_qcom_phy_qmp_14nm_phy_ops = {
 	.init		= ufs_qcom_phy_qmp_14nm_init,
 	.exit		= ufs_qcom_phy_exit,
 	.power_on	= ufs_qcom_phy_power_on,
drivers/phy/phy-qcom-ufs-qmp-20nm.c +1 -1
index fde8c87..b16ea77 100644
@@ -171,7 +171,7 @@ static int ufs_qcom_phy_qmp_20nm_is_pcs_ready(struct ufs_qcom_phy *phy_common)
 	return err;
 }
 
-static struct phy_ops ufs_qcom_phy_qmp_20nm_phy_ops = {
+static const struct phy_ops ufs_qcom_phy_qmp_20nm_phy_ops = {
 	.init		= ufs_qcom_phy_qmp_20nm_init,
 	.exit		= ufs_qcom_phy_exit,
 	.power_on	= ufs_qcom_phy_power_on,
drivers/phy/phy-qcom-ufs.c +1 -1
index f9c618f..49a1ed0 100644
@@ -77,7 +77,7 @@ EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate);
 
 struct phy *ufs_qcom_phy_generic_probe(struct platform_device *pdev,
 				struct ufs_qcom_phy *common_cfg,
-				struct phy_ops *ufs_qcom_phy_gen_ops,
+				const struct phy_ops *ufs_qcom_phy_gen_ops,
 				struct ufs_qcom_phy_specific_ops *phy_spec_ops)
 {
 	int err;
drivers/phy/phy-rcar-gen2.c +1 -1
index 39d9b29..6e0d9fa 100644
@@ -184,7 +184,7 @@ static int rcar_gen2_phy_power_off(struct phy *p)
 	return 0;
 }
 
-static struct phy_ops rcar_gen2_phy_ops = {
+static const struct phy_ops rcar_gen2_phy_ops = {
 	.init		= rcar_gen2_phy_init,
 	.exit		= rcar_gen2_phy_exit,
 	.power_on	= rcar_gen2_phy_power_on,
drivers/phy/phy-rockchip-usb.c +1 -1
index bf78721..5a5c073 100644
@@ -84,7 +84,7 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
 	return 0;
 }
 
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
 	.power_on	= rockchip_usb_phy_power_on,
 	.power_off	= rockchip_usb_phy_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-samsung-usb2.c +1 -1
index 55b6994..f278a9c 100644
@@ -71,7 +71,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops samsung_usb2_phy_ops = {
+static const struct phy_ops samsung_usb2_phy_ops = {
 	.power_on	= samsung_usb2_phy_power_on,
 	.power_off	= samsung_usb2_phy_power_off,
 	.owner		= THIS_MODULE,
drivers/phy/phy-spear1310-miphy.c +1 -1
index 45d0005..ed67e98 100644
@@ -179,7 +179,7 @@ static const struct of_device_id spear1310_miphy_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, spear1310_miphy_of_match);
 
-static struct phy_ops spear1310_miphy_ops = {
+static const struct phy_ops spear1310_miphy_ops = {
 	.init = spear1310_miphy_init,
 	.exit = spear1310_miphy_exit,
 	.owner = THIS_MODULE,
drivers/phy/phy-spear1340-miphy.c +1 -1
index 494240d..97280c0 100644
@@ -189,7 +189,7 @@ static const struct of_device_id spear1340_miphy_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, spear1340_miphy_of_match);
 
-static struct phy_ops spear1340_miphy_ops = {
+static const struct phy_ops spear1340_miphy_ops = {
 	.init = spear1340_miphy_init,
 	.exit = spear1340_miphy_exit,
 	.owner = THIS_MODULE,
drivers/phy/phy-stih41x-usb.c +1 -1
index c093b47..0ac7463 100644
@@ -112,7 +112,7 @@ static int stih41x_usb_phy_power_off(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops stih41x_usb_phy_ops = {
+static const struct phy_ops stih41x_usb_phy_ops = {
 	.init		= stih41x_usb_phy_init,
 	.power_on	= stih41x_usb_phy_power_on,
 	.power_off	= stih41x_usb_phy_power_off,
drivers/phy/phy-sun4i-usb.c +1 -1
index e2eb688d..623c714 100644
@@ -373,7 +373,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled)
 	sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
 }
 
-static struct phy_ops sun4i_usb_phy_ops = {
+static const struct phy_ops sun4i_usb_phy_ops = {
 	.init		= sun4i_usb_phy_init,
 	.exit		= sun4i_usb_phy_exit,
 	.power_on	= sun4i_usb_phy_power_on,
drivers/phy/phy-sun9i-usb.c +1 -1
index 0095914..ac4f31a 100644
@@ -114,7 +114,7 @@ static int sun9i_usb_phy_exit(struct phy *_phy)
 	return 0;
 }
 
-static struct phy_ops sun9i_usb_phy_ops = {
+static const struct phy_ops sun9i_usb_phy_ops = {
 	.init		= sun9i_usb_phy_init,
 	.exit		= sun9i_usb_phy_exit,
 	.owner		= THIS_MODULE,
drivers/phy/phy-ti-pipe3.c +1 -1
index 53f295c..2038f19 100644
@@ -279,7 +279,7 @@ static int ti_pipe3_exit(struct phy *x)
 
 	return 0;
 }
-static struct phy_ops ops = {
+static const struct phy_ops ops = {
 	.init		= ti_pipe3_init,
 	.exit		= ti_pipe3_exit,
 	.power_on	= ti_pipe3_power_on,
drivers/phy/phy-tusb1210.c +1 -1
index 07efdd3..2535d79 100644
@@ -53,7 +53,7 @@ static int tusb1210_power_off(struct phy *phy)
 	return 0;
 }
 
-static struct phy_ops phy_ops = {
+static const struct phy_ops phy_ops = {
 	.power_on = tusb1210_power_on,
 	.power_off = tusb1210_power_off,
 	.owner = THIS_MODULE,
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH 19/19 phy: lpc18xx-usb-otg: fix clock order in phy init

In reply to Kishon Vijay Abraham I

From: Joachim Eastwood <[email protected]>

Changing the frequency of the USB clock must be done before the PLL is powered on (prepared). This matters when the USB clock is not setup by either boot ROM or boot loader. Reorder the function calls to adhere to the order noted in the user manual.

---
 drivers/phy/phy-lpc18xx-usb-otg.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/phy-lpc18xx-usb-otg.c +3 -3
index 3aa8e4d..3b7a71e 100644
@@ -33,12 +33,12 @@ static int lpc18xx_usb_otg_phy_init(struct phy *phy)
 	struct lpc18xx_usb_otg_phy *lpc = phy_get_drvdata(phy);
 	int ret;
 
-	ret = clk_prepare(lpc->clk);
+	/* The PHY must be clocked at 480 MHz */
+	ret = clk_set_rate(lpc->clk, 480000000);
 	if (ret)
 		return ret;
 
-	/* The PHY must be clocked at 480 MHz */
-	return clk_set_rate(lpc->clk, 480000000);
+	return clk_prepare(lpc->clk);
 }
 
 static int lpc18xx_usb_otg_phy_exit(struct phy *phy)
Signature · 1 line
1.7.9.5
#20 lore raw
In reply to Kishon Vijay Abraham I
Quoted 11 lines · Kishon Vijay Abraham I

Hi Greg,

Please find the pull request for 4.3 merge window below. This contains a new NXP phy driver, extcon support and few fixes in phy-sun4i-usb driver and other trivial code cleanups.

Let me know if I have to change something.

Thanks
Kishon

Quoted 7 lines

The following changes since commit d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754:

Linux 4.2-rc1 (2015-07-05 11:01:52 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git tags/phy-for-4.3

Pulled and pushed out, thanks.

greg k-h