From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] drivers: usb: host: Add BRCM xHCI driver
Date: Mon, 25 Nov 2019 11:46:06 -0800 [thread overview]
Message-ID: <c65f9e7c91fce5f679103cc1500d8204@mail.gmail.com> (raw)
In-Reply-To: <d532dedd-b2e4-0768-4406-8afdc0ccf4d3@denx.de>
HI Marek,
> On 11/23/19 12:31 AM, Vladimir Olovyannikov wrote:
> [...]
>
> > +#define USBAXI_AWCACHE 0xF
> > +#define USBAXI_ARCACHE 0xF
> > +#define USBAXI_AWPROT 0x8
> > +#define USBAXI_ARPROT 0x8
> > +#define USBAXIWR_SA_VAL ((USBAXI_AWCACHE << 4 |
> USBAXI_AWPROT) << 0)
>
> Are the parenthesis correct here ?
> Might make sense to rewrite it as ((AWCACHE << 4) | AWPROT)
>
> > +#define USBAXIWR_SA_MASK (0xff)
>
> Here the parenthesis are not needed.
>
> > +#define USBAXIWR_UA_VAL ((USBAXI_AWCACHE << 4 |
> USBAXI_AWPROT) << 16)
> > +#define USBAXIWR_UA_MASK ((0xff) << 16)
> > +#define USBAXIRD_SA_VAL ((USBAXI_ARCACHE << 4 |
> USBAXI_ARPROT) << 0)
> > +#define USBAXIRD_SA_MASK (0xff)
> > +#define USBAXIRD_UA_VAL ((USBAXI_ARCACHE << 4 |
> USBAXI_ARPROT) << 16)
> > +#define USBAXIRD_UA_MASK ((0xff) << 16)
> > +
> > +struct brcm_xhci_platdata {
> > + unsigned int arcache;
> > + unsigned int awcache;
> > +};
> > +
> > +static int xhci_brcm_probe(struct udevice *dev) {
> > + struct xhci_hccr *hcd;
> > + struct xhci_hcor *hcor;
> > + struct brcm_xhci_platdata *plat = dev_get_platdata(dev);
> > + int len, ret = 0;
> > +
> > + if (!plat) {
> > + dev_err(dev, "Can't get xHCI Plat data\n");
> > + return -ENOMEM;
> > + }
> > +
> > + hcd = dev_read_addr_ptr(dev);
> > + if (!hcd) {
> > + dev_err(dev, "Can't get the xHCI register base address\n");
> > + return -ENXIO;
> > + }
> > +
> > + len = HC_LENGTH(xhci_readl(&(hcd)->cr_capbase));
> > + hcor = (struct xhci_hcor *)((uintptr_t)hcd + len);
>
> Please clean up the extraneous parenthesis ^
>
> > + /* Save the default values of AXI read and write attributes */
> > + plat->awcache = readl((uintptr_t)hcd +
> DRD2U3H_XHC_REGS_AXIWRA);
> > + plat->arcache = readl((uintptr_t)hcd +
> DRD2U3H_XHC_REGS_AXIRDA);
> > +
> > + /* Enable AXI read and write attributes. */
> > + clrsetbits_le32(((uintptr_t)hcd + DRD2U3H_XHC_REGS_AXIWRA),
> > + (USBAXIWR_UA_MASK | USBAXIWR_SA_MASK),
> > + (USBAXIWR_UA_VAL | USBAXIWR_SA_VAL));
> > + clrsetbits_le32(((uintptr_t)hcd + DRD2U3H_XHC_REGS_AXIRDA),
> > + (USBAXIRD_UA_MASK | USBAXIRD_SA_MASK),
> > + (USBAXIRD_UA_VAL | USBAXIRD_SA_VAL));
> > +
> > + ret = xhci_register(dev, hcd, hcor);
> > + if (ret)
> > + dev_err(dev, "Failed to register xHCI\n");
> > +
> > + return ret;
> > +}
> > +
> > +static int xhci_brcm_deregister(struct udevice *dev) {
> > + struct xhci_hccr *hcd;
> > + struct brcm_xhci_platdata *plat = dev_get_platdata(dev);
> > +
> > + hcd = (struct xhci_hccr *)((uintptr_t)dev_read_addr(dev));
> > +
> > + /* Restore the default values for AXI read and write attributes */
> > + writel(plat->awcache, ((uintptr_t)hcd +
> DRD2U3H_XHC_REGS_AXIWRA));
> > + writel(plat->arcache, ((uintptr_t)hcd +
> DRD2U3H_XHC_REGS_AXIRDA));
>
> Here too.
>
> Looks good otherwise, thanks.
Thanks for review Marek,
Issues will be resolved with the next patch set.
prev parent reply other threads:[~2019-11-25 19:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-22 23:31 [U-Boot] [PATCH 0/2] Add Broadcom XHCI driver for iproc platforms Vladimir Olovyannikov
2019-11-22 23:31 ` [U-Boot] [PATCH 1/2] dt-bindings: Documentation on BRCM xHCI controller Vladimir Olovyannikov
2019-11-22 23:31 ` [U-Boot] [PATCH 2/2] drivers: usb: host: Add BRCM xHCI driver Vladimir Olovyannikov
2019-11-22 23:52 ` Marek Vasut
2019-11-25 19:46 ` Vladimir Olovyannikov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c65f9e7c91fce5f679103cc1500d8204@mail.gmail.com \
--to=vladimir.olovyannikov@broadcom.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox