// SPDX-License-Identifier: GPL-2.0 /* * GPIO driver for AMD 8111 south bridges * * Copyright (c) 2012 Dmitry Eremin-Solenikov * * Based on the AMD RNG driver: * Copyright 2005 (c) MontaVista Software, Inc. * with the majority of the code coming from: * * Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) * (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> * * derived from * * Hardware driver for the AMD 768 Random Number Generator (RNG) * (c) Copyright 2001 Red Hat Inc * * derived from * * Hardware driver for Intel i810 Random Number Generator (RNG) * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
*/ #include <linux/ioport.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/gpio/driver.h> #include <linux/pci.h> #include <linux/spinlock.h>
#define AMD_GPIO_LTCH_STS 0x40 /* Latch status, w1 */ #define AMD_GPIO_RTIN 0x20 /* Real Time in, ro */ #define AMD_GPIO_DEBOUNCE 0x10 /* Debounce, rw */ #define AMD_GPIO_MODE_MASK 0x0c /* Pin Mode Select, rw */ #define AMD_GPIO_MODE_IN 0x00 #define AMD_GPIO_MODE_OUT 0x04 /* Enable alternative (e.g. clkout, IRQ, etc) function of the pin */ #define AMD_GPIO_MODE_ALTFN 0x08 /* Or 0x09 */ #define AMD_GPIO_X_MASK 0x03 /* In/Out specific, rw */ #define AMD_GPIO_X_IN_ACTIVEHI 0x01 /* Active High */ #define AMD_GPIO_X_IN_LATCH 0x02 /* Latched version is selected */ #define AMD_GPIO_X_OUT_LOW 0x00 #define AMD_GPIO_X_OUT_HI 0x01 #define AMD_GPIO_X_OUT_CLK0 0x02 #define AMD_GPIO_X_OUT_CLK1 0x03
/* * Data for PCI driver interface * * This data only exists for exporting the supported * PCI ids via MODULE_DEVICE_TABLE. We do not actually * register a pci_driver, because someone else might one day * want to register another driver on the same PCI id.
*/ staticconststruct pci_device_id pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS), 0 },
{ 0, }, /* terminate list */
};
MODULE_DEVICE_TABLE(pci, pci_tbl);
/* We look for our device - AMD South Bridge * I don't know about a system with two such bridges, * so we can assume that there is max. one device. * * We can't use plain pci_driver mechanism, * as the device is really a multiple function device, * main driver that binds to the pci_device is an smbus * driver and have to find & bind to the device this way.
*/
for_each_pci_dev(pdev) {
ent = pci_match_id(pci_tbl, pdev); if (ent) goto found;
} /* Device not found. */ goto out;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.