mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-01 11:24:25 +08:00
08ccf57283
Prepare bcm47xx to support different System buses. Before adding support for bcma it should be possible to build bcm47xx without the need of ssb. With this patch bcm47xx does not directly contain a ssb_bus, but a union contain all the supported system buses. As a SoC just uses one system bus a union is a good choice. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
/*
|
|
* 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 Aurelien Jarno <aurelien@aurel32.net>
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/serial.h>
|
|
#include <linux/serial_8250.h>
|
|
#include <linux/ssb/ssb.h>
|
|
#include <bcm47xx.h>
|
|
|
|
static struct plat_serial8250_port uart8250_data[5];
|
|
|
|
static struct platform_device uart8250_device = {
|
|
.name = "serial8250",
|
|
.id = PLAT8250_DEV_PLATFORM,
|
|
.dev = {
|
|
.platform_data = uart8250_data,
|
|
},
|
|
};
|
|
|
|
static int __init uart8250_init_ssb(void)
|
|
{
|
|
int i;
|
|
struct ssb_mipscore *mcore = &(bcm47xx_bus.ssb.mipscore);
|
|
|
|
memset(&uart8250_data, 0, sizeof(uart8250_data));
|
|
|
|
for (i = 0; i < mcore->nr_serial_ports; i++) {
|
|
struct plat_serial8250_port *p = &(uart8250_data[i]);
|
|
struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]);
|
|
|
|
p->mapbase = (unsigned int) ssb_port->regs;
|
|
p->membase = (void *) ssb_port->regs;
|
|
p->irq = ssb_port->irq + 2;
|
|
p->uartclk = ssb_port->baud_base;
|
|
p->regshift = ssb_port->reg_shift;
|
|
p->iotype = UPIO_MEM;
|
|
p->flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
|
|
}
|
|
return platform_device_register(&uart8250_device);
|
|
}
|
|
|
|
static int __init uart8250_init(void)
|
|
{
|
|
switch (bcm47xx_bus_type) {
|
|
case BCM47XX_BUS_TYPE_SSB:
|
|
return uart8250_init_ssb();
|
|
}
|
|
return -EINVAL;
|
|
}
|
|
|
|
module_init(uart8250_init);
|
|
|
|
MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_DESCRIPTION("8250 UART probe driver for the BCM47XX platforms");
|