libceph: move r_reply_op_{len,result} into struct ceph_osd_req_op
[linux-2.6-block.git] / drivers / mfd / rdc321x-southbridge.c
CommitLineData
e090d506 1/*
5a4432b9 2 * RDC321x MFD southbridge driver
e090d506
FF
3 *
4 * Copyright (C) 2007-2010 Florian Fainelli <florian@openwrt.org>
5 * Copyright (C) 2010 Bernhard Loos <bernhardloos@googlemail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
e090d506
FF
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/platform_device.h>
25#include <linux/pci.h>
26#include <linux/mfd/core.h>
27#include <linux/mfd/rdc321x.h>
28
29static struct rdc321x_wdt_pdata rdc321x_wdt_pdata;
30
31static struct resource rdc321x_wdt_resource[] = {
32 {
33 .name = "wdt-reg",
34 .start = RDC321X_WDT_CTRL,
35 .end = RDC321X_WDT_CTRL + 0x3,
8deca39e 36 .flags = IORESOURCE_IO,
e090d506
FF
37 }
38};
39
40static struct rdc321x_gpio_pdata rdc321x_gpio_pdata = {
1ec93b9b 41 .max_gpios = RDC321X_NUM_GPIO,
e090d506
FF
42};
43
44static struct resource rdc321x_gpio_resources[] = {
45 {
46 .name = "gpio-reg1",
47 .start = RDC321X_GPIO_CTRL_REG1,
48 .end = RDC321X_GPIO_CTRL_REG1 + 0x7,
8deca39e 49 .flags = IORESOURCE_IO,
e090d506
FF
50 }, {
51 .name = "gpio-reg2",
52 .start = RDC321X_GPIO_CTRL_REG2,
53 .end = RDC321X_GPIO_CTRL_REG2 + 0x7,
8deca39e 54 .flags = IORESOURCE_IO,
e090d506
FF
55 }
56};
57
5ac98553 58static const struct mfd_cell rdc321x_sb_cells[] = {
e090d506
FF
59 {
60 .name = "rdc321x-wdt",
61 .resources = rdc321x_wdt_resource,
62 .num_resources = ARRAY_SIZE(rdc321x_wdt_resource),
9abd768a
SO
63 .platform_data = &rdc321x_wdt_pdata,
64 .pdata_size = sizeof(rdc321x_wdt_pdata),
e090d506
FF
65 }, {
66 .name = "rdc321x-gpio",
67 .resources = rdc321x_gpio_resources,
68 .num_resources = ARRAY_SIZE(rdc321x_gpio_resources),
9abd768a
SO
69 .platform_data = &rdc321x_gpio_pdata,
70 .pdata_size = sizeof(rdc321x_gpio_pdata),
e090d506
FF
71 },
72};
73
f791be49 74static int rdc321x_sb_probe(struct pci_dev *pdev,
e090d506
FF
75 const struct pci_device_id *ent)
76{
77 int err;
78
79 err = pci_enable_device(pdev);
80 if (err) {
81 dev_err(&pdev->dev, "failed to enable device\n");
82 return err;
83 }
84
85 rdc321x_gpio_pdata.sb_pdev = pdev;
86 rdc321x_wdt_pdata.sb_pdev = pdev;
87
88 return mfd_add_devices(&pdev->dev, -1,
0848c94f
MB
89 rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells),
90 NULL, 0, NULL);
e090d506
FF
91}
92
4740f73f 93static void rdc321x_sb_remove(struct pci_dev *pdev)
e090d506
FF
94{
95 mfd_remove_devices(&pdev->dev);
96}
97
36fcd06c 98static const struct pci_device_id rdc321x_sb_table[] = {
e090d506
FF
99 { PCI_DEVICE(PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6030) },
100 {}
101};
85375486 102MODULE_DEVICE_TABLE(pci, rdc321x_sb_table);
e090d506
FF
103
104static struct pci_driver rdc321x_sb_driver = {
105 .name = "RDC321x Southbridge",
106 .id_table = rdc321x_sb_table,
107 .probe = rdc321x_sb_probe,
84449216 108 .remove = rdc321x_sb_remove,
e090d506
FF
109};
110
38a36f5a 111module_pci_driver(rdc321x_sb_driver);
e090d506
FF
112
113MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
114MODULE_LICENSE("GPL");
115MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver");