2 * RDC321x southbrige driver
4 * Copyright (C) 2007-2010 Florian Fainelli <florian@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <linux/init.h>
22 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/platform_device.h>
25 #include <linux/pci.h>
27 #include <asm/rdc321x_defs.h>
29 static struct pci_dev *rdc321x_sb_pdev;
32 * Unlocked PCI configuration space accessors
34 int rdc321x_pci_read(int reg, u32 *val)
38 err = pci_read_config_dword(rdc321x_sb_pdev, reg, val);
44 EXPORT_SYMBOL(rdc321x_pci_read);
46 int rdc321x_pci_write(int reg, u32 val)
50 err = pci_write_config_dword(rdc321x_sb_pdev, reg, val);
56 EXPORT_SYMBOL(rdc321x_pci_write);
58 static struct platform_device rdc321x_wdt_device = {
62 static struct platform_device rdc321x_gpio_device = {
63 .name = "rdc321x-gpio"
66 static int __devinit rdc321x_sb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
70 err = pci_enable_device(pdev);
72 printk(KERN_ERR "failed to enable device\n");
76 rdc321x_sb_pdev = pdev;
78 err = platform_device_register(&rdc321x_wdt_device);
80 dev_err(&pdev->dev, "failed to register watchdog\n");
84 panic_on_unrecovered_nmi = 1;
86 err = platform_device_register(&rdc321x_gpio_device);
88 dev_err(&pdev->dev, "failed to register gpiochip\n");
91 dev_info(&rdc321x_sb_pdev->dev, "RDC321x southhridge registered\n");
96 static struct pci_device_id rdc321x_sb_table[] = {
97 { PCI_DEVICE(PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6030) },
101 static struct pci_driver rdc321x_sb_driver = {
102 .name = "RDC3210 Southbridge",
103 .id_table = rdc321x_sb_table,
104 .probe = rdc321x_sb_probe
107 static int __init rdc321x_sb_init(void)
109 return pci_register_driver(&rdc321x_sb_driver);
112 device_initcall(rdc321x_sb_init);