blob: f6ce7021feba70f75c195b5eb6b861dd95aed3e2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Renesas Technology Sales RTS7751R2D Support.
3 *
Paul Mundtade2b3f2006-09-27 16:48:46 +09004 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2004 - 2006 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/init.h>
Paul Mundtade2b3f2006-09-27 16:48:46 +090012#include <linux/platform_device.h>
13#include <linux/serial_8250.h>
Paul Mundta56d2762006-09-27 11:43:24 +090014#include <linux/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <asm/io.h>
Paul Mundtade2b3f2006-09-27 16:48:46 +090016#include <asm/mach/rts7751r2d.h>
17#include <asm/mach/voyagergx_reg.h>
18
19static struct plat_serial8250_port uart_platform_data[] = {
20 {
21 .membase = (void *)VOYAGER_UART_BASE,
22 .mapbase = VOYAGER_UART_BASE,
23 .iotype = UPIO_MEM,
24 .irq = VOYAGER_UART0_IRQ,
25 .flags = UPF_BOOT_AUTOCONF,
26 .regshift = 2,
27 .uartclk = (9600 * 16),
28 }, {
29 .flags = 0,
30 },
31};
32
33static void __init voyagergx_serial_init(void)
34{
35 unsigned long val;
36
37 /*
38 * GPIO Control
39 */
40 val = inl(GPIO_MUX_HIGH);
41 val |= 0x00001fe0;
42 outl(val, GPIO_MUX_HIGH);
43
44 /*
45 * Power Mode Gate
46 */
47 val = inl(POWER_MODE0_GATE);
48 val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1);
49 outl(val, POWER_MODE0_GATE);
50
51 val = inl(POWER_MODE1_GATE);
52 val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1);
53 outl(val, POWER_MODE1_GATE);
54}
55
56static struct platform_device uart_device = {
57 .name = "serial8250",
58 .id = -1,
59 .dev = {
60 .platform_data = uart_platform_data,
61 },
62};
63
64static struct platform_device *rts7751r2d_devices[] __initdata = {
65 &uart_device,
66};
67
68static int __init rts7751r2d_devices_setup(void)
69{
70 return platform_add_devices(rts7751r2d_devices,
71 ARRAY_SIZE(rts7751r2d_devices));
72}
73__initcall(rts7751r2d_devices_setup);
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Linus Torvalds1da177e2005-04-16 15:20:36 -070075const char *get_system_type(void)
76{
77 return "RTS7751R2D";
78}
79
Paul Mundta56d2762006-09-27 11:43:24 +090080static void rts7751r2d_power_off(void)
81{
82 ctrl_outw(0x0001, PA_POWOFF);
83}
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085/*
86 * Initialize the board
87 */
88void __init platform_setup(void)
89{
90 printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
91 ctrl_outw(0x0000, PA_OUTPORT);
Paul Mundta56d2762006-09-27 11:43:24 +090092 pm_power_off = rts7751r2d_power_off;
Paul Mundtade2b3f2006-09-27 16:48:46 +090093
94 voyagergx_serial_init();
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096}