2 * GPR board platform device registration (Au1550)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/delay.h>
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <linux/kernel.h>
25 #include <linux/platform_device.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/physmap.h>
29 #include <linux/leds.h>
30 #include <linux/gpio.h>
31 #include <linux/i2c.h>
32 #include <linux/i2c-gpio.h>
33 #include <asm/bootinfo.h>
35 #include <asm/reboot.h>
36 #include <asm/mach-au1x00/au1000.h>
37 #include <asm/mach-au1x00/gpio-au1000.h>
40 const char *get_system_type(void)
45 void __init prom_init(void)
47 unsigned char *memsize_str;
48 unsigned long memsize;
51 prom_argv = (char **)fw_arg1;
52 prom_envp = (char **)fw_arg2;
56 memsize_str = prom_getenv("memsize");
57 if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
59 add_memory_region(0, memsize, BOOT_MEM_RAM);
62 void prom_putchar(unsigned char c)
64 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
67 static void gpr_reset(char *c)
69 /* switch System-LED to orange (red# and green# on) */
70 alchemy_gpio_direction_output(4, 0);
71 alchemy_gpio_direction_output(5, 0);
73 /* trigger watchdog to reset board in 200ms */
74 printk(KERN_EMERG "Triggering watchdog soft reset...\n");
75 raw_local_irq_disable();
76 alchemy_gpio_direction_output(1, 0);
78 alchemy_gpio_set_value(1, 1);
83 static void gpr_power_off(void)
89 void __init board_setup(void)
91 printk(KERN_INFO "Trapeze ITS GPR board\n");
93 pm_power_off = gpr_power_off;
94 _machine_halt = gpr_power_off;
95 _machine_restart = gpr_reset;
98 alchemy_uart_enable(AU1000_UART3_PHYS_ADDR);
99 alchemy_uart_enable(AU1000_UART1_PHYS_ADDR);
101 /* Take away Reset of UMTS-card */
102 alchemy_gpio_direction_output(215, 1);
108 static struct resource gpr_wdt_resource[] = {
112 .name = "gpr-adm6320-wdt",
113 .flags = IORESOURCE_IRQ,
117 static struct platform_device gpr_wdt_device = {
118 .name = "adm6320-wdt",
120 .num_resources = ARRAY_SIZE(gpr_wdt_resource),
121 .resource = gpr_wdt_resource,
127 * 0x00000000-0x00200000 : "kernel"
128 * 0x00200000-0x00a00000 : "rootfs"
129 * 0x01d00000-0x01f00000 : "config"
130 * 0x01c00000-0x01d00000 : "yamon"
131 * 0x01d00000-0x01d40000 : "yamon env vars"
132 * 0x00000000-0x00a00000 : "kernel+rootfs"
134 static struct mtd_partition gpr_mtd_partitions[] = {
143 .offset = MTDPART_OFS_APPEND,
144 .mask_flags = MTD_WRITEABLE,
149 .offset = 0x01d00000,
154 .offset = 0x01c00000,
157 .name = "yamon env vars",
159 .offset = MTDPART_OFS_APPEND,
162 .name = "kernel+rootfs",
168 static struct physmap_flash_data gpr_flash_data = {
170 .nr_parts = ARRAY_SIZE(gpr_mtd_partitions),
171 .parts = gpr_mtd_partitions,
174 static struct resource gpr_mtd_resource = {
177 .flags = IORESOURCE_MEM,
180 static struct platform_device gpr_mtd_device = {
181 .name = "physmap-flash",
183 .platform_data = &gpr_flash_data,
186 .resource = &gpr_mtd_resource,
192 static struct gpio_led gpr_gpio_leds[] = {
205 static struct gpio_led_platform_data gpr_led_data = {
206 .num_leds = ARRAY_SIZE(gpr_gpio_leds),
207 .leds = gpr_gpio_leds,
210 static struct platform_device gpr_led_devices = {
214 .platform_data = &gpr_led_data,
221 static struct i2c_gpio_platform_data gpr_i2c_data = {
223 .sda_is_open_drain = 1,
225 .scl_is_open_drain = 1,
226 .udelay = 2, /* ~100 kHz */
230 static struct platform_device gpr_i2c_device = {
233 .dev.platform_data = &gpr_i2c_data,
236 static struct i2c_board_info gpr_i2c_info[] __initdata = {
238 I2C_BOARD_INFO("lm83", 0x18),
245 static struct resource alchemy_pci_host_res[] = {
247 .start = AU1500_PCI_PHYS_ADDR,
248 .end = AU1500_PCI_PHYS_ADDR + 0xfff,
249 .flags = IORESOURCE_MEM,
253 static int gpr_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin)
255 if ((slot == 0) && (pin == 1))
256 return AU1550_PCI_INTA;
257 else if ((slot == 0) && (pin == 2))
258 return AU1550_PCI_INTB;
263 static struct alchemy_pci_platdata gpr_pci_pd = {
264 .board_map_irq = gpr_map_pci_irq,
265 .pci_cfg_set = PCI_CONFIG_AEN | PCI_CONFIG_R2H | PCI_CONFIG_R1H |
267 #if defined(__MIPSEB__)
268 PCI_CONFIG_SIC_HWA_DAT | PCI_CONFIG_SM,
274 static struct platform_device gpr_pci_host_dev = {
275 .dev.platform_data = &gpr_pci_pd,
276 .name = "alchemy-pci",
278 .num_resources = ARRAY_SIZE(alchemy_pci_host_res),
279 .resource = alchemy_pci_host_res,
282 static struct platform_device *gpr_devices[] __initdata = {
289 static int __init gpr_pci_init(void)
291 return platform_device_register(&gpr_pci_host_dev);
293 /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */
294 arch_initcall(gpr_pci_init);
297 static int __init gpr_dev_init(void)
299 i2c_register_board_info(0, gpr_i2c_info, ARRAY_SIZE(gpr_i2c_info));
301 return platform_add_devices(gpr_devices, ARRAY_SIZE(gpr_devices));
303 device_initcall(gpr_dev_init);