Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: xlp: Add GPIO driver support for Broadcom Vulcan ARM64

- Add GPIO support for Broadcom Vulcan ARM64.
- Add depends on ARCH_VULCAN to Kconfig to enable gpio controller
driver for Broadcom Vulcan ARM64 SoCs.

Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Kamlakant Patel and committed by
Linus Walleij
dd98756d 16fe1ad2

+24 -6
+3
Documentation/devicetree/bindings/gpio/gpio-xlp.txt
··· 3 3 4 4 This GPIO driver is used for following Netlogic XLP SoCs: 5 5 XLP832, XLP316, XLP208, XLP980, XLP532 6 + This GPIO driver is also compatible with GPIO controller found on 7 + Broadcom Vulcan ARM64. 6 8 7 9 Required properties: 8 10 ------------------- ··· 15 13 - "netlogic,xlp208-gpio": For Netlogic XLP208 16 14 - "netlogic,xlp980-gpio": For Netlogic XLP980 17 15 - "netlogic,xlp532-gpio": For Netlogic XLP532 16 + - "brcm,vulcan-gpio": For Broadcom Vulcan ARM64 18 17 - reg: Physical base address and length of the controller's registers. 19 18 - #gpio-cells: Should be two. The first cell is the pin number and the second 20 19 cell is used to specify optional parameters (currently unused).
+1 -1
drivers/gpio/Kconfig
··· 474 474 475 475 config GPIO_XLP 476 476 tristate "Netlogic XLP GPIO support" 477 - depends on CPU_XLP && OF_GPIO 477 + depends on OF_GPIO && (CPU_XLP || ARCH_VULCAN || COMPILE_TEST) 478 478 select GPIOLIB_IRQCHIP 479 479 help 480 480 This driver provides support for GPIO interface on Netlogic XLP MIPS64
+20 -5
drivers/gpio/gpio-xlp.c
··· 85 85 XLP_GPIO_VARIANT_XLP316, 86 86 XLP_GPIO_VARIANT_XLP208, 87 87 XLP_GPIO_VARIANT_XLP980, 88 - XLP_GPIO_VARIANT_XLP532 88 + XLP_GPIO_VARIANT_XLP532, 89 + GPIO_VARIANT_VULCAN 89 90 }; 90 91 91 92 struct xlp_gpio_priv { ··· 286 285 .compatible = "netlogic,xlp532-gpio", 287 286 .data = (void *)XLP_GPIO_VARIANT_XLP532, 288 287 }, 288 + { 289 + .compatible = "brcm,vulcan-gpio", 290 + .data = (void *)GPIO_VARIANT_VULCAN, 291 + }, 289 292 { /* sentinel */ }, 290 293 }; 291 294 MODULE_DEVICE_TABLE(of, xlp_gpio_of_ids); ··· 352 347 break; 353 348 case XLP_GPIO_VARIANT_XLP980: 354 349 case XLP_GPIO_VARIANT_XLP532: 350 + case GPIO_VARIANT_VULCAN: 355 351 priv->gpio_out_en = gpio_base + GPIO_9XX_OUTPUT_EN; 356 352 priv->gpio_paddrv = gpio_base + GPIO_9XX_PADDRV; 357 353 priv->gpio_intr_stat = gpio_base + GPIO_9XX_INT_STAT; ··· 360 354 priv->gpio_intr_pol = gpio_base + GPIO_9XX_INT_POL; 361 355 priv->gpio_intr_en = gpio_base + GPIO_9XX_INT_EN00; 362 356 363 - ngpio = (soc_type == XLP_GPIO_VARIANT_XLP980) ? 66 : 67; 357 + if (soc_type == XLP_GPIO_VARIANT_XLP980) 358 + ngpio = 66; 359 + else if (soc_type == XLP_GPIO_VARIANT_XLP532) 360 + ngpio = 67; 361 + else 362 + ngpio = 70; 364 363 break; 365 364 default: 366 365 dev_err(&pdev->dev, "Unknown Processor type!\n"); ··· 388 377 gc->get = xlp_gpio_get; 389 378 390 379 spin_lock_init(&priv->lock); 391 - irq_base = irq_alloc_descs(-1, XLP_GPIO_IRQ_BASE, gc->ngpio, 0); 392 - if (irq_base < 0) { 380 + /* XLP has fixed IRQ range for GPIO interrupts */ 381 + if (soc_type == GPIO_VARIANT_VULCAN) 382 + irq_base = irq_alloc_descs(-1, 0, gc->ngpio, 0); 383 + else 384 + irq_base = irq_alloc_descs(-1, XLP_GPIO_IRQ_BASE, gc->ngpio, 0); 385 + if (IS_ERR_VALUE(irq_base)) { 393 386 dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n"); 394 - return -ENODEV; 387 + return irq_base; 395 388 } 396 389 397 390 err = gpiochip_add_data(gc, priv);