r8a66597-hcd.c (288ead45fa6637e959015d055304f521cbbc0575) | r8a66597-hcd.c (749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab) |
---|---|
1/* 2 * R8A66597 HCD (Host Controller Driver) 3 * 4 * Copyright (C) 2006-2007 Renesas Solutions Corp. 5 * Portions Copyright (C) 2004 Psion Teklogix (for NetBook PRO) 6 * Portions Copyright (C) 2004-2005 David Brownell 7 * Portions Copyright (C) 1999 Roman Weissgaerber 8 * --- 1004 unchanged lines hidden (view full) --- 1013static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port, 1014 int connect) 1015{ 1016 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1017 1018 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; 1019 rh->scount = R8A66597_MAX_SAMPLING; 1020 if (connect) | 1/* 2 * R8A66597 HCD (Host Controller Driver) 3 * 4 * Copyright (C) 2006-2007 Renesas Solutions Corp. 5 * Portions Copyright (C) 2004 Psion Teklogix (for NetBook PRO) 6 * Portions Copyright (C) 2004-2005 David Brownell 7 * Portions Copyright (C) 1999 Roman Weissgaerber 8 * --- 1004 unchanged lines hidden (view full) --- 1013static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port, 1014 int connect) 1015{ 1016 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1017 1018 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; 1019 rh->scount = R8A66597_MAX_SAMPLING; 1020 if (connect) |
1021 rh->port |= 1 << USB_PORT_FEAT_CONNECTION; | 1021 rh->port |= USB_PORT_STAT_CONNECTION; |
1022 else | 1022 else |
1023 rh->port &= ~(1 << USB_PORT_FEAT_CONNECTION); 1024 rh->port |= 1 << USB_PORT_FEAT_C_CONNECTION; | 1023 rh->port &= ~USB_PORT_STAT_CONNECTION; 1024 rh->port |= USB_PORT_STAT_C_CONNECTION << 16; |
1025 1026 r8a66597_root_hub_start_polling(r8a66597); 1027} 1028 1029/* this function must be called with interrupt disabled */ 1030static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port, 1031 u16 syssts) 1032__releases(r8a66597->lock) --- 27 unchanged lines hidden (view full) --- 1060 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1061 1062 rh->port &= ~(USB_PORT_STAT_HIGH_SPEED | USB_PORT_STAT_LOW_SPEED); 1063 if (speed == HSMODE) 1064 rh->port |= USB_PORT_STAT_HIGH_SPEED; 1065 else if (speed == LSMODE) 1066 rh->port |= USB_PORT_STAT_LOW_SPEED; 1067 | 1025 1026 r8a66597_root_hub_start_polling(r8a66597); 1027} 1028 1029/* this function must be called with interrupt disabled */ 1030static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port, 1031 u16 syssts) 1032__releases(r8a66597->lock) --- 27 unchanged lines hidden (view full) --- 1060 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1061 1062 rh->port &= ~(USB_PORT_STAT_HIGH_SPEED | USB_PORT_STAT_LOW_SPEED); 1063 if (speed == HSMODE) 1064 rh->port |= USB_PORT_STAT_HIGH_SPEED; 1065 else if (speed == LSMODE) 1066 rh->port |= USB_PORT_STAT_LOW_SPEED; 1067 |
1068 rh->port &= ~(1 << USB_PORT_FEAT_RESET); 1069 rh->port |= 1 << USB_PORT_FEAT_ENABLE; | 1068 rh->port &= USB_PORT_STAT_RESET; 1069 rh->port |= USB_PORT_STAT_ENABLE; |
1070} 1071 1072/* this function must be called with interrupt disabled */ 1073static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port) 1074{ 1075 struct r8a66597_device *dev = r8a66597->root_hub[port].dev; 1076 1077 disable_r8a66597_pipe_all(r8a66597, dev); --- 622 unchanged lines hidden (view full) --- 1700} 1701 1702/* this function must be called with interrupt disabled */ 1703static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) 1704{ 1705 u16 tmp; 1706 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1707 | 1070} 1071 1072/* this function must be called with interrupt disabled */ 1073static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port) 1074{ 1075 struct r8a66597_device *dev = r8a66597->root_hub[port].dev; 1076 1077 disable_r8a66597_pipe_all(r8a66597, dev); --- 622 unchanged lines hidden (view full) --- 1700} 1701 1702/* this function must be called with interrupt disabled */ 1703static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) 1704{ 1705 u16 tmp; 1706 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 1707 |
1708 if (rh->port & (1 << USB_PORT_FEAT_RESET)) { | 1708 if (rh->port & USB_PORT_STAT_RESET) { |
1709 unsigned long dvstctr_reg = get_dvstctr_reg(port); 1710 1711 tmp = r8a66597_read(r8a66597, dvstctr_reg); 1712 if ((tmp & USBRST) == USBRST) { 1713 r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, 1714 dvstctr_reg); 1715 r8a66597_root_hub_start_polling(r8a66597); 1716 } else 1717 r8a66597_usb_connect(r8a66597, port); 1718 } 1719 | 1709 unsigned long dvstctr_reg = get_dvstctr_reg(port); 1710 1711 tmp = r8a66597_read(r8a66597, dvstctr_reg); 1712 if ((tmp & USBRST) == USBRST) { 1713 r8a66597_mdfy(r8a66597, UACT, USBRST | UACT, 1714 dvstctr_reg); 1715 r8a66597_root_hub_start_polling(r8a66597); 1716 } else 1717 r8a66597_usb_connect(r8a66597, port); 1718 } 1719 |
1720 if (!(rh->port & (1 << USB_PORT_FEAT_CONNECTION))) { | 1720 if (!(rh->port & USB_PORT_STAT_CONNECTION)) { |
1721 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); 1722 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 1723 } 1724 1725 if (rh->scount > 0) { 1726 tmp = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; 1727 if (tmp == rh->old_syssts) { 1728 rh->scount--; --- 451 unchanged lines hidden (view full) --- 2180 case ClearPortFeature: 2181 if (wIndex > r8a66597->max_root_hub) 2182 goto error; 2183 if (wLength != 0) 2184 goto error; 2185 2186 switch (wValue) { 2187 case USB_PORT_FEAT_ENABLE: | 1721 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); 1722 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 1723 } 1724 1725 if (rh->scount > 0) { 1726 tmp = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; 1727 if (tmp == rh->old_syssts) { 1728 rh->scount--; --- 451 unchanged lines hidden (view full) --- 2180 case ClearPortFeature: 2181 if (wIndex > r8a66597->max_root_hub) 2182 goto error; 2183 if (wLength != 0) 2184 goto error; 2185 2186 switch (wValue) { 2187 case USB_PORT_FEAT_ENABLE: |
2188 rh->port &= ~(1 << USB_PORT_FEAT_POWER); | 2188 rh->port &= ~USB_PORT_STAT_POWER; |
2189 break; 2190 case USB_PORT_FEAT_SUSPEND: 2191 break; 2192 case USB_PORT_FEAT_POWER: 2193 r8a66597_port_power(r8a66597, port, 0); 2194 break; 2195 case USB_PORT_FEAT_C_ENABLE: 2196 case USB_PORT_FEAT_C_SUSPEND: --- 24 unchanged lines hidden (view full) --- 2221 if (wLength != 0) 2222 goto error; 2223 2224 switch (wValue) { 2225 case USB_PORT_FEAT_SUSPEND: 2226 break; 2227 case USB_PORT_FEAT_POWER: 2228 r8a66597_port_power(r8a66597, port, 1); | 2189 break; 2190 case USB_PORT_FEAT_SUSPEND: 2191 break; 2192 case USB_PORT_FEAT_POWER: 2193 r8a66597_port_power(r8a66597, port, 0); 2194 break; 2195 case USB_PORT_FEAT_C_ENABLE: 2196 case USB_PORT_FEAT_C_SUSPEND: --- 24 unchanged lines hidden (view full) --- 2221 if (wLength != 0) 2222 goto error; 2223 2224 switch (wValue) { 2225 case USB_PORT_FEAT_SUSPEND: 2226 break; 2227 case USB_PORT_FEAT_POWER: 2228 r8a66597_port_power(r8a66597, port, 1); |
2229 rh->port |= (1 << USB_PORT_FEAT_POWER); | 2229 rh->port |= USB_PORT_STAT_POWER; |
2230 break; 2231 case USB_PORT_FEAT_RESET: { 2232 struct r8a66597_device *dev = rh->dev; 2233 | 2230 break; 2231 case USB_PORT_FEAT_RESET: { 2232 struct r8a66597_device *dev = rh->dev; 2233 |
2234 rh->port |= (1 << USB_PORT_FEAT_RESET); | 2234 rh->port |= USB_PORT_STAT_RESET; |
2235 2236 disable_r8a66597_pipe_all(r8a66597, dev); 2237 free_usb_address(r8a66597, dev, 1); 2238 2239 r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, 2240 get_dvstctr_reg(port)); 2241 mod_timer(&r8a66597->rh_timer, 2242 jiffies + msecs_to_jiffies(50)); --- 21 unchanged lines hidden (view full) --- 2264 int port; 2265 2266 dbg("%s", __func__); 2267 2268 for (port = 0; port < r8a66597->max_root_hub; port++) { 2269 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2270 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2271 | 2235 2236 disable_r8a66597_pipe_all(r8a66597, dev); 2237 free_usb_address(r8a66597, dev, 1); 2238 2239 r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, 2240 get_dvstctr_reg(port)); 2241 mod_timer(&r8a66597->rh_timer, 2242 jiffies + msecs_to_jiffies(50)); --- 21 unchanged lines hidden (view full) --- 2264 int port; 2265 2266 dbg("%s", __func__); 2267 2268 for (port = 0; port < r8a66597->max_root_hub; port++) { 2269 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2270 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2271 |
2272 if (!(rh->port & (1 << USB_PORT_FEAT_ENABLE))) | 2272 if (!(rh->port & USB_PORT_STAT_ENABLE)) |
2273 continue; 2274 2275 dbg("suspend port = %d", port); 2276 r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */ | 2273 continue; 2274 2275 dbg("suspend port = %d", port); 2276 r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */ |
2277 rh->port |= 1 << USB_PORT_FEAT_SUSPEND; | 2277 rh->port |= USB_PORT_STAT_SUSPEND; |
2278 2279 if (rh->dev->udev->do_remote_wakeup) { 2280 msleep(3); /* waiting last SOF */ 2281 r8a66597_bset(r8a66597, RWUPE, dvstctr_reg); 2282 r8a66597_write(r8a66597, ~BCHG, get_intsts_reg(port)); 2283 r8a66597_bset(r8a66597, BCHGE, get_intenb_reg(port)); 2284 } 2285 } --- 9 unchanged lines hidden (view full) --- 2295 int port; 2296 2297 dbg("%s", __func__); 2298 2299 for (port = 0; port < r8a66597->max_root_hub; port++) { 2300 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2301 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2302 | 2278 2279 if (rh->dev->udev->do_remote_wakeup) { 2280 msleep(3); /* waiting last SOF */ 2281 r8a66597_bset(r8a66597, RWUPE, dvstctr_reg); 2282 r8a66597_write(r8a66597, ~BCHG, get_intsts_reg(port)); 2283 r8a66597_bset(r8a66597, BCHGE, get_intenb_reg(port)); 2284 } 2285 } --- 9 unchanged lines hidden (view full) --- 2295 int port; 2296 2297 dbg("%s", __func__); 2298 2299 for (port = 0; port < r8a66597->max_root_hub; port++) { 2300 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; 2301 unsigned long dvstctr_reg = get_dvstctr_reg(port); 2302 |
2303 if (!(rh->port & (1 << USB_PORT_FEAT_SUSPEND))) | 2303 if (!(rh->port & USB_PORT_STAT_SUSPEND)) |
2304 continue; 2305 2306 dbg("resume port = %d", port); | 2304 continue; 2305 2306 dbg("resume port = %d", port); |
2307 rh->port &= ~(1 << USB_PORT_FEAT_SUSPEND); 2308 rh->port |= 1 << USB_PORT_FEAT_C_SUSPEND; | 2307 rh->port &= ~USB_PORT_STAT_SUSPEND; 2308 rh->port |= USB_PORT_STAT_C_SUSPEND < 16; |
2309 r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); 2310 msleep(50); 2311 r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); 2312 } 2313 2314 return 0; 2315 2316} --- 253 unchanged lines hidden --- | 2309 r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); 2310 msleep(50); 2311 r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); 2312 } 2313 2314 return 0; 2315 2316} --- 253 unchanged lines hidden --- |