From: Linus Walleij Date: Tue, 3 Sep 2019 14:04:19 +0000 (+0200) Subject: Merge tag 'gpio-v5.4-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8a6abcd04e4cdf6088f11212570c3e5ec36ee5c3;p=openwrt%2Fstaging%2Fblogic.git Merge tag 'gpio-v5.4-updates-for-linus' of git://git./linux/kernel/git/brgl/linux into devel gpio: updates for v5.4 - use a helper variable for &pdev->dev in gpio-em - tweak the ifdefs in GPIO headers - fix function links in HTML docs - remove an unneeded error message from ixp4xx - use the optional clk_get in gpio-mxc instead of checking the return value - a couple improvements in pca953x - allow to build gpio-lpc32xx on non-lpc32xx targets --- 8a6abcd04e4cdf6088f11212570c3e5ec36ee5c3 diff --cc drivers/gpio/gpio-ixp4xx.c index 1a57e74fdb91,2b2b89b6cd18..b3b050604e0b --- a/drivers/gpio/gpio-ixp4xx.c +++ b/drivers/gpio/gpio-ixp4xx.c @@@ -204,40 -321,9 +204,38 @@@ static int ixp4xx_gpio_probe(struct pla res = platform_get_resource(pdev, IORESOURCE_MEM, 0); g->base = devm_ioremap_resource(dev, res); - if (IS_ERR(g->base)) { - dev_err(dev, "ioremap error\n"); + if (IS_ERR(g->base)) return PTR_ERR(g->base); - } + /* + * When we convert to device tree we will simply look up the + * parent irqdomain using irq_find_host(parent) as parent comes + * from IRQCHIP_DECLARE(), then use of_node_to_fwnode() to get + * the fwnode. For now we need this boardfile style code. + */ + if (np) { + struct device_node *irq_parent; + + irq_parent = of_irq_find_parent(np); + if (!irq_parent) { + dev_err(dev, "no IRQ parent node\n"); + return -ENODEV; + } + parent = irq_find_host(irq_parent); + if (!parent) { + dev_err(dev, "no IRQ parent domain\n"); + return -ENODEV; + } + g->fwnode = of_node_to_fwnode(np); + } else { + parent = ixp4xx_get_irq_domain(); + g->fwnode = irq_domain_alloc_fwnode(&res->start); + if (!g->fwnode) { + dev_err(dev, "no domain base\n"); + return -ENODEV; + } + } + /* * Make sure GPIO 14 and 15 are NOT used as clocks but GPIO on * specific machines. diff --cc include/linux/gpio/driver.h index 8d06a054abc8,f28f534f451a..b74a3bee85e5 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@@ -20,12 -20,6 +20,8 @@@ struct module enum gpiod_flags; enum gpio_lookup_flags; - #ifdef CONFIG_GPIOLIB - - #ifdef CONFIG_GPIOLIB_IRQCHIP - +struct gpio_chip; + /** * struct gpio_irq_chip - GPIO interrupt controller */ @@@ -520,38 -443,6 +513,35 @@@ struct bgpio_pdata int ngpio; }; +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + +void gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type); +void gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type); + +#else + +static inline void gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ +} + +static inline void gpiochip_populate_parent_fwspec_fourcell(struct gpio_chip *chip, + struct irq_fwspec *fwspec, + unsigned int parent_hwirq, + unsigned int parent_type) +{ +} + +#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ + - - #if IS_ENABLED(CONFIG_GPIO_GENERIC) - int bgpio_init(struct gpio_chip *gc, struct device *dev, unsigned long sz, void __iomem *dat, void __iomem *set, void __iomem *clr, void __iomem *dirout, void __iomem *dirin, @@@ -720,10 -603,11 +702,14 @@@ void gpiochip_free_own_desc(struct gpio void devprop_gpiochip_set_names(struct gpio_chip *chip, const struct fwnode_handle *fwnode); +/* lock/unlock as IRQ */ +int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); +void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); + #ifdef CONFIG_GPIOLIB + + struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); + #else /* CONFIG_GPIOLIB */ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) @@@ -733,18 -617,6 +719,18 @@@ return ERR_PTR(-ENODEV); } +static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, + unsigned int offset) +{ + WARN_ON(1); + return -EINVAL; +} + +static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, + unsigned int offset) +{ + WARN_ON(1); +} #endif /* CONFIG_GPIOLIB */ - #endif + #endif /* __LINUX_GPIO_DRIVER_H */