Re: [PATCH] phy: ralink-usb: add driver for Mediatek/Ralink

From: Alexey Klimov
Date: Thu Nov 05 2015 - 18:38:56 EST


Hi John,

On Wed, Nov 4, 2015 at 10:54 AM, John Crispin <blogic@xxxxxxxxxxx> wrote:
> Add a driver to setup the USB phy on Mediatek/Ralink SoCs.
> The driver is trivial and only sets the power and host/device mode.
>
> Signed-off-by: John Crispin <blogic@xxxxxxxxxxx>
> ---
> .../devicetree/bindings/phy/ralink-usb-phy.txt | 17 ++
> drivers/phy/Kconfig | 7 +
> drivers/phy/Makefile | 1 +
> drivers/phy/phy-ralink-usb.c | 183 ++++++++++++++++++++
> 4 files changed, 208 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/phy/ralink-usb-phy.txt
> create mode 100644 drivers/phy/phy-ralink-usb.c

[..]

> +static int ralink_usb_phy_exit(struct phy *_phy)
> +{
> + return 0;
> +}
> +
> +static int ralink_usb_phy_power_on(struct phy *_phy)
> +{
> + if (atomic_inc_return(&usb_pwr_ref) == 1) {

> + int host = 1;
> + u32 t;
> +
> + usb_phy_enable(1);
> +
> + if (host) {

Could you please check how it's supposed to work with host var always
initialized with 1?
Do you want to drop if-else check here or ..?


> + rt_sysc_m32(0, RT_SYSCFG1_USB0_HOST_MODE,
> + RT_SYSC_REG_SYSCFG1);
> + if (!IS_ERR(rsthost))
> + reset_control_deassert(rsthost);
> + if (!IS_ERR(rstdev))
> + reset_control_deassert(rstdev);
> + } else {
> + rt_sysc_m32(RT_SYSCFG1_USB0_HOST_MODE, 0,
> + RT_SYSC_REG_SYSCFG1);
> + if (!IS_ERR(rstdev))
> + reset_control_deassert(rstdev);
> + }
> + mdelay(100);
> +
> + t = rt_sysc_r32(RT_SYSC_REG_USB_PHY_CFG);
> + dev_info(&_phy->dev, "remote usb device wakeup %s\n",
> + (t & UDEV_WAKEUP) ? ("enabbled") : ("disabled"));
> + if (t & USB_PHY_UTMI_8B60M)
> + dev_info(&_phy->dev, "UTMI 8bit 60MHz\n");
> + else
> + dev_info(&_phy->dev, "UTMI 16bit 30MHz\n");
> + }
> +
> + return 0;
> +}

--
Best regards,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/