Re: [PATCH v8 15/20] usb: chipidea: add host role

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexander Shishkin a écrit :
> This adds EHCI host support to the chipidea driver. We want it to be
> part of the hdrc driver and not a standalone (sub-)driver module, as
> the structure of ehci-hcd.c suggests, so for chipidea controller we
> hack it to not provide platform-related code, but only the ehci hcd.
> 
> The ehci-platform driver won't work for us here too, because the
> controller uses the same registers for both device and host mode and
> also otg-related bits, so it's not really possible to put ehci registers
> into a separate resource.
> 
> This is not a pretty solution, but the alternative is exporting symbols
> from the chipidea driver to a ehci-chipidea driver and doing all the
> module refcounting.
> 
> Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/usb/chipidea/Kconfig  |    6 ++
>  drivers/usb/chipidea/Makefile |    1 +
>  drivers/usb/chipidea/bits.h   |    1 +
>  drivers/usb/chipidea/ci.h     |    7 +-
>  drivers/usb/chipidea/core.c   |   15 +++-
>  drivers/usb/chipidea/host.c   |  169 +++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/chipidea/host.h   |   17 +++++
>  drivers/usb/chipidea/udc.c    |    8 +-
>  drivers/usb/host/ehci-hcd.c   |    8 ++
>  9 files changed, 223 insertions(+), 9 deletions(-)
>  create mode 100644 drivers/usb/chipidea/host.c
>  create mode 100644 drivers/usb/chipidea/host.h
> 
> +
> +static int host_start(struct ci13xxx *ci)
> +{
> +       struct usb_hcd *hcd;
> +       struct ehci_hcd *ehci;
> +       int ret;
> +
> +       if (usb_disabled())
> +               return -ENODEV;
> +
> +       hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
> +       if (!hcd)
> +               return -ENOMEM;
> +
> +       dev_set_drvdata(ci->dev, ci);
> +       hcd->rsrc_start = ci->hw_bank.phys;
> +       hcd->rsrc_len = ci->hw_bank.size;
> +       hcd->regs = ci->hw_bank.abs;
> +       hcd->has_tt = 1;
> +
> +       ehci = hcd_to_ehci(hcd);
> +       ehci->caps = ci->hw_bank.cap;


> +       ehci->regs = ci->hw_bank.cap +
> +               HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
> +       ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
> +       ehci->has_hostpc = 1;
> +       ehci->sbrn = 0x20;

ehci_setup already does :
    ehci->regs = (void __iomem *)ehci->caps +
        HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
    dbg_hcs_params(ehci, "reset");
    dbg_hcc_params(ehci, "reset");

    /* cache this readonly data; minimize chip reads */
    ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);

    ehci->sbrn = HCD_USB2;


Why do you set has_hostpc = 1 ?
This won't work with normal chipidea core ?

> +
> +       ret = hw_device_reset(ci, USBMODE_CM_HC);
> +       if (ret)
> +               goto rm_hcd;
Why do you need to do that ? ehci_reset will do it (with tdi_reset).
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux