setup.c 2.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
/*
 * Renesas Technology Sales RTS7751R2D Support.
 *
4 5 6 7 8 9
 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
 * Copyright (C) 2004 - 2006 Paul Mundt
 *
 * 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.
L
Linus Torvalds 已提交
10 11
 */
#include <linux/init.h>
12 13
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
14
#include <linux/pm.h>
L
Linus Torvalds 已提交
15
#include <asm/io.h>
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#include <asm/mach/rts7751r2d.h>
#include <asm/mach/voyagergx_reg.h>

static struct plat_serial8250_port uart_platform_data[] = {
	{
		.membase	= (void *)VOYAGER_UART_BASE,
		.mapbase	= VOYAGER_UART_BASE,
		.iotype		= UPIO_MEM,
		.irq		= VOYAGER_UART0_IRQ,
		.flags		= UPF_BOOT_AUTOCONF,
		.regshift	= 2,
		.uartclk	= (9600 * 16),
	}, {
		.flags		= 0,
	},
};

static void __init voyagergx_serial_init(void)
{
	unsigned long val;

	/*
	 * GPIO Control
	 */
	val = inl(GPIO_MUX_HIGH);
	val |= 0x00001fe0;
	outl(val, GPIO_MUX_HIGH);

	/*
	 * Power Mode Gate
	 */
	val = inl(POWER_MODE0_GATE);
	val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1);
	outl(val, POWER_MODE0_GATE);

	val = inl(POWER_MODE1_GATE);
	val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1);
	outl(val, POWER_MODE1_GATE);
}

static struct platform_device uart_device = {
	.name		= "serial8250",
	.id		= -1,
	.dev		= {
		.platform_data	= uart_platform_data,
	},
};

static struct platform_device *rts7751r2d_devices[] __initdata = {
	&uart_device,
};

static int __init rts7751r2d_devices_setup(void)
{
	return platform_add_devices(rts7751r2d_devices,
				    ARRAY_SIZE(rts7751r2d_devices));
}
__initcall(rts7751r2d_devices_setup);
L
Linus Torvalds 已提交
74 75 76 77 78 79

const char *get_system_type(void)
{
	return "RTS7751R2D";
}

80 81 82 83 84
static void rts7751r2d_power_off(void)
{
	ctrl_outw(0x0001, PA_POWOFF);
}

L
Linus Torvalds 已提交
85 86 87 88 89 90 91
/*
 * Initialize the board
 */
void __init platform_setup(void)
{
	printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
	ctrl_outw(0x0000, PA_OUTPORT);
92
	pm_power_off = rts7751r2d_power_off;
93 94 95

	voyagergx_serial_init();

L
Linus Torvalds 已提交
96
}