oxu210hp-hcd.c (288ead45fa6637e959015d055304f521cbbc0575) oxu210hp-hcd.c (749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab)
1/*
2 * Copyright (c) 2008 Rodolfo Giometti <giometti@linux.it>
3 * Copyright (c) 2008 Eurotech S.p.A. <info@eurtech.it>
4 *
5 * This code is *strongly* based on EHCI-HCD code by David Brownell since
6 * the chip is a quasi-EHCI compatible.
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 3187 unchanged lines hidden (view full) ---

3196 goto error;
3197 wIndex--;
3198 temp = readl(status_reg);
3199
3200 /*
3201 * Even if OWNER is set, so the port is owned by the
3202 * companion controller, khubd needs to be able to clear
3203 * the port-change status bits (especially
1/*
2 * Copyright (c) 2008 Rodolfo Giometti <giometti@linux.it>
3 * Copyright (c) 2008 Eurotech S.p.A. <info@eurtech.it>
4 *
5 * This code is *strongly* based on EHCI-HCD code by David Brownell since
6 * the chip is a quasi-EHCI compatible.
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 3187 unchanged lines hidden (view full) ---

3196 goto error;
3197 wIndex--;
3198 temp = readl(status_reg);
3199
3200 /*
3201 * Even if OWNER is set, so the port is owned by the
3202 * companion controller, khubd needs to be able to clear
3203 * the port-change status bits (especially
3204 * USB_PORT_FEAT_C_CONNECTION).
3204 * USB_PORT_STAT_C_CONNECTION).
3205 */
3206
3207 switch (wValue) {
3208 case USB_PORT_FEAT_ENABLE:
3209 writel(temp & ~PORT_PE, status_reg);
3210 break;
3211 case USB_PORT_FEAT_C_ENABLE:
3212 writel((temp & ~PORT_RWC_BITS) | PORT_PEC, status_reg);

--- 45 unchanged lines hidden (view full) ---

3258 if (!wIndex || wIndex > ports)
3259 goto error;
3260 wIndex--;
3261 status = 0;
3262 temp = readl(status_reg);
3263
3264 /* wPortChange bits */
3265 if (temp & PORT_CSC)
3205 */
3206
3207 switch (wValue) {
3208 case USB_PORT_FEAT_ENABLE:
3209 writel(temp & ~PORT_PE, status_reg);
3210 break;
3211 case USB_PORT_FEAT_C_ENABLE:
3212 writel((temp & ~PORT_RWC_BITS) | PORT_PEC, status_reg);

--- 45 unchanged lines hidden (view full) ---

3258 if (!wIndex || wIndex > ports)
3259 goto error;
3260 wIndex--;
3261 status = 0;
3262 temp = readl(status_reg);
3263
3264 /* wPortChange bits */
3265 if (temp & PORT_CSC)
3266 status |= 1 << USB_PORT_FEAT_C_CONNECTION;
3266 status |= USB_PORT_STAT_C_CONNECTION << 16;
3267 if (temp & PORT_PEC)
3267 if (temp & PORT_PEC)
3268 status |= 1 << USB_PORT_FEAT_C_ENABLE;
3268 status |= USB_PORT_STAT_C_ENABLE << 16;
3269 if ((temp & PORT_OCC) && !ignore_oc)
3269 if ((temp & PORT_OCC) && !ignore_oc)
3270 status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT;
3270 status |= USB_PORT_STAT_C_OVERCURRENT << 16;
3271
3272 /* whoever resumes must GetPortStatus to complete it!! */
3273 if (temp & PORT_RESUME) {
3274
3275 /* Remote Wakeup received? */
3276 if (!oxu->reset_done[wIndex]) {
3277 /* resume signaling for 20 msec */
3278 oxu->reset_done[wIndex] = jiffies
3279 + msecs_to_jiffies(20);
3280 /* check the port again */
3281 mod_timer(&oxu_to_hcd(oxu)->rh_timer,
3282 oxu->reset_done[wIndex]);
3283 }
3284
3285 /* resume completed? */
3286 else if (time_after_eq(jiffies,
3287 oxu->reset_done[wIndex])) {
3271
3272 /* whoever resumes must GetPortStatus to complete it!! */
3273 if (temp & PORT_RESUME) {
3274
3275 /* Remote Wakeup received? */
3276 if (!oxu->reset_done[wIndex]) {
3277 /* resume signaling for 20 msec */
3278 oxu->reset_done[wIndex] = jiffies
3279 + msecs_to_jiffies(20);
3280 /* check the port again */
3281 mod_timer(&oxu_to_hcd(oxu)->rh_timer,
3282 oxu->reset_done[wIndex]);
3283 }
3284
3285 /* resume completed? */
3286 else if (time_after_eq(jiffies,
3287 oxu->reset_done[wIndex])) {
3288 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
3288 status |= USB_PORT_STAT_C_SUSPEND << 16;
3289 oxu->reset_done[wIndex] = 0;
3290
3291 /* stop resume signaling */
3292 temp = readl(status_reg);
3293 writel(temp & ~(PORT_RWC_BITS | PORT_RESUME),
3294 status_reg);
3295 retval = handshake(oxu, status_reg,
3296 PORT_RESUME, 0, 2000 /* 2msec */);

--- 6 unchanged lines hidden (view full) ---

3303 temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10));
3304 }
3305 }
3306
3307 /* whoever resets must GetPortStatus to complete it!! */
3308 if ((temp & PORT_RESET)
3309 && time_after_eq(jiffies,
3310 oxu->reset_done[wIndex])) {
3289 oxu->reset_done[wIndex] = 0;
3290
3291 /* stop resume signaling */
3292 temp = readl(status_reg);
3293 writel(temp & ~(PORT_RWC_BITS | PORT_RESUME),
3294 status_reg);
3295 retval = handshake(oxu, status_reg,
3296 PORT_RESUME, 0, 2000 /* 2msec */);

--- 6 unchanged lines hidden (view full) ---

3303 temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10));
3304 }
3305 }
3306
3307 /* whoever resets must GetPortStatus to complete it!! */
3308 if ((temp & PORT_RESET)
3309 && time_after_eq(jiffies,
3310 oxu->reset_done[wIndex])) {
3311 status |= 1 << USB_PORT_FEAT_C_RESET;
3311 status |= USB_PORT_STAT_C_RESET << 16;
3312 oxu->reset_done[wIndex] = 0;
3313
3314 /* force reset to complete */
3315 writel(temp & ~(PORT_RWC_BITS | PORT_RESET),
3316 status_reg);
3317 /* REVISIT: some hardware needs 550+ usec to clear
3318 * this bit; seems too long to spin routinely...
3319 */

--- 22 unchanged lines hidden (view full) ---

3342
3343 /*
3344 * Even if OWNER is set, there's no harm letting khubd
3345 * see the wPortStatus values (they should all be 0 except
3346 * for PORT_POWER anyway).
3347 */
3348
3349 if (temp & PORT_CONNECT) {
3312 oxu->reset_done[wIndex] = 0;
3313
3314 /* force reset to complete */
3315 writel(temp & ~(PORT_RWC_BITS | PORT_RESET),
3316 status_reg);
3317 /* REVISIT: some hardware needs 550+ usec to clear
3318 * this bit; seems too long to spin routinely...
3319 */

--- 22 unchanged lines hidden (view full) ---

3342
3343 /*
3344 * Even if OWNER is set, there's no harm letting khubd
3345 * see the wPortStatus values (they should all be 0 except
3346 * for PORT_POWER anyway).
3347 */
3348
3349 if (temp & PORT_CONNECT) {
3350 status |= 1 << USB_PORT_FEAT_CONNECTION;
3350 status |= USB_PORT_STAT_CONNECTION;
3351 /* status may be from integrated TT */
3352 status |= oxu_port_speed(oxu, temp);
3353 }
3354 if (temp & PORT_PE)
3351 /* status may be from integrated TT */
3352 status |= oxu_port_speed(oxu, temp);
3353 }
3354 if (temp & PORT_PE)
3355 status |= 1 << USB_PORT_FEAT_ENABLE;
3355 status |= USB_PORT_STAT_ENABLE;
3356 if (temp & (PORT_SUSPEND|PORT_RESUME))
3356 if (temp & (PORT_SUSPEND|PORT_RESUME))
3357 status |= 1 << USB_PORT_FEAT_SUSPEND;
3357 status |= USB_PORT_STAT_SUSPEND;
3358 if (temp & PORT_OC)
3358 if (temp & PORT_OC)
3359 status |= 1 << USB_PORT_FEAT_OVER_CURRENT;
3359 status |= USB_PORT_STAT_OVERCURRENT;
3360 if (temp & PORT_RESET)
3360 if (temp & PORT_RESET)
3361 status |= 1 << USB_PORT_FEAT_RESET;
3361 status |= USB_PORT_STAT_RESET;
3362 if (temp & PORT_POWER)
3362 if (temp & PORT_POWER)
3363 status |= 1 << USB_PORT_FEAT_POWER;
3363 status |= USB_PORT_STAT_POWER;
3364
3365#ifndef OXU_VERBOSE_DEBUG
3366 if (status & ~0xffff) /* only if wPortChange is interesting */
3367#endif
3368 dbg_port(oxu, "GetStatus", wIndex + 1, temp);
3369 put_unaligned(cpu_to_le32(status), (__le32 *) buf);
3370 break;
3371 case SetHubFeature:

--- 612 unchanged lines hidden ---
3364
3365#ifndef OXU_VERBOSE_DEBUG
3366 if (status & ~0xffff) /* only if wPortChange is interesting */
3367#endif
3368 dbg_port(oxu, "GetStatus", wIndex + 1, temp);
3369 put_unaligned(cpu_to_le32(status), (__le32 *) buf);
3370 break;
3371 case SetHubFeature:

--- 612 unchanged lines hidden ---