hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/gpio/gpio-pxa.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/plat-pxa/gpio.c
34 *
....@@ -6,10 +7,6 @@
67 * Author: Nicolas Pitre
78 * Created: Jun 15, 2001
89 * Copyright: MontaVista Software Inc.
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411 #include <linux/module.h>
1512 #include <linux/clk.h>
....@@ -246,6 +243,7 @@
246243 switch (gpio_type) {
247244 case PXA3XX_GPIO:
248245 case MMP2_GPIO:
246
+ case MMP_GPIO:
249247 return false;
250248
251249 default:
....@@ -364,11 +362,8 @@
364362 pchip->chip.set = pxa_gpio_set;
365363 pchip->chip.to_irq = pxa_gpio_to_irq;
366364 pchip->chip.ngpio = ngpio;
367
-
368
- if (pxa_gpio_has_pinctrl()) {
369
- pchip->chip.request = gpiochip_generic_request;
370
- pchip->chip.free = gpiochip_generic_free;
371
- }
365
+ pchip->chip.request = gpiochip_generic_request;
366
+ pchip->chip.free = gpiochip_generic_free;
372367
373368 #ifdef CONFIG_OF_GPIO
374369 pchip->chip.of_node = np;
....@@ -577,7 +572,7 @@
577572 return 0;
578573 }
579574
580
-const struct irq_domain_ops pxa_irq_domain_ops = {
575
+static const struct irq_domain_ops pxa_irq_domain_ops = {
581576 .map = pxa_irq_domain_map,
582577 .xlate = irq_domain_xlate_twocell,
583578 };
....@@ -622,7 +617,6 @@
622617 {
623618 struct pxa_gpio_chip *pchip;
624619 struct pxa_gpio_bank *c;
625
- struct resource *res;
626620 struct clk *clk;
627621 struct pxa_gpio_platform_data *info;
628622 void __iomem *gpio_reg_base;
....@@ -656,8 +650,8 @@
656650 if (!pchip->irqdomain)
657651 return -ENOMEM;
658652
659
- irq0 = platform_get_irq_byname(pdev, "gpio0");
660
- irq1 = platform_get_irq_byname(pdev, "gpio1");
653
+ irq0 = platform_get_irq_byname_optional(pdev, "gpio0");
654
+ irq1 = platform_get_irq_byname_optional(pdev, "gpio1");
661655 irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
662656 if ((irq0 > 0 && irq1 <= 0) || (irq0 <= 0 && irq1 > 0)
663657 || (irq_mux <= 0))
....@@ -665,13 +659,10 @@
665659
666660 pchip->irq0 = irq0;
667661 pchip->irq1 = irq1;
668
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
669
- if (!res)
670
- return -EINVAL;
671
- gpio_reg_base = devm_ioremap(&pdev->dev, res->start,
672
- resource_size(res));
673
- if (!gpio_reg_base)
674
- return -EINVAL;
662
+
663
+ gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
664
+ if (IS_ERR(gpio_reg_base))
665
+ return PTR_ERR(gpio_reg_base);
675666
676667 clk = clk_get(&pdev->dev, NULL);
677668 if (IS_ERR(clk)) {
....@@ -816,7 +807,7 @@
816807 #define pxa_gpio_resume NULL
817808 #endif
818809
819
-struct syscore_ops pxa_gpio_syscore_ops = {
810
+static struct syscore_ops pxa_gpio_syscore_ops = {
820811 .suspend = pxa_gpio_suspend,
821812 .resume = pxa_gpio_resume,
822813 };