Release 4.14 arch/x86/platform/scx200/scx200_32.c
/*
* 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))
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_VDEVICE(NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
{ PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
{ PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_SCx200_XBUS) },
{ PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_SC1100_XBUS) },
{ },
};
MODULE_DEVICE_TABLE(pci,scx200_tbl);
static int 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 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);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jim Cromie | 39 | 100.00% | 1 | 100.00% |
Total | 39 | 100.00% | 1 | 100.00% |
static int 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);
pr_info("GPIO base 0x%x\n", base);
if (!request_region(base, SCx200_GPIO_SIZE,
"NatSemi SCx200 GPIO")) {
pr_err("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 {
pr_warn("Configuration Block not found\n");
return -ENODEV;
}
}
pr_info("Configuration Block base 0x%x\n", scx200_cb_base);
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Henrik Brix Andersen | 71 | 48.30% | 1 | 20.00% |
Evgeniy Polyakov | 59 | 40.14% | 1 | 20.00% |
Jim Cromie | 16 | 10.88% | 2 | 40.00% |
Harvey Harrison | 1 | 0.68% | 1 | 20.00% |
Total | 147 | 100.00% | 5 | 100.00% |
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;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christer Weinigel | 68 | 95.77% | 1 | 33.33% |
Jim Cromie | 3 | 4.23% | 2 | 66.67% |
Total | 71 | 100.00% | 3 | 100.00% |
static int __init scx200_init(void)
{
pr_info("NatSemi SCx200 Driver\n");
return pci_register_driver(&scx200_pci_driver);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christer Weinigel | 14 | 66.67% | 1 | 20.00% |
Jim Cromie | 3 | 14.29% | 1 | 20.00% |
Evgeniy Polyakov | 2 | 9.52% | 1 | 20.00% |
Richard Knutsson | 1 | 4.76% | 1 | 20.00% |
Adrian Bunk | 1 | 4.76% | 1 | 20.00% |
Total | 21 | 100.00% | 5 | 100.00% |
static void __exit scx200_cleanup(void)
{
pci_unregister_driver(&scx200_pci_driver);
release_region(scx200_gpio_base, SCx200_GPIO_SIZE);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christer Weinigel | 15 | 68.18% | 1 | 33.33% |
Evgeniy Polyakov | 6 | 27.27% | 1 | 33.33% |
Adrian Bunk | 1 | 4.55% | 1 | 33.33% |
Total | 22 | 100.00% | 3 | 100.00% |
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);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christer Weinigel | 168 | 34.29% | 1 | 6.67% |
Evgeniy Polyakov | 134 | 27.35% | 1 | 6.67% |
Henrik Brix Andersen | 103 | 21.02% | 1 | 6.67% |
Jim Cromie | 73 | 14.90% | 5 | 33.33% |
Adrian Bunk | 5 | 1.02% | 2 | 13.33% |
Thomas Gleixner | 3 | 0.61% | 1 | 6.67% |
Harvey Harrison | 1 | 0.20% | 1 | 6.67% |
Dave Jones | 1 | 0.20% | 1 | 6.67% |
Richard Knutsson | 1 | 0.20% | 1 | 6.67% |
Al Viro | 1 | 0.20% | 1 | 6.67% |
Total | 490 | 100.00% | 15 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.