|
25 | 25 | struct fsl_gpio_soc_data {
|
26 | 26 | /* SoCs has a Port Data Direction Register (PDDR) */
|
27 | 27 | bool have_paddr;
|
| 28 | + bool have_dual_base; |
28 | 29 | };
|
29 | 30 |
|
30 | 31 | struct vf610_gpio_port {
|
@@ -60,13 +61,26 @@ struct vf610_gpio_port {
|
60 | 61 | #define PORT_INT_EITHER_EDGE 0xb
|
61 | 62 | #define PORT_INT_LOGIC_ONE 0xc
|
62 | 63 |
|
| 64 | +#define IMX8ULP_GPIO_BASE_OFF 0x40 |
| 65 | +#define IMX8ULP_BASE_OFF 0x80 |
| 66 | + |
| 67 | +static const struct fsl_gpio_soc_data vf610_data = { |
| 68 | + .have_dual_base = true, |
| 69 | +}; |
| 70 | + |
63 | 71 | static const struct fsl_gpio_soc_data imx_data = {
|
64 | 72 | .have_paddr = true,
|
| 73 | + .have_dual_base = true, |
| 74 | +}; |
| 75 | + |
| 76 | +static const struct fsl_gpio_soc_data imx8ulp_data = { |
| 77 | + .have_paddr = true, |
65 | 78 | };
|
66 | 79 |
|
67 | 80 | static const struct of_device_id vf610_gpio_dt_ids[] = {
|
68 |
| - { .compatible = "fsl,vf610-gpio", .data = NULL, }, |
| 81 | + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, |
69 | 82 | { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, },
|
| 83 | + { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, |
70 | 84 | { /* sentinel */ }
|
71 | 85 | };
|
72 | 86 |
|
@@ -263,19 +277,38 @@ static int vf610_gpio_probe(struct platform_device *pdev)
|
263 | 277 | struct gpio_irq_chip *girq;
|
264 | 278 | int i;
|
265 | 279 | int ret;
|
| 280 | + bool dual_base; |
266 | 281 |
|
267 | 282 | port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
|
268 | 283 | if (!port)
|
269 | 284 | return -ENOMEM;
|
270 | 285 |
|
271 | 286 | port->sdata = of_device_get_match_data(dev);
|
272 |
| - port->base = devm_platform_ioremap_resource(pdev, 0); |
273 |
| - if (IS_ERR(port->base)) |
274 |
| - return PTR_ERR(port->base); |
275 | 287 |
|
276 |
| - port->gpio_base = devm_platform_ioremap_resource(pdev, 1); |
277 |
| - if (IS_ERR(port->gpio_base)) |
278 |
| - return PTR_ERR(port->gpio_base); |
| 288 | + dual_base = port->sdata->have_dual_base; |
| 289 | + |
| 290 | + /* support old compatible strings */ |
| 291 | + if (device_is_compatible(dev, "fsl,imx7ulp-gpio") && |
| 292 | + (device_is_compatible(dev, "fsl,imx93-gpio") || |
| 293 | + (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) |
| 294 | + dual_base = true; |
| 295 | + |
| 296 | + if (dual_base) { |
| 297 | + port->base = devm_platform_ioremap_resource(pdev, 0); |
| 298 | + if (IS_ERR(port->base)) |
| 299 | + return PTR_ERR(port->base); |
| 300 | + |
| 301 | + port->gpio_base = devm_platform_ioremap_resource(pdev, 1); |
| 302 | + if (IS_ERR(port->gpio_base)) |
| 303 | + return PTR_ERR(port->gpio_base); |
| 304 | + } else { |
| 305 | + port->base = devm_platform_ioremap_resource(pdev, 0); |
| 306 | + if (IS_ERR(port->base)) |
| 307 | + return PTR_ERR(port->base); |
| 308 | + |
| 309 | + port->gpio_base = port->base + IMX8ULP_GPIO_BASE_OFF; |
| 310 | + port->base = port->base + IMX8ULP_BASE_OFF; |
| 311 | + } |
279 | 312 |
|
280 | 313 | port->irq = platform_get_irq(pdev, 0);
|
281 | 314 | if (port->irq < 0)
|
|
0 commit comments