[PATCH v3 1/1] drivers: usb: host: Add BRCM xHCI driver

Rayagonda Kokatanur rayagonda.kokatanur at broadcom.com
Wed Apr 8 09:25:09 CEST 2020


On Wed, Apr 8, 2020 at 11:18 AM Rayagonda Kokatanur
<rayagonda.kokatanur at broadcom.com> wrote:
>
> On Wed, Apr 8, 2020 at 9:56 AM Marek Vasut <marex at denx.de> wrote:
> >
> > On 4/8/20 5:35 AM, Rayagonda Kokatanur wrote:
> > [...]
> > > +struct brcm_xhci_platdata {
> > > +     unsigned int arcache;
> > > +     unsigned int awcache;
> > > +     uintptr_t hc_base;
> >
> > This could be struct xhci_hccr * instead , and then you can remove the
> > cast ...

Hi Marek,

uintptr_t is "unsigned long int" , its not pointer.
If we make hc_base as a pointer "struct xhci_hccr *" it won't work
because of pointer arithmetic during readl and writel.
Please let me know if I am missing anything ?

>
> If we make it struct xhci_hccr * then I think we need to type cast in
> readl and writel function.
> Please let me know ?
> >
> > > +};
> > > +
> > > +static int xhci_brcm_probe(struct udevice *dev)
> > > +{
> > > +     struct brcm_xhci_platdata *plat = dev_get_platdata(dev);
> > > +     struct xhci_hcor *hcor;
> > > +     struct xhci_hccr *hcd;
> > > +     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;
> > > +     }
> > > +
> > > +     plat->hc_base = (uintptr_t)hcd;
> >
> > ... here.
> >
> > > +     len = HC_LENGTH(xhci_readl(&hcd->cr_capbase));
> > > +     hcor = (struct xhci_hcor *)(plat->hc_base + len);
> > [...]


More information about the U-Boot mailing list