Bjorn Helgaas | 7e92b4f | 2007-05-08 00:36:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Legacy COM port devices for x86 platforms without PNPBIOS or ACPI. |
| 3 | * Data taken from include/asm-i386/serial.h. |
| 4 | * |
| 5 | * (c) Copyright 2007 Hewlett-Packard Development Company, L.P. |
| 6 | * Bjorn Helgaas <bjorn.helgaas@hp.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/pnp.h> |
| 15 | #include <linux/serial_8250.h> |
| 16 | |
| 17 | /* Standard COM flags (except for COM4, because of the 8514 problem) */ |
| 18 | #ifdef CONFIG_SERIAL_DETECT_IRQ |
| 19 | #define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ) |
| 20 | #define COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ) |
| 21 | #else |
| 22 | #define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST) |
| 23 | #define COM4_FLAGS UPF_BOOT_AUTOCONF |
| 24 | #endif |
| 25 | |
| 26 | #define PORT(_base,_irq,_flags) \ |
| 27 | { \ |
| 28 | .iobase = _base, \ |
| 29 | .irq = _irq, \ |
| 30 | .uartclk = 1843200, \ |
| 31 | .iotype = UPIO_PORT, \ |
| 32 | .flags = _flags, \ |
| 33 | } |
| 34 | |
| 35 | static struct plat_serial8250_port x86_com_data[] = { |
| 36 | PORT(0x3F8, 4, COM_FLAGS), |
| 37 | PORT(0x2F8, 3, COM_FLAGS), |
| 38 | PORT(0x3E8, 4, COM_FLAGS), |
| 39 | PORT(0x2E8, 3, COM4_FLAGS), |
| 40 | { }, |
| 41 | }; |
| 42 | |
| 43 | static struct platform_device x86_com_device = { |
| 44 | .name = "serial8250", |
| 45 | .id = PLAT8250_DEV_PLATFORM, |
| 46 | .dev = { |
| 47 | .platform_data = x86_com_data, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static int force_legacy_probe; |
| 52 | module_param_named(force, force_legacy_probe, bool, 0); |
| 53 | MODULE_PARM_DESC(force, "Force legacy serial port probe"); |
| 54 | |
| 55 | static int __init serial8250_x86_com_init(void) |
| 56 | { |
| 57 | if (pnp_platform_devices && !force_legacy_probe) |
| 58 | return -ENODEV; |
| 59 | |
| 60 | return platform_device_register(&x86_com_device); |
| 61 | } |
| 62 | |
| 63 | module_init(serial8250_x86_com_init); |
| 64 | |
| 65 | MODULE_AUTHOR("Bjorn Helgaas"); |
| 66 | MODULE_LICENSE("GPL"); |
| 67 | MODULE_DESCRIPTION("Generic 8250/16x50 legacy probe module"); |