1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2007 Google, Inc.
4  * Copyright (C) 2011 Intel, Inc.
5  * Copyright (C) 2013 Intel, Inc.
6  */
7 
8 #include <linux/kernel.h>
9 #include <linux/irq.h>
10 #include <linux/platform_device.h>
11 
12 /*
13  * Where in virtual device memory the IO devices (timers, system controllers
14  * and so on)
15  */
16 
17 #define GOLDFISH_PDEV_BUS_BASE	(0xff001000)
18 #define GOLDFISH_PDEV_BUS_END	(0xff7fffff)
19 #define GOLDFISH_PDEV_BUS_IRQ	(4)
20 
21 #define GOLDFISH_TTY_BASE	(0x2000)
22 
23 static struct resource goldfish_pdev_bus_resources[] = {
24 	{
25 		.start  = GOLDFISH_PDEV_BUS_BASE,
26 		.end    = GOLDFISH_PDEV_BUS_END,
27 		.flags  = IORESOURCE_MEM,
28 	},
29 	{
30 		.start	= GOLDFISH_PDEV_BUS_IRQ,
31 		.end	= GOLDFISH_PDEV_BUS_IRQ,
32 		.flags	= IORESOURCE_IRQ,
33 	}
34 };
35 
36 static bool goldfish_enable __initdata;
37 
goldfish_setup(char * str)38 static int __init goldfish_setup(char *str)
39 {
40 	goldfish_enable = true;
41 	return 0;
42 }
43 __setup("goldfish", goldfish_setup);
44 
goldfish_init(void)45 static int __init goldfish_init(void)
46 {
47 	if (!goldfish_enable)
48 		return -ENODEV;
49 
50 	platform_device_register_simple("goldfish_pdev_bus", -1,
51 					goldfish_pdev_bus_resources, 2);
52 	return 0;
53 }
54 device_initcall(goldfish_init);
55