|
11 | 11 | #include <linux/bitfield.h>
|
12 | 12 | #include <linux/clk.h>
|
13 | 13 | #include <linux/delay.h>
|
14 |
| -#include <linux/gpio.h> |
| 14 | +#include <linux/gpio/consumer.h> |
15 | 15 | #include <linux/init.h>
|
| 16 | +#include <linux/irqchip/chained_irq.h> |
16 | 17 | #include <linux/mbus.h>
|
17 | 18 | #include <linux/slab.h>
|
18 | 19 | #include <linux/platform_device.h>
|
19 | 20 | #include <linux/of_address.h>
|
20 | 21 | #include <linux/of_irq.h>
|
21 |
| -#include <linux/of_gpio.h> |
22 | 22 | #include <linux/of_pci.h>
|
23 | 23 | #include <linux/of_platform.h>
|
24 | 24 |
|
@@ -1261,9 +1261,8 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
|
1261 | 1261 | struct mvebu_pcie_port *port, struct device_node *child)
|
1262 | 1262 | {
|
1263 | 1263 | struct device *dev = &pcie->pdev->dev;
|
1264 |
| - enum of_gpio_flags flags; |
1265 | 1264 | u32 slot_power_limit;
|
1266 |
| - int reset_gpio, ret; |
| 1265 | + int ret; |
1267 | 1266 | u32 num_lanes;
|
1268 | 1267 |
|
1269 | 1268 | port->pcie = pcie;
|
@@ -1327,40 +1326,24 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
|
1327 | 1326 | port->name, child);
|
1328 | 1327 | }
|
1329 | 1328 |
|
1330 |
| - reset_gpio = of_get_named_gpio_flags(child, "reset-gpios", 0, &flags); |
1331 |
| - if (reset_gpio == -EPROBE_DEFER) { |
1332 |
| - ret = reset_gpio; |
| 1329 | + port->reset_name = devm_kasprintf(dev, GFP_KERNEL, "%s-reset", |
| 1330 | + port->name); |
| 1331 | + if (!port->reset_name) { |
| 1332 | + ret = -ENOMEM; |
1333 | 1333 | goto err;
|
1334 | 1334 | }
|
1335 | 1335 |
|
1336 |
| - if (gpio_is_valid(reset_gpio)) { |
1337 |
| - unsigned long gpio_flags; |
1338 |
| - |
1339 |
| - port->reset_name = devm_kasprintf(dev, GFP_KERNEL, "%s-reset", |
1340 |
| - port->name); |
1341 |
| - if (!port->reset_name) { |
1342 |
| - ret = -ENOMEM; |
| 1336 | + port->reset_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(child), |
| 1337 | + "reset", GPIOD_OUT_HIGH, |
| 1338 | + port->name); |
| 1339 | + ret = PTR_ERR_OR_ZERO(port->reset_gpio); |
| 1340 | + if (ret) { |
| 1341 | + if (ret != -ENOENT) |
1343 | 1342 | goto err;
|
1344 |
| - } |
1345 |
| - |
1346 |
| - if (flags & OF_GPIO_ACTIVE_LOW) { |
1347 |
| - dev_info(dev, "%pOF: reset gpio is active low\n", |
1348 |
| - child); |
1349 |
| - gpio_flags = GPIOF_ACTIVE_LOW | |
1350 |
| - GPIOF_OUT_INIT_LOW; |
1351 |
| - } else { |
1352 |
| - gpio_flags = GPIOF_OUT_INIT_HIGH; |
1353 |
| - } |
1354 |
| - |
1355 |
| - ret = devm_gpio_request_one(dev, reset_gpio, gpio_flags, |
1356 |
| - port->reset_name); |
1357 |
| - if (ret) { |
1358 |
| - if (ret == -EPROBE_DEFER) |
1359 |
| - goto err; |
1360 |
| - goto skip; |
1361 |
| - } |
1362 |
| - |
1363 |
| - port->reset_gpio = gpio_to_desc(reset_gpio); |
| 1343 | + /* reset gpio is optional */ |
| 1344 | + port->reset_gpio = NULL; |
| 1345 | + devm_kfree(dev, port->reset_name); |
| 1346 | + port->reset_name = NULL; |
1364 | 1347 | }
|
1365 | 1348 |
|
1366 | 1349 | slot_power_limit = of_pci_get_slot_power_limit(child,
|
|
0 commit comments