x86: Move scx200 to platform
authorThomas Gleixner <tglx@linutronix.de>
Sat, 16 Oct 2010 08:35:51 +0000 (10:35 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 27 Oct 2010 12:30:01 +0000 (14:30 +0200)
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/Makefile
arch/x86/kernel/scx200_32.c [deleted file]
arch/x86/platform/Makefile
arch/x86/platform/scx200/Makefile [new file with mode: 0644]
arch/x86/platform/scx200/scx200_32.c [new file with mode: 0644]

index 28c4f3f2e97dc564e2d7cf63289b09547ded0d95..f57eeea4bc161f1410ffbc36f9a3b3624cd0f9a8 100644 (file)
@@ -101,9 +101,6 @@ obj-$(CONFIG_PARAVIRT_CLOCK)        += pvclock.o
 
 obj-$(CONFIG_PCSPKR_PLATFORM)  += pcspeaker.o
 
-obj-$(CONFIG_SCx200)           += scx200.o
-scx200-y                       += scx200_32.o
-
 obj-$(CONFIG_OLPC)             += olpc.o
 obj-$(CONFIG_OLPC_XO1)         += olpc-xo1.o
 obj-$(CONFIG_OLPC_OPENFIRMWARE)        += olpc_ofw.o
diff --git a/arch/x86/kernel/scx200_32.c b/arch/x86/kernel/scx200_32.c
deleted file mode 100644 (file)
index 7e004ac..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *  Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
- *
- *  National Semiconductor SCx200 support.
- */
-
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/mutex.h>
-#include <linux/pci.h>
-
-#include <linux/scx200.h>
-#include <linux/scx200_gpio.h>
-
-/* Verify that the configuration block really is there */
-#define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base))
-
-#define NAME "scx200"
-
-MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>");
-MODULE_DESCRIPTION("NatSemi SCx200 Driver");
-MODULE_LICENSE("GPL");
-
-unsigned scx200_gpio_base = 0;
-unsigned long scx200_gpio_shadow[2];
-
-unsigned scx200_cb_base = 0;
-
-static struct pci_device_id scx200_tbl[] = {
-       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
-       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
-       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_XBUS)   },
-       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_XBUS)   },
-       { },
-};
-MODULE_DEVICE_TABLE(pci,scx200_tbl);
-
-static int __devinit scx200_probe(struct pci_dev *, const struct pci_device_id *);
-
-static struct pci_driver scx200_pci_driver = {
-       .name = "scx200",
-       .id_table = scx200_tbl,
-       .probe = scx200_probe,
-};
-
-static DEFINE_MUTEX(scx200_gpio_config_lock);
-
-static void __devinit scx200_init_shadow(void)
-{
-       int bank;
-
-       /* read the current values driven on the GPIO signals */
-       for (bank = 0; bank < 2; ++bank)
-               scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
-}
-
-static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
-{
-       unsigned base;
-
-       if (pdev->device == PCI_DEVICE_ID_NS_SCx200_BRIDGE ||
-           pdev->device == PCI_DEVICE_ID_NS_SC1100_BRIDGE) {
-               base = pci_resource_start(pdev, 0);
-               printk(KERN_INFO NAME ": GPIO base 0x%x\n", base);
-
-               if (!request_region(base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO")) {
-                       printk(KERN_ERR NAME ": can't allocate I/O for GPIOs\n");
-                       return -EBUSY;
-               }
-
-               scx200_gpio_base = base;
-               scx200_init_shadow();
-
-       } else {
-               /* find the base of the Configuration Block */
-               if (scx200_cb_probe(SCx200_CB_BASE_FIXED)) {
-                       scx200_cb_base = SCx200_CB_BASE_FIXED;
-               } else {
-                       pci_read_config_dword(pdev, SCx200_CBA_SCRATCH, &base);
-                       if (scx200_cb_probe(base)) {
-                               scx200_cb_base = base;
-                       } else {
-                               printk(KERN_WARNING NAME ": Configuration Block not found\n");
-                               return -ENODEV;
-                       }
-               }
-               printk(KERN_INFO NAME ": Configuration Block base 0x%x\n", scx200_cb_base);
-       }
-
-       return 0;
-}
-
-u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits)
-{
-       u32 config, new_config;
-
-       mutex_lock(&scx200_gpio_config_lock);
-
-       outl(index, scx200_gpio_base + 0x20);
-       config = inl(scx200_gpio_base + 0x24);
-
-       new_config = (config & mask) | bits;
-       outl(new_config, scx200_gpio_base + 0x24);
-
-       mutex_unlock(&scx200_gpio_config_lock);
-
-       return config;
-}
-
-static int __init scx200_init(void)
-{
-       printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n");
-
-       return pci_register_driver(&scx200_pci_driver);
-}
-
-static void __exit scx200_cleanup(void)
-{
-       pci_unregister_driver(&scx200_pci_driver);
-       release_region(scx200_gpio_base, SCx200_GPIO_SIZE);
-}
-
-module_init(scx200_init);
-module_exit(scx200_cleanup);
-
-EXPORT_SYMBOL(scx200_gpio_base);
-EXPORT_SYMBOL(scx200_gpio_shadow);
-EXPORT_SYMBOL(scx200_gpio_configure);
-EXPORT_SYMBOL(scx200_cb_base);
index e629d7a428cb4769b6ee0b6b36c68fbfecb10667..1191989e9f00e8ccc56e6a74f90e393a5131d50a 100644 (file)
@@ -1,4 +1,5 @@
 # Platform specific code goes here
 obj-y  += efi/
+obj-y  += scx200/
 obj-y  += sfi/
 obj-y  += visws/
diff --git a/arch/x86/platform/scx200/Makefile b/arch/x86/platform/scx200/Makefile
new file mode 100644 (file)
index 0000000..762b4c7
--- /dev/null
@@ -0,0 +1,2 @@
+obj-$(CONFIG_SCx200)           += scx200.o
+scx200-y                       += scx200_32.o
diff --git a/arch/x86/platform/scx200/scx200_32.c b/arch/x86/platform/scx200/scx200_32.c
new file mode 100644 (file)
index 0000000..7e004ac
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ *  Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
+ *
+ *  National Semiconductor SCx200 support.
+ */
+
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/mutex.h>
+#include <linux/pci.h>
+
+#include <linux/scx200.h>
+#include <linux/scx200_gpio.h>
+
+/* Verify that the configuration block really is there */
+#define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base))
+
+#define NAME "scx200"
+
+MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>");
+MODULE_DESCRIPTION("NatSemi SCx200 Driver");
+MODULE_LICENSE("GPL");
+
+unsigned scx200_gpio_base = 0;
+unsigned long scx200_gpio_shadow[2];
+
+unsigned scx200_cb_base = 0;
+
+static struct pci_device_id scx200_tbl[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
+       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
+       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_XBUS)   },
+       { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_XBUS)   },
+       { },
+};
+MODULE_DEVICE_TABLE(pci,scx200_tbl);
+
+static int __devinit scx200_probe(struct pci_dev *, const struct pci_device_id *);
+
+static struct pci_driver scx200_pci_driver = {
+       .name = "scx200",
+       .id_table = scx200_tbl,
+       .probe = scx200_probe,
+};
+
+static DEFINE_MUTEX(scx200_gpio_config_lock);
+
+static void __devinit scx200_init_shadow(void)
+{
+       int bank;
+
+       /* read the current values driven on the GPIO signals */
+       for (bank = 0; bank < 2; ++bank)
+               scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
+}
+
+static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+       unsigned base;
+
+       if (pdev->device == PCI_DEVICE_ID_NS_SCx200_BRIDGE ||
+           pdev->device == PCI_DEVICE_ID_NS_SC1100_BRIDGE) {
+               base = pci_resource_start(pdev, 0);
+               printk(KERN_INFO NAME ": GPIO base 0x%x\n", base);
+
+               if (!request_region(base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO")) {
+                       printk(KERN_ERR NAME ": can't allocate I/O for GPIOs\n");
+                       return -EBUSY;
+               }
+
+               scx200_gpio_base = base;
+               scx200_init_shadow();
+
+       } else {
+               /* find the base of the Configuration Block */
+               if (scx200_cb_probe(SCx200_CB_BASE_FIXED)) {
+                       scx200_cb_base = SCx200_CB_BASE_FIXED;
+               } else {
+                       pci_read_config_dword(pdev, SCx200_CBA_SCRATCH, &base);
+                       if (scx200_cb_probe(base)) {
+                               scx200_cb_base = base;
+                       } else {
+                               printk(KERN_WARNING NAME ": Configuration Block not found\n");
+                               return -ENODEV;
+                       }
+               }
+               printk(KERN_INFO NAME ": Configuration Block base 0x%x\n", scx200_cb_base);
+       }
+
+       return 0;
+}
+
+u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits)
+{
+       u32 config, new_config;
+
+       mutex_lock(&scx200_gpio_config_lock);
+
+       outl(index, scx200_gpio_base + 0x20);
+       config = inl(scx200_gpio_base + 0x24);
+
+       new_config = (config & mask) | bits;
+       outl(new_config, scx200_gpio_base + 0x24);
+
+       mutex_unlock(&scx200_gpio_config_lock);
+
+       return config;
+}
+
+static int __init scx200_init(void)
+{
+       printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n");
+
+       return pci_register_driver(&scx200_pci_driver);
+}
+
+static void __exit scx200_cleanup(void)
+{
+       pci_unregister_driver(&scx200_pci_driver);
+       release_region(scx200_gpio_base, SCx200_GPIO_SIZE);
+}
+
+module_init(scx200_init);
+module_exit(scx200_cleanup);
+
+EXPORT_SYMBOL(scx200_gpio_base);
+EXPORT_SYMBOL(scx200_gpio_shadow);
+EXPORT_SYMBOL(scx200_gpio_configure);
+EXPORT_SYMBOL(scx200_cb_base);