goldfish.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include <linux/kernel.h>
  17. #include <linux/irq.h>
  18. #include <linux/platform_device.h>
  19. /*
  20. * Where in virtual device memory the IO devices (timers, system controllers
  21. * and so on)
  22. */
  23. #define GOLDFISH_PDEV_BUS_BASE (0xff001000)
  24. #define GOLDFISH_PDEV_BUS_END (0xff7fffff)
  25. #define GOLDFISH_PDEV_BUS_IRQ (4)
  26. #define GOLDFISH_TTY_BASE (0x2000)
  27. static struct resource goldfish_pdev_bus_resources[] = {
  28. {
  29. .start = GOLDFISH_PDEV_BUS_BASE,
  30. .end = GOLDFISH_PDEV_BUS_END,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. {
  34. .start = GOLDFISH_PDEV_BUS_IRQ,
  35. .end = GOLDFISH_PDEV_BUS_IRQ,
  36. .flags = IORESOURCE_IRQ,
  37. }
  38. };
  39. static bool goldfish_enable __initdata;
  40. static int __init goldfish_setup(char *str)
  41. {
  42. goldfish_enable = true;
  43. return 0;
  44. }
  45. __setup("goldfish", goldfish_setup);
  46. static int __init goldfish_init(void)
  47. {
  48. if (!goldfish_enable)
  49. return -ENODEV;
  50. platform_device_register_simple("goldfish_pdev_bus", -1,
  51. goldfish_pdev_bus_resources, 2);
  52. return 0;
  53. }
  54. device_initcall(goldfish_init);