2 * BRIEF MODULE DESCRIPTION
3 * MyCable XXS1500 board support
5 * Copyright 2003, 2008 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <linux/kernel.h>
24 #include <linux/init.h>
25 #include <linux/interrupt.h>
26 #include <linux/platform_device.h>
27 #include <linux/gpio.h>
28 #include <linux/delay.h>
30 #include <asm/bootinfo.h>
31 #include <asm/reboot.h>
32 #include <asm/mach-au1x00/au1000.h>
35 const char *get_system_type(void)
40 void __init
prom_init(void)
42 unsigned char *memsize_str
;
43 unsigned long memsize
;
46 prom_argv
= (char **)fw_arg1
;
47 prom_envp
= (char **)fw_arg2
;
51 memsize_str
= prom_getenv("memsize");
52 if (!memsize_str
|| strict_strtoul(memsize_str
, 0, &memsize
))
55 add_memory_region(0, memsize
, BOOT_MEM_RAM
);
58 void prom_putchar(unsigned char c
)
60 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR
, c
);
63 static void xxs1500_reset(char *c
)
65 /* Jump to the reset vector */
66 __asm__
__volatile__("jr\t%0" : : "r"(0xbfc00000));
69 static void xxs1500_power_off(void)
78 void __init
board_setup(void)
82 pm_power_off
= xxs1500_power_off
;
83 _machine_halt
= xxs1500_power_off
;
84 _machine_restart
= xxs1500_reset
;
86 alchemy_gpio1_input_enable();
87 alchemy_gpio2_enable();
89 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
90 pin_func
= au_readl(SYS_PINFUNC
) & ~SYS_PF_UR3
;
91 pin_func
|= SYS_PF_UR3
;
92 au_writel(pin_func
, SYS_PINFUNC
);
95 alchemy_uart_enable(AU1000_UART3_PHYS_ADDR
);
96 /* Enable DTR (MCR bit 0) = USB power up */
97 __raw_writel(1, (void __iomem
*)KSEG1ADDR(AU1000_UART3_PHYS_ADDR
+ 0x18));
101 /******************************************************************************/
103 static struct resource xxs1500_pcmcia_res
[] = {
106 .flags
= IORESOURCE_MEM
,
107 .start
= AU1000_PCMCIA_IO_PHYS_ADDR
,
108 .end
= AU1000_PCMCIA_IO_PHYS_ADDR
+ 0x000400000 - 1,
111 .name
= "pcmcia-attr",
112 .flags
= IORESOURCE_MEM
,
113 .start
= AU1000_PCMCIA_ATTR_PHYS_ADDR
,
114 .end
= AU1000_PCMCIA_ATTR_PHYS_ADDR
+ 0x000400000 - 1,
117 .name
= "pcmcia-mem",
118 .flags
= IORESOURCE_MEM
,
119 .start
= AU1000_PCMCIA_MEM_PHYS_ADDR
,
120 .end
= AU1000_PCMCIA_MEM_PHYS_ADDR
+ 0x000400000 - 1,
124 static struct platform_device xxs1500_pcmcia_dev
= {
125 .name
= "xxs1500_pcmcia",
127 .num_resources
= ARRAY_SIZE(xxs1500_pcmcia_res
),
128 .resource
= xxs1500_pcmcia_res
,
131 static struct platform_device
*xxs1500_devs
[] __initdata
= {
135 static int __init
xxs1500_dev_init(void)
137 irq_set_irq_type(AU1500_GPIO204_INT
, IRQ_TYPE_LEVEL_HIGH
);
138 irq_set_irq_type(AU1500_GPIO201_INT
, IRQ_TYPE_LEVEL_LOW
);
139 irq_set_irq_type(AU1500_GPIO202_INT
, IRQ_TYPE_LEVEL_LOW
);
140 irq_set_irq_type(AU1500_GPIO203_INT
, IRQ_TYPE_LEVEL_LOW
);
141 irq_set_irq_type(AU1500_GPIO205_INT
, IRQ_TYPE_LEVEL_LOW
);
142 irq_set_irq_type(AU1500_GPIO207_INT
, IRQ_TYPE_LEVEL_LOW
);
144 irq_set_irq_type(AU1500_GPIO0_INT
, IRQ_TYPE_LEVEL_LOW
);
145 irq_set_irq_type(AU1500_GPIO1_INT
, IRQ_TYPE_LEVEL_LOW
);
146 irq_set_irq_type(AU1500_GPIO2_INT
, IRQ_TYPE_LEVEL_LOW
);
147 irq_set_irq_type(AU1500_GPIO3_INT
, IRQ_TYPE_LEVEL_LOW
);
148 irq_set_irq_type(AU1500_GPIO4_INT
, IRQ_TYPE_LEVEL_LOW
); /* CF irq */
149 irq_set_irq_type(AU1500_GPIO5_INT
, IRQ_TYPE_LEVEL_LOW
);
151 return platform_add_devices(xxs1500_devs
,
152 ARRAY_SIZE(xxs1500_devs
));
154 device_initcall(xxs1500_dev_init
);