1 /* arch/mips/mach-goldfish/goldfish-platform.c
2 **
3 ** Copyright (C) 2007 Google, Inc.
4 **
5 ** This software is licensed under the terms of the GNU General Public
6 ** License version 2, as published by the Free Software Foundation, and
7 ** may be copied, distributed, and modified under those terms.
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
13 **
14 */
15
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/interrupt.h>
19 #include <linux/irq.h>
20 #include <linux/platform_device.h>
21 #include <linux/delay.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/nand.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/input.h>
26
27 #include <mach/hardware.h>
28 #include <asm/io.h>
29 #include <asm/bootinfo.h>
30 #include <asm/mach-goldfish/irq.h>
31
32 int GOLDFISH_READY;
33
34 static struct resource goldfish_pdev_bus_resources[] = {
35 {
36 .start = GOLDFISH_PDEV_BUS_BASE,
37 .end = GOLDFISH_PDEV_BUS_BASE + GOLDFISH_PDEV_BUS_END - 1,
38 .flags = IORESOURCE_IO,
39 },
40 {
41 .start = GOLDFISH_IRQ_BASE+GOLDFISH_IRQ_PBUS,
42 .end = GOLDFISH_IRQ_BASE+GOLDFISH_IRQ_PBUS,
43 .flags = IORESOURCE_IRQ,
44 }
45 };
46
47 struct platform_device goldfish_pdev_bus_device = {
48 .name = "goldfish_pdev_bus",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(goldfish_pdev_bus_resources),
51 .resource = goldfish_pdev_bus_resources
52 };
53
54
goldfish_setup_devinit(void)55 static int __init goldfish_setup_devinit(void)
56 {
57 platform_device_register(&goldfish_pdev_bus_device);
58 GOLDFISH_READY = 1;
59 return 0;
60 }
61 device_initcall(goldfish_setup_devinit);
62
63
prom_init(void)64 void __init prom_init(void)
65 {
66 char *cmdline = (char *)fw_arg0;
67 strcpy(arcs_cmdline, cmdline);
68 }
69
plat_mem_setup(void)70 void plat_mem_setup(void)
71 {
72 unsigned int ramsize = fw_arg1;
73 add_memory_region(0x0, ramsize, BOOT_MEM_RAM);
74 }
75
prom_free_prom_memory(void)76 void prom_free_prom_memory(void)
77 {
78 }
79
80 #define GOLDFISH_TTY_PUT_CHAR (*(volatile unsigned int *)0xbf002000)
prom_putchar(int c)81 void prom_putchar(int c)
82 {
83 GOLDFISH_TTY_PUT_CHAR = c;
84 }
85
get_system_type(void)86 const char *get_system_type(void)
87 {
88 return "MIPS-Goldfish";
89 }
90
91