Commit 4e519473 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/ctrl/mvebu'

- Switch to the gpiod API so we can make of_get_named_gpio_flags() private
  (Dmitry Torokhov)

* pci/ctrl/mvebu:
  PCI: mvebu: Switch to using gpiod API
parents 0454c6c0 76007ccc
Loading
Loading
Loading
Loading
+17 −34
Original line number Diff line number Diff line
@@ -11,14 +11,14 @@
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/mbus.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_gpio.h>
#include <linux/of_pci.h>
#include <linux/of_platform.h>

@@ -1261,9 +1261,8 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
	struct mvebu_pcie_port *port, struct device_node *child)
{
	struct device *dev = &pcie->pdev->dev;
	enum of_gpio_flags flags;
	u32 slot_power_limit;
	int reset_gpio, ret;
	int ret;
	u32 num_lanes;

	port->pcie = pcie;
@@ -1327,15 +1326,6 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
			 port->name, child);
	}

	reset_gpio = of_get_named_gpio_flags(child, "reset-gpios", 0, &flags);
	if (reset_gpio == -EPROBE_DEFER) {
		ret = reset_gpio;
		goto err;
	}

	if (gpio_is_valid(reset_gpio)) {
		unsigned long gpio_flags;

	port->reset_name = devm_kasprintf(dev, GFP_KERNEL, "%s-reset",
					  port->name);
	if (!port->reset_name) {
@@ -1343,24 +1333,17 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
		goto err;
	}

		if (flags & OF_GPIO_ACTIVE_LOW) {
			dev_info(dev, "%pOF: reset gpio is active low\n",
				 child);
			gpio_flags = GPIOF_ACTIVE_LOW |
				     GPIOF_OUT_INIT_LOW;
		} else {
			gpio_flags = GPIOF_OUT_INIT_HIGH;
		}

		ret = devm_gpio_request_one(dev, reset_gpio, gpio_flags,
					    port->reset_name);
	port->reset_gpio = devm_fwnode_gpiod_get(dev, of_fwnode_handle(child),
						 "reset", GPIOD_OUT_HIGH,
						 port->name);
	ret = PTR_ERR_OR_ZERO(port->reset_gpio);
	if (ret) {
			if (ret == -EPROBE_DEFER)
		if (ret != -ENOENT)
			goto err;
			goto skip;
		}

		port->reset_gpio = gpio_to_desc(reset_gpio);
		/* reset gpio is optional */
		port->reset_gpio = NULL;
		devm_kfree(dev, port->reset_name);
		port->reset_name = NULL;
	}

	slot_power_limit = of_pci_get_slot_power_limit(child,