1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * RDC321x MFD southbridge driver
5 * Copyright (C) 2007-2010 Florian Fainelli <florian@openwrt.org>
6 * Copyright (C) 2010 Bernhard Loos <bernhardloos@googlemail.com>
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/platform_device.h>
11 #include <linux/pci.h>
12 #include <linux/mfd/core.h>
13 #include <linux/mfd/rdc321x.h>
15 static struct rdc321x_wdt_pdata rdc321x_wdt_pdata
;
17 static struct resource rdc321x_wdt_resource
[] = {
20 .start
= RDC321X_WDT_CTRL
,
21 .end
= RDC321X_WDT_CTRL
+ 0x3,
22 .flags
= IORESOURCE_IO
,
26 static struct rdc321x_gpio_pdata rdc321x_gpio_pdata
= {
27 .max_gpios
= RDC321X_NUM_GPIO
,
30 static struct resource rdc321x_gpio_resources
[] = {
33 .start
= RDC321X_GPIO_CTRL_REG1
,
34 .end
= RDC321X_GPIO_CTRL_REG1
+ 0x7,
35 .flags
= IORESOURCE_IO
,
38 .start
= RDC321X_GPIO_CTRL_REG2
,
39 .end
= RDC321X_GPIO_CTRL_REG2
+ 0x7,
40 .flags
= IORESOURCE_IO
,
44 static const struct mfd_cell rdc321x_sb_cells
[] = {
46 .name
= "rdc321x-wdt",
47 .resources
= rdc321x_wdt_resource
,
48 .num_resources
= ARRAY_SIZE(rdc321x_wdt_resource
),
49 .platform_data
= &rdc321x_wdt_pdata
,
50 .pdata_size
= sizeof(rdc321x_wdt_pdata
),
52 .name
= "rdc321x-gpio",
53 .resources
= rdc321x_gpio_resources
,
54 .num_resources
= ARRAY_SIZE(rdc321x_gpio_resources
),
55 .platform_data
= &rdc321x_gpio_pdata
,
56 .pdata_size
= sizeof(rdc321x_gpio_pdata
),
60 static int rdc321x_sb_probe(struct pci_dev
*pdev
,
61 const struct pci_device_id
*ent
)
65 err
= pci_enable_device(pdev
);
67 dev_err(&pdev
->dev
, "failed to enable device\n");
71 rdc321x_gpio_pdata
.sb_pdev
= pdev
;
72 rdc321x_wdt_pdata
.sb_pdev
= pdev
;
74 return devm_mfd_add_devices(&pdev
->dev
, -1,
76 ARRAY_SIZE(rdc321x_sb_cells
),
80 static const struct pci_device_id rdc321x_sb_table
[] = {
81 { PCI_DEVICE(PCI_VENDOR_ID_RDC
, PCI_DEVICE_ID_RDC_R6030
) },
84 MODULE_DEVICE_TABLE(pci
, rdc321x_sb_table
);
86 static struct pci_driver rdc321x_sb_driver
= {
87 .name
= "RDC321x Southbridge",
88 .id_table
= rdc321x_sb_table
,
89 .probe
= rdc321x_sb_probe
,
92 module_pci_driver(rdc321x_sb_driver
);
94 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
95 MODULE_LICENSE("GPL");
96 MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver");