USB: host: ehci-atmel: Add support for HSIC phy
authorCristian Birsan <cristian.birsan@microchip.com>
Fri, 10 Sep 2021 16:38:42 +0000 (19:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Sep 2021 08:26:29 +0000 (10:26 +0200)
Add support for USB Host High Speed Port HSIC phy.

Tested-by: Alexander Dahl <ada@thorsis.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
Link: https://lore.kernel.org/r/20210910163842.1596407-3-cristian.birsan@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-atmel.c

index e893467..05d41fd 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/platform_device.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/usb/phy.h>
+#include <linux/usb/of.h>
 
 #include "ehci.h"
 
@@ -25,6 +27,9 @@
 
 static const char hcd_name[] = "ehci-atmel";
 
+#define EHCI_INSNREG(index)                    ((index) * 4 + 0x90)
+#define EHCI_INSNREG08_HSIC_EN                 BIT(2)
+
 /* interface and function clocks */
 #define hcd_to_atmel_ehci_priv(h) \
        ((struct atmel_ehci_priv *)hcd_to_ehci(h)->priv)
@@ -154,6 +159,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
                goto fail_add_hcd;
        device_wakeup_enable(hcd->self.controller);
 
+       if (of_usb_get_phy_mode(pdev->dev.of_node) == USBPHY_INTERFACE_MODE_HSIC)
+               writel(EHCI_INSNREG08_HSIC_EN, hcd->regs + EHCI_INSNREG(8));
+
        return retval;
 
 fail_add_hcd: