aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/nxp/pnx8550/common/setup.c
diff options
context:
space:
mode:
authorDaniel Laird <daniel.j.laird@nxp.com>2008-03-06 04:07:18 -0500
committerRalf Baechle <ralf@linux-mips.org>2008-04-28 12:14:26 -0400
commita92b05880d261e9017ef8e7d5b6b01e0e5aa991d (patch)
tree663109c57e75dd2183507818a035c99ab53fff25 /arch/mips/nxp/pnx8550/common/setup.c
parent389310e2b0c195f176e7d4be788bc245e9102412 (diff)
[MIPS] Move arch/mips/philips to arch/mips/nxp
Signed-off-by: daniel.j.laird <daniel.j.laird@nxp.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/nxp/pnx8550/common/setup.c')
-rw-r--r--arch/mips/nxp/pnx8550/common/setup.c157
1 files changed, 157 insertions, 0 deletions
diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c
new file mode 100644
index 000000000000..92d764c97701
--- /dev/null
+++ b/arch/mips/nxp/pnx8550/common/setup.c
@@ -0,0 +1,157 @@
1/*
2 *
3 * 2.6 port, Embedded Alley Solutions, Inc
4 *
5 * Based on Per Hallsmark, per.hallsmark@mvista.com
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 */
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/ioport.h>
23#include <linux/irq.h>
24#include <linux/mm.h>
25#include <linux/delay.h>
26#include <linux/interrupt.h>
27#include <linux/serial_pnx8xxx.h>
28#include <linux/pm.h>
29
30#include <asm/cpu.h>
31#include <asm/bootinfo.h>
32#include <asm/irq.h>
33#include <asm/mipsregs.h>
34#include <asm/reboot.h>
35#include <asm/pgtable.h>
36#include <asm/time.h>
37
38#include <glb.h>
39#include <int.h>
40#include <pci.h>
41#include <uart.h>
42#include <nand.h>
43
44extern void __init board_setup(void);
45extern void pnx8550_machine_restart(char *);
46extern void pnx8550_machine_halt(void);
47extern void pnx8550_machine_power_off(void);
48extern struct resource ioport_resource;
49extern struct resource iomem_resource;
50extern void rs_kgdb_hook(int tty_no);
51extern char *prom_getcmdline(void);
52
53struct resource standard_io_resources[] = {
54 {
55 .start = 0x00,
56 .end = 0x1f,
57 .name = "dma1",
58 .flags = IORESOURCE_BUSY
59 }, {
60 .start = 0x40,
61 .end = 0x5f,
62 .name = "timer",
63 .flags = IORESOURCE_BUSY
64 }, {
65 .start = 0x80,
66 .end = 0x8f,
67 .name = "dma page reg",
68 .flags = IORESOURCE_BUSY
69 }, {
70 .start = 0xc0,
71 .end = 0xdf,
72 .name = "dma2",
73 .flags = IORESOURCE_BUSY
74 },
75};
76
77#define STANDARD_IO_RESOURCES ARRAY_SIZE(standard_io_resources)
78
79extern struct resource pci_io_resource;
80extern struct resource pci_mem_resource;
81
82/* Return the total size of DRAM-memory, (RANK0 + RANK1) */
83unsigned long get_system_mem_size(void)
84{
85 /* Read IP2031_RANK0_ADDR_LO */
86 unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010);
87 /* Read IP2031_RANK1_ADDR_HI */
88 unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018);
89
90 return dram_r1_hi - dram_r0_lo + 1;
91}
92
93int pnx8550_console_port = -1;
94
95void __init plat_mem_setup(void)
96{
97 int i;
98 char* argptr;
99
100 board_setup(); /* board specific setup */
101
102 _machine_restart = pnx8550_machine_restart;
103 _machine_halt = pnx8550_machine_halt;
104 pm_power_off = pnx8550_machine_power_off;
105
106 /* Clear the Global 2 Register, PCI Inta Output Enable Registers
107 Bit 1:Enable DAC Powerdown
108 -> 0:DACs are enabled and are working normally
109 1:DACs are powerdown
110 Bit 0:Enable of PCI inta output
111 -> 0 = Disable PCI inta output
112 1 = Enable PCI inta output
113 */
114 PNX8550_GLB2_ENAB_INTA_O = 0;
115
116 /* IO/MEM resources. */
117 set_io_port_base(KSEG1);
118 ioport_resource.start = 0;
119 ioport_resource.end = ~0;
120 iomem_resource.start = 0;
121 iomem_resource.end = ~0;
122
123 /* Request I/O space for devices on this board */
124 for (i = 0; i < STANDARD_IO_RESOURCES; i++)
125 request_resource(&ioport_resource, standard_io_resources + i);
126
127 /* Place the Mode Control bit for GPIO pin 16 in primary function */
128 /* Pin 16 is used by UART1, UA1_TX */
129 outl((PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_16_BIT) |
130 (PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_17_BIT),
131 PNX8550_GPIO_MC1);
132
133 argptr = prom_getcmdline();
134 if ((argptr = strstr(argptr, "console=ttyS")) != NULL) {
135 argptr += strlen("console=ttyS");
136 pnx8550_console_port = *argptr == '0' ? 0 : 1;
137
138 /* We must initialize the UART (console) before early printk */
139 /* Set LCR to 8-bit and BAUD to 38400 (no 5) */
140 ip3106_lcr(UART_BASE, pnx8550_console_port) =
141 PNX8XXX_UART_LCR_8BIT;
142 ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
143 }
144
145#ifdef CONFIG_KGDB
146 argptr = prom_getcmdline();
147 if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
148 int line;
149 argptr += strlen("kgdb=ttyS");
150 line = *argptr == '0' ? 0 : 1;
151 rs_kgdb_hook(line);
152 pr_info("KGDB: Using ttyS%i for session, "
153 "please connect your debugger\n", line ? 1 : 0);
154 }
155#endif
156 return;
157}