Re: [PATCH v2 2/4] phy: allwinner: add phy driver for USB3 PHY on Allwinner H6 SoC

From: Kishon Vijay Abraham I
Date: Fri Oct 25 2019 - 07:46:46 EST


Hi,

On 24/10/19 4:24 PM, Ondrej Jirman wrote:
> From: Icenowy Zheng <icenowy@xxxxxxx>
>
> Allwinner H6 SoC contains a USB3 PHY (with USB2 DP/DM lines also
> controlled).
>
> Add a driver for it.
>
> The register operations in this driver is mainly extracted from the BSP
> USB3 driver.
>
> Signed-off-by: Ondrej Jirman <megous@xxxxxxxxxx>
> Signed-off-by: Icenowy Zheng <icenowy@xxxxxxx>
> Reviewed-by: Chen-Yu Tsai <wens@xxxxxxxx>
> Acked-by: Maxime Ripard <mripard@xxxxxxxxxx>
> ---
> drivers/phy/allwinner/Kconfig | 12 ++
> drivers/phy/allwinner/Makefile | 1 +
> drivers/phy/allwinner/phy-sun50i-usb3.c | 195 ++++++++++++++++++++++++
> 3 files changed, 208 insertions(+)
> create mode 100644 drivers/phy/allwinner/phy-sun50i-usb3.c
>
> diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig
> index 215425296c77..fcae35ddd430 100644
> --- a/drivers/phy/allwinner/Kconfig
> +++ b/drivers/phy/allwinner/Kconfig
> @@ -45,3 +45,15 @@ config PHY_SUN9I_USB
> sun9i SoCs.
>
> This driver controls each individual USB 2 host PHY.
> +
> +config PHY_SUN50I_USB3
> + tristate "Allwinner sun50i SoC USB3 PHY driver"
> + depends on ARCH_SUNXI && HAS_IOMEM && OF
> + depends on RESET_CONTROLLER
> + select USB_COMMON

Looks like USB_COMMON is not required here.
> + select GENERIC_PHY
> + help
> + Enable this to support the USB3.0-capable transceiver that is
> + part of some Allwinner sun50i SoCs.
> +
> + This driver controls each individual USB 2+3 host PHY combo.
> diff --git a/drivers/phy/allwinner/Makefile b/drivers/phy/allwinner/Makefile
> index 799a65c0b58d..bd74901a1255 100644
> --- a/drivers/phy/allwinner/Makefile
> +++ b/drivers/phy/allwinner/Makefile
> @@ -2,3 +2,4 @@
> obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o
> obj-$(CONFIG_PHY_SUN6I_MIPI_DPHY) += phy-sun6i-mipi-dphy.o
> obj-$(CONFIG_PHY_SUN9I_USB) += phy-sun9i-usb.o
> +obj-$(CONFIG_PHY_SUN50I_USB3) += phy-sun50i-usb3.o
> diff --git a/drivers/phy/allwinner/phy-sun50i-usb3.c b/drivers/phy/allwinner/phy-sun50i-usb3.c
> new file mode 100644
> index 000000000000..8e170a4d0a11
> --- /dev/null
> +++ b/drivers/phy/allwinner/phy-sun50i-usb3.c
> @@ -0,0 +1,195 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Allwinner sun50i(H6) USB 3.0 phy driver
> + *
> + * Copyright (C) 2017 Icenowy Zheng <icenowy@xxxxxxx>
> + *
> + * Based on phy-sun9i-usb.c, which is:
> + *
> + * Copyright (C) 2014-2015 Chen-Yu Tsai <wens@xxxxxxxx>
> + *
> + * Based on code from Allwinner BSP, which is:
> + *
> + * Copyright (c) 2010-2015 Allwinner Technology Co., Ltd.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/phy/phy.h>
> +#include <linux/usb/of.h>

this too..

Thanks
Kishon