From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 13 Dec 2015 05:17:56 +0100 Subject: [U-Boot] [PATCH 4/6] usb: dwc2: add helper function for setting SPLIT HC registers In-Reply-To: <1449980278-19881-1-git-send-email-stefan.bruens@rwth-aachen.de> References: <1449980278-19881-1-git-send-email-stefan.bruens@rwth-aachen.de> Message-ID: <1449980278-19881-5-git-send-email-stefan.bruens@rwth-aachen.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Stefan Br?ns --- drivers/usb/host/dwc2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index 2d97546..6496fcf 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -495,10 +495,27 @@ static void dwc_otg_hc_init(struct dwc2_core_regs *regs, uint8_t hc_num, */ writel(hcchar, &hc_regs->hcchar); - /* Program the HCSPLIT register for SPLITs */ + /* Program the HCSPLIT register, default to no SPLIT */ writel(0, &hc_regs->hcsplt); } +static void dwc_otg_hc_init_split(struct dwc2_core_regs *regs, + uint8_t hc_num, uint8_t hub_devnum, + uint8_t hub_port, uint8_t complete_split) +{ + struct dwc2_hc_regs *hc_regs = ®s->hc_regs[hc_num]; + uint32_t hcsplt = 0; + + hcsplt = DWC2_HCSPLT_SPLTENA; + hcsplt |= hub_devnum << DWC2_HCSPLT_HUBADDR_OFFSET; + hcsplt |= hub_port << DWC2_HCSPLT_PRTADDR_OFFSET; + if (complete_split) + hcsplt |= 1 << DWC2_HCSPLT_COMPSPLT_OFFSET; + + /* Program the HCSPLIT register for SPLITs */ + writel(hcsplt, &hc_regs->hcsplt); +} + /* * DWC2 to USB API interface */ -- 2.1.4