import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-sa1100 / jornada720.c
1 /*
2  * linux/arch/arm/mach-sa1100/jornada720.c
3  */
4
5 #include <linux/init.h>
6 #include <linux/kernel.h>
7 #include <linux/tty.h>
8 #include <linux/delay.h>
9
10 #include <asm/hardware.h>
11 #include <asm/hardware/sa1111.h>
12 #include <asm/irq.h>
13 #include <asm/setup.h>
14
15 #include <asm/mach/arch.h>
16 #include <asm/mach/map.h>
17 #include <asm/mach/serial_sa1100.h>
18
19 #include "generic.h"
20 #include "sa1111.h"
21
22
23 #define JORTUCR_VAL     0x20000400
24 #define JORSKCR_INIT    0x00002081      /* Turn off VCO to enable PLL, set Ready En and enable nOE assertion from DC */
25 #define JORSKCR_RCLK    0x00002083      /* Add turning on RCLK to above */
26 #define JORSKCR_VAL     0x0000001B      /* sets the 1101 control register to on */
27
28 static int __init jornada720_init(void)
29 {
30         GPDR |= GPIO_GPIO20;
31         TUCR = JORTUCR_VAL;     /* set the oscillator out to the SA-1101 */
32
33         GPSR = GPIO_GPIO20;
34         udelay(1);
35         GPCR = GPIO_GPIO20;
36         udelay(1);
37         GPSR = GPIO_GPIO20;
38         udelay(20);
39         SBI_SKCR = JORSKCR_INIT;/* Turn on the PLL, enable Ready and enable nOE assertion from DC */
40         mdelay(100);
41
42         SBI_SKCR = JORSKCR_RCLK;/* turn on the RCLOCK */
43         SBI_SMCR = 0x35;        /* initialize the SMC (debug SA-1111 reset */
44         PCCR = 0;               /* initialize the S2MC (debug SA-1111 reset) */
45
46         /* LDD4 is speaker, LDD3 is microphone */
47         PPSR &= ~(PPC_LDD3 | PPC_LDD4);
48         PPDR |= PPC_LDD3 | PPC_LDD4;
49
50         /* initialize extra IRQs */
51         set_GPIO_IRQ_edge(GPIO_GPIO1, GPIO_RISING_EDGE);
52         sa1111_init_irq(IRQ_GPIO1);     /* chained on GPIO 1 */
53
54         return 0;
55 }
56
57 __initcall(jornada720_init);
58
59
60 static void __init
61 fixup_jornada720(struct machine_desc *desc, struct param_struct *params,
62                  char **cmdline, struct meminfo *mi)
63 {
64         SET_BANK( 0, 0xc0000000, 32*1024*1024 );
65         mi->nr_banks = 1;
66 }
67
68 static struct map_desc jornada720_io_desc[] __initdata = {
69  /* virtual     physical    length      domain     r  w  c  b */
70   { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* Flash bank 0 */
71   { 0xf0000000, 0x48000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, /* Epson registers */
72   { 0xf1000000, 0x48200000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, /* Epson frame buffer */
73   { 0xf4000000, 0x40000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, /* SA-1111 */
74   LAST_DESC
75 };
76
77 static void __init jornada720_map_io(void)
78 {
79         sa1100_map_io();
80         iotable_init(jornada720_io_desc);
81         
82         sa1100_register_uart(0, 3);
83         sa1100_register_uart(1, 1);
84 }
85
86 MACHINE_START(JORNADA720, "HP Jornada 720")
87         BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
88         BOOT_PARAMS(0xc0000100)
89         FIXUP(fixup_jornada720)
90         MAPIO(jornada720_map_io)
91         INITIRQ(sa1100_init_irq)
92 MACHINE_END