2010-11-10 03:08:04 +07:00
|
|
|
/*
|
|
|
|
* Intel CE4100 platform specific setup code
|
|
|
|
*
|
|
|
|
* (C) Copyright 2010 Intel Corporation
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; version 2
|
|
|
|
* of the License.
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/module.h>
|
2010-11-22 21:28:48 +07:00
|
|
|
#include <linux/serial_reg.h>
|
|
|
|
#include <linux/serial_8250.h>
|
2013-07-09 10:06:27 +07:00
|
|
|
#include <linux/reboot.h>
|
2010-11-10 03:08:04 +07:00
|
|
|
|
2011-03-14 16:33:40 +07:00
|
|
|
#include <asm/ce4100.h>
|
2011-02-23 03:07:45 +07:00
|
|
|
#include <asm/prom.h>
|
2010-11-10 03:08:04 +07:00
|
|
|
#include <asm/setup.h>
|
2011-02-23 03:07:45 +07:00
|
|
|
#include <asm/i8259.h>
|
2010-11-22 21:28:48 +07:00
|
|
|
#include <asm/io.h>
|
2011-02-23 03:07:45 +07:00
|
|
|
#include <asm/io_apic.h>
|
2012-10-29 20:40:19 +07:00
|
|
|
#include <asm/emergency-restart.h>
|
2010-11-10 03:08:04 +07:00
|
|
|
|
|
|
|
static int ce4100_i8042_detect(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-29 20:40:18 +07:00
|
|
|
/*
|
|
|
|
* The CE4100 platform has an internal 8051 Microcontroller which is
|
|
|
|
* responsible for signaling to the external Power Management Unit the
|
|
|
|
* intention to reset, reboot or power off the system. This 8051 device has
|
|
|
|
* its command register mapped at I/O port 0xcf9 and the value 0x4 is used
|
|
|
|
* to power off the system.
|
|
|
|
*/
|
|
|
|
static void ce4100_power_off(void)
|
|
|
|
{
|
|
|
|
outb(0x4, 0xcf9);
|
|
|
|
}
|
|
|
|
|
2010-11-22 21:28:48 +07:00
|
|
|
#ifdef CONFIG_SERIAL_8250
|
|
|
|
|
|
|
|
static unsigned int mem_serial_in(struct uart_port *p, int offset)
|
|
|
|
{
|
|
|
|
offset = offset << p->regshift;
|
|
|
|
return readl(p->membase + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The UART Tx interrupts are not set under some conditions and therefore serial
|
|
|
|
* transmission hangs. This is a silicon issue and has not been root caused. The
|
|
|
|
* workaround for this silicon issue checks UART_LSR_THRE bit and UART_LSR_TEMT
|
|
|
|
* bit of LSR register in interrupt handler to see whether at least one of these
|
|
|
|
* two bits is set, if so then process the transmit request. If this workaround
|
|
|
|
* is not applied, then the serial transmission may hang. This workaround is for
|
|
|
|
* errata number 9 in Errata - B step.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
|
|
|
|
{
|
|
|
|
unsigned int ret, ier, lsr;
|
|
|
|
|
|
|
|
if (offset == UART_IIR) {
|
|
|
|
offset = offset << p->regshift;
|
|
|
|
ret = readl(p->membase + offset);
|
|
|
|
if (ret & UART_IIR_NO_INT) {
|
|
|
|
/* see if the TX interrupt should have really set */
|
|
|
|
ier = mem_serial_in(p, UART_IER);
|
|
|
|
/* see if the UART's XMIT interrupt is enabled */
|
|
|
|
if (ier & UART_IER_THRI) {
|
|
|
|
lsr = mem_serial_in(p, UART_LSR);
|
|
|
|
/* now check to see if the UART should be
|
|
|
|
generating an interrupt (but isn't) */
|
|
|
|
if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
|
|
|
|
ret &= ~UART_IIR_NO_INT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
ret = mem_serial_in(p, offset);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
|
|
|
|
{
|
|
|
|
offset = offset << p->regshift;
|
|
|
|
writel(value, p->membase + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ce4100_serial_fixup(int port, struct uart_port *up,
|
|
|
|
unsigned short *capabilites)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_EARLY_PRINTK
|
|
|
|
/*
|
|
|
|
* Over ride the legacy port configuration that comes from
|
|
|
|
* asm/serial.h. Using the ioport driver then switching to the
|
|
|
|
* PCI memmaped driver hangs the IOAPIC
|
|
|
|
*/
|
|
|
|
if (up->iotype != UPIO_MEM32) {
|
|
|
|
up->uartclk = 14745600;
|
|
|
|
up->mapbase = 0xdffe0200;
|
|
|
|
set_fixmap_nocache(FIX_EARLYCON_MEM_BASE,
|
|
|
|
up->mapbase & PAGE_MASK);
|
|
|
|
up->membase =
|
|
|
|
(void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
|
|
|
|
up->membase += up->mapbase & ~PAGE_MASK;
|
2012-10-19 15:45:07 +07:00
|
|
|
up->mapbase += port * 0x100;
|
|
|
|
up->membase += port * 0x100;
|
2010-11-22 21:28:48 +07:00
|
|
|
up->iotype = UPIO_MEM32;
|
|
|
|
up->regshift = 2;
|
2012-10-19 15:45:07 +07:00
|
|
|
up->irq = 4;
|
2010-11-22 21:28:48 +07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
up->iobase = 0;
|
|
|
|
up->serial_in = ce4100_mem_serial_in;
|
|
|
|
up->serial_out = ce4100_mem_serial_out;
|
|
|
|
|
|
|
|
*capabilites |= (1 << 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __init void sdv_serial_fixup(void)
|
|
|
|
{
|
|
|
|
serial8250_set_isa_configurator(ce4100_serial_fixup);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2011-11-10 20:21:10 +07:00
|
|
|
static inline void sdv_serial_fixup(void) {};
|
2010-11-22 21:28:48 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void __init sdv_arch_setup(void)
|
2010-11-10 03:08:04 +07:00
|
|
|
{
|
2010-11-22 21:28:48 +07:00
|
|
|
sdv_serial_fixup();
|
2010-11-10 03:08:04 +07:00
|
|
|
}
|
|
|
|
|
2011-02-23 03:07:45 +07:00
|
|
|
#ifdef CONFIG_X86_IO_APIC
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-19 05:23:59 +07:00
|
|
|
static void sdv_pci_init(void)
|
2011-02-23 03:07:45 +07:00
|
|
|
{
|
|
|
|
x86_of_pci_init();
|
|
|
|
/* We can't set this earlier, because we need to calibrate the timer */
|
|
|
|
legacy_pic = &null_legacy_pic;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-11-10 03:08:04 +07:00
|
|
|
/*
|
|
|
|
* CE4100 specific x86_init function overrides and early setup
|
|
|
|
* calls.
|
|
|
|
*/
|
|
|
|
void __init x86_ce4100_early_setup(void)
|
|
|
|
{
|
|
|
|
x86_init.oem.arch_setup = sdv_arch_setup;
|
|
|
|
x86_platform.i8042_detect = ce4100_i8042_detect;
|
|
|
|
x86_init.resources.probe_roms = x86_init_noop;
|
|
|
|
x86_init.mpparse.get_smp_config = x86_init_uint_noop;
|
2011-02-25 22:09:31 +07:00
|
|
|
x86_init.mpparse.find_smp_config = x86_init_noop;
|
2011-03-14 16:33:40 +07:00
|
|
|
x86_init.pci.init = ce4100_pci_init;
|
2011-02-23 03:07:45 +07:00
|
|
|
|
2012-10-29 20:40:19 +07:00
|
|
|
/*
|
|
|
|
* By default, the reboot method is ACPI which is supported by the
|
|
|
|
* CE4100 bootloader CEFDK using FADT.ResetReg Address and ResetValue
|
|
|
|
* the bootloader will however issue a system power off instead of
|
|
|
|
* reboot. By using BOOT_KBD we ensure proper system reboot as
|
|
|
|
* expected.
|
|
|
|
*/
|
|
|
|
reboot_type = BOOT_KBD;
|
|
|
|
|
2011-02-23 03:07:45 +07:00
|
|
|
#ifdef CONFIG_X86_IO_APIC
|
|
|
|
x86_init.pci.init_irq = sdv_pci_init;
|
|
|
|
x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck;
|
|
|
|
#endif
|
2012-10-29 20:40:18 +07:00
|
|
|
|
|
|
|
pm_power_off = ce4100_power_off;
|
2010-11-10 03:08:04 +07:00
|
|
|
}
|