pinctrl: msm: Fix irq domain initialization
Irq domain initialization is required in all TLMM instances. Handle multiple tlmm irq domain instances. Change-Id: I7664f5015d2c122e5fad29786b9d21bceb4b4ba0 Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
This commit is contained in:
parent
2b961e35df
commit
f01753b9c8
|
@ -22,7 +22,7 @@ static int __init irq_msm_gpio_init(struct device_node *node,
|
|||
int rc;
|
||||
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
rc = msm_tlmm_v3_of_irq_init(node, parent);
|
||||
rc = msm_tlmm_of_irq_init(node, parent);
|
||||
#else
|
||||
rc = msm_gpio_of_init(node, parent);
|
||||
#endif
|
||||
|
@ -42,7 +42,8 @@ static int __init irq_msm_gpio_init(struct device_node *node,
|
|||
}
|
||||
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
IRQCHIP_DECLARE(tlmm_irq, "qcom,msm-tlmmv3-gp-intc", irq_msm_gpio_init);
|
||||
IRQCHIP_DECLARE(tlmmv3_irq, "qcom,msm-tlmmv3-gp-intc", irq_msm_gpio_init);
|
||||
IRQCHIP_DECLARE(tlmmv4_irq, "qcom,msm-tlmmv4-gp-intc", irq_msm_gpio_init);
|
||||
#else
|
||||
IRQCHIP_DECLARE(tlmm_irq, "qcom,msm-gpio", irq_msm_gpio_init);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -625,18 +625,8 @@ static const struct irq_domain_ops msm_tlmm_v3_gp_irqd_ops = {
|
|||
.xlate = irq_domain_xlate_twocell,
|
||||
};
|
||||
|
||||
struct irq_chip mpm_tlmm_irq_extn = {
|
||||
.irq_eoi = NULL,
|
||||
.irq_mask = NULL,
|
||||
.irq_unmask = NULL,
|
||||
.irq_retrigger = NULL,
|
||||
.irq_set_type = NULL,
|
||||
.irq_set_wake = NULL,
|
||||
.irq_disable = NULL,
|
||||
};
|
||||
|
||||
static struct msm_tlmm_irq_chip msm_tlmm_v3_gp_irq = {
|
||||
.irq_chip_extn = &mpm_tlmm_irq_extn,
|
||||
.chip = {
|
||||
.name = "msm_tlmm_v3_irq",
|
||||
.irq_mask = msm_tlmm_v3_irq_mask,
|
||||
|
@ -694,8 +684,8 @@ static struct syscore_ops msm_tlmm_v3_irq_syscore_ops = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
int __init msm_tlmm_v3_of_irq_init(struct device_node *controller,
|
||||
struct device_node *parent)
|
||||
int msm_tlmm_v3_of_irq_init(struct device_node *controller,
|
||||
struct irq_chip *chip_extn)
|
||||
{
|
||||
int ret, num_irqs, apps_id;
|
||||
struct msm_tlmm_irq_chip *ic = &msm_tlmm_v3_gp_irq;
|
||||
|
@ -716,6 +706,7 @@ int __init msm_tlmm_v3_of_irq_init(struct device_node *controller,
|
|||
ic);
|
||||
if (IS_ERR(ic->domain))
|
||||
return -ENOMEM;
|
||||
ic->irq_chip_extn = chip_extn;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -684,6 +684,34 @@ static struct syscore_ops msm_tlmm_v4_irq_syscore_ops = {
|
|||
.resume = msm_tlmm_v4_gp_irq_resume,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
int msm_tlmm_v4_of_irq_init(struct device_node *controller,
|
||||
struct irq_chip *chip_extn)
|
||||
{
|
||||
int ret, num_irqs, apps_id;
|
||||
struct msm_tlmm_irq_chip *ic = &msm_tlmm_v4_gp_irq;
|
||||
|
||||
ret = of_property_read_u32(controller, "num_irqs", &num_irqs);
|
||||
if (ret) {
|
||||
WARN(1, "Cannot get numirqs from device tree\n");
|
||||
return ret;
|
||||
}
|
||||
ret = of_property_read_u32(controller, "apps_id", &apps_id);
|
||||
if (!ret) {
|
||||
pr_info("processor id specified, in device tree %d\n", apps_id);
|
||||
ic->apps_id = apps_id;
|
||||
}
|
||||
ic->num_irqs = num_irqs;
|
||||
ic->domain = irq_domain_add_linear(controller, ic->num_irqs,
|
||||
ic->domain_ops,
|
||||
ic);
|
||||
if (IS_ERR(ic->domain))
|
||||
return -ENOMEM;
|
||||
ic->irq_chip_extn = chip_extn;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int msm_tlmm_v4_gp_irq_init(int irq, struct msm_pintype_info *pinfo,
|
||||
struct device *tlmm_dev)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -58,6 +58,17 @@ struct msm_pinctrl_dd {
|
|||
struct device *dev;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct msm_irq_of_info: represents of init data for tlmm interrupt
|
||||
* controllers
|
||||
* @compat: compat string for tlmm interrup controller instance.
|
||||
* @irq_init: irq chip initialization callback.
|
||||
*/
|
||||
struct msm_irq_of_info {
|
||||
const char *compat;
|
||||
int (*irq_init)(struct device_node *np, struct irq_chip *ic);
|
||||
};
|
||||
|
||||
static int msm_pmx_functions_count(struct pinctrl_dev *pctldev)
|
||||
{
|
||||
struct msm_pinctrl_dd *dd;
|
||||
|
@ -796,3 +807,51 @@ int msm_pinctrl_probe(struct platform_device *pdev,
|
|||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_pinctrl_probe);
|
||||
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
struct irq_chip mpm_tlmm_irq_extn = {
|
||||
.irq_eoi = NULL,
|
||||
.irq_mask = NULL,
|
||||
.irq_unmask = NULL,
|
||||
.irq_retrigger = NULL,
|
||||
.irq_set_type = NULL,
|
||||
.irq_set_wake = NULL,
|
||||
.irq_disable = NULL,
|
||||
};
|
||||
|
||||
struct msm_irq_of_info msm_tlmm_irq[] = {
|
||||
#ifdef CONFIG_PINCTRL_MSM_TLMM_V3
|
||||
{
|
||||
.compat = "qcom,msm-tlmmv3-gp-intc",
|
||||
.irq_init = msm_tlmm_v3_of_irq_init,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_PINCTRL_MSM_TLMM_V4
|
||||
{
|
||||
.compat = "qcom,msm-tlmmv4-gp-intc",
|
||||
.irq_init = msm_tlmm_v4_of_irq_init,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
int __init msm_tlmm_of_irq_init(struct device_node *controller,
|
||||
struct device_node *parent)
|
||||
{
|
||||
int rc, i;
|
||||
const char *compat;
|
||||
|
||||
rc = of_property_read_string(controller, "compatible", &compat);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(msm_tlmm_irq); i++) {
|
||||
struct msm_irq_of_info *tlmm_info = &msm_tlmm_irq[i];
|
||||
|
||||
if (!of_compat_cmp(tlmm_info->compat, compat, strlen(compat)))
|
||||
return tlmm_info->irq_init(controller,
|
||||
&mpm_tlmm_irq_extn);
|
||||
|
||||
}
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -160,5 +160,24 @@ struct msm_tlmm_desc {
|
|||
/* Common probe for all TLMM */
|
||||
int msm_pinctrl_probe(struct platform_device *pdev,
|
||||
struct msm_tlmm_desc *tlmm_info);
|
||||
#ifdef CONFIG_USE_PINCTRL_IRQ
|
||||
#ifdef CONFIG_PINCTRL_MSM_TLMM_V3
|
||||
extern int msm_tlmm_v3_of_irq_init(struct device_node *np, struct irq_chip *ic);
|
||||
#else
|
||||
static inline int msm_tlmm_v3_of_irq_init(struct device_node *np,
|
||||
struct irq_chip *ic)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_PINCTRL_MSM_TLMM_V4
|
||||
extern int msm_tlmm_v4_of_irq_init(struct device_node *np, struct irq_chip *ic);
|
||||
#else
|
||||
static inline int msm_tlmm_v4_of_irq_init(struct device_node *np,
|
||||
struct irq_chip *ic)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -22,7 +22,7 @@ int __init msm_gpio_of_init(struct device_node *node,
|
|||
struct device_node *parent);
|
||||
extern struct irq_chip msm_gpio_irq_extn;
|
||||
#else
|
||||
int __init msm_tlmm_v3_of_irq_init(struct device_node *node,
|
||||
int __init msm_tlmm_of_irq_init(struct device_node *node,
|
||||
struct device_node *parent);
|
||||
extern struct irq_chip mpm_tlmm_irq_extn;
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ static inline int __init msm_gpio_of_init(struct device_node *node,
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int __init msm_tlmm_v3_of_irq_init(struct device_node *node,
|
||||
static inline int __init msm_tlmm_of_irq_init(struct device_node *node,
|
||||
struct device_node *parent)
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue