18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2007 Google, Inc.
48c2ecf20Sopenharmony_ci * Copyright (C) 2011 Intel, Inc.
58c2ecf20Sopenharmony_ci * Copyright (C) 2013 Intel, Inc.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/kernel.h>
98c2ecf20Sopenharmony_ci#include <linux/irq.h>
108c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Where in virtual device memory the IO devices (timers, system controllers
148c2ecf20Sopenharmony_ci * and so on)
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define GOLDFISH_PDEV_BUS_BASE	(0xff001000)
188c2ecf20Sopenharmony_ci#define GOLDFISH_PDEV_BUS_END	(0xff7fffff)
198c2ecf20Sopenharmony_ci#define GOLDFISH_PDEV_BUS_IRQ	(4)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define GOLDFISH_TTY_BASE	(0x2000)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic struct resource goldfish_pdev_bus_resources[] = {
248c2ecf20Sopenharmony_ci	{
258c2ecf20Sopenharmony_ci		.start  = GOLDFISH_PDEV_BUS_BASE,
268c2ecf20Sopenharmony_ci		.end    = GOLDFISH_PDEV_BUS_END,
278c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_MEM,
288c2ecf20Sopenharmony_ci	},
298c2ecf20Sopenharmony_ci	{
308c2ecf20Sopenharmony_ci		.start	= GOLDFISH_PDEV_BUS_IRQ,
318c2ecf20Sopenharmony_ci		.end	= GOLDFISH_PDEV_BUS_IRQ,
328c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
338c2ecf20Sopenharmony_ci	}
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistatic bool goldfish_enable __initdata;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic int __init goldfish_setup(char *str)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	goldfish_enable = true;
418c2ecf20Sopenharmony_ci	return 0;
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci__setup("goldfish", goldfish_setup);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic int __init goldfish_init(void)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	if (!goldfish_enable)
488c2ecf20Sopenharmony_ci		return -ENODEV;
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	platform_device_register_simple("goldfish_pdev_bus", -1,
518c2ecf20Sopenharmony_ci					goldfish_pdev_bus_resources, 2);
528c2ecf20Sopenharmony_ci	return 0;
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_cidevice_initcall(goldfish_init);
55