1 /*
2  * linux/arch/arm/mach-sa1100/pfs168.c
3  */
4 #include <linux/config.h>
5 #include <linux/init.h>
6 #include <linux/kernel.h>
7 #include <linux/tty.h>
8 #include <linux/errno.h>
9 
10 #include <asm/hardware.h>
11 #include <asm/setup.h>
12 
13 #include <asm/mach/arch.h>
14 #include <asm/mach/map.h>
15 #include <asm/mach/serial_sa1100.h>
16 
17 #include "generic.h"
18 #include "sa1111.h"
19 
20 
pfs168_init(void)21 static int __init pfs168_init(void)
22 {
23 	int ret;
24 
25 	if (!machine_is_pfs168())
26 		return -ENODEV;
27 
28 	/*
29 	 * Ensure that the memory bus request/grant signals are setup,
30 	 * and the grant is held in its inactive state
31 	 */
32 	sa1110_mb_disable();
33 
34 	/*
35 	 * Probe for SA1111.
36 	 */
37 	ret = sa1111_probe(PFS168_SA1111_BASE);
38 	if (ret < 0)
39 		return ret;
40 
41 	/*
42 	 * We found it.  Wake the chip up.
43 	 */
44 	sa1111_wake();
45 
46 	/*
47 	 * The SDRAM configuration of the SA1110 and the SA1111 must
48 	 * match.  This is very important to ensure that SA1111 accesses
49 	 * don't corrupt the SDRAM.  Note that this ungates the SA1111's
50 	 * MBGNT signal, so we must have called sa1110_mb_disable()
51 	 * beforehand.
52 	 */
53 	sa1111_configure_smc(1,
54 			     FExtr(MDCNFG, MDCNFG_SA1110_DRAC0),
55 			     FExtr(MDCNFG, MDCNFG_SA1110_TDL0));
56 
57 	/*
58 	 * We only need to turn on DCLK whenever we want to use the
59 	 * DMA.  It can otherwise be held firmly in the off position.
60 	 */
61 	SKPCR |= SKPCR_DCLKEN;
62 
63 	/*
64 	 * Enable the SA1110 memory bus request and grant signals.
65 	 */
66 	sa1110_mb_enable();
67 
68 	sa1111_init_irq(IRQ_GPIO25);	/* SA1111 IRQ on GPIO 25 */
69 
70 	return 0;
71 }
72 
73 __initcall(pfs168_init);
74 
75 
pfs168_init_irq(void)76 static void __init pfs168_init_irq(void)
77 {
78 	sa1100_init_irq();
79 
80 	/*
81 	 * Need to register these as rising edge interrupts
82 	 * for standard 16550 serial driver support.
83 	 */
84 	set_GPIO_IRQ_edge(GPIO_GPIO(19), GPIO_RISING_EDGE);
85 	set_GPIO_IRQ_edge(GPIO_GPIO(20), GPIO_RISING_EDGE);
86 	set_GPIO_IRQ_edge(GPIO_GPIO(25), GPIO_RISING_EDGE);
87 	set_GPIO_IRQ_edge(GPIO_UCB1300_IRQ, GPIO_RISING_EDGE);
88 }
89 
90 
91 static void __init
fixup_pfs168(struct machine_desc * desc,struct param_struct * params,char ** cmdline,struct meminfo * mi)92 fixup_pfs168(struct machine_desc *desc, struct param_struct *params,
93 	     char **cmdline, struct meminfo *mi)
94 {
95 	SET_BANK( 0, 0xc0000000, 16*1024*1024 );
96 	mi->nr_banks = 1;
97 
98 	ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
99 	setup_ramdisk( 1, 0, 0, 8192 );
100 	setup_initrd( 0xc0800000, 3*1024*1024 );
101 }
102 
103 static struct map_desc pfs168_io_desc[] __initdata = {
104  /* virtual     physical    length      domain     r  w  c  b */
105   { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 0 */
106   { 0xf0000000, 0x10000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* 16C752 DUART port A (COM5) */
107   { 0xf0001000, 0x10800000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* 16C752 DUART port B (COM6) */
108   { 0xf0002000, 0x11000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* COM1 RTS control (SYSC1RTS) */
109   { 0xf0003000, 0x11400000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* Status LED control (SYSLED) */
110   { 0xf0004000, 0x11800000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* DTMF code read (SYSDTMF) */
111   { 0xf0005000, 0x11c00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* LCD configure, enable (SYSLCDDE) */
112   { 0xf0006000, 0x12000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* COM1 DSR and motion sense (SYSC1DSR) */
113   { 0xf0007000, 0x12800000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* COM3 xmit enable (SYSC3TEN) */
114   { 0xf0008000, 0x13000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* Control register A (SYSCTLA) */
115   { 0xf0009000, 0x13800000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* Control register B (SYSCTLB) */
116   { 0xf000a000, 0x18000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, /* SMC91C96 */
117   { 0xf2800000, 0x4b800000, 0x00800000, DOMAIN_IO, 0, 1, 0, 0 }, /* MQ200 */
118   { 0xf4000000, 0x40000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, /* SA-1111 */
119   LAST_DESC
120 };
121 
pfs168_map_io(void)122 static void __init pfs168_map_io(void)
123 {
124 	sa1100_map_io();
125 	iotable_init(pfs168_io_desc);
126 
127 	sa1100_register_uart(0, 3);
128 	sa1100_register_uart(1, 1);
129 }
130 
131 MACHINE_START(PFS168, "Tulsa")
132 	BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
133 #if defined(CONFIG_PFS168_CMDLINE)
134 	BOOT_PARAMS(0xc0000100)
135 #endif
136 	FIXUP(fixup_pfs168)
137 	MAPIO(pfs168_map_io)
138 	INITIRQ(pfs168_init_irq)
139 MACHINE_END
140