Thomas Gleixner | d1d24ed | 2019-05-28 10:10:13 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Virtual EISA root driver. |
| 4 | * Acts as a placeholder if we don't have a proper EISA bridge. |
| 5 | * |
| 6 | * (C) 2003 Marc Zyngier <maz@wild-wind.fr.eu.org> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/kernel.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 10 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/eisa.h> |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/moduleparam.h> |
| 14 | #include <linux/init.h> |
| 15 | |
| 16 | #if defined(CONFIG_ALPHA_JENSEN) || defined(CONFIG_EISA_VLB_PRIMING) |
| 17 | #define EISA_FORCE_PROBE_DEFAULT 1 |
| 18 | #else |
| 19 | #define EISA_FORCE_PROBE_DEFAULT 0 |
| 20 | #endif |
| 21 | |
| 22 | static int force_probe = EISA_FORCE_PROBE_DEFAULT; |
| 23 | static void virtual_eisa_release (struct device *); |
| 24 | |
| 25 | /* The default EISA device parent (virtual root device). |
| 26 | * Now use a platform device, since that's the obvious choice. */ |
| 27 | |
| 28 | static struct platform_device eisa_root_dev = { |
| 29 | .name = "eisa", |
| 30 | .id = 0, |
| 31 | .dev = { |
| 32 | .release = virtual_eisa_release, |
| 33 | }, |
| 34 | }; |
| 35 | |
| 36 | static struct eisa_root_device eisa_bus_root = { |
Ladislav Michl | 91809d2 | 2018-01-17 10:44:06 +0100 | [diff] [blame] | 37 | .dev = &eisa_root_dev.dev, |
| 38 | .bus_base_addr = 0, |
| 39 | .res = &ioport_resource, |
| 40 | .slots = EISA_MAX_SLOTS, |
| 41 | .dma_mask = 0xffffffff, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | static void virtual_eisa_release (struct device *dev) |
| 45 | { |
| 46 | /* nothing really to do here */ |
| 47 | } |
| 48 | |
Andrew Morton | 4a1ccb5 | 2007-05-08 00:26:02 -0700 | [diff] [blame] | 49 | static int __init virtual_eisa_root_init (void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | { |
| 51 | int r; |
Ladislav Michl | 91809d2 | 2018-01-17 10:44:06 +0100 | [diff] [blame] | 52 | |
| 53 | if ((r = platform_device_register (&eisa_root_dev))) |
| 54 | return r; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | eisa_bus_root.force_probe = force_probe; |
Ladislav Michl | 91809d2 | 2018-01-17 10:44:06 +0100 | [diff] [blame] | 57 | |
Greg Kroah-Hartman | 4b9d0d3 | 2009-04-30 14:43:31 -0700 | [diff] [blame] | 58 | dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | if (eisa_root_register (&eisa_bus_root)) { |
| 61 | /* A real bridge may have been registered before |
| 62 | * us. So quietly unregister. */ |
| 63 | platform_device_unregister (&eisa_root_dev); |
| 64 | return -1; |
| 65 | } |
| 66 | |
| 67 | return 0; |
| 68 | } |
| 69 | |
| 70 | module_param (force_probe, int, 0444); |
| 71 | |
| 72 | device_initcall (virtual_eisa_root_init); |