Commit dd98756d authored by Kamlakant Patel's avatar Kamlakant Patel Committed by Linus Walleij

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: default avatarKamlakant Patel <kamlakant.patel@broadcom.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 16fe1ad2
...@@ -3,6 +3,8 @@ Netlogic XLP Family GPIO ...@@ -3,6 +3,8 @@ Netlogic XLP Family GPIO
This GPIO driver is used for following Netlogic XLP SoCs: This GPIO driver is used for following Netlogic XLP SoCs:
XLP832, XLP316, XLP208, XLP980, XLP532 XLP832, XLP316, XLP208, XLP980, XLP532
This GPIO driver is also compatible with GPIO controller found on
Broadcom Vulcan ARM64.
Required properties: Required properties:
------------------- -------------------
...@@ -13,6 +15,7 @@ Required properties: ...@@ -13,6 +15,7 @@ Required properties:
- "netlogic,xlp208-gpio": For Netlogic XLP208 - "netlogic,xlp208-gpio": For Netlogic XLP208
- "netlogic,xlp980-gpio": For Netlogic XLP980 - "netlogic,xlp980-gpio": For Netlogic XLP980
- "netlogic,xlp532-gpio": For Netlogic XLP532 - "netlogic,xlp532-gpio": For Netlogic XLP532
- "brcm,vulcan-gpio": For Broadcom Vulcan ARM64
- reg: Physical base address and length of the controller's registers. - reg: Physical base address and length of the controller's registers.
- #gpio-cells: Should be two. The first cell is the pin number and the second - #gpio-cells: Should be two. The first cell is the pin number and the second
cell is used to specify optional parameters (currently unused). cell is used to specify optional parameters (currently unused).
......
...@@ -474,7 +474,7 @@ config GPIO_XILINX ...@@ -474,7 +474,7 @@ config GPIO_XILINX
config GPIO_XLP config GPIO_XLP
tristate "Netlogic XLP GPIO support" tristate "Netlogic XLP GPIO support"
depends on CPU_XLP && OF_GPIO depends on OF_GPIO && (CPU_XLP || ARCH_VULCAN || COMPILE_TEST)
select GPIOLIB_IRQCHIP select GPIOLIB_IRQCHIP
help help
This driver provides support for GPIO interface on Netlogic XLP MIPS64 This driver provides support for GPIO interface on Netlogic XLP MIPS64
......
...@@ -85,7 +85,8 @@ enum { ...@@ -85,7 +85,8 @@ enum {
XLP_GPIO_VARIANT_XLP316, XLP_GPIO_VARIANT_XLP316,
XLP_GPIO_VARIANT_XLP208, XLP_GPIO_VARIANT_XLP208,
XLP_GPIO_VARIANT_XLP980, XLP_GPIO_VARIANT_XLP980,
XLP_GPIO_VARIANT_XLP532 XLP_GPIO_VARIANT_XLP532,
GPIO_VARIANT_VULCAN
}; };
struct xlp_gpio_priv { struct xlp_gpio_priv {
...@@ -285,6 +286,10 @@ static const struct of_device_id xlp_gpio_of_ids[] = { ...@@ -285,6 +286,10 @@ static const struct of_device_id xlp_gpio_of_ids[] = {
.compatible = "netlogic,xlp532-gpio", .compatible = "netlogic,xlp532-gpio",
.data = (void *)XLP_GPIO_VARIANT_XLP532, .data = (void *)XLP_GPIO_VARIANT_XLP532,
}, },
{
.compatible = "brcm,vulcan-gpio",
.data = (void *)GPIO_VARIANT_VULCAN,
},
{ /* sentinel */ }, { /* sentinel */ },
}; };
MODULE_DEVICE_TABLE(of, xlp_gpio_of_ids); MODULE_DEVICE_TABLE(of, xlp_gpio_of_ids);
...@@ -347,6 +352,7 @@ static int xlp_gpio_probe(struct platform_device *pdev) ...@@ -347,6 +352,7 @@ static int xlp_gpio_probe(struct platform_device *pdev)
break; break;
case XLP_GPIO_VARIANT_XLP980: case XLP_GPIO_VARIANT_XLP980:
case XLP_GPIO_VARIANT_XLP532: case XLP_GPIO_VARIANT_XLP532:
case GPIO_VARIANT_VULCAN:
priv->gpio_out_en = gpio_base + GPIO_9XX_OUTPUT_EN; priv->gpio_out_en = gpio_base + GPIO_9XX_OUTPUT_EN;
priv->gpio_paddrv = gpio_base + GPIO_9XX_PADDRV; priv->gpio_paddrv = gpio_base + GPIO_9XX_PADDRV;
priv->gpio_intr_stat = gpio_base + GPIO_9XX_INT_STAT; priv->gpio_intr_stat = gpio_base + GPIO_9XX_INT_STAT;
...@@ -354,7 +360,12 @@ static int xlp_gpio_probe(struct platform_device *pdev) ...@@ -354,7 +360,12 @@ static int xlp_gpio_probe(struct platform_device *pdev)
priv->gpio_intr_pol = gpio_base + GPIO_9XX_INT_POL; priv->gpio_intr_pol = gpio_base + GPIO_9XX_INT_POL;
priv->gpio_intr_en = gpio_base + GPIO_9XX_INT_EN00; priv->gpio_intr_en = gpio_base + GPIO_9XX_INT_EN00;
ngpio = (soc_type == XLP_GPIO_VARIANT_XLP980) ? 66 : 67; if (soc_type == XLP_GPIO_VARIANT_XLP980)
ngpio = 66;
else if (soc_type == XLP_GPIO_VARIANT_XLP532)
ngpio = 67;
else
ngpio = 70;
break; break;
default: default:
dev_err(&pdev->dev, "Unknown Processor type!\n"); dev_err(&pdev->dev, "Unknown Processor type!\n");
...@@ -377,10 +388,14 @@ static int xlp_gpio_probe(struct platform_device *pdev) ...@@ -377,10 +388,14 @@ static int xlp_gpio_probe(struct platform_device *pdev)
gc->get = xlp_gpio_get; gc->get = xlp_gpio_get;
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
/* XLP has fixed IRQ range for GPIO interrupts */
if (soc_type == GPIO_VARIANT_VULCAN)
irq_base = irq_alloc_descs(-1, 0, gc->ngpio, 0);
else
irq_base = irq_alloc_descs(-1, XLP_GPIO_IRQ_BASE, gc->ngpio, 0); irq_base = irq_alloc_descs(-1, XLP_GPIO_IRQ_BASE, gc->ngpio, 0);
if (irq_base < 0) { if (IS_ERR_VALUE(irq_base)) {
dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n"); dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n");
return -ENODEV; return irq_base;
} }
err = gpiochip_add_data(gc, priv); err = gpiochip_add_data(gc, priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment