|
@@ -666,3 +666,67 @@ static struct resource usbhs0_resources[] = {
|
|
|
.start = evt2irq(0x1ca0) /* USB0_USB0I0 */,
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device usbhs0_device = {
|
|
|
+ .name = "renesas_usbhs",
|
|
|
+ .id = 0,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &usbhs0_private.info,
|
|
|
+ },
|
|
|
+ .num_resources = ARRAY_SIZE(usbhs0_resources),
|
|
|
+ .resource = usbhs0_resources,
|
|
|
+};
|
|
|
+
|
|
|
+/* USBHS1 is connected to CN31 which takes a USB Mini-AB plug
|
|
|
+ *
|
|
|
+ * Use J30 to select between Host and Function. This setting
|
|
|
+ * can however not be detected by software. Hotplug of USBHS1
|
|
|
+ * is provided via IRQ8.
|
|
|
+ *
|
|
|
+ * Current USB1 works as "USB Host".
|
|
|
+ * - set J30 "short"
|
|
|
+ *
|
|
|
+ * If you want to use it as "USB gadget",
|
|
|
+ * - J30 "open"
|
|
|
+ * - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET
|
|
|
+ * - add .get_vbus = usbhs_get_vbus in usbhs1_private
|
|
|
+ * - check usbhs0_device(pio)/usbhs1_device(irq) order in mackerel_devices.
|
|
|
+ */
|
|
|
+#define IRQ8 evt2irq(0x0300)
|
|
|
+#define USB_PHY_MODE (1 << 4)
|
|
|
+#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
|
|
|
+#define USB_PHY_ON (1 << 1)
|
|
|
+#define USB_PHY_OFF (1 << 0)
|
|
|
+#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
|
|
|
+
|
|
|
+static irqreturn_t usbhs1_interrupt(int irq, void *data)
|
|
|
+{
|
|
|
+ struct platform_device *pdev = data;
|
|
|
+ struct usbhs_private *priv = usbhs_get_priv(pdev);
|
|
|
+
|
|
|
+ dev_dbg(&pdev->dev, "%s\n", __func__);
|
|
|
+
|
|
|
+ renesas_usbhs_call_notify_hotplug(pdev);
|
|
|
+
|
|
|
+ /* clear status */
|
|
|
+ __raw_writew(__raw_readw(priv->usbphyaddr) | USB_PHY_INT_CLR,
|
|
|
+ priv->usbphyaddr);
|
|
|
+
|
|
|
+ return IRQ_HANDLED;
|
|
|
+}
|
|
|
+
|
|
|
+static int usbhs1_hardware_init(struct platform_device *pdev)
|
|
|
+{
|
|
|
+ struct usbhs_private *priv = usbhs_get_priv(pdev);
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ /* clear interrupt status */
|
|
|
+ __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr);
|
|
|
+
|
|
|
+ ret = request_irq(IRQ8, usbhs1_interrupt, IRQF_TRIGGER_HIGH,
|
|
|
+ dev_name(&pdev->dev), pdev);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(&pdev->dev, "request_irq err\n");
|
|
|
+ return ret;
|
|
|
+ }
|