Path: blob/master/arch/x86/platform/ce4100/ce4100.c
10821 views
/*1* Intel CE4100 platform specific setup code2*3* (C) Copyright 2010 Intel Corporation4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; version 28* of the License.9*/10#include <linux/init.h>11#include <linux/kernel.h>12#include <linux/irq.h>13#include <linux/module.h>14#include <linux/serial_reg.h>15#include <linux/serial_8250.h>1617#include <asm/ce4100.h>18#include <asm/prom.h>19#include <asm/setup.h>20#include <asm/i8259.h>21#include <asm/io.h>22#include <asm/io_apic.h>2324static int ce4100_i8042_detect(void)25{26return 0;27}2829#ifdef CONFIG_SERIAL_82503031static unsigned int mem_serial_in(struct uart_port *p, int offset)32{33offset = offset << p->regshift;34return readl(p->membase + offset);35}3637/*38* The UART Tx interrupts are not set under some conditions and therefore serial39* transmission hangs. This is a silicon issue and has not been root caused. The40* workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT41* bit of LSR register in interrupt handler to see whether at least one of these42* two bits is set, if so then process the transmit request. If this workaround43* is not applied, then the serial transmission may hang. This workaround is for44* errata number 9 in Errata - B step.45*/4647static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)48{49unsigned int ret, ier, lsr;5051if (offset == UART_IIR) {52offset = offset << p->regshift;53ret = readl(p->membase + offset);54if (ret & UART_IIR_NO_INT) {55/* see if the TX interrupt should have really set */56ier = mem_serial_in(p, UART_IER);57/* see if the UART's XMIT interrupt is enabled */58if (ier & UART_IER_THRI) {59lsr = mem_serial_in(p, UART_LSR);60/* now check to see if the UART should be61generating an interrupt (but isn't) */62if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))63ret &= ~UART_IIR_NO_INT;64}65}66} else67ret = mem_serial_in(p, offset);68return ret;69}7071static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)72{73offset = offset << p->regshift;74writel(value, p->membase + offset);75}7677static void ce4100_serial_fixup(int port, struct uart_port *up,78unsigned short *capabilites)79{80#ifdef CONFIG_EARLY_PRINTK81/*82* Over ride the legacy port configuration that comes from83* asm/serial.h. Using the ioport driver then switching to the84* PCI memmaped driver hangs the IOAPIC85*/86if (up->iotype != UPIO_MEM32) {87up->uartclk = 14745600;88up->mapbase = 0xdffe0200;89set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,90up->mapbase & PAGE_MASK);91up->membase =92(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);93up->membase += up->mapbase & ~PAGE_MASK;94up->iotype = UPIO_MEM32;95up->regshift = 2;96}97#endif98up->iobase = 0;99up->serial_in = ce4100_mem_serial_in;100up->serial_out = ce4100_mem_serial_out;101102*capabilites |= (1 << 12);103}104105static __init void sdv_serial_fixup(void)106{107serial8250_set_isa_configurator(ce4100_serial_fixup);108}109110#else111static inline void sdv_serial_fixup(void);112#endif113114static void __init sdv_arch_setup(void)115{116sdv_serial_fixup();117}118119#ifdef CONFIG_X86_IO_APIC120static void __cpuinit sdv_pci_init(void)121{122x86_of_pci_init();123/* We can't set this earlier, because we need to calibrate the timer */124legacy_pic = &null_legacy_pic;125}126#endif127128/*129* CE4100 specific x86_init function overrides and early setup130* calls.131*/132void __init x86_ce4100_early_setup(void)133{134x86_init.oem.arch_setup = sdv_arch_setup;135x86_platform.i8042_detect = ce4100_i8042_detect;136x86_init.resources.probe_roms = x86_init_noop;137x86_init.mpparse.get_smp_config = x86_init_uint_noop;138x86_init.mpparse.find_smp_config = x86_init_noop;139x86_init.pci.init = ce4100_pci_init;140141#ifdef CONFIG_X86_IO_APIC142x86_init.pci.init_irq = sdv_pci_init;143x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;144#endif145}146147148