diff options
| -rw-r--r-- | drivers/parport/daisy.c | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c index fd41e28101ea..83ee095ec6e2 100644 --- a/drivers/parport/daisy.c +++ b/drivers/parport/daisy.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #undef DEBUG | 30 | #undef DEBUG |
| 31 | 31 | ||
| 32 | #ifdef DEBUG | 32 | #ifdef DEBUG |
| 33 | #define DPRINTK(stuff...) printk (stuff) | 33 | #define DPRINTK(stuff...) printk(stuff) |
| 34 | #else | 34 | #else |
| 35 | #define DPRINTK(stuff...) | 35 | #define DPRINTK(stuff...) |
| 36 | #endif | 36 | #endif |
| @@ -46,16 +46,16 @@ static DEFINE_SPINLOCK(topology_lock); | |||
| 46 | static int numdevs = 0; | 46 | static int numdevs = 0; |
| 47 | 47 | ||
| 48 | /* Forward-declaration of lower-level functions. */ | 48 | /* Forward-declaration of lower-level functions. */ |
| 49 | static int mux_present (struct parport *port); | 49 | static int mux_present(struct parport *port); |
| 50 | static int num_mux_ports (struct parport *port); | 50 | static int num_mux_ports(struct parport *port); |
| 51 | static int select_port (struct parport *port); | 51 | static int select_port(struct parport *port); |
| 52 | static int assign_addrs (struct parport *port); | 52 | static int assign_addrs(struct parport *port); |
| 53 | 53 | ||
| 54 | /* Add a device to the discovered topology. */ | 54 | /* Add a device to the discovered topology. */ |
| 55 | static void add_dev (int devnum, struct parport *port, int daisy) | 55 | static void add_dev(int devnum, struct parport *port, int daisy) |
| 56 | { | 56 | { |
| 57 | struct daisydev *newdev, **p; | 57 | struct daisydev *newdev, **p; |
| 58 | newdev = kmalloc (sizeof (struct daisydev), GFP_KERNEL); | 58 | newdev = kmalloc(sizeof(struct daisydev), GFP_KERNEL); |
| 59 | if (newdev) { | 59 | if (newdev) { |
| 60 | newdev->port = port; | 60 | newdev->port = port; |
| 61 | newdev->daisy = daisy; | 61 | newdev->daisy = daisy; |
| @@ -70,9 +70,9 @@ static void add_dev (int devnum, struct parport *port, int daisy) | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /* Clone a parport (actually, make an alias). */ | 72 | /* Clone a parport (actually, make an alias). */ |
| 73 | static struct parport *clone_parport (struct parport *real, int muxport) | 73 | static struct parport *clone_parport(struct parport *real, int muxport) |
| 74 | { | 74 | { |
| 75 | struct parport *extra = parport_register_port (real->base, | 75 | struct parport *extra = parport_register_port(real->base, |
| 76 | real->irq, | 76 | real->irq, |
| 77 | real->dma, | 77 | real->dma, |
| 78 | real->ops); | 78 | real->ops); |
| @@ -88,7 +88,7 @@ static struct parport *clone_parport (struct parport *real, int muxport) | |||
| 88 | 88 | ||
| 89 | /* Discover the IEEE1284.3 topology on a port -- muxes and daisy chains. | 89 | /* Discover the IEEE1284.3 topology on a port -- muxes and daisy chains. |
| 90 | * Return value is number of devices actually detected. */ | 90 | * Return value is number of devices actually detected. */ |
| 91 | int parport_daisy_init (struct parport *port) | 91 | int parport_daisy_init(struct parport *port) |
| 92 | { | 92 | { |
| 93 | int detected = 0; | 93 | int detected = 0; |
| 94 | char *deviceid; | 94 | char *deviceid; |
| @@ -103,26 +103,26 @@ again: | |||
| 103 | 103 | ||
| 104 | /* If mux present on normal port, need to create new | 104 | /* If mux present on normal port, need to create new |
| 105 | * parports for each extra port. */ | 105 | * parports for each extra port. */ |
| 106 | if (port->muxport < 0 && mux_present (port) && | 106 | if (port->muxport < 0 && mux_present(port) && |
| 107 | /* don't be fooled: a mux must have 2 or 4 ports. */ | 107 | /* don't be fooled: a mux must have 2 or 4 ports. */ |
| 108 | ((num_ports = num_mux_ports (port)) == 2 || num_ports == 4)) { | 108 | ((num_ports = num_mux_ports(port)) == 2 || num_ports == 4)) { |
| 109 | /* Leave original as port zero. */ | 109 | /* Leave original as port zero. */ |
| 110 | port->muxport = 0; | 110 | port->muxport = 0; |
| 111 | printk (KERN_INFO | 111 | printk(KERN_INFO |
| 112 | "%s: 1st (default) port of %d-way multiplexor\n", | 112 | "%s: 1st (default) port of %d-way multiplexor\n", |
| 113 | port->name, num_ports); | 113 | port->name, num_ports); |
| 114 | for (i = 1; i < num_ports; i++) { | 114 | for (i = 1; i < num_ports; i++) { |
| 115 | /* Clone the port. */ | 115 | /* Clone the port. */ |
| 116 | struct parport *extra = clone_parport (port, i); | 116 | struct parport *extra = clone_parport(port, i); |
| 117 | if (!extra) { | 117 | if (!extra) { |
| 118 | if (signal_pending (current)) | 118 | if (signal_pending(current)) |
| 119 | break; | 119 | break; |
| 120 | 120 | ||
| 121 | schedule (); | 121 | schedule(); |
| 122 | continue; | 122 | continue; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | printk (KERN_INFO | 125 | printk(KERN_INFO |
| 126 | "%s: %d%s port of %d-way multiplexor on %s\n", | 126 | "%s: %d%s port of %d-way multiplexor on %s\n", |
| 127 | extra->name, i + 1, th[i + 1], num_ports, | 127 | extra->name, i + 1, th[i + 1], num_ports, |
| 128 | port->name); | 128 | port->name); |
| @@ -135,34 +135,34 @@ again: | |||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | if (port->muxport >= 0) | 137 | if (port->muxport >= 0) |
| 138 | select_port (port); | 138 | select_port(port); |
| 139 | 139 | ||
| 140 | parport_daisy_deselect_all (port); | 140 | parport_daisy_deselect_all(port); |
| 141 | detected += assign_addrs (port); | 141 | detected += assign_addrs(port); |
| 142 | 142 | ||
| 143 | /* Count the potential legacy device at the end. */ | 143 | /* Count the potential legacy device at the end. */ |
| 144 | add_dev (numdevs++, port, -1); | 144 | add_dev(numdevs++, port, -1); |
| 145 | 145 | ||
| 146 | /* Find out the legacy device's IEEE 1284 device ID. */ | 146 | /* Find out the legacy device's IEEE 1284 device ID. */ |
| 147 | deviceid = kmalloc (1024, GFP_KERNEL); | 147 | deviceid = kmalloc(1024, GFP_KERNEL); |
| 148 | if (deviceid) { | 148 | if (deviceid) { |
| 149 | if (parport_device_id (numdevs - 1, deviceid, 1024) > 2) | 149 | if (parport_device_id(numdevs - 1, deviceid, 1024) > 2) |
| 150 | detected++; | 150 | detected++; |
| 151 | 151 | ||
| 152 | kfree (deviceid); | 152 | kfree(deviceid); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | if (!detected && !last_try) { | 155 | if (!detected && !last_try) { |
| 156 | /* No devices were detected. Perhaps they are in some | 156 | /* No devices were detected. Perhaps they are in some |
| 157 | funny state; let's try to reset them and see if | 157 | funny state; let's try to reset them and see if |
| 158 | they wake up. */ | 158 | they wake up. */ |
| 159 | parport_daisy_fini (port); | 159 | parport_daisy_fini(port); |
| 160 | parport_write_control (port, PARPORT_CONTROL_SELECT); | 160 | parport_write_control(port, PARPORT_CONTROL_SELECT); |
| 161 | udelay (50); | 161 | udelay(50); |
| 162 | parport_write_control (port, | 162 | parport_write_control(port, |
| 163 | PARPORT_CONTROL_SELECT | | 163 | PARPORT_CONTROL_SELECT | |
| 164 | PARPORT_CONTROL_INIT); | 164 | PARPORT_CONTROL_INIT); |
| 165 | udelay (50); | 165 | udelay(50); |
| 166 | last_try = 1; | 166 | last_try = 1; |
| 167 | goto again; | 167 | goto again; |
| 168 | } | 168 | } |
| @@ -171,7 +171,7 @@ again: | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /* Forget about devices on a physical port. */ | 173 | /* Forget about devices on a physical port. */ |
| 174 | void parport_daisy_fini (struct parport *port) | 174 | void parport_daisy_fini(struct parport *port) |
| 175 | { | 175 | { |
| 176 | struct daisydev **p; | 176 | struct daisydev **p; |
| 177 | 177 | ||
| @@ -214,7 +214,7 @@ void parport_daisy_fini (struct parport *port) | |||
| 214 | * for parport_register_device(). | 214 | * for parport_register_device(). |
| 215 | **/ | 215 | **/ |
| 216 | 216 | ||
| 217 | struct pardevice *parport_open (int devnum, const char *name, | 217 | struct pardevice *parport_open(int devnum, const char *name, |
| 218 | int (*pf) (void *), void (*kf) (void *), | 218 | int (*pf) (void *), void (*kf) (void *), |
| 219 | void (*irqf) (int, void *, struct pt_regs *), | 219 | void (*irqf) (int, void *, struct pt_regs *), |
| 220 | int flags, void *handle) | 220 | int flags, void *handle) |
| @@ -237,7 +237,7 @@ struct pardevice *parport_open (int devnum, const char *name, | |||
| 237 | port = parport_get_port(p->port); | 237 | port = parport_get_port(p->port); |
| 238 | spin_unlock(&topology_lock); | 238 | spin_unlock(&topology_lock); |
| 239 | 239 | ||
| 240 | dev = parport_register_device (port, name, pf, kf, | 240 | dev = parport_register_device(port, name, pf, kf, |
| 241 | irqf, flags, handle); | 241 | irqf, flags, handle); |
| 242 | parport_put_port(port); | 242 | parport_put_port(port); |
| 243 | if (!dev) | 243 | if (!dev) |
| @@ -248,13 +248,13 @@ struct pardevice *parport_open (int devnum, const char *name, | |||
| 248 | /* Check that there really is a device to select. */ | 248 | /* Check that there really is a device to select. */ |
| 249 | if (daisy >= 0) { | 249 | if (daisy >= 0) { |
| 250 | int selected; | 250 | int selected; |
| 251 | parport_claim_or_block (dev); | 251 | parport_claim_or_block(dev); |
| 252 | selected = port->daisy; | 252 | selected = port->daisy; |
| 253 | parport_release (dev); | 253 | parport_release(dev); |
| 254 | 254 | ||
| 255 | if (selected != daisy) { | 255 | if (selected != daisy) { |
| 256 | /* No corresponding device. */ | 256 | /* No corresponding device. */ |
| 257 | parport_unregister_device (dev); | 257 | parport_unregister_device(dev); |
| 258 | return NULL; | 258 | return NULL; |
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| @@ -270,9 +270,9 @@ struct pardevice *parport_open (int devnum, const char *name, | |||
| 270 | * parport_register_device(). | 270 | * parport_register_device(). |
| 271 | **/ | 271 | **/ |
| 272 | 272 | ||
| 273 | void parport_close (struct pardevice *dev) | 273 | void parport_close(struct pardevice *dev) |
| 274 | { | 274 | { |
| 275 | parport_unregister_device (dev); | 275 | parport_unregister_device(dev); |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | /** | 278 | /** |
| @@ -287,7 +287,7 @@ void parport_close (struct pardevice *dev) | |||
| 287 | * exists. | 287 | * exists. |
| 288 | **/ | 288 | **/ |
| 289 | 289 | ||
| 290 | int parport_device_num (int parport, int mux, int daisy) | 290 | int parport_device_num(int parport, int mux, int daisy) |
| 291 | { | 291 | { |
| 292 | int res = -ENXIO; | 292 | int res = -ENXIO; |
| 293 | struct daisydev *dev; | 293 | struct daisydev *dev; |
| @@ -305,16 +305,16 @@ int parport_device_num (int parport, int mux, int daisy) | |||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | /* Send a daisy-chain-style CPP command packet. */ | 307 | /* Send a daisy-chain-style CPP command packet. */ |
| 308 | static int cpp_daisy (struct parport *port, int cmd) | 308 | static int cpp_daisy(struct parport *port, int cmd) |
| 309 | { | 309 | { |
| 310 | unsigned char s; | 310 | unsigned char s; |
| 311 | 311 | ||
| 312 | parport_data_forward (port); | 312 | parport_data_forward(port); |
| 313 | parport_write_data (port, 0xaa); udelay (2); | 313 | parport_write_data(port, 0xaa); udelay(2); |
| 314 | parport_write_data (port, 0x55); udelay (2); | 314 | parport_write_data(port, 0x55); udelay(2); |
| 315 | parport_write_data (port, 0x00); udelay (2); | 315 | parport_write_data(port, 0x00); udelay(2); |
| 316 | parport_write_data (port, 0xff); udelay (2); | 316 | parport_write_data(port, 0xff); udelay(2); |
| 317 | s = parport_read_status (port) & (PARPORT_STATUS_BUSY | 317 | s = parport_read_status(port) & (PARPORT_STATUS_BUSY |
| 318 | | PARPORT_STATUS_PAPEROUT | 318 | | PARPORT_STATUS_PAPEROUT |
| 319 | | PARPORT_STATUS_SELECT | 319 | | PARPORT_STATUS_SELECT |
| 320 | | PARPORT_STATUS_ERROR); | 320 | | PARPORT_STATUS_ERROR); |
| @@ -322,54 +322,54 @@ static int cpp_daisy (struct parport *port, int cmd) | |||
| 322 | | PARPORT_STATUS_PAPEROUT | 322 | | PARPORT_STATUS_PAPEROUT |
| 323 | | PARPORT_STATUS_SELECT | 323 | | PARPORT_STATUS_SELECT |
| 324 | | PARPORT_STATUS_ERROR)) { | 324 | | PARPORT_STATUS_ERROR)) { |
| 325 | DPRINTK (KERN_DEBUG "%s: cpp_daisy: aa5500ff(%02x)\n", | 325 | DPRINTK(KERN_DEBUG "%s: cpp_daisy: aa5500ff(%02x)\n", |
| 326 | port->name, s); | 326 | port->name, s); |
| 327 | return -ENXIO; | 327 | return -ENXIO; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | parport_write_data (port, 0x87); udelay (2); | 330 | parport_write_data(port, 0x87); udelay(2); |
| 331 | s = parport_read_status (port) & (PARPORT_STATUS_BUSY | 331 | s = parport_read_status(port) & (PARPORT_STATUS_BUSY |
| 332 | | PARPORT_STATUS_PAPEROUT | 332 | | PARPORT_STATUS_PAPEROUT |
| 333 | | PARPORT_STATUS_SELECT | 333 | | PARPORT_STATUS_SELECT |
| 334 | | PARPORT_STATUS_ERROR); | 334 | | PARPORT_STATUS_ERROR); |
| 335 | if (s != (PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { | 335 | if (s != (PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { |
| 336 | DPRINTK (KERN_DEBUG "%s: cpp_daisy: aa5500ff87(%02x)\n", | 336 | DPRINTK(KERN_DEBUG "%s: cpp_daisy: aa5500ff87(%02x)\n", |
| 337 | port->name, s); | 337 | port->name, s); |
| 338 | return -ENXIO; | 338 | return -ENXIO; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | parport_write_data (port, 0x78); udelay (2); | 341 | parport_write_data(port, 0x78); udelay(2); |
| 342 | parport_write_data (port, cmd); udelay (2); | 342 | parport_write_data(port, cmd); udelay(2); |
| 343 | parport_frob_control (port, | 343 | parport_frob_control(port, |
| 344 | PARPORT_CONTROL_STROBE, | 344 | PARPORT_CONTROL_STROBE, |
| 345 | PARPORT_CONTROL_STROBE); | 345 | PARPORT_CONTROL_STROBE); |
| 346 | udelay (1); | 346 | udelay(1); |
| 347 | s = parport_read_status (port); | 347 | s = parport_read_status(port); |
| 348 | parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); | 348 | parport_frob_control(port, PARPORT_CONTROL_STROBE, 0); |
| 349 | udelay (1); | 349 | udelay(1); |
| 350 | parport_write_data (port, 0xff); udelay (2); | 350 | parport_write_data(port, 0xff); udelay(2); |
| 351 | 351 | ||
| 352 | return s; | 352 | return s; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | /* Send a mux-style CPP command packet. */ | 355 | /* Send a mux-style CPP command packet. */ |
| 356 | static int cpp_mux (struct parport *port, int cmd) | 356 | static int cpp_mux(struct parport *port, int cmd) |
| 357 | { | 357 | { |
| 358 | unsigned char s; | 358 | unsigned char s; |
| 359 | int rc; | 359 | int rc; |
| 360 | 360 | ||
| 361 | parport_data_forward (port); | 361 | parport_data_forward(port); |
| 362 | parport_write_data (port, 0xaa); udelay (2); | 362 | parport_write_data(port, 0xaa); udelay(2); |
| 363 | parport_write_data (port, 0x55); udelay (2); | 363 | parport_write_data(port, 0x55); udelay(2); |
| 364 | parport_write_data (port, 0xf0); udelay (2); | 364 | parport_write_data(port, 0xf0); udelay(2); |
| 365 | parport_write_data (port, 0x0f); udelay (2); | 365 | parport_write_data(port, 0x0f); udelay(2); |
| 366 | parport_write_data (port, 0x52); udelay (2); | 366 | parport_write_data(port, 0x52); udelay(2); |
| 367 | parport_write_data (port, 0xad); udelay (2); | 367 | parport_write_data(port, 0xad); udelay(2); |
| 368 | parport_write_data (port, cmd); udelay (2); | 368 | parport_write_data(port, cmd); udelay(2); |
| 369 | 369 | ||
| 370 | s = parport_read_status (port); | 370 | s = parport_read_status(port); |
| 371 | if (!(s & PARPORT_STATUS_ACK)) { | 371 | if (!(s & PARPORT_STATUS_ACK)) { |
| 372 | DPRINTK (KERN_DEBUG "%s: cpp_mux: aa55f00f52ad%02x(%02x)\n", | 372 | DPRINTK(KERN_DEBUG "%s: cpp_mux: aa55f00f52ad%02x(%02x)\n", |
| 373 | port->name, cmd, s); | 373 | port->name, cmd, s); |
| 374 | return -EIO; | 374 | return -EIO; |
| 375 | } | 375 | } |
| @@ -382,12 +382,12 @@ static int cpp_mux (struct parport *port, int cmd) | |||
| 382 | return rc; | 382 | return rc; |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | void parport_daisy_deselect_all (struct parport *port) | 385 | void parport_daisy_deselect_all(struct parport *port) |
| 386 | { | 386 | { |
| 387 | cpp_daisy (port, 0x30); | 387 | cpp_daisy(port, 0x30); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | int parport_daisy_select (struct parport *port, int daisy, int mode) | 390 | int parport_daisy_select(struct parport *port, int daisy, int mode) |
| 391 | { | 391 | { |
| 392 | switch (mode) | 392 | switch (mode) |
| 393 | { | 393 | { |
| @@ -395,14 +395,14 @@ int parport_daisy_select (struct parport *port, int daisy, int mode) | |||
| 395 | case IEEE1284_MODE_EPP: | 395 | case IEEE1284_MODE_EPP: |
| 396 | case IEEE1284_MODE_EPPSL: | 396 | case IEEE1284_MODE_EPPSL: |
| 397 | case IEEE1284_MODE_EPPSWE: | 397 | case IEEE1284_MODE_EPPSWE: |
| 398 | return !(cpp_daisy (port, 0x20 + daisy) & | 398 | return !(cpp_daisy(port, 0x20 + daisy) & |
| 399 | PARPORT_STATUS_ERROR); | 399 | PARPORT_STATUS_ERROR); |
| 400 | 400 | ||
| 401 | // For these modes we should switch to ECP mode: | 401 | // For these modes we should switch to ECP mode: |
| 402 | case IEEE1284_MODE_ECP: | 402 | case IEEE1284_MODE_ECP: |
| 403 | case IEEE1284_MODE_ECPRLE: | 403 | case IEEE1284_MODE_ECPRLE: |
| 404 | case IEEE1284_MODE_ECPSWE: | 404 | case IEEE1284_MODE_ECPSWE: |
| 405 | return !(cpp_daisy (port, 0xd0 + daisy) & | 405 | return !(cpp_daisy(port, 0xd0 + daisy) & |
| 406 | PARPORT_STATUS_ERROR); | 406 | PARPORT_STATUS_ERROR); |
| 407 | 407 | ||
| 408 | // Nothing was told for BECP in Daisy chain specification. | 408 | // Nothing was told for BECP in Daisy chain specification. |
| @@ -413,28 +413,28 @@ int parport_daisy_select (struct parport *port, int daisy, int mode) | |||
| 413 | case IEEE1284_MODE_BYTE: | 413 | case IEEE1284_MODE_BYTE: |
| 414 | case IEEE1284_MODE_COMPAT: | 414 | case IEEE1284_MODE_COMPAT: |
| 415 | default: | 415 | default: |
| 416 | return !(cpp_daisy (port, 0xe0 + daisy) & | 416 | return !(cpp_daisy(port, 0xe0 + daisy) & |
| 417 | PARPORT_STATUS_ERROR); | 417 | PARPORT_STATUS_ERROR); |
| 418 | } | 418 | } |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | static int mux_present (struct parport *port) | 421 | static int mux_present(struct parport *port) |
| 422 | { | 422 | { |
| 423 | return cpp_mux (port, 0x51) == 3; | 423 | return cpp_mux(port, 0x51) == 3; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | static int num_mux_ports (struct parport *port) | 426 | static int num_mux_ports(struct parport *port) |
| 427 | { | 427 | { |
| 428 | return cpp_mux (port, 0x58); | 428 | return cpp_mux(port, 0x58); |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | static int select_port (struct parport *port) | 431 | static int select_port(struct parport *port) |
| 432 | { | 432 | { |
| 433 | int muxport = port->muxport; | 433 | int muxport = port->muxport; |
| 434 | return cpp_mux (port, 0x60 + muxport) == muxport; | 434 | return cpp_mux(port, 0x60 + muxport) == muxport; |
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | static int assign_addrs (struct parport *port) | 437 | static int assign_addrs(struct parport *port) |
| 438 | { | 438 | { |
| 439 | unsigned char s; | 439 | unsigned char s; |
| 440 | unsigned char daisy; | 440 | unsigned char daisy; |
| @@ -442,12 +442,12 @@ static int assign_addrs (struct parport *port) | |||
| 442 | int detected; | 442 | int detected; |
| 443 | char *deviceid; | 443 | char *deviceid; |
| 444 | 444 | ||
| 445 | parport_data_forward (port); | 445 | parport_data_forward(port); |
| 446 | parport_write_data (port, 0xaa); udelay (2); | 446 | parport_write_data(port, 0xaa); udelay(2); |
| 447 | parport_write_data (port, 0x55); udelay (2); | 447 | parport_write_data(port, 0x55); udelay(2); |
| 448 | parport_write_data (port, 0x00); udelay (2); | 448 | parport_write_data(port, 0x00); udelay(2); |
| 449 | parport_write_data (port, 0xff); udelay (2); | 449 | parport_write_data(port, 0xff); udelay(2); |
| 450 | s = parport_read_status (port) & (PARPORT_STATUS_BUSY | 450 | s = parport_read_status(port) & (PARPORT_STATUS_BUSY |
| 451 | | PARPORT_STATUS_PAPEROUT | 451 | | PARPORT_STATUS_PAPEROUT |
| 452 | | PARPORT_STATUS_SELECT | 452 | | PARPORT_STATUS_SELECT |
| 453 | | PARPORT_STATUS_ERROR); | 453 | | PARPORT_STATUS_ERROR); |
| @@ -455,40 +455,40 @@ static int assign_addrs (struct parport *port) | |||
| 455 | | PARPORT_STATUS_PAPEROUT | 455 | | PARPORT_STATUS_PAPEROUT |
| 456 | | PARPORT_STATUS_SELECT | 456 | | PARPORT_STATUS_SELECT |
| 457 | | PARPORT_STATUS_ERROR)) { | 457 | | PARPORT_STATUS_ERROR)) { |
| 458 | DPRINTK (KERN_DEBUG "%s: assign_addrs: aa5500ff(%02x)\n", | 458 | DPRINTK(KERN_DEBUG "%s: assign_addrs: aa5500ff(%02x)\n", |
| 459 | port->name, s); | 459 | port->name, s); |
| 460 | return 0; | 460 | return 0; |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | parport_write_data (port, 0x87); udelay (2); | 463 | parport_write_data(port, 0x87); udelay(2); |
| 464 | s = parport_read_status (port) & (PARPORT_STATUS_BUSY | 464 | s = parport_read_status(port) & (PARPORT_STATUS_BUSY |
| 465 | | PARPORT_STATUS_PAPEROUT | 465 | | PARPORT_STATUS_PAPEROUT |
| 466 | | PARPORT_STATUS_SELECT | 466 | | PARPORT_STATUS_SELECT |
| 467 | | PARPORT_STATUS_ERROR); | 467 | | PARPORT_STATUS_ERROR); |
| 468 | if (s != (PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { | 468 | if (s != (PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { |
| 469 | DPRINTK (KERN_DEBUG "%s: assign_addrs: aa5500ff87(%02x)\n", | 469 | DPRINTK(KERN_DEBUG "%s: assign_addrs: aa5500ff87(%02x)\n", |
| 470 | port->name, s); | 470 | port->name, s); |
| 471 | return 0; | 471 | return 0; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | parport_write_data (port, 0x78); udelay (2); | 474 | parport_write_data(port, 0x78); udelay(2); |
| 475 | s = parport_read_status (port); | 475 | s = parport_read_status(port); |
| 476 | 476 | ||
| 477 | for (daisy = 0; | 477 | for (daisy = 0; |
| 478 | (s & (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT)) | 478 | (s & (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT)) |
| 479 | == (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT) | 479 | == (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT) |
| 480 | && daisy < 4; | 480 | && daisy < 4; |
| 481 | ++daisy) { | 481 | ++daisy) { |
| 482 | parport_write_data (port, daisy); | 482 | parport_write_data(port, daisy); |
| 483 | udelay (2); | 483 | udelay(2); |
| 484 | parport_frob_control (port, | 484 | parport_frob_control(port, |
| 485 | PARPORT_CONTROL_STROBE, | 485 | PARPORT_CONTROL_STROBE, |
| 486 | PARPORT_CONTROL_STROBE); | 486 | PARPORT_CONTROL_STROBE); |
| 487 | udelay (1); | 487 | udelay(1); |
| 488 | parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); | 488 | parport_frob_control(port, PARPORT_CONTROL_STROBE, 0); |
| 489 | udelay (1); | 489 | udelay(1); |
| 490 | 490 | ||
| 491 | add_dev (numdevs++, port, daisy); | 491 | add_dev(numdevs++, port, daisy); |
| 492 | 492 | ||
| 493 | /* See if this device thought it was the last in the | 493 | /* See if this device thought it was the last in the |
| 494 | * chain. */ | 494 | * chain. */ |
| @@ -499,21 +499,21 @@ static int assign_addrs (struct parport *port) | |||
| 499 | last_dev from next device or if last_dev does not | 499 | last_dev from next device or if last_dev does not |
| 500 | work status lines from some non-daisy chain | 500 | work status lines from some non-daisy chain |
| 501 | device. */ | 501 | device. */ |
| 502 | s = parport_read_status (port); | 502 | s = parport_read_status(port); |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | parport_write_data (port, 0xff); udelay (2); | 505 | parport_write_data(port, 0xff); udelay(2); |
| 506 | detected = numdevs - thisdev; | 506 | detected = numdevs - thisdev; |
| 507 | DPRINTK (KERN_DEBUG "%s: Found %d daisy-chained devices\n", port->name, | 507 | DPRINTK(KERN_DEBUG "%s: Found %d daisy-chained devices\n", port->name, |
| 508 | detected); | 508 | detected); |
| 509 | 509 | ||
| 510 | /* Ask the new devices to introduce themselves. */ | 510 | /* Ask the new devices to introduce themselves. */ |
| 511 | deviceid = kmalloc (1024, GFP_KERNEL); | 511 | deviceid = kmalloc(1024, GFP_KERNEL); |
| 512 | if (!deviceid) return 0; | 512 | if (!deviceid) return 0; |
| 513 | 513 | ||
| 514 | for (daisy = 0; thisdev < numdevs; thisdev++, daisy++) | 514 | for (daisy = 0; thisdev < numdevs; thisdev++, daisy++) |
| 515 | parport_device_id (thisdev, deviceid, 1024); | 515 | parport_device_id(thisdev, deviceid, 1024); |
| 516 | 516 | ||
| 517 | kfree (deviceid); | 517 | kfree(deviceid); |
| 518 | return detected; | 518 | return detected; |
| 519 | } | 519 | } |
