/* * Driver for the 98626/98644/internal serial interface on hp300/hp400 * (based on the National Semiconductor INS8250/NS16550AF/WD16C552 UARTs) * * Ported from 2.2 and modified to use the normal 8250 driver * by Kars de Jong , May 2004. */ #include #include #include #include #include #include #include #include #include #include #include #include "8250.h" #if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI) #warning CONFIG_SERIAL_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure? #endif #ifdef CONFIG_HPAPCI struct hp300_port { struct hp300_port *next; /* next port */ int line; /* line (tty) number */ }; static struct hp300_port *hp300_ports; #endif #ifdef CONFIG_HPDCA static int hpdca_init_one(struct dio_dev *d, const struct dio_device_id *ent); static void hpdca_remove_one(struct dio_dev *d); static struct dio_device_id hpdca_dio_tbl[] = { { DIO_ID_DCA0 }, { DIO_ID_DCA0REM }, { DIO_ID_DCA1 }, { DIO_ID_DCA1REM }, { 0 } }; static struct dio_driver hpdca_driver = { .name = "hpdca", .id_table = hpdca_dio_tbl, .probe = hpdca_init_one, .remove = hpdca_remove_one, }; #endif static unsigned int num_ports; extern int hp300_uart_scode; /* Offset to UART registers from base of DCA */ #define UART_OFFSET 17 #define DCA_ID 0x01 /* ID (read), reset (write) */ #define DCA_IC 0x03 /* Interrupt control */ /* Interrupt control */ #define DCA_IC_IE 0x80 /* Master interrupt enable */ #define HPDCA_BAUD_BASE 153600 /* Base address of the Frodo part */ #define FRODO_BASE (0x41c000) /* * Where we find the 8250-like APCI ports, and how far apart they are. */ #define FRODO_APCIBASE 0x0 #define FRODO_APCISPACE 0x20 #define FRODO_APCI_OFFSET(x) (FRODO_APCIBASE + ((x) * FRODO_APCISPACE)) #define HPAPCI_BAUD_BASE 500400 #ifdef CONFIG_SERIAL_8250_CONSOLE /* * Parse the bootinfo to find descriptions for headless console and * debug serial ports and register them with the 8250 driver. */ int __init hp300_setup_serial_console(void) { int scode; struct uart_port port; memset(&port, 0, sizeof(port)); if (hp300_uart_scode < 0 || hp300_uart_scode > DIO_SCMAX) return 0; if (DIO_SCINHOLE(hp300_uart_scode)) return 0; scode = hp300_uart_scode; /* Memory mapped I/O */ port.iotype = UPIO_MEM; port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; port.type = PORT_UNKNOWN; /* Check for APCI console */ if (scode == 256) { #ifdef CONFIG_HPAPCI pr_info("Serial console is HP APCI 1\n"); port.uartclk = HPAPCI_BAUD_BASE * 16; port.mapbase = (FRODO_BASE + FRODO_APCI_OFFSET(1)); port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE); port.regshift = 2; add_preferred_console("ttyS", port.line, "9600n8"); #else pr_warn("Serial console is APCI but support is disabled (CONFIG_HPAPCI)!\n"); return 0; #endif } else { #ifdef CONFIG_HPDCA unsigned long pa = dio_scodetophysaddr(scode); if (!pa) return 0; pr_info("Serial console is HP DCA at select code %d\n", scode); port.uartclk = HPDCA_BAUD_BASE * 16; port.mapbase = (pa + UART_OFFSET); port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE); port.regshift = 1; port.irq = DIO_IPL(pa + DIO_VIRADDRBASE); /* Enable board-interrupts */ out_8(pa + DIO_VIRADDRBASE + DCA_IC, DCA_IC_IE); if (DIO_ID(pa + DIO_VIRADDRBASE) & 0x80) add_preferred_console("ttyS", port.line, "9600n8"); #else pr_warn("Serial console is DCA but support is disabled (CONFIG_HPDCA)!\n"); return 0; #endif } if (early_serial_setup(&port) < 0) pr_warn("%s: early_serial_setup() failed.\n", __func__); return 0; } #endif /* CONFIG_SERIAL_8250_CONSOLE */ #ifdef CONFIG_HPDCA static int hpdca_init_one(struct dio_dev *d, const struct dio_device_id *ent) { struct uart_8250_port uart; int line; #ifdef CONFIG_SERIAL_8250_CONSOLE if (hp300_uart_scode == d->scode) { /* Already got it. */ return 0; } #endif memset(&uart, 0, sizeof(uart)); /* Memory mapped I/O */ uart.port.iotype = UPIO_MEM; uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; uart.port.irq = d->ipl; uart.port.uartclk = HPDCA_BAUD_BASE * 16; uart.port.mapbase = (d->resource.start + UART_OFFSET); uart.port.membase = (char *)(uart.port.mapbase + DIO_VIRADDRBASE); uart.port.regshift = 1; uart.port.dev = &d->dev; line = serial8250_register_8250_port(&uart); if (line < 0) { dev_notice(&d->dev, "8250_hp300: register_serial() DCA scode %d irq %d failed\n", d->scode, uart.port.irq); return -ENOMEM; } /* Enable board-interrupts */ out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, DCA_IC_IE); dio_set_drvdata(d, (void *)line); /* Reset the DCA */ out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); udelay(100); num_ports++; return 0; } #endif static int __init hp300_8250_init(void) { static int called; #ifdef CONFIG_HPAPCI int line; unsigned long base; struct uart_8250_port uart; struct hp300_port *port; int i; #endif if (called) return -ENODEV; called = 1; if (!MACH_IS_HP300) return -ENODEV; #ifdef CONFIG_HPDCA dio_register_driver(&hpdca_driver); #endif #ifdef CONFIG_HPAPCI if (hp300_model < HP_400) { if (!num_ports) return -ENODEV; return 0; } /* These models have the Frodo chip. * Port 0 is reserved for the Apollo Domain keyboard. * Port 1 is either the console or the DCA. */ for (i = 1; i < 4; i++) { /* Port 1 is the console on a 425e, on other machines it's * mapped to DCA. */ #ifdef CONFIG_SERIAL_8250_CONSOLE if (i == 1) continue; #endif /* Create new serial device */ port = kmalloc(sizeof(struct hp300_port), GFP_KERNEL); if (!port) return -ENOMEM; memset(&uart, 0, sizeof(uart)); base = (FRODO_BASE + FRODO_APCI_OFFSET(i)); /* Memory mapped I/O */ uart.port.iotype = UPIO_MEM; uart.port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; /* XXX - no interrupt support yet */ uart.port.irq = 0; uart.port.uartclk = HPAPCI_BAUD_BASE * 16; uart.port.mapbase = base; uart.port.membase = (char *)(base + DIO_VIRADDRBASE); uart.port.regshift = 2; line = serial8250_register_8250_port(&uart); if (line < 0) { dev_notice(uart.port.dev, "8250_hp300: register_serial() APCI %d irq %d failed\n", i, uart.port.irq); kfree(port); continue; } port->line = line; port->next = hp300_ports; hp300_ports = port; num_ports++; } #endif /* Any boards found? */ if (!num_ports) return -ENODEV; return 0; } #ifdef CONFIG_HPDCA static void hpdca_remove_one(struct dio_dev *d) { int line; line = (int) dio_get_drvdata(d); if (d->resource.start) { /* Disable board-interrupts */ out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, 0); } serial8250_unregister_port(line); } #endif static void __exit hp300_8250_exit(void) { #ifdef CONFIG_HPAPCI struct hp300_port *port, *to_free; for (port = hp300_ports; port; ) { serial8250_unregister_port(port->line); to_free = port; port = port->next; kfree(to_free); } hp300_ports = NULL; #endif #ifdef CONFIG_HPDCA dio_unregister_driver(&hpdca_driver); #endif } module_init(hp300_8250_init); module_exit(hp300_8250_exit); MODULE_DESCRIPTION("HP DCA/APCI serial driver"); MODULE_AUTHOR("Kars de Jong "); MODULE_LICENSE("GPL"); build of vdso.lds - VDSO: Drop duplicated -I*/-E* aflags - tracing: move insn_has_delay_slot to a shared header - tracing: disable uprobe/kprobe on compact branch instructions - ptrace: Fix regs_return_value for kernel context - Squash lines for simple wrapper functions - Move identification of VP(E) into proc.c from smp-mt.c - Add definitions of SYNC barrierstype values - traps: Ensure full EBase is written - tlb-r4k: If there are wired entries, don't use TLBINVF - Sanitise coherentio semantics - dma-default: Don't check hw_coherentio if device is non-coherent - Support per-device DMA coherence - Adjust MIPS64 CAC_BASE to reflect Config.K0 - Support generating Flattened Image Trees (.itb) - generic: Introduce generic DT-based board support - generic: Convert SEAD-3 to a generic board - Enable hardened usercopy - Don't specify STACKPROTECTOR in defconfigs Octeon: - Delete dead code and files across the platform. - Change to use all memory into use by default. - Rename upper case variables in setup code to lowercase. - Delete legacy hack for broken bootloaders. - Leave maintaining the link state to the actual ethernet/PHY drivers. - Add DTS for D-Link DSR-500N. - Fix PCI interrupt routing on D-Link DSR-500N. Pistachio: - Remove ANDROID_TIMED_OUTPUT from defconfig TX39xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework TX49xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework txx9wdt: - Add missing clock (un)prepare calls for CCF BMIPS: - Add PW, GPIO SDHCI and NAND device node names - Support APPENDED_DTB - Add missing bcm97435svmb to DT_NONE - Rename bcm96358nb4ser to bcm6358-neufbox4-sercom - Add DT examples for BCM63268, BCM3368 and BCM6362 - Add support for BCM3368 and BCM6362 PCI - Reduce stack frame usage - Use struct list_head lists - Support for CONFIG_PCI_DOMAINS_GENERIC - Make pcibios_set_cache_line_size an initcall - Inline pcibios_assign_all_busses - Split pci.c into pci.c & pci-legacy.c - Introduce CONFIG_PCI_DRIVERS_LEGACY - Support generic drivers CPC - Convert bare 'unsigned' to 'unsigned int' - Avoid lock when MIPS CM >= 3 is present GIC: - Delete unused file smp-gic.c mt7620: - Delete unnecessary assignment for the field "owner" from PCI BCM63xx: - Let clk_disable() return immediately if clk is NULL pm-cps: - Change FSB workaround to CPU blacklist - Update comments on barrier instructions - Use MIPS standard lightweight ordering barrier - Use MIPS standard completion barrier - Remove selection of sync types - Add MIPSr6 CPU support - Support CM3 changes to Coherence Enable Register SMP: - Wrap call to mips_cpc_lock_other in mips_cm_lock_other - Introduce mechanism for freeing and allocating IPIs cpuidle: - cpuidle-cps: Enable use with MIPSr6 CPUs. SEAD3: - Rewrite to use DT and generic kernel feature. USB: - host: ehci-sead3: Remove SEAD-3 EHCI code FBDEV: - cobalt_lcdfb: Drop SEAD3 support dt-bindings: - Document a binding for simple ASCII LCDs auxdisplay: - img-ascii-lcd: driver for simple ASCII LCD displays irqchip i8259: - i8259: Add domain before mapping parent irq - i8259: Allow platforms to override poll function - i8259: Remove unused i8259A_irq_pending Malta: - Rewrite to use DT of/platform: - Probe "isa" busses by default CM: - Print CM error reports upon bus errors Module: - Migrate exception table users off module.h and onto extable.h - Make various drivers explicitly non-modular: - Audit and remove any unnecessary uses of module.h mailmap: - Canonicalize to Qais' current email address. Documentation: - MIPS supports HAVE_REGS_AND_STACK_ACCESS_API Loongson1C: - Add CPU support for Loongson1C - Add board support - Add defconfig - Add RTC support for Loongson1C board All this except one Documentation fix has sat in linux-next and has survived Imagination's automated build test system" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (127 commits) Documentation: MIPS supports HAVE_REGS_AND_STACK_ACCESS_API MIPS: ptrace: Fix regs_return_value for kernel context MIPS: VDSO: Drop duplicated -I*/-E* aflags MIPS: Fix -mabi=64 build of vdso.lds MIPS: Enable hardened usercopy MIPS: generic: Convert SEAD-3 to a generic board MIPS: generic: Introduce generic DT-based board support MIPS: Support generating Flattened Image Trees (.itb) MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0 MIPS: Print CM error reports upon bus errors MIPS: Support per-device DMA coherence MIPS: dma-default: Don't check hw_coherentio if device is non-coherent MIPS: Sanitise coherentio semantics MIPS: PCI: Support generic drivers MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY MIPS: PCI: Split pci.c into pci.c & pci-legacy.c MIPS: PCI: Inline pcibios_assign_all_busses MIPS: PCI: Make pcibios_set_cache_line_size an initcall MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC MIPS: PCI: Use struct list_head lists ...
Diffstat (limited to 'tools/testing/selftests')