/* * Legacy DMA mask is 32 bit. * AC5 has the DDR starting at 8GB, hence it requires * a larger (34-bit) DMA mask, in order for DMA allocations * to succeed:
*/ staticconst u64 dma_mask_orion = DMA_BIT_MASK(32); staticconst u64 dma_mask_ac5 = DMA_BIT_MASK(34);
/* * Implement Orion USB controller specification guidelines
*/ staticvoid orion_usb_phy_v1_setup(struct usb_hcd *hcd)
{ /* The below GLs are according to the Orion Errata document */ /* * Clear interrupt cause and mask
*/
wrl(USB_CAUSE, 0);
wrl(USB_MASK, 0);
/* * GL# USB-3 GL# USB-9: USB PHY Test Group Control * REG_FIFO_SQ_RST[15]=0
*/
wrl(USB_PHY_TST_GRP_CTRL, rdl(USB_PHY_TST_GRP_CTRL) & ~0x8000);
/* * Stop and reset controller
*/
wrl(USB_CMD, rdl(USB_CMD) & ~USB_CMD_RUN);
wrl(USB_CMD, rdl(USB_CMD) | USB_CMD_RESET); while (rdl(USB_CMD) & USB_CMD_RESET);
/* * GL# USB-5 Streaming disable REG_USB_MODE[4]=1 * TBD: This need to be done after each reset! * GL# USB-4 Setup USB Host mode
*/
wrl(USB_MODE, USB_MODE_SDIS | USB_MODE_HOST);
}
staticvoid
ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, conststruct mbus_dram_target_info *dram)
{ int i;
for (i = 0; i < 4; i++) {
wrl(USB_WINDOW_CTRL(i), 0);
wrl(USB_WINDOW_BASE(i), 0);
}
for (i = 0; i < dram->num_cs; i++) { conststruct mbus_dram_window *cs = dram->cs + i;
/* * For SoC without hlock, need to program sbuscfg value to guarantee * AHB master's burst would not overrun or underrun FIFO. * * sbuscfg reg has to be set after usb controller reset, otherwise * the value would be override to 0.
*/ if (of_device_is_compatible(dev->of_node, "marvell,armada-3700-ehci"))
wrl(USB_SBUSCFG, USB_SBUSCFG_DEF_VAL);
/* * Right now device-tree probed devices don't get dma_mask * set. Since shared usb code relies on it, set it here for * now. Once we have dma capability bindings this can go away.
*/
dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev);
err = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); if (err) goto err;
priv = hcd_to_orion_priv(hcd); /* * Not all platforms can gate the clock, so it is not an error if * the clock does not exists.
*/
priv->clk = devm_clk_get(&pdev->dev, NULL); if (!IS_ERR(priv->clk)) {
err = clk_prepare_enable(priv->clk); if (err) goto err_put_hcd;
}
priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); if (IS_ERR(priv->phy)) {
err = PTR_ERR(priv->phy); if (err != -ENOSYS) goto err_dis_clk;
}
/* * (Re-)program MBUS remapping windows if we are asked to.
*/
dram = mv_mbus_dram_info(); if (dram)
ehci_orion_conf_mbus_windows(hcd, dram);
/* * setup Orion USB controller.
*/ if (pdev->dev.of_node)
phy_version = EHCI_PHY_NA; else
phy_version = pd->phy_version;
switch (phy_version) { case EHCI_PHY_NA: /* dont change USB phy settings */ break; case EHCI_PHY_ORION:
orion_usb_phy_v1_setup(hcd); break; case EHCI_PHY_DD: case EHCI_PHY_KW: default:
dev_warn(&pdev->dev, "USB phy version isn't supported.\n");
}
err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_dis_clk;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.