Linux Audio

Check our new training course

Loading...
v3.1
  1/*
  2 * RDC321x MFD southbrige driver
  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 */
 22#include <linux/init.h>
 23#include <linux/module.h>
 24#include <linux/kernel.h>
 25#include <linux/platform_device.h>
 26#include <linux/pci.h>
 27#include <linux/mfd/core.h>
 28#include <linux/mfd/rdc321x.h>
 29
 30static struct rdc321x_wdt_pdata rdc321x_wdt_pdata;
 31
 32static struct resource rdc321x_wdt_resource[] = {
 33	{
 34		.name	= "wdt-reg",
 35		.start	= RDC321X_WDT_CTRL,
 36		.end	= RDC321X_WDT_CTRL + 0x3,
 37		.flags	= IORESOURCE_IO,
 38	}
 39};
 40
 41static struct rdc321x_gpio_pdata rdc321x_gpio_pdata = {
 42	.max_gpios	= RDC321X_MAX_GPIO,
 43};
 44
 45static struct resource rdc321x_gpio_resources[] = {
 46	{
 47		.name	= "gpio-reg1",
 48		.start	= RDC321X_GPIO_CTRL_REG1,
 49		.end	= RDC321X_GPIO_CTRL_REG1 + 0x7,
 50		.flags	= IORESOURCE_IO,
 51	}, {
 52		.name	= "gpio-reg2",
 53		.start	= RDC321X_GPIO_CTRL_REG2,
 54		.end	= RDC321X_GPIO_CTRL_REG2 + 0x7,
 55		.flags	= IORESOURCE_IO,
 56	}
 57};
 58
 59static struct mfd_cell rdc321x_sb_cells[] = {
 60	{
 61		.name		= "rdc321x-wdt",
 62		.resources	= rdc321x_wdt_resource,
 63		.num_resources	= ARRAY_SIZE(rdc321x_wdt_resource),
 64		.platform_data	= &rdc321x_wdt_pdata,
 65		.pdata_size	= sizeof(rdc321x_wdt_pdata),
 66	}, {
 67		.name		= "rdc321x-gpio",
 68		.resources	= rdc321x_gpio_resources,
 69		.num_resources	= ARRAY_SIZE(rdc321x_gpio_resources),
 70		.platform_data	= &rdc321x_gpio_pdata,
 71		.pdata_size	= sizeof(rdc321x_gpio_pdata),
 72	},
 73};
 74
 75static int __devinit rdc321x_sb_probe(struct pci_dev *pdev,
 76					const struct pci_device_id *ent)
 77{
 78	int err;
 79
 80	err = pci_enable_device(pdev);
 81	if (err) {
 82		dev_err(&pdev->dev, "failed to enable device\n");
 83		return err;
 84	}
 85
 86	rdc321x_gpio_pdata.sb_pdev = pdev;
 87	rdc321x_wdt_pdata.sb_pdev = pdev;
 88
 89	return mfd_add_devices(&pdev->dev, -1,
 90		rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells), NULL, 0);
 
 
 91}
 92
 93static void __devexit rdc321x_sb_remove(struct pci_dev *pdev)
 94{
 95	mfd_remove_devices(&pdev->dev);
 96}
 97
 98static DEFINE_PCI_DEVICE_TABLE(rdc321x_sb_table) = {
 99	{ PCI_DEVICE(PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6030) },
100	{}
101};
102MODULE_DEVICE_TABLE(pci, rdc321x_sb_table);
103
104static struct pci_driver rdc321x_sb_driver = {
105	.name		= "RDC321x Southbridge",
106	.id_table	= rdc321x_sb_table,
107	.probe		= rdc321x_sb_probe,
108	.remove		= __devexit_p(rdc321x_sb_remove),
109};
110
111static int __init rdc321x_sb_init(void)
112{
113	return pci_register_driver(&rdc321x_sb_driver);
114}
115
116static void __exit rdc321x_sb_exit(void)
117{
118	pci_unregister_driver(&rdc321x_sb_driver);
119}
120
121module_init(rdc321x_sb_init);
122module_exit(rdc321x_sb_exit);
123
124MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
125MODULE_LICENSE("GPL");
126MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver");
v4.10.11
  1/*
  2 * RDC321x MFD southbridge driver
  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 */
 
 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,
 36		.flags	= IORESOURCE_IO,
 37	}
 38};
 39
 40static struct rdc321x_gpio_pdata rdc321x_gpio_pdata = {
 41	.max_gpios	= RDC321X_NUM_GPIO,
 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,
 49		.flags	= IORESOURCE_IO,
 50	}, {
 51		.name	= "gpio-reg2",
 52		.start	= RDC321X_GPIO_CTRL_REG2,
 53		.end	= RDC321X_GPIO_CTRL_REG2 + 0x7,
 54		.flags	= IORESOURCE_IO,
 55	}
 56};
 57
 58static const struct mfd_cell rdc321x_sb_cells[] = {
 59	{
 60		.name		= "rdc321x-wdt",
 61		.resources	= rdc321x_wdt_resource,
 62		.num_resources	= ARRAY_SIZE(rdc321x_wdt_resource),
 63		.platform_data	= &rdc321x_wdt_pdata,
 64		.pdata_size	= sizeof(rdc321x_wdt_pdata),
 65	}, {
 66		.name		= "rdc321x-gpio",
 67		.resources	= rdc321x_gpio_resources,
 68		.num_resources	= ARRAY_SIZE(rdc321x_gpio_resources),
 69		.platform_data	= &rdc321x_gpio_pdata,
 70		.pdata_size	= sizeof(rdc321x_gpio_pdata),
 71	},
 72};
 73
 74static int rdc321x_sb_probe(struct pci_dev *pdev,
 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 devm_mfd_add_devices(&pdev->dev, -1,
 89				    rdc321x_sb_cells,
 90				    ARRAY_SIZE(rdc321x_sb_cells),
 91				    NULL, 0, NULL);
 92}
 93
 94static const struct pci_device_id rdc321x_sb_table[] = {
 
 
 
 
 
 95	{ PCI_DEVICE(PCI_VENDOR_ID_RDC, PCI_DEVICE_ID_RDC_R6030) },
 96	{}
 97};
 98MODULE_DEVICE_TABLE(pci, rdc321x_sb_table);
 99
100static struct pci_driver rdc321x_sb_driver = {
101	.name		= "RDC321x Southbridge",
102	.id_table	= rdc321x_sb_table,
103	.probe		= rdc321x_sb_probe,
 
104};
105
106module_pci_driver(rdc321x_sb_driver);
 
 
 
 
 
 
 
 
 
 
 
107
108MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
109MODULE_LICENSE("GPL");
110MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver");