Commit 7246a035 authored by Paul Mackerras's avatar Paul Mackerras

Merge bk://stop.crashing.org/linux-2.5-misc

into samba.org:/home/paulus/kernel/for-linus-ppc
parents 5bb4ee47 a9e6fe83
...@@ -470,6 +470,10 @@ config PRPMC800 ...@@ -470,6 +470,10 @@ config PRPMC800
config SANDPOINT config SANDPOINT
bool "Motorola-Sandpoint" bool "Motorola-Sandpoint"
help
Select SANDPOINT if configuring for a Motorola Sandpoint X3
or X3(b).
X3 (any flavor).
config ADIR config ADIR
bool "SBS-Adirondack" bool "SBS-Adirondack"
...@@ -494,6 +498,11 @@ config PPC_CHRP ...@@ -494,6 +498,11 @@ config PPC_CHRP
depends on PPC_MULTIPLATFORM depends on PPC_MULTIPLATFORM
default y default y
config PPC_GEN550
bool
depends on SANDPOINT
default y
config PPC_PMAC config PPC_PMAC
bool bool
depends on PPC_MULTIPLATFORM depends on PPC_MULTIPLATFORM
...@@ -509,10 +518,6 @@ config PPC_OF ...@@ -509,10 +518,6 @@ config PPC_OF
depends on PPC_PMAC || PPC_CHRP depends on PPC_PMAC || PPC_CHRP
default y default y
config SANDPOINT_X3
bool "Sandpoint X3"
depends on SANDPOINT
config FORCE config FORCE
bool bool
depends on 6xx && !8260 && (PCORE || POWERPMC250) depends on 6xx && !8260 && (PCORE || POWERPMC250)
...@@ -520,7 +525,7 @@ config FORCE ...@@ -520,7 +525,7 @@ config FORCE
config EPIC_SERIAL_MODE config EPIC_SERIAL_MODE
bool bool
depends on 6xx && !8260 && (LOPEC || SANDPOINT_X3) depends on 6xx && !8260 && (LOPEC || SANDPOINT)
default y default y
config WILLOW config WILLOW
......
...@@ -66,7 +66,7 @@ CONFIG_SANDPOINT=y ...@@ -66,7 +66,7 @@ CONFIG_SANDPOINT=y
# CONFIG_K2 is not set # CONFIG_K2 is not set
# CONFIG_PAL4 is not set # CONFIG_PAL4 is not set
# CONFIG_GEMINI is not set # CONFIG_GEMINI is not set
CONFIG_SANDPOINT_X3=y CONFIG_PPC_GEN550=y
CONFIG_EPIC_SERIAL_MODE=y CONFIG_EPIC_SERIAL_MODE=y
# CONFIG_MPC10X_STORE_GATHERING is not set # CONFIG_MPC10X_STORE_GATHERING is not set
# CONFIG_SMP is not set # CONFIG_SMP is not set
...@@ -82,8 +82,8 @@ CONFIG_ALTIVEC=y ...@@ -82,8 +82,8 @@ CONFIG_ALTIVEC=y
CONFIG_PCI=y CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS=y
CONFIG_KCORE_ELF=y CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y CONFIG_KERNEL_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_MISC=m CONFIG_BINFMT_MISC=m
# CONFIG_PCI_LEGACY_PROC is not set # CONFIG_PCI_LEGACY_PROC is not set
# CONFIG_PCI_NAMES is not set # CONFIG_PCI_NAMES is not set
...@@ -115,6 +115,11 @@ CONFIG_KERNEL_START=0xc0000000 ...@@ -115,6 +115,11 @@ CONFIG_KERNEL_START=0xc0000000
CONFIG_TASK_SIZE=0x80000000 CONFIG_TASK_SIZE=0x80000000
CONFIG_BOOT_LOAD=0x00800000 CONFIG_BOOT_LOAD=0x00800000
#
# Generic Driver Options
#
# CONFIG_FW_LOADER is not set
# #
# Memory Technology Devices (MTD) # Memory Technology Devices (MTD)
# #
...@@ -145,7 +150,7 @@ CONFIG_BLK_DEV_INITRD=y ...@@ -145,7 +150,7 @@ CONFIG_BLK_DEV_INITRD=y
# CONFIG_MD is not set # CONFIG_MD is not set
# #
# ATA/IDE/MFM/RLL support # ATA/ATAPI/MFM/RLL support
# #
CONFIG_IDE=y CONFIG_IDE=y
...@@ -164,6 +169,7 @@ CONFIG_BLK_DEV_IDEDISK=y ...@@ -164,6 +169,7 @@ CONFIG_BLK_DEV_IDEDISK=y
CONFIG_BLK_DEV_IDECD=y CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_IDE_TASK_IOCTL is not set # CONFIG_IDE_TASK_IOCTL is not set
CONFIG_IDE_TASKFILE_IO=y
# #
# IDE chipset support/bugfixes # IDE chipset support/bugfixes
...@@ -171,7 +177,7 @@ CONFIG_BLK_DEV_IDECD=y ...@@ -171,7 +177,7 @@ CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDEPCI is not set # CONFIG_BLK_DEV_IDEPCI is not set
# #
# SCSI support # SCSI device support
# #
# CONFIG_SCSI is not set # CONFIG_SCSI is not set
...@@ -290,6 +296,7 @@ CONFIG_NET_PCI=y ...@@ -290,6 +296,7 @@ CONFIG_NET_PCI=y
# CONFIG_AMD8111_ETH is not set # CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_B44 is not set # CONFIG_B44 is not set
# CONFIG_TC35815 is not set
# CONFIG_DGRS is not set # CONFIG_DGRS is not set
# CONFIG_EEPRO100 is not set # CONFIG_EEPRO100 is not set
CONFIG_E100=y CONFIG_E100=y
...@@ -410,11 +417,6 @@ CONFIG_FONT_8x16=y ...@@ -410,11 +417,6 @@ CONFIG_FONT_8x16=y
# #
# CONFIG_LOGO is not set # CONFIG_LOGO is not set
#
# Old CD-ROM drivers (not SCSI, not IDE)
#
# CONFIG_CD_NO_IDESCSI is not set
# #
# Input device support # Input device support
# #
...@@ -441,6 +443,7 @@ CONFIG_SERIO=y ...@@ -441,6 +443,7 @@ CONFIG_SERIO=y
CONFIG_SERIO_I8042=y CONFIG_SERIO_I8042=y
# CONFIG_SERIO_SERPORT is not set # CONFIG_SERIO_SERPORT is not set
# CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PCIPS2 is not set
# #
# Input Device Drivers # Input Device Drivers
...@@ -729,6 +732,7 @@ CONFIG_USB_SE401=m ...@@ -729,6 +732,7 @@ CONFIG_USB_SE401=m
# #
# USB Network adaptors # USB Network adaptors
# #
# CONFIG_USB_AX8817X is not set
# CONFIG_USB_CATC is not set # CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set # CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set # CONFIG_USB_PEGASUS is not set
......
...@@ -851,14 +851,4 @@ kgdb_output_string (const char* s, unsigned int count) ...@@ -851,14 +851,4 @@ kgdb_output_string (const char* s, unsigned int count)
putpacket(buffer); putpacket(buffer);
return 1; return 1;
}
#if defined(CONFIG_6xx) || defined(CONFIG_POWER3)
/* This is used on arches which don't have a serial driver that maps
* the ports for us */
void
kgdb_map_scc(void)
{
} }
#endif
...@@ -272,8 +272,10 @@ EXPORT_SYMBOL(kd_mksound); ...@@ -272,8 +272,10 @@ EXPORT_SYMBOL(kd_mksound);
#ifdef CONFIG_NVRAM #ifdef CONFIG_NVRAM
EXPORT_SYMBOL(nvram_read_byte); EXPORT_SYMBOL(nvram_read_byte);
EXPORT_SYMBOL(nvram_write_byte); EXPORT_SYMBOL(nvram_write_byte);
#ifdef CONFIG_PPC_PMAC
EXPORT_SYMBOL(pmac_xpram_read); EXPORT_SYMBOL(pmac_xpram_read);
EXPORT_SYMBOL(pmac_xpram_write); EXPORT_SYMBOL(pmac_xpram_write);
#endif
#endif /* CONFIG_NVRAM */ #endif /* CONFIG_NVRAM */
EXPORT_SYMBOL(to_tm); EXPORT_SYMBOL(to_tm);
......
...@@ -619,6 +619,8 @@ void __init setup_arch(char **cmdline_p) ...@@ -619,6 +619,8 @@ void __init setup_arch(char **cmdline_p)
if (strstr(cmd_line, "nokgdb")) if (strstr(cmd_line, "nokgdb"))
printk("kgdb default breakpoint deactivated on command line\n"); printk("kgdb default breakpoint deactivated on command line\n");
else { else {
if (ppc_md.progress)
ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
printk("kgdb default breakpoint activated\n"); printk("kgdb default breakpoint activated\n");
breakpoint(); breakpoint();
} }
......
...@@ -43,7 +43,7 @@ obj-$(CONFIG_POWERPMC250) += powerpmc250.o ...@@ -43,7 +43,7 @@ obj-$(CONFIG_POWERPMC250) += powerpmc250.o
obj-$(CONFIG_PPLUS) += pplus_pci.o pplus_setup.o obj-$(CONFIG_PPLUS) += pplus_pci.o pplus_setup.o
obj-$(CONFIG_PRPMC750) += prpmc750_setup.o prpmc750_pci.o obj-$(CONFIG_PRPMC750) += prpmc750_setup.o prpmc750_pci.o
obj-$(CONFIG_PRPMC800) += prpmc800_setup.o prpmc800_pci.o obj-$(CONFIG_PRPMC800) += prpmc800_setup.o prpmc800_pci.o
obj-$(CONFIG_SANDPOINT) += sandpoint_setup.o sandpoint_pci.o obj-$(CONFIG_SANDPOINT) += sandpoint.o
obj-$(CONFIG_SPRUCE) += spruce_setup.o spruce_pci.o obj-$(CONFIG_SPRUCE) += spruce_setup.o spruce_pci.o
ifeq ($(CONFIG_SMP),y) ifeq ($(CONFIG_SMP),y)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Author: Mark A. Greer * Author: Mark A. Greer
* mgreer@mvista.com * mgreer@mvista.com
* *
* 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under * 2000-2003 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program * the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#ifndef __PPC_PLATFORMS_SANDPOINT_H #ifndef __PPC_PLATFORMS_SANDPOINT_H
#define __PPC_PLATFORMS_SANDPOINT_H #define __PPC_PLATFORMS_SANDPOINT_H
#ifdef CONFIG_SANDPOINT_X3 #include <asm/ppcboot.h>
#define SANDPOINT_SIO_SLOT 0 /* Cascaded from EPIC IRQ 0 */
#if 0 #if 0
/* The Sandpoint X3 allows the IDE interrupt to be directly connected /* The Sandpoint X3 allows the IDE interrupt to be directly connected
* from the Windbond (PCI INTC or INTD) to the serial EPIC. Someday * from the Windbond (PCI INTC or INTD) to the serial EPIC. Someday
...@@ -28,27 +28,13 @@ ...@@ -28,27 +28,13 @@
* initialization than change it to route the different interrupts :-). * initialization than change it to route the different interrupts :-).
* -- Dan * -- Dan
*/ */
#define SANDPOINT_IDE_INT0 23 /* EPIC 7 */ #define SANDPOINT_IDE_INT0 23 /* EPIC 7 */
#define SANDPOINT_IDE_INT1 24 /* EPIC 8 */ #define SANDPOINT_IDE_INT1 24 /* EPIC 8 */
#else
#define SANDPOINT_IDE_INT0 14 /* 8259 Test */
#define SANDPOINT_IDE_INT1 15 /* 8259 Test */
#endif
#else #else
/* #define SANDPOINT_IDE_INT0 14 /* 8259 Test */
* Define the PCI slot that the 8259 is sharing interrupts with. #define SANDPOINT_IDE_INT1 15 /* 8259 Test */
* Valid values are 1 (PCI slot 2) and 2 (PCI slot 3).
*/
#define SANDPOINT_SIO_SLOT 1
/* ...and for the IDE from the 8259....
*/
#define SANDPOINT_IDE_INT0 14
#define SANDPOINT_IDE_INT1 15
#endif #endif
#define SANDPOINT_SIO_IRQ (SANDPOINT_SIO_SLOT + NUM_8259_INTERRUPTS)
/* /*
* The sandpoint boards have processor modules that either have an 8240 or * The sandpoint boards have processor modules that either have an 8240 or
* an MPC107 host bridge on them. These bridges have an IDSEL line that allows * an MPC107 host bridge on them. These bridges have an IDSEL line that allows
...@@ -62,7 +48,33 @@ ...@@ -62,7 +48,33 @@
*/ */
#define SANDPOINT_HOST_BRIDGE_IDSEL 12 #define SANDPOINT_HOST_BRIDGE_IDSEL 12
/*
* Serial defines.
*/
#define SANDPOINT_SERIAL_0 0xfe0003f8
#define SANDPOINT_SERIAL_1 0xfe0002f8
#define RS_TABLE_SIZE 2
/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
#define BASE_BAUD ( 1843200 / 16 )
#define UART_CLK 1843200
#ifdef CONFIG_SERIAL_DETECT_IRQ
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
#else
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
#endif
#define STD_SERIAL_PORT_DFNS \
{ 0, BASE_BAUD, SANDPOINT_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
iomem_base: (u8 *)SANDPOINT_SERIAL_0, \
io_type: SERIAL_IO_MEM }, \
{ 0, BASE_BAUD, SANDPOINT_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
iomem_base: (u8 *)SANDPOINT_SERIAL_1, \
io_type: SERIAL_IO_MEM },
void sandpoint_find_bridges(void); #define SERIAL_PORT_DFNS \
STD_SERIAL_PORT_DFNS
#endif /* __PPC_PLATFORMS_SANDPOINT_H */ #endif /* __PPC_PLATFORMS_SANDPOINT_H */
/*
* arch/ppc/platforms/sandpoint_pci.c
*
* PCI setup routines for the Motorola SPS Sandpoint Test Platform
*
* Author: Mark A. Greer
* mgreer@mvista.com
*
* 2000-2001 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/machdep.h>
#include <asm/pci-bridge.h>
#include <asm/mpc10x.h>
#include "sandpoint.h"
/*
* Motorola SPS Sandpoint interrupt routing.
*/
static inline int
sandpoint_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
static char pci_irq_table[][4] =
/*
* PCI IDSEL/INTPIN->INTLINE
* A B C D
*/
{
{ SANDPOINT_SIO_IRQ,
0, 0, 0 }, /* IDSEL 11 - i8259 on Winbond */
{ 0, 0, 0, 0 }, /* IDSEL 12 - unused */
#ifdef CONFIG_SANDPOINT_X3
#if 0 /* This is what it _should_ look like -- Dan */
{ 17, 20, 19, 18 }, /* IDSEL 13 - PCI slot 1 */
{ 18, 17, 20, 19 }, /* IDSEL 14 - PCI slot 2 */
{ 19, 18, 17, 20 }, /* IDSEL 15 - PCI slot 3 */
{ 20, 19, 18, 17 }, /* IDSEL 16 - PCI slot 4 */
#else
{ 18, 21, 20, 19 }, /* IDSEL 13 - PCI slot 1 */
{ 19, 18, 21, 20 }, /* IDSEL 14 - PCI slot 2 */
{ 20, 19, 18, 21 }, /* IDSEL 15 - PCI slot 3 */
{ 21, 20, 19, 18 }, /* IDSEL 16 - PCI slot 4 */
#endif
#else
{ 16, 19, 18, 17 }, /* IDSEL 13 - PCI slot 1 */
{ 17, 16, 19, 18 }, /* IDSEL 14 - PCI slot 2 */
{ 18, 17, 16, 19 }, /* IDSEL 15 - PCI slot 3 */
{ 19, 18, 17, 16 }, /* IDSEL 16 - PCI slot 4 */
#endif
};
const long min_idsel = 11, max_idsel = 16, irqs_per_slot = 4;
return PCI_IRQ_TABLE_LOOKUP;
}
static void __init
sandpoint_setup_winbond_83553(struct pci_controller *hose)
{
int devfn;
/*
* Route IDE interrupts directly to the 8259's IRQ 14 & 15.
* We can't route the IDE interrupt to PCI INTC# or INTD# because those
* woule interfere with the PMC's INTC# and INTD# lines.
*/
/*
* Winbond Fcn 0
*/
devfn = PCI_DEVFN(11,0);
early_write_config_byte(hose,
0,
devfn,
0x43, /* IDE Interrupt Routing Control */
0xef);
early_write_config_word(hose,
0,
devfn,
0x44, /* PCI Interrupt Routing Control */
0x0000);
/* Want ISA memory cycles to be forwarded to PCI bus */
early_write_config_byte(hose,
0,
devfn,
0x48, /* ISA-to-PCI Addr Decoder Control */
0xf0);
/* Enable RTC and Keyboard address locations. */
early_write_config_byte(hose,
0,
devfn,
0x4d, /* Chip Select Control Register */
0x00);
/* Enable Port 92. */
early_write_config_byte(hose,
0,
devfn,
0x4e, /* AT System Control Register */
0x06);
/*
* Winbond Fcn 1
*/
devfn = PCI_DEVFN(11,1);
/* Put IDE controller into native mode. */
early_write_config_byte(hose,
0,
devfn,
0x09, /* Programming interface Register */
0x8f);
/* Init IRQ routing, enable both ports, disable fast 16 */
early_write_config_dword(hose,
0,
devfn,
0x40, /* IDE Control/Status Register */
0x00ff0011);
return;
}
static int
sandpoint_exclude_device(u_char bus, u_char devfn)
{
if ((bus == 0) && (PCI_SLOT(devfn) == SANDPOINT_HOST_BRIDGE_IDSEL)) {
return PCIBIOS_DEVICE_NOT_FOUND;
}
else {
return PCIBIOS_SUCCESSFUL;
}
}
void __init
sandpoint_find_bridges(void)
{
struct pci_controller *hose;
hose = pcibios_alloc_controller();
if (!hose)
return;
hose->first_busno = 0;
hose->last_busno = 0xff;
if (mpc10x_bridge_init(hose,
MPC10X_MEM_MAP_B,
MPC10X_MEM_MAP_B,
MPC10X_MAPB_EUMB_BASE) == 0) {
/* Do early winbond init, then scan PCI bus */
sandpoint_setup_winbond_83553(hose);
ppc_md.pci_exclude_device = sandpoint_exclude_device;
hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
ppc_md.pcibios_fixup = NULL;
ppc_md.pcibios_fixup_bus = NULL;
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = sandpoint_map_irq;
}
else {
if (ppc_md.progress)
ppc_md.progress("Bridge init failed", 0x100);
printk("Host bridge init failed\n");
}
return;
}
/*
* include/asm-ppc/sandpoint_serial.h
*
* Definitions for Motorola SPS Sandpoint Test Platform
*
* Author: Mark A. Greer
* mgreer@mvista.com
*
* 2001 (c) MontaVista, Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#ifndef __ASMPPC_SANDPOINT_SERIAL_H
#define __ASMPPC_SANDPOINT_SERIAL_H
#include <linux/config.h>
#define SANDPOINT_SERIAL_0 0xfe0003f8
#define SANDPOINT_SERIAL_1 0xfe0002f8
#ifdef CONFIG_SERIAL_MANY_PORTS
#define RS_TABLE_SIZE 64
#else
#define RS_TABLE_SIZE 2
#endif
/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
#define BASE_BAUD ( 1843200 / 16 )
#ifdef CONFIG_SERIAL_DETECT_IRQ
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
#else
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
#endif
#define STD_SERIAL_PORT_DFNS \
{ 0, BASE_BAUD, SANDPOINT_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
iomem_base: (u8 *)SANDPOINT_SERIAL_0, \
io_type: SERIAL_IO_MEM }, \
{ 0, BASE_BAUD, SANDPOINT_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
iomem_base: (u8 *)SANDPOINT_SERIAL_1, \
io_type: SERIAL_IO_MEM },
#define SERIAL_PORT_DFNS \
STD_SERIAL_PORT_DFNS
#endif /* __ASMPPC_SANDPOINT_SERIAL_H */
...@@ -62,5 +62,8 @@ obj-$(CONFIG_SANDPOINT) += i8259.o open_pic.o mpc10x_common.o \ ...@@ -62,5 +62,8 @@ obj-$(CONFIG_SANDPOINT) += i8259.o open_pic.o mpc10x_common.o \
obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \ obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \
todc_time.o todc_time.o
obj-$(CONFIG_8260) += m8260_setup.o ppc8260_pic.o obj-$(CONFIG_8260) += m8260_setup.o ppc8260_pic.o
ifeq ($(CONFIG_SERIAL_8250)$(CONFIG_PPC_GEN550),yy)
obj-$(CONFIG_KGDB) += gen550_kgdb.o gen550_dbg.o
obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o
endif
obj-$(CONFIG_BOOTX_TEXT) += btext.o obj-$(CONFIG_BOOTX_TEXT) += btext.o
/*
* arch/ppc/syslib/gen550_dbg.c
*
* A library of polled 16550 serial routines. These are intended to
* be used to support progress messages, xmon, kgdb, etc. on a
* variety of platforms.
*
* Adapted from lots of code ripped from the arch/ppc/boot/ polled
* 16550 support.
*
* Author: Matt Porter <mporter@mvista.com>
*
* 2002-2003 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/config.h>
#include <linux/tty.h> /* For linux/serial_core.h */
#include <linux/serial_core.h>
#include <linux/serialP.h>
#include <linux/serial_reg.h>
#include <asm/machdep.h>
#include <asm/serial.h>
#include <asm/io.h>
#define SERIAL_BAUD 9600
static struct serial_state rs_table[RS_TABLE_SIZE] = {
SERIAL_PORT_DFNS /* defined in <asm/serial.h> */
};
static void (*serial_outb)(unsigned long, unsigned char);
static unsigned long (*serial_inb)(unsigned long);
static int shift;
unsigned long direct_inb(unsigned long addr)
{
return readb(addr);
}
void direct_outb(unsigned long addr, unsigned char val)
{
writeb(val, addr);
}
unsigned long io_inb(unsigned long port)
{
return inb(port);
}
void io_outb(unsigned long port, unsigned char val)
{
outb(val, port);
}
unsigned long serial_init(int chan, void *ignored)
{
unsigned long com_port;
unsigned char lcr, dlm;
/* We need to find out which type io we're expecting. If it's
* 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
* If it's 'SERIAL_IO_MEM', we can the exact location. -- Tom */
switch (rs_table[chan].io_type) {
case SERIAL_IO_PORT:
com_port = rs_table[chan].port;
serial_outb = io_outb;
serial_inb = io_inb;
break;
case SERIAL_IO_MEM:
com_port = (unsigned long)rs_table[chan].iomem_base;
serial_outb = direct_outb;
serial_inb = direct_inb;
break;
default:
/* We can't deal with it. */
return -1;
}
/* How far apart the registers are. */
shift = rs_table[chan].iomem_reg_shift;
/* save the LCR */
lcr = serial_inb(com_port + (UART_LCR << shift));
/* Access baud rate */
serial_outb(com_port + (UART_LCR << shift), UART_LCR_DLAB);
dlm = serial_inb(com_port + (UART_DLM << shift));
/*
* Test if serial port is unconfigured
* We assume that no-one uses less than 110 baud or
* less than 7 bits per character these days.
* -- paulus.
*/
if ((dlm <= 4) && (lcr & 2)) {
/* port is configured, put the old LCR back */
serial_outb(com_port + (UART_LCR << shift), lcr);
}
else {
/* Input clock. */
serial_outb(com_port + (UART_DLL << shift),
(rs_table[chan].baud_base / SERIAL_BAUD) & 0xFF);
serial_outb(com_port + (UART_DLM << shift),
(rs_table[chan].baud_base / SERIAL_BAUD) >> 8);
/* 8 data, 1 stop, no parity */
serial_outb(com_port + (UART_LCR << shift), 0x03);
/* RTS/DTR */
serial_outb(com_port + (UART_MCR << shift), 0x03);
/* Clear & enable FIFOs */
serial_outb(com_port + (UART_FCR << shift), 0x07);
}
return (com_port);
}
void
serial_putc(unsigned long com_port, unsigned char c)
{
while ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
serial_outb(com_port, c);
}
unsigned char
serial_getc(unsigned long com_port)
{
while ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) == 0)
;
return serial_inb(com_port);
}
int
serial_tstc(unsigned long com_port)
{
return ((serial_inb(com_port + (UART_LSR << shift)) & UART_LSR_DR) != 0);
}
void
serial_close(unsigned long com_port)
{
}
void
gen550_init(int i, struct uart_port *serial_req)
{
rs_table[i].io_type = serial_req->iotype;
rs_table[i].port = serial_req->line;
rs_table[i].iomem_base = serial_req->membase;
rs_table[i].iomem_reg_shift = serial_req->regshift;
}
#ifdef CONFIG_SERIAL_TEXT_DEBUG
void
gen550_progress(char *s, unsigned short hex)
{
volatile unsigned int progress_debugport;
volatile char c;
progress_debugport = serial_init(0, NULL);
serial_putc(progress_debugport, '\r');
while ((c = *s++) != 0)
serial_putc(progress_debugport, c);
serial_putc(progress_debugport, '\n');
serial_putc(progress_debugport, '\r');
}
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
/*
* arch/ppc/syslib/gen550_kgdb.c
*
* Generic 16550 kgdb support intended to be useful on a variety
* of platforms. To enable this support, it is necessary to set
* the CONFIG_GEN550 option. Any virtual mapping of the serial
* port(s) to be used can be accomplished by setting
* ppc_md.early_serial_map to a platform-specific mapping function.
*
* Adapted from ppc4xx_kgdb.c.
*
* Author: Matt Porter <mporter@mvista.com>
*
* 2002-2003 (c) MontaVista Software, Inc. This file is licensed under
* the terms of the GNU General Public License version 2. This program
* is licensed "as is" without any warranty of any kind, whether express
* or implied.
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/machdep.h>
extern unsigned long serial_init(int, void *);
extern unsigned long serial_getc(unsigned long);
extern unsigned long serial_putc(unsigned long, unsigned char);
#if defined(CONFIG_KGDB_TTYS0)
#define KGDB_PORT 0
#elif defined(CONFIG_KGDB_TTYS1)
#define KGDB_PORT 1
#elif defined(CONFIG_KGDB_TTYS2)
#define KGDB_PORT 2
#elif defined(CONFIG_KGDB_TTYS3)
#define KGDB_PORT 3
#else
#error "invalid kgdb_tty port"
#endif
static volatile unsigned int kgdb_debugport;
void putDebugChar(unsigned char c)
{
if (kgdb_debugport == 0)
kgdb_debugport = serial_init(KGDB_PORT, NULL);
serial_putc(kgdb_debugport, c);
}
int getDebugChar(void)
{
if (kgdb_debugport == 0)
kgdb_debugport = serial_init(KGDB_PORT, NULL);
return(serial_getc(kgdb_debugport));
}
void kgdb_interruptible(int enable)
{
return;
}
void putDebugString(char* str)
{
while (*str != '\0') {
putDebugChar(*str);
str++;
}
putDebugChar('\r');
return;
}
/*
* Note: gen550_init() must be called already on the port we are going
* to use.
*/
void
kgdb_map_scc(void)
{
printk(KERN_DEBUG "kgdb init\n");
kgdb_debugport = serial_init(KGDB_PORT, NULL);
}
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
void* OpenPIC_Addr; void* OpenPIC_Addr;
static volatile struct OpenPIC *OpenPIC = NULL; static volatile struct OpenPIC *OpenPIC = NULL;
/* /*
* We define OpenPIC_InitSenses table thusly: * We define OpenPIC_InitSenses table thusly:
* bit 0x1: sense, 0 for edge and 1 for level. * bit 0x1: sense, 0 for edge and 1 for level.
...@@ -261,32 +262,32 @@ static void openpic_safe_writefield_IPI(volatile u_int *addr, u_int mask, u_int ...@@ -261,32 +262,32 @@ static void openpic_safe_writefield_IPI(volatile u_int *addr, u_int mask, u_int
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PMAC_PBOOK) #ifdef CONFIG_EPIC_SERIAL_MODE
static void openpic_reset(void) static void __init openpic_eicr_set_clk(u_int clkval)
{ {
openpic_setfield(&OpenPIC->Global.Global_Configuration0, openpic_writefield(&OpenPIC->Global.Global_Configuration1,
OPENPIC_CONFIG_RESET); OPENPIC_EICR_S_CLK_MASK, (clkval << 28));
while (openpic_readfield(&OpenPIC->Global.Global_Configuration0,
OPENPIC_CONFIG_RESET))
mb();
} }
#endif
#ifdef CONFIG_EPIC_SERIAL_MODE static void __init openpic_enable_sie(void)
static void openpic_enable_sie(void)
{ {
openpic_setfield(&OpenPIC->Global.Global_Configuration1, openpic_setfield(&OpenPIC->Global.Global_Configuration1,
OPENPIC_EICR_SIE); OPENPIC_EICR_SIE);
} }
#endif
static void openpic_eicr_set_clk(u_int clkval) #if defined(CONFIG_EPIC_SERIAL_MODE) || defined(CONFIG_PMAC_PBOOK)
static void openpic_reset(void)
{ {
openpic_writefield(&OpenPIC->Global.Global_Configuration1, openpic_setfield(&OpenPIC->Global.Global_Configuration0,
OPENPIC_EICR_S_CLK_MASK, (clkval << 28)); OPENPIC_CONFIG_RESET);
while (openpic_readfield(&OpenPIC->Global.Global_Configuration0,
OPENPIC_CONFIG_RESET))
mb();
} }
#endif #endif
void openpic_set_sources(int first_irq, int num_irqs, void *first_ISR) void __init openpic_set_sources(int first_irq, int num_irqs, void *first_ISR)
{ {
volatile OpenPIC_Source *src = first_ISR; volatile OpenPIC_Source *src = first_ISR;
int i, last_irq; int i, last_irq;
...@@ -300,7 +301,14 @@ void openpic_set_sources(int first_irq, int num_irqs, void *first_ISR) ...@@ -300,7 +301,14 @@ void openpic_set_sources(int first_irq, int num_irqs, void *first_ISR)
ISR[i] = src; ISR[i] = src;
} }
void __init openpic_init(int linux_irq_offset) /*
* The `offset' parameter defines where the interrupts handled by the
* OpenPIC start in the space of interrupt numbers that the kernel knows
* about. In other words, the OpenPIC's IRQ0 is numbered `offset' in the
* kernel's interrupt numbering scheme.
* We assume there is only one OpenPIC.
*/
void __init openpic_init(int offset)
{ {
u_int t, i; u_int t, i;
u_int timerfreq; u_int timerfreq;
...@@ -349,13 +357,13 @@ void __init openpic_init(int linux_irq_offset) ...@@ -349,13 +357,13 @@ void __init openpic_init(int linux_irq_offset)
printk("OpenPIC timer frequency is %d.%06d MHz\n", printk("OpenPIC timer frequency is %d.%06d MHz\n",
timerfreq / 1000000, timerfreq % 1000000); timerfreq / 1000000, timerfreq % 1000000);
open_pic_irq_offset = linux_irq_offset; open_pic_irq_offset = offset;
/* Initialize timer interrupts */ /* Initialize timer interrupts */
if ( ppc_md.progress ) ppc_md.progress("openpic: timer",0x3ba); if ( ppc_md.progress ) ppc_md.progress("openpic: timer",0x3ba);
for (i = 0; i < OPENPIC_NUM_TIMERS; i++) { for (i = 0; i < OPENPIC_NUM_TIMERS; i++) {
/* Disabled, Priority 0 */ /* Disabled, Priority 0 */
openpic_inittimer(i, 0, OPENPIC_VEC_TIMER+i+linux_irq_offset); openpic_inittimer(i, 0, OPENPIC_VEC_TIMER+i+offset);
/* No processor */ /* No processor */
openpic_maptimer(i, 0); openpic_maptimer(i, 0);
} }
...@@ -365,12 +373,10 @@ void __init openpic_init(int linux_irq_offset) ...@@ -365,12 +373,10 @@ void __init openpic_init(int linux_irq_offset)
if ( ppc_md.progress ) ppc_md.progress("openpic: ipi",0x3bb); if ( ppc_md.progress ) ppc_md.progress("openpic: ipi",0x3bb);
for (i = 0; i < OPENPIC_NUM_IPI; i++) { for (i = 0; i < OPENPIC_NUM_IPI; i++) {
/* Disabled, Priority 10..13 */ /* Disabled, Priority 10..13 */
openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i+linux_irq_offset); openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i+offset);
/* IPIs are per-CPU */ /* IPIs are per-CPU */
irq_desc[OPENPIC_VEC_IPI+i+linux_irq_offset].status |= irq_desc[OPENPIC_VEC_IPI+i+offset].status |= IRQ_PER_CPU;
IRQ_PER_CPU; irq_desc[OPENPIC_VEC_IPI+i+offset].handler = &open_pic_ipi;
irq_desc[OPENPIC_VEC_IPI+i+linux_irq_offset].handler =
&open_pic_ipi;
} }
#endif #endif
...@@ -387,40 +393,36 @@ void __init openpic_init(int linux_irq_offset) ...@@ -387,40 +393,36 @@ void __init openpic_init(int linux_irq_offset)
continue; continue;
/* the bootloader may have left it enabled (bad !) */ /* the bootloader may have left it enabled (bad !) */
openpic_disable_irq(i+linux_irq_offset); openpic_disable_irq(i+offset);
/* sense = (i < OpenPIC_NumInitSenses)? OpenPIC_InitSenses[i]: \
* We find the value from either the InitSenses table (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE);
* or assume a negative polarity level interrupt.
*/
sense = (i < OpenPIC_NumInitSenses)? OpenPIC_InitSenses[i]: 1;
if ((sense & IRQ_SENSE_MASK) == 1) if (sense & IRQ_SENSE_MASK)
irq_desc[i+linux_irq_offset].status = IRQ_LEVEL; irq_desc[i+offset].status = IRQ_LEVEL;
/* Enabled, Priority 8 */ /* Enabled, Priority 8 */
openpic_initirq(i, 8, i + linux_irq_offset, openpic_initirq(i, 8, i+offset, (sense & IRQ_POLARITY_MASK),
(sense & IRQ_POLARITY_MASK),
(sense & IRQ_SENSE_MASK)); (sense & IRQ_SENSE_MASK));
/* Processor 0 */ /* Processor 0 */
openpic_mapirq(i, 1<<0, 0); openpic_mapirq(i, 1<<0, 0);
} }
/* Init descriptors */ /* Init descriptors */
for (i = linux_irq_offset; i < NumSources + linux_irq_offset; i++) for (i = offset; i < NumSources + offset; i++)
irq_desc[i].handler = &open_pic; irq_desc[i].handler = &open_pic;
/* Initialize the spurious interrupt */ /* Initialize the spurious interrupt */
if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd); if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd);
openpic_set_spurious(OPENPIC_VEC_SPURIOUS+linux_irq_offset); openpic_set_spurious(OPENPIC_VEC_SPURIOUS+offset);
/* Initialize the cascade */ /* Initialize the cascade */
if (linux_irq_offset) { if (offset) {
if (request_irq(linux_irq_offset, no_action, SA_INTERRUPT, if (request_irq(offset, no_action, SA_INTERRUPT,
"82c59 cascade", NULL)) "82c59 cascade", NULL))
printk("Unable to get OpenPIC IRQ 0 for cascade\n"); printk("Unable to get OpenPIC IRQ 0 for cascade\n");
} }
openpic_disable_8259_pass_through(); openpic_disable_8259_pass_through();
#ifdef CONFIG_EPIC_SERIAL_MODE #ifdef CONFIG_EPIC_SERIAL_MODE
openpic_eicr_set_clk(7); /* Slowest value until we know better */ openpic_eicr_set_clk(7); /* Slowest value until we know better */
openpic_enable_sie(); openpic_enable_sie();
...@@ -479,7 +481,7 @@ static u_int openpic_get_priority(void) ...@@ -479,7 +481,7 @@ static u_int openpic_get_priority(void)
} }
#endif /* notused */ #endif /* notused */
static void openpic_set_priority(u_int pri) static void __init openpic_set_priority(u_int pri)
{ {
DECL_THIS_CPU; DECL_THIS_CPU;
...@@ -656,29 +658,18 @@ static void __init openpic_maptimer(u_int timer, u_int cpumask) ...@@ -656,29 +658,18 @@ static void __init openpic_maptimer(u_int timer, u_int cpumask)
} }
/* /*
* Initalize the interrupt source which will generate an NMI (and disable it). * Initalize the interrupt source which will generate an NMI.
* This raises the interrupt's priority from 8 to 9.
* *
* irq: The logical IRQ which generates an NMI. * irq: The logical IRQ which generates an NMI.
*/ */
void __init void __init
openpic_init_nmi_irq(u_int irq) openpic_init_nmi_irq(u_int irq)
{ {
int sense; check_arg_irq(irq);
openpic_safe_writefield(&ISR[irq - open_pic_irq_offset]->Vector_Priority,
/* If this wasn't given, assume a level, negative polarity interrupt. */ OPENPIC_PRIORITY_MASK,
sense = (irq < OpenPIC_NumInitSenses) ? OpenPIC_InitSenses[irq] : 9 << OPENPIC_PRIORITY_SHIFT);
(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE);
openpic_safe_writefield(&ISR[irq]->Vector_Priority,
OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
OPENPIC_SENSE_MASK | OPENPIC_POLARITY_MASK,
(9 << OPENPIC_PRIORITY_SHIFT) |
(irq + open_pic_irq_offset) |
((sense & IRQ_POLARITY_MASK) ?
OPENPIC_POLARITY_POSITIVE :
OPENPIC_POLARITY_NEGATIVE) |
((sense & IRQ_SENSE_MASK) ? OPENPIC_SENSE_LEVEL
: OPENPIC_SENSE_EDGE));
} }
/* /*
...@@ -752,7 +743,8 @@ void openpic_disable_ipi(u_int irq) ...@@ -752,7 +743,8 @@ void openpic_disable_ipi(u_int irq)
* pol: polarity (1 for positive, 0 for negative) * pol: polarity (1 for positive, 0 for negative)
* sense: 1 for level, 0 for edge * sense: 1 for level, 0 for edge
*/ */
static void openpic_initirq(u_int irq, u_int pri, u_int vec, int pol, int sense) static void __init
openpic_initirq(u_int irq, u_int pri, u_int vec, int pol, int sense)
{ {
openpic_safe_writefield(&ISR[irq]->Vector_Priority, openpic_safe_writefield(&ISR[irq]->Vector_Priority,
OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK | OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#elif defined(CONFIG_PRPMC800) #elif defined(CONFIG_PRPMC800)
#include <platforms/prpmc800_serial.h> #include <platforms/prpmc800_serial.h>
#elif defined(CONFIG_SANDPOINT) #elif defined(CONFIG_SANDPOINT)
#include <platforms/sandpoint_serial.h> #include <platforms/sandpoint.h>
#elif defined(CONFIG_SPRUCE) #elif defined(CONFIG_SPRUCE)
#include <platforms/spruce_serial.h> #include <platforms/spruce_serial.h>
#elif defined(CONFIG_40x) #elif defined(CONFIG_40x)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment