0001
0002
0003
0004
0005
0006
0007 #include <linux/init.h>
0008 #include <linux/kernel.h>
0009 #include <linux/irq.h>
0010 #include <linux/reboot.h>
0011 #include <linux/serial_reg.h>
0012 #include <linux/serial_8250.h>
0013
0014 #include <asm/ce4100.h>
0015 #include <asm/prom.h>
0016 #include <asm/setup.h>
0017 #include <asm/i8259.h>
0018 #include <asm/io.h>
0019 #include <asm/io_apic.h>
0020 #include <asm/emergency-restart.h>
0021
0022
0023
0024
0025
0026
0027
0028
0029 static void ce4100_power_off(void)
0030 {
0031 outb(0x4, 0xcf9);
0032 }
0033
0034 #ifdef CONFIG_SERIAL_8250
0035
0036 static unsigned int mem_serial_in(struct uart_port *p, int offset)
0037 {
0038 offset = offset << p->regshift;
0039 return readl(p->membase + offset);
0040 }
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
0053 {
0054 unsigned int ret, ier, lsr;
0055
0056 if (offset == UART_IIR) {
0057 offset = offset << p->regshift;
0058 ret = readl(p->membase + offset);
0059 if (ret & UART_IIR_NO_INT) {
0060
0061 ier = mem_serial_in(p, UART_IER);
0062
0063 if (ier & UART_IER_THRI) {
0064 lsr = mem_serial_in(p, UART_LSR);
0065
0066
0067 if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
0068 ret &= ~UART_IIR_NO_INT;
0069 }
0070 }
0071 } else
0072 ret = mem_serial_in(p, offset);
0073 return ret;
0074 }
0075
0076 static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
0077 {
0078 offset = offset << p->regshift;
0079 writel(value, p->membase + offset);
0080 }
0081
0082 static void ce4100_serial_fixup(int port, struct uart_port *up,
0083 u32 *capabilities)
0084 {
0085 #ifdef CONFIG_EARLY_PRINTK
0086
0087
0088
0089
0090
0091 if (up->iotype != UPIO_MEM32) {
0092 up->uartclk = 14745600;
0093 up->mapbase = 0xdffe0200;
0094 set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
0095 up->mapbase & PAGE_MASK);
0096 up->membase =
0097 (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
0098 up->membase += up->mapbase & ~PAGE_MASK;
0099 up->mapbase += port * 0x100;
0100 up->membase += port * 0x100;
0101 up->iotype = UPIO_MEM32;
0102 up->regshift = 2;
0103 up->irq = 4;
0104 }
0105 #endif
0106 up->iobase = 0;
0107 up->serial_in = ce4100_mem_serial_in;
0108 up->serial_out = ce4100_mem_serial_out;
0109
0110 *capabilities |= (1 << 12);
0111 }
0112
0113 static __init void sdv_serial_fixup(void)
0114 {
0115 serial8250_set_isa_configurator(ce4100_serial_fixup);
0116 }
0117
0118 #else
0119 static inline void sdv_serial_fixup(void) {};
0120 #endif
0121
0122 static void __init sdv_arch_setup(void)
0123 {
0124 sdv_serial_fixup();
0125 }
0126
0127 static void sdv_pci_init(void)
0128 {
0129 x86_of_pci_init();
0130 }
0131
0132
0133
0134
0135
0136 void __init x86_ce4100_early_setup(void)
0137 {
0138 x86_init.oem.arch_setup = sdv_arch_setup;
0139 x86_init.resources.probe_roms = x86_init_noop;
0140 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
0141 x86_init.mpparse.find_smp_config = x86_init_noop;
0142 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;
0143 x86_init.pci.init = ce4100_pci_init;
0144 x86_init.pci.init_irq = sdv_pci_init;
0145
0146
0147
0148
0149
0150
0151
0152
0153 reboot_type = BOOT_KBD;
0154
0155 pm_power_off = ce4100_power_off;
0156 }