[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0907201721340.5320-100000@iolanthe.rowland.org>
Date: Mon, 20 Jul 2009 17:25:41 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Jason Wessel <jason.wessel@...driver.com>
cc: gregkh@...e.de, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <dbrownell@...rs.sourceforge.net>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Yinghai Lu <yinghai@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH 07/10] ehci-dbgp,ehci: Allow early or late use of the
dbgp device
On Mon, 20 Jul 2009, Jason Wessel wrote:
> If the EHCI debug port is initialized and in use, the EHCI host
> controller driver must follow two rules.
>
> 1) If the EHCI host driver issues a controller reset, the debug
> controller driver re-initialization must get called after the reset
> is completed.
>
> 2) The EHCI host driver should ignore any requests to the physical
> EHCI debug port when the EHCI debug port is in use.
>
> The code to check for debug port was moved from the ehci_pci_reinit()
> to the EHCI host controller reset logic because it applies to any
> condition where EHCI host controller is getting reset.
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -238,7 +238,33 @@ static int ehci_reset (struct ehci_hcd *ehci)
> {
> int retval;
> u32 command = ehci_readl(ehci, &ehci->regs->command);
> -
> + u32 temp;
> + struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
> +
> + /* Special handling for the ehci debug port */
> + ehci->debug = NULL;
> + /* optional debug port, normally in the first BAR */
> + temp = pci_find_capability(pdev, 0x0a);
This isn't going to work very well on systems with non-PCI EHCI
controllers. Maybe you should leave debug-port detection in
ehci-pci.c. The controller doesn't get reset very much in any case.
> + if (temp) {
> + pci_read_config_dword(pdev, temp, &temp);
> + temp >>= 16;
> + if ((temp & (3 << 13)) == (1 << 13)) {
> + temp &= 0xfff;
> + ehci->debug = ehci_to_hcd(ehci)->regs + temp;
> + temp = ehci_readl(ehci, &ehci->debug->control);
> + ehci_info(ehci, "debug port %d%s\n",
> + HCS_DEBUG_PORT(ehci->hcs_params),
> + (temp & DBGP_ENABLED)
> + ? " IN USE"
> + : "");
> +#ifdef CONFIG_EARLY_PRINTK_DBGP
> + if (!dbgp_reset_prep() || !(temp & DBGP_ENABLED))
> +#else
> + if (!(temp & DBGP_ENABLED))
> +#endif
This sort of thing is better handled by defining dhbp_reset_prep() as
an inline routine or macro always returning 1 if
CONFIG_EARLY_PRINTK_DBGP isn't set.
> @@ -253,6 +279,11 @@ static int ehci_reset (struct ehci_hcd *ehci)
> if (ehci_is_TDI(ehci))
> tdi_reset (ehci);
>
> +#ifdef CONFIG_EARLY_PRINTK_DBGP
> + /* Restore debug facilities if the controler was active */
> + if (ehci->debug)
> + dbgp_external_startup();
> +#endif
Similarly here, make dgbp_external_startup() an empty inline function
or an empty macro.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists