|
16 | 16 | #include <linux/kernel.h>
|
17 | 17 | #include <linux/module.h>
|
18 | 18 | #include <linux/pci.h>
|
| 19 | +#include <linux/platform_data/x86/p2sb.h> |
19 | 20 | #include <linux/platform_data/x86/simatic-ipc-base.h>
|
20 | 21 | #include <linux/platform_device.h>
|
21 | 22 | #include <linux/sizes.h>
|
@@ -54,9 +55,9 @@ static struct resource io_resource_trigger =
|
54 | 55 | DEFINE_RES_IO_NAMED(WD_TRIGGER_IOADR, SZ_1,
|
55 | 56 | KBUILD_MODNAME " WD_TRIGGER_IOADR");
|
56 | 57 |
|
57 |
| -/* the actual start will be discovered with pci, 0 is a placeholder */ |
| 58 | +/* the actual start will be discovered with p2sb, 0 is a placeholder */ |
58 | 59 | static struct resource mem_resource =
|
59 |
| - DEFINE_RES_MEM_NAMED(0, SZ_4, "WD_RESET_BASE_ADR"); |
| 60 | + DEFINE_RES_MEM_NAMED(0, 0, "WD_RESET_BASE_ADR"); |
60 | 61 |
|
61 | 62 | static u32 wd_timeout_table[] = {2, 4, 6, 8, 16, 32, 48, 64 };
|
62 | 63 | static void __iomem *wd_reset_base_addr;
|
@@ -150,6 +151,7 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
|
150 | 151 | struct simatic_ipc_platform *plat = pdev->dev.platform_data;
|
151 | 152 | struct device *dev = &pdev->dev;
|
152 | 153 | struct resource *res;
|
| 154 | + int ret; |
153 | 155 |
|
154 | 156 | switch (plat->devmode) {
|
155 | 157 | case SIMATIC_IPC_DEVICE_227E:
|
@@ -190,15 +192,14 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
|
190 | 192 | if (plat->devmode == SIMATIC_IPC_DEVICE_427E) {
|
191 | 193 | res = &mem_resource;
|
192 | 194 |
|
193 |
| - /* get GPIO base from PCI */ |
194 |
| - res->start = simatic_ipc_get_membase0(PCI_DEVFN(0x1f, 1)); |
195 |
| - if (res->start == 0) |
196 |
| - return -ENODEV; |
| 195 | + ret = p2sb_bar(NULL, 0, res); |
| 196 | + if (ret) |
| 197 | + return ret; |
197 | 198 |
|
198 | 199 | /* do the final address calculation */
|
199 | 200 | res->start = res->start + (GPIO_COMMUNITY0_PORT_ID << 16) +
|
200 | 201 | PAD_CFG_DW0_GPP_A_23;
|
201 |
| - res->end += res->start; |
| 202 | + res->end = res->start + SZ_4 - 1; |
202 | 203 |
|
203 | 204 | wd_reset_base_addr = devm_ioremap_resource(dev, res);
|
204 | 205 | if (IS_ERR(wd_reset_base_addr))
|
|
0 commit comments