Re: [PATCH v2 1/3] drivers: usb: phy: Add qoriq usb 3.0 phy driver support

2017-11-10 Thread Rob Herring
On Tue, Nov 07, 2017 at 03:20:53PM +0800, Ran Wang wrote:
> Adds qoriq usb 3.0 phy driver to implement erratum related workaround
> for qoriq SoC.
> 
> Signed-off-by: Sriram Dash 
> Signed-off-by: Ran Wang 
> ---
> Change in v2:
>   - Replace funciont __raw_writel() by iowrite32be()
>   - Remove qoriq_usb3_phy_read() and qoriq_usb3_phy_write()
>   - Remove USB3PRM1CR_VAL define, use numbers directly
>   - Use C-style numeric constants on 32'h27672B2A in annotation
>   - Add prefix 'static' to struct qoriq_usb3_phy_erratum
> 
>  .../devicetree/bindings/phy/phy-qoriq-usb3.txt |  36 

Please split bindings to separate patch.

>  drivers/phy/Kconfig|   9 +
>  drivers/phy/Makefile   |   1 +
>  drivers/phy/phy-qoriq-usb3.c   | 191 
> +
>  4 files changed, 237 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
>  create mode 100644 drivers/phy/phy-qoriq-usb3.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt 
> b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
> new file mode 100644
> index ..d956f9c89fbf
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
> @@ -0,0 +1,36 @@
> +Driver for Freescale USB 3.0 PHY
> +
> +Required properties:
> +
> +- compatible :   fsl,qoriq-usb3-phy
> +- reg :  register mappings for Parameter Configuration Register
> + and Phy base offset.
> +- reg-names :"param_ctrl" and "phy_base"
> +- phy_type : For multi port host USB controllers, should be one of
> + "ulpi", or "serial". For dual role USB controllers,
> + should be one of "ulpi", "utmi", "utmi_wide", or "serial".
> +
> +Example:
> + usbphy0: usb-phy@084F {

Drop leading 0s and use lower case hex. Building dts with W=2 will tell 
you this.

> + compatible = "fsl,qoriq-usb3-phy";
> +reg = <0x0 0x01570070 0x0 0xC>, <0x0 0x084F 0x0 0x5000>;
> +reg-names = "param_ctrl", "phy_base";
> +#phy-cells = <0>;
> +phy_type = "utmi";
> + };
> +
> +usbphy1: usb-phy@0850 {
> +compatible = "fsl,qoriq-usb3-phy";
> +reg = <0x0 0x0157007C 0x0 0xC>, <0x0 0x0850 0x0 0x5000>;
> +reg-names = "param_ctrl", "phy_base";
> +#phy-cells = <0>;
> +phy_type = "utmi";
> +};
> +
> +usbphy2: usb-phy@0851 {
> +compatible = "fsl,qoriq-usb3-phy";
> +reg = <0x0 0x01570088 0x0 0xC>, <0x0 0x0851 0x0 0x5000>;
> +reg-names = "param_ctrl", "phy_base";
> +#phy-cells = <0>;
> +phy_type = "utmi";
> +};
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] drivers: usb: phy: Add qoriq usb 3.0 phy driver support

2017-11-06 Thread Ran Wang
Adds qoriq usb 3.0 phy driver to implement erratum related workaround
for qoriq SoC.

Signed-off-by: Sriram Dash 
Signed-off-by: Ran Wang 
---
Change in v2:
- Replace funciont __raw_writel() by iowrite32be()
- Remove qoriq_usb3_phy_read() and qoriq_usb3_phy_write()
- Remove USB3PRM1CR_VAL define, use numbers directly
- Use C-style numeric constants on 32'h27672B2A in annotation
- Add prefix 'static' to struct qoriq_usb3_phy_erratum

 .../devicetree/bindings/phy/phy-qoriq-usb3.txt |  36 
 drivers/phy/Kconfig|   9 +
 drivers/phy/Makefile   |   1 +
 drivers/phy/phy-qoriq-usb3.c   | 191 +
 4 files changed, 237 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
 create mode 100644 drivers/phy/phy-qoriq-usb3.c

diff --git a/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt 
b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
new file mode 100644
index ..d956f9c89fbf
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt
@@ -0,0 +1,36 @@
+Driver for Freescale USB 3.0 PHY
+
+Required properties:
+
+- compatible : fsl,qoriq-usb3-phy
+- reg :register mappings for Parameter Configuration Register
+   and Phy base offset.
+- reg-names :  "param_ctrl" and "phy_base"
+- phy_type :   For multi port host USB controllers, should be one of
+   "ulpi", or "serial". For dual role USB controllers,
+   should be one of "ulpi", "utmi", "utmi_wide", or "serial".
+
+Example:
+   usbphy0: usb-phy@084F {
+   compatible = "fsl,qoriq-usb3-phy";
+reg = <0x0 0x01570070 0x0 0xC>, <0x0 0x084F 0x0 0x5000>;
+reg-names = "param_ctrl", "phy_base";
+#phy-cells = <0>;
+phy_type = "utmi";
+   };
+
+usbphy1: usb-phy@0850 {
+compatible = "fsl,qoriq-usb3-phy";
+reg = <0x0 0x0157007C 0x0 0xC>, <0x0 0x0850 0x0 0x5000>;
+reg-names = "param_ctrl", "phy_base";
+#phy-cells = <0>;
+phy_type = "utmi";
+};
+
+usbphy2: usb-phy@0851 {
+compatible = "fsl,qoriq-usb3-phy";
+reg = <0x0 0x01570088 0x0 0xC>, <0x0 0x0851 0x0 0x5000>;
+reg-names = "param_ctrl", "phy_base";
+#phy-cells = <0>;
+phy_type = "utmi";
+};
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index c1807d4a0079..077e6765d2df 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -41,6 +41,15 @@ config PHY_PISTACHIO_USB
help
  Enable this to support the USB2.0 PHY on the IMG Pistachio SoC.
 
+
+config PHY_QORIQ_USB3
+   tristate "Freescale QorIQ USB 3.0 PHY driver"
+   depends on ARCH_LAYERSCAPE
+   depends on OF
+   select GENERIC_PHY
+   help
+ Enable this to support the USB3.0 PHY on the QorIQ SoC.
+
 config PHY_XGENE
tristate "APM X-Gene 15Gbps PHY support"
depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST)
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index f252201e0ec9..94712e066cde 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -21,3 +21,4 @@ obj-y += broadcom/\
   samsung/ \
   st/  \
   ti/
+obj-$(CONFIG_PHY_QORIQ_USB3)+= phy-qoriq-usb3.o
diff --git a/drivers/phy/phy-qoriq-usb3.c b/drivers/phy/phy-qoriq-usb3.c
new file mode 100644
index ..f9302fc59f05
--- /dev/null
+++ b/drivers/phy/phy-qoriq-usb3.c
@@ -0,0 +1,191 @@
+/*
+ * Freescale QorIQ USB3 phy driver
+ *
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * 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.
+ *
+ * Author: Sriram Dash 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+/* Parameter control */
+#define USB3PRM1CR 0x000
+
+/*
+ * struct qoriq_usb3_phy - driver data for USB 3.0 PHY
+ * @dev: pointer to device instance of this platform device
+ * @param_ctrl: usb3 phy