1 /*
2  *  setup.c, Setup for the TANBAC TB0229 (VR4131DIMM)
3  *
4  *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5  *
6  *  Modified for TANBAC TB0229:
7  *  Copyright (C) 2003 Megasolution Inc.  <matsu@megasolution.jp>
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 #include <linux/config.h>
24 #include <linux/console.h>
25 #include <linux/init.h>
26 #include <linux/ioport.h>
27 
28 #include <asm/pci_channel.h>
29 #include <asm/reboot.h>
30 #include <asm/time.h>
31 #include <asm/vr41xx/tb0229.h>
32 
33 #ifdef CONFIG_PCI
34 static struct resource vr41xx_pci_io_resource = {
35 	.name	= "PCI I/O space",
36 	.start	= VR41XX_PCI_IO_START,
37 	.end	= VR41XX_PCI_IO_END,
38 	.flags	= IORESOURCE_IO,
39 };
40 
41 static struct resource vr41xx_pci_mem_resource = {
42 	.name	= "PCI memory space",
43 	.start	= VR41XX_PCI_MEM_START,
44 	.end	= VR41XX_PCI_MEM_END,
45 	.flags	= IORESOURCE_MEM,
46 };
47 
48 struct pci_channel mips_pci_channels[] = {
49 	{	.pci_ops	= &vr41xx_pci_ops,
50 		.io_resource	= &vr41xx_pci_io_resource,
51 		.mem_resource	= &vr41xx_pci_mem_resource,
52 		.first_devfn	= 0,
53 		.last_devfn	= 256,	},
54 	{	.pci_ops	= NULL,
55 		.io_resource	= NULL,
56 		.mem_resource	= NULL,
57 		.first_devfn	= 0,
58 		.last_devfn	= 0,	}
59 };
60 
61 struct vr41xx_pci_address_space vr41xx_pci_mem1 = {
62 	.internal_base	= VR41XX_PCI_MEM1_BASE,
63 	.address_mask	= VR41XX_PCI_MEM1_MASK,
64 	.pci_base	= IO_MEM1_RESOURCE_START,
65 };
66 
67 struct vr41xx_pci_address_space vr41xx_pci_mem2 = {
68 	.internal_base	= VR41XX_PCI_MEM2_BASE,
69 	.address_mask	= VR41XX_PCI_MEM2_MASK,
70 	.pci_base	= IO_MEM2_RESOURCE_START,
71 };
72 
73 struct vr41xx_pci_address_space vr41xx_pci_io = {
74 	.internal_base	= VR41XX_PCI_IO_BASE,
75 	.address_mask	= VR41XX_PCI_IO_MASK,
76 	.pci_base	= IO_PORT_RESOURCE_START,
77 };
78 
79 static struct vr41xx_pci_address_map pci_address_map = {
80 	.mem1	= &vr41xx_pci_mem1,
81 	.mem2	= &vr41xx_pci_mem2,
82 	.io	= &vr41xx_pci_io,
83 };
84 #endif
85 
tanbac_tb0229_setup(void)86 void __init tanbac_tb0229_setup(void)
87 {
88 	set_io_port_base(IO_PORT_BASE);
89 	ioport_resource.start = IO_PORT_RESOURCE_START;
90 	ioport_resource.end = IO_PORT_RESOURCE_END;
91 	iomem_resource.start = IO_MEM1_RESOURCE_START;
92 	iomem_resource.end = IO_MEM2_RESOURCE_END;
93 
94 	board_time_init = vr41xx_time_init;
95 	board_timer_setup = vr41xx_timer_setup;
96 
97 #ifdef CONFIG_FB
98 	conswitchp = &dummy_con;
99 #endif
100 
101 	vr41xx_bcu_init();
102 	vr41xx_cmu_init();
103 	vr41xx_pmu_init();
104 
105 #ifdef CONFIG_SERIAL
106 	vr41xx_siu_init(SIU_RS232C, 0);
107 	vr41xx_dsiu_init();
108 #endif
109 
110 #ifdef CONFIG_PCI
111 	vr41xx_pciu_init(&pci_address_map);
112 #endif
113 
114 #ifdef CONFIG_TANBAC_TB0219
115 	_machine_restart = tanbac_tb0219_restart;
116 #endif
117 }
118