1 /*
2  * Copyright (C) 2007 Google, Inc.
3  * Copyright (C) 2011 Intel, Inc.
4  * Copyright (C) 2013 Intel, Inc.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16 
17 #include <linux/kernel.h>
18 #include <linux/irq.h>
19 #include <linux/platform_device.h>
20 
21 /*
22  * Where in virtual device memory the IO devices (timers, system controllers
23  * and so on)
24  */
25 
26 #define GOLDFISH_PDEV_BUS_BASE	(0xff001000)
27 #define GOLDFISH_PDEV_BUS_END	(0xff7fffff)
28 #define GOLDFISH_PDEV_BUS_IRQ	(4)
29 
30 #define GOLDFISH_TTY_BASE	(0x2000)
31 
32 static struct resource goldfish_pdev_bus_resources[] = {
33 	{
34 		.start  = GOLDFISH_PDEV_BUS_BASE,
35 		.end    = GOLDFISH_PDEV_BUS_END,
36 		.flags  = IORESOURCE_MEM,
37 	},
38 	{
39 		.start	= GOLDFISH_PDEV_BUS_IRQ,
40 		.end	= GOLDFISH_PDEV_BUS_IRQ,
41 		.flags	= IORESOURCE_IRQ,
42 	}
43 };
44 
45 static bool goldfish_enable __initdata;
46 
goldfish_setup(char * str)47 static int __init goldfish_setup(char *str)
48 {
49 	goldfish_enable = true;
50 	return 0;
51 }
52 __setup("goldfish", goldfish_setup);
53 
goldfish_init(void)54 static int __init goldfish_init(void)
55 {
56 	if (!goldfish_enable)
57 		return -ENODEV;
58 
59 	platform_device_register_simple("goldfish_pdev_bus", -1,
60 					goldfish_pdev_bus_resources, 2);
61 	return 0;
62 }
63 device_initcall(goldfish_init);
64