=== modified file 'uspace/drv/bus/usb/ohci/hc.c'
old
|
new
|
|
518 | 518 | instance->registers->control &= (C_HCFS_OPERATIONAL << C_HCFS_SHIFT); |
519 | 519 | usb_log_debug("OHCI HC up and running (ctl_reg=0x%x).\n", |
520 | 520 | instance->registers->control); |
| 521 | rh_replug(&instance->rh); |
521 | 522 | } |
522 | 523 | /*----------------------------------------------------------------------------*/ |
523 | 524 | /** Initialize schedule queues |
=== modified file 'uspace/drv/bus/usb/ohci/ohci_regs.h'
old
|
new
|
|
137 | 137 | |
138 | 138 | /** The first root hub control register */ |
139 | 139 | volatile uint32_t rh_desc_a; |
140 | | #define RHDA_NDS_MASK (0xff) /* Number of downstream ports, max 15 */ |
141 | | #define RHDA_NDS_SHIFT (0) |
| 140 | #define RHDA_NDP_MASK (0xff) /* Number of downstream ports, max 15 */ |
| 141 | #define RHDA_NDP_SHIFT (0) |
142 | 142 | #define RHDA_PSM_FLAG (1 << 8) /* Power switching mode: 0-global, 1-per port*/ |
143 | 143 | #define RHDA_NPS_FLAG (1 << 9) /* No power switch: 1-power on, 0-use PSM*/ |
144 | 144 | #define RHDA_DT_FLAG (1 << 10) /* 1-Compound device, must be 0 */ |
=== modified file 'uspace/drv/bus/usb/ohci/root_hub.c'
old
|
new
|
|
218 | 218 | assert(instance); |
219 | 219 | instance->registers = regs; |
220 | 220 | instance->port_count = |
221 | | (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK; |
| 221 | (instance->registers->rh_desc_a >> RHDA_NDP_SHIFT) & RHDA_NDP_MASK; |
222 | 222 | int opResult = rh_init_descriptors(instance); |
223 | 223 | if (opResult != EOK) { |
224 | 224 | return opResult; |
225 | 225 | } |
226 | | // set port power mode to no-power-switching |
| 226 | |
| 227 | /* Set port power mode to no-power-switching (always on) */ |
227 | 228 | instance->registers->rh_desc_a |= RHDA_NPS_FLAG; |
| 229 | |
228 | 230 | instance->unfinished_interrupt_transfer = NULL; |
229 | 231 | instance->interrupt_mask_size = (instance->port_count + 8) / 8; |
230 | 232 | instance->interrupt_buffer = malloc(instance->interrupt_mask_size); |
… |
… |
|
236 | 238 | |
237 | 239 | return EOK; |
238 | 240 | } |
| 241 | |
| 242 | void rh_replug(rh_t *instance) |
| 243 | { |
| 244 | assert(instance); |
| 245 | /* Simulate unplug */ |
| 246 | |
| 247 | /* Enable power-switching */ |
| 248 | instance->registers->rh_desc_a &= ~RHDA_NPS_FLAG; |
| 249 | /* Set power switch to global */ |
| 250 | instance->registers->rh_desc_a &= ~RHDA_PSM_FLAG; |
| 251 | /* Shut down ports */ |
| 252 | instance->registers->rh_status |= RHS_CLEAR_PORT_POWER; |
| 253 | async_usleep(10000); |
| 254 | instance->registers->rh_status |= RHS_SET_PORT_POWER; |
| 255 | |
| 256 | /* Set port power mode to no-power-switching (always on) */ |
| 257 | instance->registers->rh_desc_a |= RHDA_NPS_FLAG; |
| 258 | } |
239 | 259 | /*----------------------------------------------------------------------------*/ |
240 | 260 | |
241 | 261 | /** |
=== modified file 'uspace/drv/bus/usb/ohci/root_hub.h'
old
|
new
|
|
73 | 73 | |
74 | 74 | int rh_init(rh_t *instance, ohci_regs_t *regs); |
75 | 75 | |
| 76 | void rh_replug(rh_t *instance); |
| 77 | |
76 | 78 | int rh_request(rh_t *instance, usb_transfer_batch_t *request); |
77 | 79 | |
78 | 80 | void rh_interrupt(rh_t *instance); |