diff options
author | Alexander Stein <alexander.stein@systec-electronic.com> | 2011-06-16 07:05:49 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-07-31 17:28:23 -0400 |
commit | 19921ef61217fff600202b819c05bb078f254619 (patch) | |
tree | 5e06f6ef8dbcf6f58ba63fc765f93cda7c2980e8 /drivers/mfd | |
parent | 0a1b089738cf2165ee8678e2483fce3c40389d4a (diff) |
mfd: Add tunnelcreek watchdog to lpc_sch devices
Tunnel Creek has an additional watchdog core.
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/lpc_sch.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c index ea3f52c07ef7..ea1169b04779 100644 --- a/drivers/mfd/lpc_sch.c +++ b/drivers/mfd/lpc_sch.c | |||
@@ -37,6 +37,9 @@ | |||
37 | #define GPIOBASE 0x44 | 37 | #define GPIOBASE 0x44 |
38 | #define GPIO_IO_SIZE 64 | 38 | #define GPIO_IO_SIZE 64 |
39 | 39 | ||
40 | #define WDTBASE 0x84 | ||
41 | #define WDT_IO_SIZE 64 | ||
42 | |||
40 | static struct resource smbus_sch_resource = { | 43 | static struct resource smbus_sch_resource = { |
41 | .flags = IORESOURCE_IO, | 44 | .flags = IORESOURCE_IO, |
42 | }; | 45 | }; |
@@ -59,6 +62,18 @@ static struct mfd_cell lpc_sch_cells[] = { | |||
59 | }, | 62 | }, |
60 | }; | 63 | }; |
61 | 64 | ||
65 | static struct resource wdt_sch_resource = { | ||
66 | .flags = IORESOURCE_IO, | ||
67 | }; | ||
68 | |||
69 | static struct mfd_cell tunnelcreek_cells[] = { | ||
70 | { | ||
71 | .name = "tunnelcreek_wdt", | ||
72 | .num_resources = 1, | ||
73 | .resources = &wdt_sch_resource, | ||
74 | }, | ||
75 | }; | ||
76 | |||
62 | static struct pci_device_id lpc_sch_ids[] = { | 77 | static struct pci_device_id lpc_sch_ids[] = { |
63 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) }, | 78 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) }, |
64 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ITC_LPC) }, | 79 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ITC_LPC) }, |
@@ -72,6 +87,7 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev, | |||
72 | unsigned int base_addr_cfg; | 87 | unsigned int base_addr_cfg; |
73 | unsigned short base_addr; | 88 | unsigned short base_addr; |
74 | int i; | 89 | int i; |
90 | int ret; | ||
75 | 91 | ||
76 | pci_read_config_dword(dev, SMBASE, &base_addr_cfg); | 92 | pci_read_config_dword(dev, SMBASE, &base_addr_cfg); |
77 | if (!(base_addr_cfg & (1 << 31))) { | 93 | if (!(base_addr_cfg & (1 << 31))) { |
@@ -104,8 +120,39 @@ static int __devinit lpc_sch_probe(struct pci_dev *dev, | |||
104 | for (i=0; i < ARRAY_SIZE(lpc_sch_cells); i++) | 120 | for (i=0; i < ARRAY_SIZE(lpc_sch_cells); i++) |
105 | lpc_sch_cells[i].id = id->device; | 121 | lpc_sch_cells[i].id = id->device; |
106 | 122 | ||
107 | return mfd_add_devices(&dev->dev, 0, | 123 | ret = mfd_add_devices(&dev->dev, 0, |
108 | lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, 0); | 124 | lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, 0); |
125 | if (ret) | ||
126 | goto out_dev; | ||
127 | |||
128 | if (id->device == PCI_DEVICE_ID_INTEL_ITC_LPC) { | ||
129 | pci_read_config_dword(dev, WDTBASE, &base_addr_cfg); | ||
130 | if (!(base_addr_cfg & (1 << 31))) { | ||
131 | dev_err(&dev->dev, "Decode of the WDT I/O range disabled\n"); | ||
132 | ret = -ENODEV; | ||
133 | goto out_dev; | ||
134 | } | ||
135 | base_addr = (unsigned short)base_addr_cfg; | ||
136 | if (base_addr == 0) { | ||
137 | dev_err(&dev->dev, "I/O space for WDT uninitialized\n"); | ||
138 | ret = -ENODEV; | ||
139 | goto out_dev; | ||
140 | } | ||
141 | |||
142 | wdt_sch_resource.start = base_addr; | ||
143 | wdt_sch_resource.end = base_addr + WDT_IO_SIZE - 1; | ||
144 | |||
145 | for (i = 0; i < ARRAY_SIZE(tunnelcreek_cells); i++) | ||
146 | tunnelcreek_cells[i].id = id->device; | ||
147 | |||
148 | ret = mfd_add_devices(&dev->dev, 0, tunnelcreek_cells, | ||
149 | ARRAY_SIZE(tunnelcreek_cells), NULL, 0); | ||
150 | } | ||
151 | |||
152 | return ret; | ||
153 | out_dev: | ||
154 | mfd_remove_devices(&dev->dev); | ||
155 | return ret; | ||
109 | } | 156 | } |
110 | 157 | ||
111 | static void __devexit lpc_sch_remove(struct pci_dev *dev) | 158 | static void __devexit lpc_sch_remove(struct pci_dev *dev) |