Skip to content

Commit

Permalink
[MIPS] Put an end to <asm/serial.h>'s long and annyoing existence
Browse files Browse the repository at this point in the history
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Jul 10, 2007
1 parent 192cca6 commit e7c4782
Show file tree
Hide file tree
Showing 15 changed files with 371 additions and 151 deletions.
1 change: 0 additions & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ config MIPS_MALTA
bool "MIPS Malta board"
select ARCH_MAY_HAVE_PC_FDC
select BOOT_ELF32
select HAVE_STD_PC_SERIAL_PORT
select DMA_NONCOHERENT
select GENERIC_ISA_DMA
select IRQ_CPU
Expand Down
3 changes: 2 additions & 1 deletion arch/mips/ddb5xxx/ddb5477/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Makefile for NEC DDB-Vrc5477 board
#

obj-y += irq.o irq_5477.o setup.o lcd44780.o
obj-y += ddb5477-platform.o irq.o irq_5477.o setup.o \
lcd44780.o

obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
obj-$(CONFIG_KGDB) += kgdb_io.o
49 changes: 49 additions & 0 deletions arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/serial_8250.h>

#include <asm/ddb5xxx/ddb5477.h>

#define DDB_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)

#define DDB5477_PORT(base, int) \
{ \
.mapbase = base, \
.irq = int, \
.uartclk = 1843200, \
.iotype = UPIO_MEM, \
.flags = DDB_UART_FLAGS, \
.regshift = 3, \
}

static struct plat_serial8250_port uart8250_data[] = {
DDB5477_PORT(0xbfa04200, VRC5477_IRQ_UART0),
DDB5477_PORT(0xbfa04240, VRC5477_IRQ_UART1),
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the NEC DDB5477");
2 changes: 1 addition & 1 deletion arch/mips/gt64120/momenco_ocelot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Makefile for Momentum's Ocelot board.
#

obj-y += irq.o prom.o reset.o setup.o
obj-y += irq.o ocelot-platform.o prom.o reset.o setup.o

obj-$(CONFIG_KGDB) += dbg_io.o
46 changes: 46 additions & 0 deletions arch/mips/gt64120/momenco_ocelot/ocelot-platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*
* A NS16552 DUART with a 20MHz crystal.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define OCELOT_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)

static struct plat_serial8250_port uart8250_data[] = {
{
.mapbase = 0xe0001020,
.irq = 4,
.uartclk = 20000000,
.iotype = UPIO_MEM,
.flags = OCELOT_UART_FLAGS,
.regshift = 2,
},
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Momenco Ocelot");
2 changes: 1 addition & 1 deletion arch/mips/jazz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Makefile for the Jazz family specific parts of the kernel
#

obj-y := irq.o jazzdma.o reset.o setup.o
obj-y := irq.o jazzdma.o jazz-platform.o reset.o setup.o
60 changes: 60 additions & 0 deletions arch/mips/jazz/jazz-platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/serial_8250.h>

#include <asm/jazz.h>

/*
* Confusion ... It seems the original Microsoft Jazz machine used to have a
* 4.096MHz clock for its UART while the MIPS Magnum and Millenium systems
* had 8MHz. The Olivetti M700-10 and the Acer PICA have 1.8432MHz like PCs.
*/
#ifdef CONFIG_OLIVETTI_M700
#define JAZZ_BASE_BAUD 1843200
#else
#define JAZZ_BASE_BAUD 8000000 /* 3072000 */
#endif

#define JAZZ_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)

#define JAZZ_PORT(base, int) \
{ \
.mapbase = base, \
.irq = int, \
.uartclk = JAZZ_BASE_BAUD, \
.iotype = UPIO_MEM, \
.flags = JAZZ_UART_FLAGS, \
.regshift = 0, \
}

static struct plat_serial8250_port uart8250_data[] = {
JAZZ_PORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
JAZZ_PORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Jazz family");
47 changes: 47 additions & 0 deletions arch/mips/kernel/8250-platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define PORT(base, int) \
{ \
.iobase = base, \
.irq = int, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
.regshift = 0, \
}

static struct plat_serial8250_port uart8250_data[] = {
PORT(0x3F8, 4),
PORT(0x2F8, 3),
PORT(0x3E8, 4),
PORT(0x2E8, 3),
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Generic 8250 UART probe driver");
2 changes: 2 additions & 0 deletions arch/mips/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o

CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)

obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
3 changes: 2 additions & 1 deletion arch/mips/mips-boards/malta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# under Linux.
#

obj-y := malta_int.o malta_setup.o
obj-y := malta_int.o malta_platform.o malta_setup.o

obj-$(CONFIG_MTD) += malta_mtd.o
obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o
65 changes: 65 additions & 0 deletions arch/mips/mips-boards/malta/malta_platform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007 MIPS Technologies, Inc.
* written by Ralf Baechle (ralf@linux-mips.org)
*
* Probe driver for the Malta's UART ports:
*
* o 2 ports in the SMC SuperIO
* o 1 port in the CBUS UART, a discrete 16550 which normally is only used
* for bringups.
*
* We don't use 8250_platform.c on Malta as it would result in the CBUS
* UART becoming ttyS0.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/serial_8250.h>

#define SMC_PORT(base, int) \
{ \
.iobase = base, \
.irq = int, \
.uartclk = 1843200, \
.iotype = UPIO_PORT, \
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
.regshift = 0, \
}

#define CBUS_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)

static struct plat_serial8250_port uart8250_data[] = {
SMC_PORT(0x3F8, 4),
SMC_PORT(0x2F8, 3),
{
.mapbase = 0x1f000900, /* The CBUS UART */
.irq = MIPS_CPU_IRQ_BASE + 2,
.uartclk = 3686400, /* Twice the usual clk! */
.iotype = UPIO_MEM32,
.flags = CBUS_UART_FLAGS,
.regshift = 3,
},
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM2,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");
44 changes: 44 additions & 0 deletions arch/mips/momentum/ocelot_3/platform.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2006, 07 Ralf Baechle (ralf@linux-mips.org)
* Copyright (C) 2007 Dale Farnsworth (dale@farnsworth.org)
*/
#include <linux/delay.h>
#include <linux/if_ether.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/mv643xx.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>

#include "ocelot_3_fpga.h"

Expand Down Expand Up @@ -206,3 +217,36 @@ static int __init mv643xx_eth_add_pds(void)
device_initcall(mv643xx_eth_add_pds);

#endif /* defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) */

#define OCELOT3_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)

static struct plat_serial8250_port uart8250_data[] = {
{
.membase = (signed long) 0xfd000020,
.irq = 6,
.uartclk = 20000000,
.iotype = UPIO_MEM,
.flags = OCELOT3_UART_FLAGS,
.regshift = 2,
},
{ },
};

static struct platform_device uart8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = uart8250_data,
},
};

static int __init uart8250_init(void)
{
return platform_device_register(&uart8250_device);
}

module_init(uart8250_init);

MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("8250 UART probe driver for the Ocelot 3");
Loading

0 comments on commit e7c4782

Please sign in to comment.