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

pinctrl: single: Add support for auxdata

For omaps, we still have dependencies to the legacy code
for handling the PRM (Power Reset Management) interrupts,
and also for reconfiguring the io wake-up chain after
changes.

Let's pass the PRM interrupt and the rearm functions via
auxdata. Then when at some point we have a proper PRM
driver, we can get the interrupt via device tree and
set up the rearm function as exported function in the
PRM driver.

By using auxdata we can remove a dependency to the
wake-up events for converting omap3 to be device
tree only.

Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Prakash Manjunathappa <prakash.pm@ti.com>
Cc: Roger Quadros <rogerq@ti.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Tested-by: Kevin Hilman <khilman@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

+35
+23
drivers/pinctrl/pinctrl-single.c
··· 28 28 #include <linux/pinctrl/pinmux.h> 29 29 #include <linux/pinctrl/pinconf-generic.h> 30 30 31 + #include <linux/platform_data/pinctrl-single.h> 32 + 31 33 #include "core.h" 32 34 #include "pinconf.h" 33 35 ··· 161 159 * @irq: optional interrupt for the controller 162 160 * @irq_enable_mask: optional SoC specific interrupt enable mask 163 161 * @irq_status_mask: optional SoC specific interrupt status mask 162 + * @rearm: optional SoC specific wake-up rearm function 164 163 */ 165 164 struct pcs_soc_data { 166 165 unsigned flags; 167 166 int irq; 168 167 unsigned irq_enable_mask; 169 168 unsigned irq_status_mask; 169 + void (*rearm)(void); 170 170 }; 171 171 172 172 /** ··· 1626 1622 struct pcs_soc_data *pcs_soc = irq_data_get_irq_chip_data(d); 1627 1623 1628 1624 pcs_irq_set(pcs_soc, d->irq, true); 1625 + if (pcs_soc->rearm) 1626 + pcs_soc->rearm(); 1629 1627 } 1630 1628 1631 1629 /** ··· 1677 1671 count++; 1678 1672 } 1679 1673 } 1674 + 1675 + /* 1676 + * For debugging on omaps, you may want to call pcs_soc->rearm() 1677 + * here to see wake-up interrupts during runtime also. 1678 + */ 1680 1679 1681 1680 return count; 1682 1681 } ··· 1846 1835 { 1847 1836 struct device_node *np = pdev->dev.of_node; 1848 1837 const struct of_device_id *match; 1838 + struct pcs_pdata *pdata; 1849 1839 struct resource *res; 1850 1840 struct pcs_device *pcs; 1851 1841 const struct pcs_soc_data *soc; ··· 1960 1948 pcs->socdata.irq = irq_of_parse_and_map(np, 0); 1961 1949 if (pcs->socdata.irq) 1962 1950 pcs->flags |= PCS_FEAT_IRQ; 1951 + 1952 + /* We still need auxdata for some omaps for PRM interrupts */ 1953 + pdata = dev_get_platdata(&pdev->dev); 1954 + if (pdata) { 1955 + if (pdata->rearm) 1956 + pcs->socdata.rearm = pdata->rearm; 1957 + if (pdata->irq) { 1958 + pcs->socdata.irq = pdata->irq; 1959 + pcs->flags |= PCS_FEAT_IRQ; 1960 + } 1961 + } 1963 1962 1964 1963 if (PCS_HAS_IRQ) { 1965 1964 ret = pcs_irq_init_chained_handler(pcs, np);
+12
include/linux/platform_data/pinctrl-single.h
··· 1 + /** 2 + * irq: optional wake-up interrupt 3 + * rearm: optional soc specific rearm function 4 + * 5 + * Note that the irq and rearm setup should come from device 6 + * tree except for omap where there are still some dependencies 7 + * to the legacy PRM code. 8 + */ 9 + struct pcs_pdata { 10 + int irq; 11 + void (*rearm)(void); 12 + };