diff options
author | Linus Walleij <triad@df.lth.se> | 2006-04-14 19:03:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-04-14 19:03:33 -0400 |
commit | 08d099974a09faf4cb11ffc46da87073fa132fc0 (patch) | |
tree | f02654cce99a34216192501edcc319fefc08d036 /drivers | |
parent | 269690ac164fc0a7c2de03e7e0d2f554104d1516 (diff) |
[IRDA]: smsc-ircc2, smcinit support for ALi ISA bridges
From: Linus Walleij <triad@df.lth.se>
This patch enables support for ALi ISA bridges when we run the smcinit
code. It is needed to properly configure some Toshiba laptops.
Signed-off-by: Samuel Ortiz <samuel.ortiz@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 316 |
1 files changed, 264 insertions, 52 deletions
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index bbcfc8ec35a1..58f76cefbc83 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -225,6 +225,8 @@ static int __init smsc_superio_lpc(unsigned short cfg_base); | |||
225 | #ifdef CONFIG_PCI | 225 | #ifdef CONFIG_PCI |
226 | static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); | 226 | static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); |
227 | static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); | 227 | static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); |
228 | static void __init preconfigure_ali_port(struct pci_dev *dev, | ||
229 | unsigned short port); | ||
228 | static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); | 230 | static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); |
229 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | 231 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, |
230 | unsigned short ircc_fir, | 232 | unsigned short ircc_fir, |
@@ -2327,9 +2329,14 @@ static int __init smsc_superio_lpc(unsigned short cfg_base) | |||
2327 | * pre-configuration not properly done by the BIOS (especially laptops) | 2329 | * pre-configuration not properly done by the BIOS (especially laptops) |
2328 | * This code is based in part on smcinit.c, tosh1800-smcinit.c | 2330 | * This code is based in part on smcinit.c, tosh1800-smcinit.c |
2329 | * and tosh2450-smcinit.c. The table lists the device entries | 2331 | * and tosh2450-smcinit.c. The table lists the device entries |
2330 | * for ISA bridges with an LPC (Local Peripheral Configurator) | 2332 | * for ISA bridges with an LPC (Low Pin Count) controller which |
2331 | * that are in turn used to configure the SMSC device with default | 2333 | * handles the communication with the SMSC device. After the LPC |
2332 | * SIR and FIR I/O ports, DMA and IRQ. | 2334 | * controller is initialized through PCI, the SMSC device is initialized |
2335 | * through a dedicated port in the ISA port-mapped I/O area, this latter | ||
2336 | * area is used to configure the SMSC device with default | ||
2337 | * SIR and FIR I/O ports, DMA and IRQ. Different vendors have | ||
2338 | * used different sets of parameters and different control port | ||
2339 | * addresses making a subsystem device table necessary. | ||
2333 | */ | 2340 | */ |
2334 | #ifdef CONFIG_PCI | 2341 | #ifdef CONFIG_PCI |
2335 | #define PCIID_VENDOR_INTEL 0x8086 | 2342 | #define PCIID_VENDOR_INTEL 0x8086 |
@@ -2340,9 +2347,10 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __dev | |||
2340 | .device = 0x24cc, | 2347 | .device = 0x24cc, |
2341 | .subvendor = 0x103c, | 2348 | .subvendor = 0x103c, |
2342 | .subdevice = 0x088c, | 2349 | .subdevice = 0x088c, |
2343 | .sir_io = 0x02f8, /* Quite certain these are the same for nc8000 as for nc6000 */ | 2350 | /* Quite certain these are the same for nc8000 as for nc6000 */ |
2351 | .sir_io = 0x02f8, | ||
2344 | .fir_io = 0x0130, | 2352 | .fir_io = 0x0130, |
2345 | .fir_irq = 0x09, | 2353 | .fir_irq = 0x05, |
2346 | .fir_dma = 0x03, | 2354 | .fir_dma = 0x03, |
2347 | .cfg_base = 0x004e, | 2355 | .cfg_base = 0x004e, |
2348 | .preconfigure = preconfigure_through_82801, | 2356 | .preconfigure = preconfigure_through_82801, |
@@ -2355,60 +2363,79 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __dev | |||
2355 | .subdevice = 0x0890, | 2363 | .subdevice = 0x0890, |
2356 | .sir_io = 0x02f8, | 2364 | .sir_io = 0x02f8, |
2357 | .fir_io = 0x0130, | 2365 | .fir_io = 0x0130, |
2358 | .fir_irq = 0x09, | 2366 | .fir_irq = 0x05, |
2359 | .fir_dma = 0x03, | 2367 | .fir_dma = 0x03, |
2360 | .cfg_base = 0x004e, | 2368 | .cfg_base = 0x004e, |
2361 | .preconfigure = preconfigure_through_82801, | 2369 | .preconfigure = preconfigure_through_82801, |
2362 | .name = "HP nc6000", | 2370 | .name = "HP nc6000", |
2363 | }, | 2371 | }, |
2364 | { | 2372 | { |
2365 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ | 2373 | /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ |
2374 | .vendor = PCIID_VENDOR_INTEL, | ||
2366 | .device = 0x24c0, | 2375 | .device = 0x24c0, |
2367 | .subvendor = 0x1179, | 2376 | .subvendor = 0x1179, |
2368 | .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ | 2377 | .subdevice = 0xffff, /* 0xffff is "any" */ |
2369 | .sir_io = 0x03f8, | 2378 | .sir_io = 0x03f8, |
2370 | .fir_io = 0x0130, | 2379 | .fir_io = 0x0130, |
2371 | .fir_irq = 0x07, | 2380 | .fir_irq = 0x07, |
2372 | .fir_dma = 0x01, | 2381 | .fir_dma = 0x01, |
2373 | .cfg_base = 0x002e, | 2382 | .cfg_base = 0x002e, |
2374 | .preconfigure = preconfigure_through_82801, | 2383 | .preconfigure = preconfigure_through_82801, |
2375 | .name = "Toshiba Satellite 2450", | 2384 | .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge", |
2376 | }, | 2385 | }, |
2377 | { | 2386 | { |
2378 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */ | 2387 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */ |
2379 | .device = 0x248c, /* Some use 24cc? */ | 2388 | .device = 0x248c, |
2380 | .subvendor = 0x1179, | 2389 | .subvendor = 0x1179, |
2381 | .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ | 2390 | .subdevice = 0xffff, /* 0xffff is "any" */ |
2382 | .sir_io = 0x03f8, | 2391 | .sir_io = 0x03f8, |
2383 | .fir_io = 0x0130, | 2392 | .fir_io = 0x0130, |
2384 | .fir_irq = 0x03, | 2393 | .fir_irq = 0x03, |
2385 | .fir_dma = 0x03, | 2394 | .fir_dma = 0x03, |
2386 | .cfg_base = 0x002e, | 2395 | .cfg_base = 0x002e, |
2387 | .preconfigure = preconfigure_through_82801, | 2396 | .preconfigure = preconfigure_through_82801, |
2388 | .name = "Toshiba Satellite 5100/5200, Tecra 9100", | 2397 | .name = "Toshiba laptop with Intel 82801CAM ISA bridge", |
2389 | }, | 2398 | }, |
2390 | { | 2399 | { |
2391 | .vendor = PCIID_VENDOR_ALI, /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */ | 2400 | /* 82801DBM (ICH4-M) LPC Interface Bridge */ |
2401 | .vendor = PCIID_VENDOR_INTEL, | ||
2402 | .device = 0x24cc, | ||
2403 | .subvendor = 0x1179, | ||
2404 | .subdevice = 0xffff, /* 0xffff is "any" */ | ||
2405 | .sir_io = 0x03f8, | ||
2406 | .fir_io = 0x0130, | ||
2407 | .fir_irq = 0x03, | ||
2408 | .fir_dma = 0x03, | ||
2409 | .cfg_base = 0x002e, | ||
2410 | .preconfigure = preconfigure_through_82801, | ||
2411 | .name = "Toshiba laptop with Intel 8281DBM LPC bridge", | ||
2412 | }, | ||
2413 | { | ||
2414 | /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */ | ||
2415 | .vendor = PCIID_VENDOR_ALI, | ||
2392 | .device = 0x1533, | 2416 | .device = 0x1533, |
2393 | .subvendor = 0x1179, | 2417 | .subvendor = 0x1179, |
2394 | .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */ | 2418 | .subdevice = 0xffff, /* 0xffff is "any" */ |
2395 | .sir_io = 0x02e8, | 2419 | .sir_io = 0x02e8, |
2396 | .fir_io = 0x02f8, | 2420 | .fir_io = 0x02f8, |
2397 | .fir_irq = 0x07, | 2421 | .fir_irq = 0x07, |
2398 | .fir_dma = 0x03, | 2422 | .fir_dma = 0x03, |
2399 | .cfg_base = 0x002e, | 2423 | .cfg_base = 0x002e, |
2400 | .preconfigure = preconfigure_through_ali, | 2424 | .preconfigure = preconfigure_through_ali, |
2401 | .name = "Toshiba Satellite 1800", | 2425 | .name = "Toshiba laptop with ALi ISA bridge", |
2402 | }, | 2426 | }, |
2403 | { } // Terminator | 2427 | { } // Terminator |
2404 | }; | 2428 | }; |
2405 | 2429 | ||
2406 | 2430 | ||
2407 | /* | 2431 | /* |
2408 | * This sets up the basic SMSC parameters (FIR port, SIR port, FIR DMA, FIR IRQ) | 2432 | * This sets up the basic SMSC parameters |
2433 | * (FIR port, SIR port, FIR DMA, FIR IRQ) | ||
2409 | * through the chip configuration port. | 2434 | * through the chip configuration port. |
2410 | */ | 2435 | */ |
2411 | static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf) | 2436 | static int __init preconfigure_smsc_chip(struct |
2437 | smsc_ircc_subsystem_configuration | ||
2438 | *conf) | ||
2412 | { | 2439 | { |
2413 | unsigned short iobase = conf->cfg_base; | 2440 | unsigned short iobase = conf->cfg_base; |
2414 | unsigned char tmpbyte; | 2441 | unsigned char tmpbyte; |
@@ -2416,7 +2443,9 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio | |||
2416 | outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state | 2443 | outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state |
2417 | outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID | 2444 | outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID |
2418 | tmpbyte = inb(iobase +1); // Read device ID | 2445 | tmpbyte = inb(iobase +1); // Read device ID |
2419 | IRDA_DEBUG(0, "Detected Chip id: 0x%02x, setting up registers...\n",tmpbyte); | 2446 | IRDA_DEBUG(0, |
2447 | "Detected Chip id: 0x%02x, setting up registers...\n", | ||
2448 | tmpbyte); | ||
2420 | 2449 | ||
2421 | /* Disable UART1 and set up SIR I/O port */ | 2450 | /* Disable UART1 and set up SIR I/O port */ |
2422 | outb(0x24, iobase); // select CR24 - UART1 base addr | 2451 | outb(0x24, iobase); // select CR24 - UART1 base addr |
@@ -2426,6 +2455,7 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio | |||
2426 | tmpbyte = inb(iobase + 1); | 2455 | tmpbyte = inb(iobase + 1); |
2427 | if (tmpbyte != (conf->sir_io >> 2) ) { | 2456 | if (tmpbyte != (conf->sir_io >> 2) ) { |
2428 | IRDA_WARNING("ERROR: could not configure SIR ioport.\n"); | 2457 | IRDA_WARNING("ERROR: could not configure SIR ioport.\n"); |
2458 | IRDA_WARNING("Try to supply ircc_cfg argument.\n"); | ||
2429 | return -ENXIO; | 2459 | return -ENXIO; |
2430 | } | 2460 | } |
2431 | 2461 | ||
@@ -2461,7 +2491,8 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio | |||
2461 | 2491 | ||
2462 | outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode | 2492 | outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode |
2463 | tmpbyte = inb(iobase + 1); | 2493 | tmpbyte = inb(iobase + 1); |
2464 | tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK | SMSCSIOFLAT_UART2MODE_VAL_IRDA; | 2494 | tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK | |
2495 | SMSCSIOFLAT_UART2MODE_VAL_IRDA; | ||
2465 | outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed | 2496 | outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed |
2466 | 2497 | ||
2467 | outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel | 2498 | outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel |
@@ -2486,53 +2517,226 @@ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuratio | |||
2486 | return 0; | 2517 | return 0; |
2487 | } | 2518 | } |
2488 | 2519 | ||
2489 | /* 82801CAM registers */ | 2520 | /* 82801CAM generic registers */ |
2490 | #define VID 0x00 | 2521 | #define VID 0x00 |
2491 | #define DID 0x02 | 2522 | #define DID 0x02 |
2492 | #define PIRQA_ROUT 0x60 | 2523 | #define PIRQ_A_D_ROUT 0x60 |
2524 | #define SIRQ_CNTL 0x64 | ||
2525 | #define PIRQ_E_H_ROUT 0x68 | ||
2493 | #define PCI_DMA_C 0x90 | 2526 | #define PCI_DMA_C 0x90 |
2527 | /* LPC-specific registers */ | ||
2494 | #define COM_DEC 0xe0 | 2528 | #define COM_DEC 0xe0 |
2529 | #define GEN1_DEC 0xe4 | ||
2495 | #define LPC_EN 0xe6 | 2530 | #define LPC_EN 0xe6 |
2496 | #define GEN2_DEC 0xec | 2531 | #define GEN2_DEC 0xec |
2497 | /* | 2532 | /* |
2498 | * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge or | 2533 | * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge |
2499 | * Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. They all work the same way! | 2534 | * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. |
2535 | * They all work the same way! | ||
2500 | */ | 2536 | */ |
2501 | static int __init preconfigure_through_82801(struct pci_dev *dev, | 2537 | static int __init preconfigure_through_82801(struct pci_dev *dev, |
2502 | struct smsc_ircc_subsystem_configuration *conf) | 2538 | struct |
2539 | smsc_ircc_subsystem_configuration | ||
2540 | *conf) | ||
2503 | { | 2541 | { |
2504 | unsigned short tmpword; | 2542 | unsigned short tmpword; |
2505 | int ret; | 2543 | unsigned char tmpbyte; |
2506 | 2544 | ||
2507 | IRDA_MESSAGE("Setting up the SMSC device via the 82801 controller.\n"); | 2545 | IRDA_MESSAGE("Setting up Intel 82801 controller and SMSC device\n"); |
2508 | pci_write_config_byte(dev, COM_DEC, 0x10); | 2546 | /* |
2547 | * Select the range for the COMA COM port (SIR) | ||
2548 | * Register COM_DEC: | ||
2549 | * Bit 7: reserved | ||
2550 | * Bit 6-4, COMB decode range | ||
2551 | * Bit 3: reserved | ||
2552 | * Bit 2-0, COMA decode range | ||
2553 | * | ||
2554 | * Decode ranges: | ||
2555 | * 000 = 0x3f8-0x3ff (COM1) | ||
2556 | * 001 = 0x2f8-0x2ff (COM2) | ||
2557 | * 010 = 0x220-0x227 | ||
2558 | * 011 = 0x228-0x22f | ||
2559 | * 100 = 0x238-0x23f | ||
2560 | * 101 = 0x2e8-0x2ef (COM4) | ||
2561 | * 110 = 0x338-0x33f | ||
2562 | * 111 = 0x3e8-0x3ef (COM3) | ||
2563 | */ | ||
2564 | pci_read_config_byte(dev, COM_DEC, &tmpbyte); | ||
2565 | tmpbyte &= 0xf8; /* mask COMA bits */ | ||
2566 | switch(conf->sir_io) { | ||
2567 | case 0x3f8: | ||
2568 | tmpbyte |= 0x00; | ||
2569 | break; | ||
2570 | case 0x2f8: | ||
2571 | tmpbyte |= 0x01; | ||
2572 | break; | ||
2573 | case 0x220: | ||
2574 | tmpbyte |= 0x02; | ||
2575 | break; | ||
2576 | case 0x228: | ||
2577 | tmpbyte |= 0x03; | ||
2578 | break; | ||
2579 | case 0x238: | ||
2580 | tmpbyte |= 0x04; | ||
2581 | break; | ||
2582 | case 0x2e8: | ||
2583 | tmpbyte |= 0x05; | ||
2584 | break; | ||
2585 | case 0x338: | ||
2586 | tmpbyte |= 0x06; | ||
2587 | break; | ||
2588 | case 0x3e8: | ||
2589 | tmpbyte |= 0x07; | ||
2590 | break; | ||
2591 | default: | ||
2592 | tmpbyte |= 0x01; /* COM2 default */ | ||
2593 | } | ||
2594 | IRDA_DEBUG(1, "COM_DEC (write): 0x%02x\n", tmpbyte); | ||
2595 | pci_write_config_byte(dev, COM_DEC, tmpbyte); | ||
2509 | 2596 | ||
2510 | /* Enable LPC */ | 2597 | /* Enable Low Pin Count interface */ |
2511 | pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */ | 2598 | pci_read_config_word(dev, LPC_EN, &tmpword); |
2512 | tmpword &= 0xfffd; /* mask bit 1 */ | 2599 | /* These seem to be set up at all times, |
2513 | tmpword |= 0x0001; /* set bit 0 : COMA addr range enable */ | 2600 | * just make sure it is properly set. |
2601 | */ | ||
2602 | switch(conf->cfg_base) { | ||
2603 | case 0x04e: | ||
2604 | tmpword |= 0x2000; | ||
2605 | break; | ||
2606 | case 0x02e: | ||
2607 | tmpword |= 0x1000; | ||
2608 | break; | ||
2609 | case 0x062: | ||
2610 | tmpword |= 0x0800; | ||
2611 | break; | ||
2612 | case 0x060: | ||
2613 | tmpword |= 0x0400; | ||
2614 | break; | ||
2615 | default: | ||
2616 | IRDA_WARNING("Uncommon I/O base address: 0x%04x\n", | ||
2617 | conf->cfg_base); | ||
2618 | break; | ||
2619 | } | ||
2620 | tmpword &= 0xfffd; /* disable LPC COMB */ | ||
2621 | tmpword |= 0x0001; /* set bit 0 : enable LPC COMA addr range (GEN2) */ | ||
2622 | IRDA_DEBUG(1, "LPC_EN (write): 0x%04x\n", tmpword); | ||
2514 | pci_write_config_word(dev, LPC_EN, tmpword); | 2623 | pci_write_config_word(dev, LPC_EN, tmpword); |
2515 | 2624 | ||
2516 | /* Setup DMA */ | 2625 | /* |
2517 | pci_write_config_word(dev, PCI_DMA_C, 0xc0c0); /* LPC I/F DMA on, channel 3 -- rtm (?? PCI DMA ?) */ | 2626 | * Configure LPC DMA channel |
2518 | pci_write_config_word(dev, GEN2_DEC, 0x131); /* LPC I/F 2nd decode range */ | 2627 | * PCI_DMA_C bits: |
2628 | * Bit 15-14: DMA channel 7 select | ||
2629 | * Bit 13-12: DMA channel 6 select | ||
2630 | * Bit 11-10: DMA channel 5 select | ||
2631 | * Bit 9-8: Reserved | ||
2632 | * Bit 7-6: DMA channel 3 select | ||
2633 | * Bit 5-4: DMA channel 2 select | ||
2634 | * Bit 3-2: DMA channel 1 select | ||
2635 | * Bit 1-0: DMA channel 0 select | ||
2636 | * 00 = Reserved value | ||
2637 | * 01 = PC/PCI DMA | ||
2638 | * 10 = Reserved value | ||
2639 | * 11 = LPC I/F DMA | ||
2640 | */ | ||
2641 | pci_read_config_word(dev, PCI_DMA_C, &tmpword); | ||
2642 | switch(conf->fir_dma) { | ||
2643 | case 0x07: | ||
2644 | tmpword |= 0xc000; | ||
2645 | break; | ||
2646 | case 0x06: | ||
2647 | tmpword |= 0x3000; | ||
2648 | break; | ||
2649 | case 0x05: | ||
2650 | tmpword |= 0x0c00; | ||
2651 | break; | ||
2652 | case 0x03: | ||
2653 | tmpword |= 0x00c0; | ||
2654 | break; | ||
2655 | case 0x02: | ||
2656 | tmpword |= 0x0030; | ||
2657 | break; | ||
2658 | case 0x01: | ||
2659 | tmpword |= 0x000c; | ||
2660 | break; | ||
2661 | case 0x00: | ||
2662 | tmpword |= 0x0003; | ||
2663 | break; | ||
2664 | default: | ||
2665 | break; /* do not change settings */ | ||
2666 | } | ||
2667 | IRDA_DEBUG(1, "PCI_DMA_C (write): 0x%04x\n", tmpword); | ||
2668 | pci_write_config_word(dev, PCI_DMA_C, tmpword); | ||
2669 | |||
2670 | /* | ||
2671 | * GEN2_DEC bits: | ||
2672 | * Bit 15-4: Generic I/O range | ||
2673 | * Bit 3-1: reserved (read as 0) | ||
2674 | * Bit 0: enable GEN2 range on LPC I/F | ||
2675 | */ | ||
2676 | tmpword = conf->fir_io & 0xfff8; | ||
2677 | tmpword |= 0x0001; | ||
2678 | IRDA_DEBUG(1, "GEN2_DEC (write): 0x%04x\n", tmpword); | ||
2679 | pci_write_config_word(dev, GEN2_DEC, tmpword); | ||
2519 | 2680 | ||
2520 | /* Pre-configure chip */ | 2681 | /* Pre-configure chip */ |
2521 | ret = preconfigure_smsc_chip(conf); | 2682 | return preconfigure_smsc_chip(conf); |
2683 | } | ||
2522 | 2684 | ||
2523 | /* Disable LPC */ | 2685 | /* |
2524 | pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */ | 2686 | * Pre-configure a certain port on the ALi 1533 bridge. |
2525 | tmpword &= 0xfffc; /* mask bit 1 and bit 0, COMA addr range disable */ | 2687 | * This is based on reverse-engineering since ALi does not |
2526 | pci_write_config_word(dev, LPC_EN, tmpword); | 2688 | * provide any data sheet for the 1533 chip. |
2527 | return ret; | 2689 | */ |
2690 | static void __init preconfigure_ali_port(struct pci_dev *dev, | ||
2691 | unsigned short port) | ||
2692 | { | ||
2693 | unsigned char reg; | ||
2694 | /* These bits obviously control the different ports */ | ||
2695 | unsigned char mask; | ||
2696 | unsigned char tmpbyte; | ||
2697 | |||
2698 | switch(port) { | ||
2699 | case 0x0130: | ||
2700 | case 0x0178: | ||
2701 | reg = 0xb0; | ||
2702 | mask = 0x80; | ||
2703 | break; | ||
2704 | case 0x03f8: | ||
2705 | reg = 0xb4; | ||
2706 | mask = 0x80; | ||
2707 | break; | ||
2708 | case 0x02f8: | ||
2709 | reg = 0xb4; | ||
2710 | mask = 0x30; | ||
2711 | break; | ||
2712 | case 0x02e8: | ||
2713 | reg = 0xb4; | ||
2714 | mask = 0x08; | ||
2715 | break; | ||
2716 | default: | ||
2717 | IRDA_ERROR("Failed to configure unsupported port on ALi 1533 bridge: 0x%04x\n", port); | ||
2718 | return; | ||
2719 | } | ||
2720 | |||
2721 | pci_read_config_byte(dev, reg, &tmpbyte); | ||
2722 | /* Turn on the right bits */ | ||
2723 | tmpbyte |= mask; | ||
2724 | pci_write_config_byte(dev, reg, tmpbyte); | ||
2725 | IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port); | ||
2726 | return; | ||
2528 | } | 2727 | } |
2529 | 2728 | ||
2530 | static int __init preconfigure_through_ali(struct pci_dev *dev, | 2729 | static int __init preconfigure_through_ali(struct pci_dev *dev, |
2531 | struct smsc_ircc_subsystem_configuration *conf) | 2730 | struct |
2731 | smsc_ircc_subsystem_configuration | ||
2732 | *conf) | ||
2532 | { | 2733 | { |
2533 | /* TODO: put in ALi 1533 configuration here. */ | 2734 | /* Configure the two ports on the ALi 1533 */ |
2534 | IRDA_MESSAGE("SORRY: %s has an unsupported bridge controller (ALi): not pre-configured.\n", conf->name); | 2735 | preconfigure_ali_port(dev, conf->sir_io); |
2535 | return -ENODEV; | 2736 | preconfigure_ali_port(dev, conf->fir_io); |
2737 | |||
2738 | /* Pre-configure chip */ | ||
2739 | return preconfigure_smsc_chip(conf); | ||
2536 | } | 2740 | } |
2537 | 2741 | ||
2538 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | 2742 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, |
@@ -2552,9 +2756,10 @@ static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | |||
2552 | struct smsc_ircc_subsystem_configuration *conf; | 2756 | struct smsc_ircc_subsystem_configuration *conf; |
2553 | 2757 | ||
2554 | /* | 2758 | /* |
2555 | * Cache the subsystem vendor/device: some manufacturers fail to set | 2759 | * Cache the subsystem vendor/device: |
2556 | * this for all components, so we save it in case there is just | 2760 | * some manufacturers fail to set this for all components, |
2557 | * 0x0000 0x0000 on the device we want to check. | 2761 | * so we save it in case there is just 0x0000 0x0000 on the |
2762 | * device we want to check. | ||
2558 | */ | 2763 | */ |
2559 | if (dev->subsystem_vendor != 0x0000U) { | 2764 | if (dev->subsystem_vendor != 0x0000U) { |
2560 | ss_vendor = dev->subsystem_vendor; | 2765 | ss_vendor = dev->subsystem_vendor; |
@@ -2564,13 +2769,20 @@ static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | |||
2564 | for( ; conf->subvendor; conf++) { | 2769 | for( ; conf->subvendor; conf++) { |
2565 | if(conf->vendor == dev->vendor && | 2770 | if(conf->vendor == dev->vendor && |
2566 | conf->device == dev->device && | 2771 | conf->device == dev->device && |
2567 | conf->subvendor == ss_vendor && /* Sometimes these are cached values */ | 2772 | conf->subvendor == ss_vendor && |
2568 | (conf->subdevice == ss_device || conf->subdevice == 0xffff)) { | 2773 | /* Sometimes these are cached values */ |
2569 | struct smsc_ircc_subsystem_configuration tmpconf; | 2774 | (conf->subdevice == ss_device || |
2775 | conf->subdevice == 0xffff)) { | ||
2776 | struct smsc_ircc_subsystem_configuration | ||
2777 | tmpconf; | ||
2570 | 2778 | ||
2571 | memcpy(&tmpconf, conf, sizeof(struct smsc_ircc_subsystem_configuration)); | 2779 | memcpy(&tmpconf, conf, |
2780 | sizeof(struct smsc_ircc_subsystem_configuration)); | ||
2572 | 2781 | ||
2573 | /* Override the default values with anything passed in as parameter */ | 2782 | /* |
2783 | * Override the default values with anything | ||
2784 | * passed in as parameter | ||
2785 | */ | ||
2574 | if (ircc_cfg != 0) | 2786 | if (ircc_cfg != 0) |
2575 | tmpconf.cfg_base = ircc_cfg; | 2787 | tmpconf.cfg_base = ircc_cfg; |
2576 | if (ircc_fir != 0) | 2788 | if (ircc_fir != 0) |