xref: /openbmc/linux/drivers/usb/host/xhci-rzv2m.c (revision 6fa24b41)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * xHCI host controller driver for RZ/V2M
4  *
5  * Copyright (C) 2022 Renesas Electronics Corporation
6  */
7 
8 #include <linux/usb/rzv2m_usb3drd.h>
9 #include "xhci.h"
10 #include "xhci-plat.h"
11 #include "xhci-rzv2m.h"
12 
13 #define RZV2M_USB3_INTEN	0x1044	/* Interrupt Enable */
14 
15 #define RZV2M_USB3_INT_XHC_ENA	BIT(0)
16 #define RZV2M_USB3_INT_HSE_ENA	BIT(2)
17 #define RZV2M_USB3_INT_ENA_VAL	(RZV2M_USB3_INT_XHC_ENA \
18 				 | RZV2M_USB3_INT_HSE_ENA)
19 
20 int xhci_rzv2m_init_quirk(struct usb_hcd *hcd)
21 {
22 	struct device *dev = hcd->self.controller;
23 
24 	rzv2m_usb3drd_reset(dev->parent, true);
25 
26 	return 0;
27 }
28 
29 void xhci_rzv2m_start(struct usb_hcd *hcd)
30 {
31 	u32 int_en;
32 
33 	if (hcd->regs) {
34 		/* Interrupt Enable */
35 		int_en = readl(hcd->regs + RZV2M_USB3_INTEN);
36 		int_en |= RZV2M_USB3_INT_ENA_VAL;
37 		writel(int_en, hcd->regs + RZV2M_USB3_INTEN);
38 	}
39 }
40