On Mon, Feb 23, 2009 at 8:55 PM, Felipe Balbi <[email protected]> wrote:
> Make the register definitions in ehci-omap.c more sane.
> Also change the parameter passed omap_start/stop_ehc().
>
> Signed-off-by: Felipe Balbi <[email protected]>
> ---
> drivers/usb/host/ehci-omap.c | 219
> +++++++++++++++++++++---------------------
> 1 files changed, 111 insertions(+), 108 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index cd891cc..c9305a3 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
<snip>
> @@ -343,84 +346,87 @@ static int omap_start_ehc(struct ehci_hcd_omap *omap,
> struct usb_hcd *hcd)
> clk_enable(omap->usbtll_ick);
>
> /* Disable Auto Idle of USBTLL */
> - cm_write_mod_reg((0 << OMAP3430ES2_AUTO_USBTLL_SHIFT),
> + cm_write_mod_reg((0 << OMAP3430ES2_AUTO_USBTLL),
> CORE_MOD, CM_AUTOIDLE3);
>
> /* Wait for TLL to be Active */
> while ((cm_read_mod_reg(CORE_MOD, OMAP2430_CM_IDLEST3)
> - & (1 << OMAP3430ES2_ST_USBTLL_SHIFT))) {
> + & (0 << OMAP3430ES2_ST_USBTLL_SHIFT))) {
> cpu_relax();
>
> if (time_after(timeout, jiffies)) {
> - dev_dbg(hcd->self.controller, "operation timed
> out\n");
> + dev_dbg(omap->dev, "operation timed out\n");
> ret = -EINVAL;
> goto err_idlest3;
> }
> }
>
> /* perform TLL soft reset, and wait until reset is complete */
> - omap_writel(1 << OMAP_USBTLL_SYSCONFIG_SOFTRESET_SHIFT,
> + omap_writel(1 << OMAP_USBTLL_SYSCONFIG_SOFTRESET,
> OMAP_USBTLL_SYSCONFIG);
You forgot to remove the actual shift here
>
> /* Wait for TLL reset to complete */
> while (!(omap_readl(OMAP_USBTLL_SYSSTATUS)
> - & (1 << OMAP_USBTLL_SYSSTATUS_RESETDONE_SHIFT))) {
> + & (1 << OMAP_USBTLL_SYSSTATUS_RESETDONE))) {
> cpu_relax();
and here, that's why it locks up.
>
> if (time_after(timeout, jiffies)) {
> - dev_dbg(hcd->self.controller, "operation timed
> out\n");
> + dev_dbg(omap->dev, "operation timed out\n");
> ret = -EINVAL;
> goto err_sys_status;
> }
> }
>
> - dev_dbg(hcd->self.controller, "TLL RESET DONE\n");
> + dev_dbg(omap->dev, "TLL RESET DONE\n");
>
> /* (1<<3) = no idle mode only for initial debugging */
> - omap_writel((1 << OMAP_USBTLL_SYSCONFIG_ENAWAKEUP_SHIFT) |
> - (1 << OMAP_USBTLL_SYSCONFIG_SIDLEMODE_SHIFT) |
> - (1 << OMAP_USBTLL_SYSCONFIG_CACTIVITY_SHIFT),
> + omap_writel(OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
> + OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
> + OMAP_USBTLL_SYSCONFIG_CACTIVITY,
> OMAP_USBTLL_SYSCONFIG);
>
>
> /* Put UHH in NoIdle/NoStandby mode */
> - omap_writel((0 << OMAP_UHH_SYSCONFIG_AUTOIDLE_SHIFT) |
> - (1 << OMAP_UHH_SYSCONFIG_ENAWAKEUP_SHIFT) |
> - (1 << OMAP_UHH_SYSCONFIG_SIDLEMODE_SHIFT) |
> - (1 << OMAP_UHH_SYSCONFIG_CACTIVITY_SHIFT) |
> - (1 << OMAP_UHH_SYSCONFIG_MIDLEMODE_SHIFT),
> - OMAP_UHH_SYSCONFIG);
> + reg = omap_readl(OMAP_UHH_SYSCONFIG);
> + reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
> + | OMAP_UHH_SYSCONFIG_SIDLEMODE
> + | OMAP_UHH_SYSCONFIG_CACTIVITY
> + | OMAP_UHH_SYSCONFIG_MIDLEMODE);
> + reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
> +
> + omap_writel(reg, OMAP_UHH_SYSCONFIG);
>
> if (omap->phy_mode == EHCI_HCD_OMAP_MODE_PHY) {
> + reg = omap_readl(OMAP_UHH_HOSTCONFIG);
> +
> + reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
> + | OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN
> + | OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN);
> + reg &= ~(OMAP_UHH_HOSTCONFIG_ULPI_BYPASS
> + | OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN);
>
> /* Bypass the TLL module for PHY mode operation */
> - omap_writel((0 << OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT)|
> - (1 << OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN_SHIFT)|
> - (1 << OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN_SHIFT)|
> - (1 << OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN_SHIFT)|
> - (0 << OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN_SHIFT),
> - OMAP_UHH_HOSTCONFIG);
> + omap_writel(reg, OMAP_UHH_HOSTCONFIG);
>
> /* Ensure that BYPASS is set */
> while (omap_readl(OMAP_UHH_HOSTCONFIG)
> - & (1 << OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT)) {
> + & (1 << OMAP_UHH_HOSTCONFIG_ULPI_BYPASS)) {
> cpu_relax();
here too..
building now a kernel with these fixed..
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html