Commit a71e0673 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

twl4030-core: portability updates

Improve handling of the OMAP-specific setup in twl4030-core,
and remove various warnings on non-OMAP builds.

The main remaining portability problem for this core code (from
a build perspective) is needing symbols like TWL4030_PWR_IRQ_BASE
which are undesirable and platform-specific.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent fc902fc1
...@@ -75,6 +75,19 @@ ...@@ -75,6 +75,19 @@
#define twl_has_usb() false #define twl_has_usb() false
#endif #endif
static inline void activate_irq(int irq)
{
#ifdef CONFIG_ARM
/* ARM requires an extra step to clear IRQ_NOREQUEST, which it
* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE.
*/
set_irq_flags(irq, IRQF_VALID);
#else
/* same effect on other architectures */
set_irq_noprobe(irq);
#endif
}
/* Primary Interrupt Handler on TWL4030 Registers */ /* Primary Interrupt Handler on TWL4030 Registers */
/* Register Definitions */ /* Register Definitions */
...@@ -584,7 +597,7 @@ static unsigned twl4030_irq_base; ...@@ -584,7 +597,7 @@ static unsigned twl4030_irq_base;
*/ */
static int twl4030_irq_thread(void *data) static int twl4030_irq_thread(void *data)
{ {
int irq = (int)data; long irq = (long)data;
irq_desc_t *desc = irq_desc + irq; irq_desc_t *desc = irq_desc + irq;
static unsigned i2c_errors; static unsigned i2c_errors;
const static unsigned max_i2c_errors = 100; const static unsigned max_i2c_errors = 100;
...@@ -868,15 +881,15 @@ err: ...@@ -868,15 +881,15 @@ err:
return status; return status;
} }
static struct task_struct * __init start_twl4030_irq_thread(int irq) static struct task_struct * __init start_twl4030_irq_thread(long irq)
{ {
struct task_struct *thread; struct task_struct *thread;
init_completion(&irq_event); init_completion(&irq_event);
thread = kthread_run(twl4030_irq_thread, (void *)irq, thread = kthread_run(twl4030_irq_thread, (void *)irq,
"twl4030 irq %d", irq); "twl4030 irq %ld", irq);
if (!thread) if (!thread)
pr_err("%s: could not create twl4030 irq %d thread!\n", pr_err("%s: could not create twl4030 irq %ld thread!\n",
DRIVER_NAME, irq); DRIVER_NAME, irq);
return thread; return thread;
...@@ -909,16 +922,18 @@ static int __init unprotect_pm_master(void) ...@@ -909,16 +922,18 @@ static int __init unprotect_pm_master(void)
static int __init power_companion_init(void) static int __init power_companion_init(void)
{ {
int e = 0; int e = 0;
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
struct clk *osc; struct clk *osc;
u32 rate; u32 rate;
u8 ctrl = HFCLK_FREQ_26_MHZ; u8 ctrl = HFCLK_FREQ_26_MHZ;
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
if (cpu_is_omap2430()) if (cpu_is_omap2430())
osc = clk_get(NULL, "osc_ck"); osc = clk_get(NULL, "osc_ck");
else else
osc = clk_get(NULL, "osc_sys_ck"); osc = clk_get(NULL, "osc_sys_ck");
#else
osc = ERR_PTR(-EIO);
#endif
if (IS_ERR(osc)) { if (IS_ERR(osc)) {
printk(KERN_WARNING "Skipping twl4030 internal clock init and " printk(KERN_WARNING "Skipping twl4030 internal clock init and "
"using bootloader value (unknown osc rate)\n"); "using bootloader value (unknown osc rate)\n");
...@@ -945,7 +960,6 @@ static int __init power_companion_init(void) ...@@ -945,7 +960,6 @@ static int __init power_companion_init(void)
/* effect->MADC+USB ck en */ /* effect->MADC+USB ck en */
e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT); e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
e |= protect_pm_master(); e |= protect_pm_master();
#endif /* OMAP */
return e; return e;
} }
...@@ -1051,9 +1065,9 @@ static void twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) ...@@ -1051,9 +1065,9 @@ static void twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
/* install an irq handler for each of the PIH modules */ /* install an irq handler for each of the PIH modules */
for (i = irq_base; i < irq_end; i++) { for (i = irq_base; i < irq_end; i++) {
set_irq_chip(i, &twl4030_irq_chip); set_irq_chip_and_handler(i, &twl4030_irq_chip,
set_irq_handler(i, do_twl4030_module_irq); do_twl4030_module_irq);
set_irq_flags(i, IRQF_VALID); activate_irq(i);
} }
/* install an irq handler to demultiplex the TWL4030 interrupt */ /* install an irq handler to demultiplex the TWL4030 interrupt */
......
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