···1111 select HAVE_GENERIC_HARDIRQS1212 select GENERIC_IRQ_PROBE1313 select AUTO_IRQ_AFFINITY if SMP1414- select GENERIC_HARDIRQS_NO_DEPRECATED1414+ select GENERIC_IRQ_SHOW1515 help1616 The Alpha is a 64-bit general-purpose processor designed and1717 marketed by the Digital Equipment Corporation of blessed memory,
···276276277277 /* Set up the lsi irqs. */278278 for (i = 0; i < 128; ++i) {279279- set_irq_chip_and_handler(base + i, lsi_ops, handle_level_irq);279279+ irq_set_chip_and_handler(base + i, lsi_ops, handle_level_irq);280280 irq_set_status_flags(i, IRQ_LEVEL);281281 }282282···290290291291 /* Set up the msi irqs. */292292 for (i = 128; i < (128 + 512); ++i) {293293- set_irq_chip_and_handler(base + i, msi_ops, handle_level_irq);293293+ irq_set_chip_and_handler(base + i, msi_ops, handle_level_irq);294294 irq_set_status_flags(i, IRQ_LEVEL);295295 }296296···308308309309 /* Reserve the legacy irqs. */310310 for (i = 0; i < 16; ++i) {311311- set_irq_chip_and_handler(i, &marvel_legacy_irq_type,312312- handle_level_irq);311311+ irq_set_chip_and_handler(i, &marvel_legacy_irq_type,312312+ handle_level_irq);313313 }314314315315 /* Init the io7 irqs. */
+2-1
arch/alpha/kernel/sys_mikasa.c
···9898 mikasa_update_irq_hw(0);9999100100 for (i = 16; i < 32; ++i) {101101- set_irq_chip_and_handler(i, &mikasa_irq_type, handle_level_irq);101101+ irq_set_chip_and_handler(i, &mikasa_irq_type,102102+ handle_level_irq);102103 irq_set_status_flags(i, IRQ_LEVEL);103104 }104105
+2-1
arch/alpha/kernel/sys_noritake.c
···127127 outw(0, 0x54c);128128129129 for (i = 16; i < 48; ++i) {130130- set_irq_chip_and_handler(i, &noritake_irq_type, handle_level_irq);130130+ irq_set_chip_and_handler(i, &noritake_irq_type,131131+ handle_level_irq);131132 irq_set_status_flags(i, IRQ_LEVEL);132133 }133134
+2-1
arch/alpha/kernel/sys_rawhide.c
···180180 }181181182182 for (i = 16; i < 128; ++i) {183183- set_irq_chip_and_handler(i, &rawhide_irq_type, handle_level_irq);183183+ irq_set_chip_and_handler(i, &rawhide_irq_type,184184+ handle_level_irq);184185 irq_set_status_flags(i, IRQ_LEVEL);185186 }186187
+1-1
arch/alpha/kernel/sys_rx164.c
···9999100100 rx164_update_irq_hw(0);101101 for (i = 16; i < 40; ++i) {102102- set_irq_chip_and_handler(i, &rx164_irq_type, handle_level_irq);102102+ irq_set_chip_and_handler(i, &rx164_irq_type, handle_level_irq);103103 irq_set_status_flags(i, IRQ_LEVEL);104104 }105105
+2-2
arch/alpha/kernel/sys_sable.c
···518518 long i;519519520520 for (i = 0; i < nr_of_irqs; ++i) {521521- set_irq_chip_and_handler(i, &sable_lynx_irq_type,522522- handle_level_irq);521521+ irq_set_chip_and_handler(i, &sable_lynx_irq_type,522522+ handle_level_irq);523523 irq_set_status_flags(i, IRQ_LEVEL);524524 }525525
+2-1
arch/alpha/kernel/sys_takara.c
···138138 takara_update_irq_hw(i, -1);139139140140 for (i = 16; i < 128; ++i) {141141- set_irq_chip_and_handler(i, &takara_irq_type, handle_level_irq);141141+ irq_set_chip_and_handler(i, &takara_irq_type,142142+ handle_level_irq);142143 irq_set_status_flags(i, IRQ_LEVEL);143144 }144145
+1-1
arch/alpha/kernel/sys_titan.c
···179179{180180 long i;181181 for (i = imin; i <= imax; ++i) {182182- set_irq_chip_and_handler(i, ops, handle_level_irq);182182+ irq_set_chip_and_handler(i, ops, handle_level_irq);183183 irq_set_status_flags(i, IRQ_LEVEL);184184 }185185}
+6-6
arch/alpha/kernel/sys_wildfire.c
···183183 for (i = 0; i < 16; ++i) {184184 if (i == 2)185185 continue;186186- set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type,187187- handle_level_irq);186186+ irq_set_chip_and_handler(i + irq_bias, &wildfire_irq_type,187187+ handle_level_irq);188188 irq_set_status_flags(i + irq_bias, IRQ_LEVEL);189189 }190190191191- set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type,192192- handle_level_irq);191191+ irq_set_chip_and_handler(36 + irq_bias, &wildfire_irq_type,192192+ handle_level_irq);193193 irq_set_status_flags(36 + irq_bias, IRQ_LEVEL);194194 for (i = 40; i < 64; ++i) {195195- set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type,196196- handle_level_irq);195195+ irq_set_chip_and_handler(i + irq_bias, &wildfire_irq_type,196196+ handle_level_irq);197197 irq_set_status_flags(i + irq_bias, IRQ_LEVEL);198198 }199199
+2
arch/arm/Kconfig
···2828 select HAVE_C_RECORDMCOUNT2929 select HAVE_GENERIC_HARDIRQS3030 select HAVE_SPARSE_IRQ3131+ select GENERIC_IRQ_SHOW3132 help3233 The ARM series is a line of low-power-consumption RISC chip designs3334 licensed by ARM Ltd and targeted at embedded applications and···366365 select GENERIC_CLOCKEVENTS367366 select ARCH_REQUIRE_GPIOLIB368367 select CLKDEV_LOOKUP368368+ select HAVE_SCHED_CLOCK369369 help370370 Support for Freescale MXC/iMX-based family of processors371371
···1010 irq_err_count++;1111}12121313-/*1414- * Obsolete inline function for calling irq descriptor handlers.1515- */1616-static inline void desc_handle_irq(unsigned int irq, struct irq_desc *desc)1717-{1818- desc->handle_irq(irq, desc);1919-}2020-2113void set_irq_flags(unsigned int irq, unsigned int flags);22142315#define IRQF_VALID (1 << 0)
-2
arch/arm/include/asm/mach/udc_pxa2xx.h
···2020 * VBUS IRQ and omit the methods above. Store the GPIO number2121 * here. Note that sometimes the signals go through inverters...2222 */2323- bool gpio_vbus_inverted;2424- int gpio_vbus; /* high == vbus present */2523 bool gpio_pullup_inverted;2624 int gpio_pullup; /* high == pullup activated */2725};
-25
arch/arm/kernel/bios32.c
···159159DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, pci_fixup_dec21285);160160161161/*162162- * Same as above. The PrPMC800 carrier board for the PrPMC1100 163163- * card maps the host-bridge @ 00:01:00 for some reason and it164164- * ends up getting scanned. Note that we only want to do this165165- * fixup when we find the IXP4xx on a PrPMC system, which is why166166- * we check the machine type. We could be running on a board167167- * with an IXP4xx target device and we don't want to kill the168168- * resources in that case.169169- */170170-static void __devinit pci_fixup_prpmc1100(struct pci_dev *dev)171171-{172172- int i;173173-174174- if (machine_is_prpmc1100()) {175175- dev->class &= 0xff;176176- dev->class |= PCI_CLASS_BRIDGE_HOST << 8;177177- for (i = 0; i < PCI_NUM_RESOURCES; i++) {178178- dev->resource[i].start = 0;179179- dev->resource[i].end = 0;180180- dev->resource[i].flags = 0;181181- }182182- }183183-}184184-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IXP4XX, pci_fixup_prpmc1100);185185-186186-/*187162 * PCI IDE controllers use non-standard I/O port decoding, respect it.188163 */189164static void __devinit pci_fixup_ide_bases(struct pci_dev *dev)
···338338 .fops = &etb_fops,339339};340340341341-static int __init etb_probe(struct amba_device *dev, const struct amba_id *id)341341+static int __devinit etb_probe(struct amba_device *dev, const struct amba_id *id)342342{343343 struct tracectx *t = &tracer;344344 int ret = 0;···530530static struct kobj_attribute trace_mode_attr =531531 __ATTR(trace_mode, 0644, trace_mode_show, trace_mode_store);532532533533-static int __init etm_probe(struct amba_device *dev, const struct amba_id *id)533533+static int __devinit etm_probe(struct amba_device *dev, const struct amba_id *id)534534{535535 struct tracectx *t = &tracer;536536 int ret = 0;
+11-59
arch/arm/kernel/irq.c
···51515252unsigned long irq_err_count;53535454-int show_interrupts(struct seq_file *p, void *v)5454+int arch_show_interrupts(struct seq_file *p, int prec)5555{5656- int i = *(loff_t *) v, cpu;5757- struct irq_desc *desc;5858- struct irqaction * action;5959- unsigned long flags;6060- int prec, n;6161-6262- for (prec = 3, n = 1000; prec < 10 && n <= nr_irqs; prec++)6363- n *= 10;6464-6565-#ifdef CONFIG_SMP6666- if (prec < 4)6767- prec = 4;6868-#endif6969-7070- if (i == 0) {7171- char cpuname[12];7272-7373- seq_printf(p, "%*s ", prec, "");7474- for_each_present_cpu(cpu) {7575- sprintf(cpuname, "CPU%d", cpu);7676- seq_printf(p, " %10s", cpuname);7777- }7878- seq_putc(p, '\n');7979- }8080-8181- if (i < nr_irqs) {8282- desc = irq_to_desc(i);8383- raw_spin_lock_irqsave(&desc->lock, flags);8484- action = desc->action;8585- if (!action)8686- goto unlock;8787-8888- seq_printf(p, "%*d: ", prec, i);8989- for_each_present_cpu(cpu)9090- seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));9191- seq_printf(p, " %10s", desc->irq_data.chip->name ? : "-");9292- seq_printf(p, " %s", action->name);9393- for (action = action->next; action; action = action->next)9494- seq_printf(p, ", %s", action->name);9595-9696- seq_putc(p, '\n');9797-unlock:9898- raw_spin_unlock_irqrestore(&desc->lock, flags);9999- } else if (i == nr_irqs) {10056#ifdef CONFIG_FIQ101101- show_fiq_list(p, prec);5757+ show_fiq_list(p, prec);10258#endif10359#ifdef CONFIG_SMP104104- show_ipi_list(p, prec);6060+ show_ipi_list(p, prec);10561#endif10662#ifdef CONFIG_LOCAL_TIMERS107107- show_local_irqs(p, prec);6363+ show_local_irqs(p, prec);10864#endif109109- seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count);110110- }6565+ seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count);11166 return 0;11267}11368···99144100145void set_irq_flags(unsigned int irq, unsigned int iflags)101146{102102- struct irq_desc *desc;103103- unsigned long flags;147147+ unsigned long clr = 0, set = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;104148105149 if (irq >= nr_irqs) {106150 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq);107151 return;108152 }109153110110- desc = irq_to_desc(irq);111111- raw_spin_lock_irqsave(&desc->lock, flags);112112- desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;113154 if (iflags & IRQF_VALID)114114- desc->status &= ~IRQ_NOREQUEST;155155+ clr |= IRQ_NOREQUEST;115156 if (iflags & IRQF_PROBE)116116- desc->status &= ~IRQ_NOPROBE;157157+ clr |= IRQ_NOPROBE;117158 if (!(iflags & IRQF_NOAUTOEN))118118- desc->status &= ~IRQ_NOAUTOEN;119119- raw_spin_unlock_irqrestore(&desc->lock, flags);159159+ clr |= IRQ_NOAUTOEN;160160+ /* Order is clear bits in "clr" then set bits in "set" */161161+ irq_modify_status(irq, clr, set & ~clr);120162}121163122164void __init init_IRQ(void)
+6-4
arch/arm/kernel/kprobes-decode.c
···594594 long cpsr = regs->ARM_cpsr;595595596596 fnr.dr = insnslot_llret_3arg_rflags(rnv, 0, rmv, cpsr, i_fn);597597- regs->uregs[rn] = fnr.r0; /* Save Rn in case of writeback. */597597+ if (rn != 15)598598+ regs->uregs[rn] = fnr.r0; /* Save Rn in case of writeback. */598599 rdv = fnr.r1;599600600601 if (rd == 15) {···623622 long rdv = (rd == 15) ? iaddr + str_pc_offset : regs->uregs[rd];624623 long rnv = (rn == 15) ? iaddr + 8 : regs->uregs[rn];625624 long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */625625+ long rnv_wb;626626627627- /* Save Rn in case of writeback. */628628- regs->uregs[rn] =629629- insnslot_3arg_rflags(rnv, rdv, rmv, regs->ARM_cpsr, i_fn);627627+ rnv_wb = insnslot_3arg_rflags(rnv, rdv, rmv, regs->ARM_cpsr, i_fn);628628+ if (rn != 15)629629+ regs->uregs[rn] = rnv_wb; /* Save Rn in case of writeback. */630630}631631632632static void __kprobes emulate_mrrc(struct kprobe *p, struct pt_regs *regs)
+25-8
arch/arm/kernel/perf_event.c
···7979 void (*write_counter)(int idx, u32 val);8080 void (*start)(void);8181 void (*stop)(void);8282+ void (*reset)(void *);8283 const unsigned (*cache_map)[PERF_COUNT_HW_CACHE_MAX]8384 [PERF_COUNT_HW_CACHE_OP_MAX]8485 [PERF_COUNT_HW_CACHE_RESULT_MAX];···205204static u64206205armpmu_event_update(struct perf_event *event,207206 struct hw_perf_event *hwc,208208- int idx)207207+ int idx, int overflow)209208{210210- int shift = 64 - 32;211211- s64 prev_raw_count, new_raw_count;212212- u64 delta;209209+ u64 delta, prev_raw_count, new_raw_count;213210214211again:215212 prev_raw_count = local64_read(&hwc->prev_count);···217218 new_raw_count) != prev_raw_count)218219 goto again;219220220220- delta = (new_raw_count << shift) - (prev_raw_count << shift);221221- delta >>= shift;221221+ new_raw_count &= armpmu->max_period;222222+ prev_raw_count &= armpmu->max_period;223223+224224+ if (overflow)225225+ delta = armpmu->max_period - prev_raw_count + new_raw_count;226226+ else227227+ delta = new_raw_count - prev_raw_count;222228223229 local64_add(delta, &event->count);224230 local64_sub(delta, &hwc->period_left);···240236 if (hwc->idx < 0)241237 return;242238243243- armpmu_event_update(event, hwc, hwc->idx);239239+ armpmu_event_update(event, hwc, hwc->idx, 0);244240}245241246242static void···258254 if (!(hwc->state & PERF_HES_STOPPED)) {259255 armpmu->disable(hwc, hwc->idx);260256 barrier(); /* why? */261261- armpmu_event_update(event, hwc, hwc->idx);257257+ armpmu_event_update(event, hwc, hwc->idx, 0);262258 hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;263259 }264260}···627623#include "perf_event_xscale.c"628624#include "perf_event_v6.c"629625#include "perf_event_v7.c"626626+627627+/*628628+ * Ensure the PMU has sane values out of reset.629629+ * This requires SMP to be available, so exists as a separate initcall.630630+ */631631+static int __init632632+armpmu_reset(void)633633+{634634+ if (armpmu && armpmu->reset)635635+ return on_each_cpu(armpmu->reset, NULL, 1);636636+ return 0;637637+}638638+arch_initcall(armpmu_reset);630639631640static int __init632641init_hw_perf_events(void)
···143143 /* Active Low interrupt, with the specified priority */144144 at91_sys_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);145145146146- set_irq_chip(i, &at91_aic_chip);147147- set_irq_handler(i, handle_level_irq);146146+ irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq);148147 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);149148150149 /* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */
+5-5
arch/arm/mach-bcmring/irq.c
···9393 unsigned int i;9494 for (i = 0; i < 32; i++) {9595 unsigned int irq = irq_start + i;9696- set_irq_chip(irq, chip);9797- set_irq_chip_data(irq, base);9696+ irq_set_chip(irq, chip);9797+ irq_set_chip_data(irq, base);98989999 if (vic_sources & (1 << i)) {100100- set_irq_handler(irq, handle_level_irq);100100+ irq_set_handler(irq, handle_level_irq);101101 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);102102 }103103 }···119119120120 /* special cases */121121 if (INTCHW_INTC1_GPIO0 & IRQ_INTC1_VALID_MASK) {122122- set_irq_handler(IRQ_GPIO0, handle_simple_irq);122122+ irq_set_handler(IRQ_GPIO0, handle_simple_irq);123123 }124124 if (INTCHW_INTC1_GPIO1 & IRQ_INTC1_VALID_MASK) {125125- set_irq_handler(IRQ_GPIO1, handle_simple_irq);125125+ irq_set_handler(IRQ_GPIO1, handle_simple_irq);126126 }127127}
+4-4
arch/arm/mach-clps711x/irq.c
···112112113113 for (i = 0; i < NR_IRQS; i++) {114114 if (INT1_IRQS & (1 << i)) {115115- set_irq_handler(i, handle_level_irq);116116- set_irq_chip(i, &int1_chip);115115+ irq_set_chip_and_handler(i, &int1_chip,116116+ handle_level_irq);117117 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);118118 }119119 if (INT2_IRQS & (1 << i)) {120120- set_irq_handler(i, handle_level_irq);121121- set_irq_chip(i, &int2_chip);120120+ irq_set_chip_and_handler(i, &int2_chip,121121+ handle_level_irq);122122 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);123123 } 124124 }
+2-2
arch/arm/mach-davinci/cp_intc.c
···167167168168 /* Set up genirq dispatching for cp_intc */169169 for (i = 0; i < num_irq; i++) {170170- set_irq_chip(i, &cp_intc_irq_chip);170170+ irq_set_chip(i, &cp_intc_irq_chip);171171 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);172172- set_irq_handler(i, handle_edge_irq);172172+ irq_set_handler(i, handle_edge_irq);173173 }174174175175 /* Enable global interrupt */
+20-29
arch/arm/mach-davinci/gpio.c
···6262{6363 struct davinci_gpio_regs __iomem *g;64646565- g = (__force struct davinci_gpio_regs __iomem *)get_irq_chip_data(irq);6565+ g = (__force struct davinci_gpio_regs __iomem *)irq_get_chip_data(irq);66666767 return g;6868}···208208static void gpio_irq_disable(struct irq_data *d)209209{210210 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);211211- u32 mask = (u32) irq_data_get_irq_data(d);211211+ u32 mask = (u32) irq_data_get_irq_handler_data(d);212212213213 __raw_writel(mask, &g->clr_falling);214214 __raw_writel(mask, &g->clr_rising);···217217static void gpio_irq_enable(struct irq_data *d)218218{219219 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);220220- u32 mask = (u32) irq_data_get_irq_data(d);221221- unsigned status = irq_desc[d->irq].status;220220+ u32 mask = (u32) irq_data_get_irq_handler_data(d);221221+ unsigned status = irqd_get_trigger_type(d);222222223223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;224224 if (!status)···233233static int gpio_irq_type(struct irq_data *d, unsigned trigger)234234{235235 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);236236- u32 mask = (u32) irq_data_get_irq_data(d);236236+ u32 mask = (u32) irq_data_get_irq_handler_data(d);237237238238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))239239 return -EINVAL;240240241241- irq_desc[d->irq].status &= ~IRQ_TYPE_SENSE_MASK;242242- irq_desc[d->irq].status |= trigger;243243-244244- /* don't enable the IRQ if it's currently disabled */245245- if (irq_desc[d->irq].depth == 0) {246246- __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)247247- ? &g->set_falling : &g->clr_falling);248248- __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)249249- ? &g->set_rising : &g->clr_rising);250250- }251241 return 0;252242}253243···246256 .irq_enable = gpio_irq_enable,247257 .irq_disable = gpio_irq_disable,248258 .irq_set_type = gpio_irq_type,259259+ .flags = IRQCHIP_SET_TYPE_MASKED,249260};250261251262static void···276285 status >>= 16;277286278287 /* now demux them to the right lowlevel handler */279279- n = (int)get_irq_data(irq);288288+ n = (int)irq_get_handler_data(irq);280289 while (status) {281290 res = ffs(status);282291 n += res;···314323static int gpio_irq_type_unbanked(struct irq_data *d, unsigned trigger)315324{316325 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);317317- u32 mask = (u32) irq_data_get_irq_data(d);326326+ u32 mask = (u32) irq_data_get_irq_handler_data(d);318327319328 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))320329 return -EINVAL;···386395387396 /* AINTC handles mask/unmask; GPIO handles triggering */388397 irq = bank_irq;389389- gpio_irqchip_unbanked = *get_irq_desc_chip(irq_to_desc(irq));398398+ gpio_irqchip_unbanked = *irq_get_chip(irq);390399 gpio_irqchip_unbanked.name = "GPIO-AINTC";391400 gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked;392401···397406398407 /* set the direct IRQs up to use that irqchip */399408 for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) {400400- set_irq_chip(irq, &gpio_irqchip_unbanked);401401- set_irq_data(irq, (void *) __gpio_mask(gpio));402402- set_irq_chip_data(irq, (__force void *) g);403403- irq_desc[irq].status |= IRQ_TYPE_EDGE_BOTH;409409+ irq_set_chip(irq, &gpio_irqchip_unbanked);410410+ irq_set_handler_data(irq, (void *)__gpio_mask(gpio));411411+ irq_set_chip_data(irq, (__force void *)g);412412+ irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH);404413 }405414406415 goto done;···421430 __raw_writel(~0, &g->clr_rising);422431423432 /* set up all irqs in this bank */424424- set_irq_chained_handler(bank_irq, gpio_irq_handler);425425- set_irq_chip_data(bank_irq, (__force void *) g);426426- set_irq_data(bank_irq, (void *) irq);433433+ irq_set_chained_handler(bank_irq, gpio_irq_handler);434434+ irq_set_chip_data(bank_irq, (__force void *)g);435435+ irq_set_handler_data(bank_irq, (void *)irq);427436428437 for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) {429429- set_irq_chip(irq, &gpio_irqchip);430430- set_irq_chip_data(irq, (__force void *) g);431431- set_irq_data(irq, (void *) __gpio_mask(gpio));432432- set_irq_handler(irq, handle_simple_irq);438438+ irq_set_chip(irq, &gpio_irqchip);439439+ irq_set_chip_data(irq, (__force void *)g);440440+ irq_set_handler_data(irq, (void *)__gpio_mask(gpio));441441+ irq_set_handler(irq, handle_simple_irq);433442 set_irq_flags(irq, IRQF_VALID);434443 }435444
+3-3
arch/arm/mach-davinci/irq.c
···154154155155 /* set up genirq dispatch for ARM INTC */156156 for (i = 0; i < davinci_soc_info.intc_irq_num; i++) {157157- set_irq_chip(i, &davinci_irq_chip_0);157157+ irq_set_chip(i, &davinci_irq_chip_0);158158 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);159159 if (i != IRQ_TINT1_TINT34)160160- set_irq_handler(i, handle_edge_irq);160160+ irq_set_handler(i, handle_edge_irq);161161 else162162- set_irq_handler(i, handle_level_irq);162162+ irq_set_handler(i, handle_level_irq);163163 }164164}
···290290 }291291292292 /* Ok to use the level handler for all types */293293- set_irq_handler(d->irq, handle_level_irq);293293+ irq_set_handler(d->irq, handle_level_irq);294294295295 return 0;296296}···390390391391 /* Configure supported IRQ's */392392 for (i = 0; i < NR_IRQS; i++) {393393- set_irq_chip(i, &lpc32xx_irq_chip);394394- set_irq_handler(i, handle_level_irq);393393+ irq_set_chip_and_handler(i, &lpc32xx_irq_chip,394394+ handle_level_irq);395395 set_irq_flags(i, IRQF_VALID);396396 }397397···406406 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));407407408408 /* MIC SUBIRQx interrupts will route handling to the chain handlers */409409- set_irq_chained_handler(IRQ_LPC32XX_SUB1IRQ, lpc32xx_sic1_handler);410410- set_irq_chained_handler(IRQ_LPC32XX_SUB2IRQ, lpc32xx_sic2_handler);409409+ irq_set_chained_handler(IRQ_LPC32XX_SUB1IRQ, lpc32xx_sic1_handler);410410+ irq_set_chained_handler(IRQ_LPC32XX_SUB2IRQ, lpc32xx_sic2_handler);411411412412 /* Initially disable all wake events */413413 __raw_writel(0, LPC32XX_CLKPWR_P01_ER);
···5353 */5454 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {5555 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)5656- set_irq_handler(i, handle_percpu_irq);5656+ irq_set_handler(i, handle_percpu_irq);5757 }5858}5959
+1-1
arch/arm/mach-msm/board-msm8x60.c
···5656 */5757 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {5858 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)5959- set_irq_handler(i, handle_percpu_irq);5959+ irq_set_handler(i, handle_percpu_irq);6060 }6161}6262
+5-5
arch/arm/mach-msm/board-trout-gpio.c
···214214{215215 int i;216216 for(i = TROUT_INT_START; i <= TROUT_INT_END; i++) {217217- set_irq_chip(i, &trout_gpio_irq_chip);218218- set_irq_handler(i, handle_edge_irq);217217+ irq_set_chip_and_handler(i, &trout_gpio_irq_chip,218218+ handle_edge_irq);219219 set_irq_flags(i, IRQF_VALID);220220 }221221222222 for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++)223223 gpiochip_add(&msm_gpio_banks[i].chip);224224225225- set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);226226- set_irq_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler);227227- set_irq_wake(MSM_GPIO_TO_INT(17), 1);225225+ irq_set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);226226+ irq_set_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler);227227+ irq_set_irq_wake(MSM_GPIO_TO_INT(17), 1);228228229229 return 0;230230}
+1-1
arch/arm/mach-msm/board-trout-mmc.c
···174174 if (IS_ERR(vreg_sdslot))175175 return PTR_ERR(vreg_sdslot);176176177177- set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1);177177+ irq_set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1);178178179179 if (!opt_disable_sdcard)180180 msm_add_sdcc(2, &trout_sdslot_data,
+25-24
arch/arm/mach-msm/gpio-v2.c
···230230 val, val2);231231}232232233233-static void msm_gpio_irq_ack(unsigned int irq)233233+static void msm_gpio_irq_ack(struct irq_data *d)234234{235235- int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, irq);235235+ int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);236236237237 writel(BIT(INTR_STATUS), GPIO_INTR_STATUS(gpio));238238 if (test_bit(gpio, msm_gpio.dual_edge_irqs))239239 msm_gpio_update_dual_edge_pos(gpio);240240}241241242242-static void msm_gpio_irq_mask(unsigned int irq)242242+static void msm_gpio_irq_mask(struct irq_data *d)243243{244244- int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, irq);244244+ int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);245245 unsigned long irq_flags;246246247247 spin_lock_irqsave(&tlmm_lock, irq_flags);···251251 spin_unlock_irqrestore(&tlmm_lock, irq_flags);252252}253253254254-static void msm_gpio_irq_unmask(unsigned int irq)254254+static void msm_gpio_irq_unmask(struct irq_data *d)255255{256256- int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, irq);256256+ int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);257257 unsigned long irq_flags;258258259259 spin_lock_irqsave(&tlmm_lock, irq_flags);···263263 spin_unlock_irqrestore(&tlmm_lock, irq_flags);264264}265265266266-static int msm_gpio_irq_set_type(unsigned int irq, unsigned int flow_type)266266+static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type)267267{268268- int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, irq);268268+ int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);269269 unsigned long irq_flags;270270 uint32_t bits;271271···275275276276 if (flow_type & IRQ_TYPE_EDGE_BOTH) {277277 bits |= BIT(INTR_DECT_CTL);278278- irq_desc[irq].handle_irq = handle_edge_irq;278278+ __irq_set_handler_locked(d->irq, handle_edge_irq);279279 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)280280 __set_bit(gpio, msm_gpio.dual_edge_irqs);281281 else282282 __clear_bit(gpio, msm_gpio.dual_edge_irqs);283283 } else {284284 bits &= ~BIT(INTR_DECT_CTL);285285- irq_desc[irq].handle_irq = handle_level_irq;285285+ __irq_set_handler_locked(d->irq, handle_level_irq);286286 __clear_bit(gpio, msm_gpio.dual_edge_irqs);287287 }288288···309309 */310310static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc)311311{312312+ struct irq_data *data = irq_desc_get_irq_data(desc);312313 unsigned long i;313314314315 for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS);···319318 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip,320319 i));321320 }322322- desc->chip->ack(irq);321321+ data->chip->irq_ack(data);323322}324323325325-static int msm_gpio_irq_set_wake(unsigned int irq, unsigned int on)324324+static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)326325{327327- int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, irq);326326+ int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);328327329328 if (on) {330329 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS))331331- set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 1);330330+ irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 1);332331 set_bit(gpio, msm_gpio.wake_irqs);333332 } else {334333 clear_bit(gpio, msm_gpio.wake_irqs);335334 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS))336336- set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 0);335335+ irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 0);337336 }338337339338 return 0;···341340342341static struct irq_chip msm_gpio_irq_chip = {343342 .name = "msmgpio",344344- .mask = msm_gpio_irq_mask,345345- .unmask = msm_gpio_irq_unmask,346346- .ack = msm_gpio_irq_ack,347347- .set_type = msm_gpio_irq_set_type,348348- .set_wake = msm_gpio_irq_set_wake,343343+ .irq_mask = msm_gpio_irq_mask,344344+ .irq_unmask = msm_gpio_irq_unmask,345345+ .irq_ack = msm_gpio_irq_ack,346346+ .irq_set_type = msm_gpio_irq_set_type,347347+ .irq_set_wake = msm_gpio_irq_set_wake,349348};350349351350static int __devinit msm_gpio_probe(struct platform_device *dev)···362361363362 for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) {364363 irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i);365365- set_irq_chip(irq, &msm_gpio_irq_chip);366366- set_irq_handler(irq, handle_level_irq);364364+ irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,365365+ handle_level_irq);367366 set_irq_flags(irq, IRQF_VALID);368367 }369368370370- set_irq_chained_handler(TLMM_SCSS_SUMMARY_IRQ,369369+ irq_set_chained_handler(TLMM_SCSS_SUMMARY_IRQ,371370 msm_summary_irq_handler);372371 return 0;373372}···379378 if (ret < 0)380379 return ret;381380382382- set_irq_handler(TLMM_SCSS_SUMMARY_IRQ, NULL);381381+ irq_set_handler(TLMM_SCSS_SUMMARY_IRQ, NULL);383382384383 return 0;385384}
···165165 select IMX_HAVE_PLATFORM_IMX_I2C166166 select IMX_HAVE_PLATFORM_IMX_UART167167 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX168168+ select IMX_HAVE_PLATFORM_GPIO_KEYS168169 help169170 Include support for MX53 LOCO platform. This includes specific170171 configurations for the board and its peripherals.
···11+/*22+ * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.33+ */44+55+/*66+ * The code contained herein is licensed under the GNU General Public77+ * License. You may obtain a copy of the GNU General Public License88+ * Version 2 or later at the following locations:99+ *1010+ * http://www.opensource.org/licenses/gpl-license.html1111+ * http://www.gnu.org/copyleft/gpl.html1212+ */1313+#include <linux/platform_device.h>1414+#include <linux/io.h>1515+#include <mach/hardware.h>1616+#include "crm_regs.h"1717+1818+/* set cpu low power mode before WFI instruction. This function is called1919+ * mx5 because it can be used for mx50, mx51, and mx53.*/2020+void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)2121+{2222+ u32 plat_lpc, arm_srpgcr, ccm_clpcr;2323+ u32 empgc0, empgc1;2424+ int stop_mode = 0;2525+2626+ /* always allow platform to issue a deep sleep mode request */2727+ plat_lpc = __raw_readl(MXC_CORTEXA8_PLAT_LPC) &2828+ ~(MXC_CORTEXA8_PLAT_LPC_DSM);2929+ ccm_clpcr = __raw_readl(MXC_CCM_CLPCR) & ~(MXC_CCM_CLPCR_LPM_MASK);3030+ arm_srpgcr = __raw_readl(MXC_SRPG_ARM_SRPGCR) & ~(MXC_SRPGCR_PCR);3131+ empgc0 = __raw_readl(MXC_SRPG_EMPGC0_SRPGCR) & ~(MXC_SRPGCR_PCR);3232+ empgc1 = __raw_readl(MXC_SRPG_EMPGC1_SRPGCR) & ~(MXC_SRPGCR_PCR);3333+3434+ switch (mode) {3535+ case WAIT_CLOCKED:3636+ break;3737+ case WAIT_UNCLOCKED:3838+ ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET;3939+ break;4040+ case WAIT_UNCLOCKED_POWER_OFF:4141+ case STOP_POWER_OFF:4242+ plat_lpc |= MXC_CORTEXA8_PLAT_LPC_DSM4343+ | MXC_CORTEXA8_PLAT_LPC_DBG_DSM;4444+ if (mode == WAIT_UNCLOCKED_POWER_OFF) {4545+ ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET;4646+ ccm_clpcr &= ~MXC_CCM_CLPCR_VSTBY;4747+ ccm_clpcr &= ~MXC_CCM_CLPCR_SBYOS;4848+ stop_mode = 0;4949+ } else {5050+ ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET;5151+ ccm_clpcr |= 0x3 << MXC_CCM_CLPCR_STBY_COUNT_OFFSET;5252+ ccm_clpcr |= MXC_CCM_CLPCR_VSTBY;5353+ ccm_clpcr |= MXC_CCM_CLPCR_SBYOS;5454+ stop_mode = 1;5555+ }5656+ arm_srpgcr |= MXC_SRPGCR_PCR;5757+5858+ if (tzic_enable_wake(1) != 0)5959+ return;6060+ break;6161+ case STOP_POWER_ON:6262+ ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET;6363+ break;6464+ default:6565+ printk(KERN_WARNING "UNKNOWN cpu power mode: %d\n", mode);6666+ return;6767+ }6868+6969+ __raw_writel(plat_lpc, MXC_CORTEXA8_PLAT_LPC);7070+ __raw_writel(ccm_clpcr, MXC_CCM_CLPCR);7171+ __raw_writel(arm_srpgcr, MXC_SRPG_ARM_SRPGCR);7272+7373+ /* Enable NEON SRPG for all but MX50TO1.0. */7474+ if (mx50_revision() != IMX_CHIP_REVISION_1_0)7575+ __raw_writel(arm_srpgcr, MXC_SRPG_NEON_SRPGCR);7676+7777+ if (stop_mode) {7878+ empgc0 |= MXC_SRPGCR_PCR;7979+ empgc1 |= MXC_SRPGCR_PCR;8080+8181+ __raw_writel(empgc0, MXC_SRPG_EMPGC0_SRPGCR);8282+ __raw_writel(empgc1, MXC_SRPG_EMPGC1_SRPGCR);8383+ }8484+}
···276276 return;277277 }278278 /* the CF I/O IRQ is really active-low */279279- set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);279279+ irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);280280}281281282282static void __init osk_init_irq(void)···482482 omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */483483 gpio_request(4, "ts_int");484484 gpio_direction_input(4);485485- set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);485485+ irq_set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);486486487487 spi_register_board_info(mistral_boardinfo,488488 ARRAY_SIZE(mistral_boardinfo));···500500 int irq = gpio_to_irq(OMAP_MPUIO(2));501501502502 gpio_direction_input(OMAP_MPUIO(2));503503- set_irq_type(irq, IRQ_TYPE_EDGE_RISING);503503+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);504504#ifdef CONFIG_PM505505 /* share the IRQ in case someone wants to use the506506 * button for more than wakeup from system sleep.
+4-4
arch/arm/mach-omap1/board-palmz71.c
···256256{257257 if (gpio_get_value(PALMZ71_USBDETECT_GPIO)) {258258 printk(KERN_INFO "PM: Power cable connected\n");259259- set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),260260- IRQ_TYPE_EDGE_FALLING);259259+ irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),260260+ IRQ_TYPE_EDGE_FALLING);261261 } else {262262 printk(KERN_INFO "PM: Power cable disconnected\n");263263- set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),264264- IRQ_TYPE_EDGE_RISING);263263+ irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),264264+ IRQ_TYPE_EDGE_RISING);265265 }266266 return IRQ_HANDLED;267267}
···128128 return 0;129129130130err_req_gpio:131131- while (i > 0)132132- gpio_free(gpios[i--]);131131+ while (--i >= 0)132132+ gpio_free(gpios[i]);133133134134 return err;135135}···194194};195195196196/* this gets called as part of our init. these steps must be done now so197197- * that we can use set_pxa_fb_info */197197+ * that we can use pxa_set_fb_info */198198static void __init am200_presetup_fb(void)199199{200200 int fw;···249249 /* we divide since we told the LCD controller we're 16bpp */250250 am200_fb_info.modes->xres /= 2;251251252252- set_pxa_fb_info(&am200_fb_info);252252+ pxa_set_fb_info(NULL, &am200_fb_info);253253254254}255255
+7-6
arch/arm/mach-pxa/am300epd.c
···125125 if (err) {126126 dev_err(&am300_device->dev, "failed requesting "127127 "gpio %d, err=%d\n", i, err);128128- while (i >= DB0_GPIO_PIN)129129- gpio_free(i--);130130- i = ARRAY_SIZE(gpios) - 1;131131- goto err_req_gpio;128128+ goto err_req_gpio2;132129 }133130 }134131···156159157160 return 0;158161162162+err_req_gpio2:163163+ while (--i >= DB0_GPIO_PIN)164164+ gpio_free(i);165165+ i = ARRAY_SIZE(gpios);159166err_req_gpio:160160- while (i > 0)161161- gpio_free(gpios[i--]);167167+ while (--i >= 0)168168+ gpio_free(gpios[i]);162169163170 return err;164171}
···11/*22 * Common code for Palm LD, T5, TX, Z7233 *44- * Copyright (C) 201055- * Marek Vasut <marek.vasut@gmail.com>44+ * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>65 *76 * This program is free software; you can redistribute it and/or modify87 * it under the terms of the GNU General Public License version 2 as···157158 palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl;158159 }159160160160- set_pxa_fb_info(&palm27x_lcd_screen);161161+ pxa_set_fb_info(NULL, &palm27x_lcd_screen);161162}162163#endif163164
···597597{598598 int ret;599599600600- set_pxa_fb_info(&raumfeld_sharp_lcd_info);600600+ pxa_set_fb_info(NULL, &raumfeld_sharp_lcd_info);601601602602 /* Earlier devices had the backlight regulator controlled603603 * via PWM, later versions use another controller for that */
···29293030 ret = -ENOSYS;31313232- base = get_irq_chip(irq);3232+ base = irq_get_chip(irq);3333 if (base) {3434 chip = container_of(base, struct mxc_irq_chip, base);3535 if (chip->set_priority)···48484949 ret = -ENOSYS;50505151- base = get_irq_chip(irq);5151+ base = irq_get_chip(irq);5252 if (base) {5353 chip = container_of(base, struct mxc_irq_chip, base);5454 if (chip->set_irq_fiq)
···167167 /* all IRQ no FIQ Warning :: No selection */168168169169 for (i = 0; i < MXC_INTERNAL_IRQS; i++) {170170- set_irq_chip(i, &mxc_tzic_chip.base);171171- set_irq_handler(i, handle_level_irq);170170+ irq_set_chip_and_handler(i, &mxc_tzic_chip.base,171171+ handle_level_irq);172172 set_irq_flags(i, IRQF_VALID);173173 }174174
+27-30
arch/arm/plat-nomadik/gpio.c
···5454 u32 rwimsc;5555 u32 fwimsc;5656 u32 slpm;5757+ u32 enabled;5758};58595960static struct nmk_gpio_chip *···319318 struct nmk_gpio_chip *nmk_chip;320319 int pin = PIN_NUM(cfgs[i]);321320322322- nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(pin));321321+ nmk_chip = irq_get_chip_data(NOMADIK_GPIO_TO_IRQ(pin));323322 if (!nmk_chip) {324323 ret = -EINVAL;325324 break;···398397 struct nmk_gpio_chip *nmk_chip;399398 unsigned long flags;400399401401- nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));400400+ nmk_chip = irq_get_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));402401 if (!nmk_chip)403402 return -EINVAL;404403···431430 struct nmk_gpio_chip *nmk_chip;432431 unsigned long flags;433432434434- nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));433433+ nmk_chip = irq_get_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));435434 if (!nmk_chip)436435 return -EINVAL;437436···457456 struct nmk_gpio_chip *nmk_chip;458457 unsigned long flags;459458460460- nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));459459+ nmk_chip = irq_get_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));461460 if (!nmk_chip)462461 return -EINVAL;463462···474473 struct nmk_gpio_chip *nmk_chip;475474 u32 afunc, bfunc, bit;476475477477- nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));476476+ nmk_chip = irq_get_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));478477 if (!nmk_chip)479478 return -EINVAL;480479···542541static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip,543542 int gpio, bool on)544543{545545-#ifdef CONFIG_ARCH_U8500546546- if (cpu_is_u8500v2()) {547547- __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base,548548- on ? NMK_GPIO_SLPM_WAKEUP_ENABLE549549- : NMK_GPIO_SLPM_WAKEUP_DISABLE);550550- }551551-#endif552544 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on);553545}554546···557563 bitmask = nmk_gpio_get_bitmask(gpio);558564 if (!nmk_chip)559565 return -EINVAL;566566+567567+ if (enable)568568+ nmk_chip->enabled |= bitmask;569569+ else570570+ nmk_chip->enabled &= ~bitmask;560571561572 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);562573 spin_lock(&nmk_chip->lock);···589590590591static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)591592{592592- struct irq_desc *desc = irq_to_desc(d->irq);593593- bool enabled = !(desc->status & IRQ_DISABLED);594593 struct nmk_gpio_chip *nmk_chip;595594 unsigned long flags;596595 u32 bitmask;···603606 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);604607 spin_lock(&nmk_chip->lock);605608606606- if (!enabled)609609+ if (!(nmk_chip->enabled & bitmask))607610 __nmk_gpio_set_wake(nmk_chip, gpio, on);608611609612 if (on)···619622620623static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)621624{622622- struct irq_desc *desc = irq_to_desc(d->irq);623623- bool enabled = !(desc->status & IRQ_DISABLED);624624- bool wake = desc->wake_depth;625625+ bool enabled, wake = irqd_is_wakeup_set(d);625626 int gpio;626627 struct nmk_gpio_chip *nmk_chip;627628 unsigned long flags;···635640 return -EINVAL;636641 if (type & IRQ_TYPE_LEVEL_LOW)637642 return -EINVAL;643643+644644+ enabled = nmk_chip->enabled & bitmask;638645639646 spin_lock_irqsave(&nmk_chip->lock, flags);640647···678681 u32 status)679682{680683 struct nmk_gpio_chip *nmk_chip;681681- struct irq_chip *host_chip = get_irq_chip(irq);684684+ struct irq_chip *host_chip = irq_get_chip(irq);682685 unsigned int first_irq;683686684687 if (host_chip->irq_mask_ack)···689692 host_chip->irq_ack(&desc->irq_data);690693 }691694692692- nmk_chip = get_irq_data(irq);695695+ nmk_chip = irq_get_handler_data(irq);693696 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);694697 while (status) {695698 int bit = __ffs(status);···703706704707static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)705708{706706- struct nmk_gpio_chip *nmk_chip = get_irq_data(irq);709709+ struct nmk_gpio_chip *nmk_chip = irq_get_handler_data(irq);707710 u32 status = readl(nmk_chip->addr + NMK_GPIO_IS);708711709712 __nmk_gpio_irq_handler(irq, desc, status);···712715static void nmk_gpio_secondary_irq_handler(unsigned int irq,713716 struct irq_desc *desc)714717{715715- struct nmk_gpio_chip *nmk_chip = get_irq_data(irq);718718+ struct nmk_gpio_chip *nmk_chip = irq_get_handler_data(irq);716719 u32 status = nmk_chip->get_secondary_status(nmk_chip->bank);717720718721 __nmk_gpio_irq_handler(irq, desc, status);···725728726729 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);727730 for (i = first_irq; i < first_irq + nmk_chip->chip.ngpio; i++) {728728- set_irq_chip(i, &nmk_gpio_irq_chip);729729- set_irq_handler(i, handle_edge_irq);731731+ irq_set_chip_and_handler(i, &nmk_gpio_irq_chip,732732+ handle_edge_irq);730733 set_irq_flags(i, IRQF_VALID);731731- set_irq_chip_data(i, nmk_chip);732732- set_irq_type(i, IRQ_TYPE_EDGE_FALLING);734734+ irq_set_chip_data(i, nmk_chip);735735+ irq_set_irq_type(i, IRQ_TYPE_EDGE_FALLING);733736 }734737735735- set_irq_chained_handler(nmk_chip->parent_irq, nmk_gpio_irq_handler);736736- set_irq_data(nmk_chip->parent_irq, nmk_chip);738738+ irq_set_chained_handler(nmk_chip->parent_irq, nmk_gpio_irq_handler);739739+ irq_set_handler_data(nmk_chip->parent_irq, nmk_chip);737740738741 if (nmk_chip->secondary_parent_irq >= 0) {739739- set_irq_chained_handler(nmk_chip->secondary_parent_irq,742742+ irq_set_chained_handler(nmk_chip->secondary_parent_irq,740743 nmk_gpio_secondary_irq_handler);741741- set_irq_data(nmk_chip->secondary_parent_irq, nmk_chip);744744+ irq_set_handler_data(nmk_chip->secondary_parent_irq, nmk_chip);742745 }743746744747 return 0;
···2222void samsung_sync_wakemask(void __iomem *reg,2323 struct samsung_wakeup_mask *mask, int nr_mask)2424{2525- struct irq_desc *desc;2525+ struct irq_data *data;2626 u32 val;27272828 val = __raw_readl(reg);···3333 continue;3434 }35353636- desc = irq_to_desc(mask->irq);3636+ data = irq_get_irq_data(mask->irq);37373838- /* bit of a liberty to read this directly from irq_desc. */3939- if (desc->wake_depth > 0)3838+ /* bit of a liberty to read this directly from irq_data. */3939+ if (irqd_is_wakeup_set(data))4040 val &= ~mask->bit;4141 else4242 val |= mask->bit;
···3535 /* Disable all interrupts initially */3636 for (i = 0; i < NR_REAL_IRQS; i++) {3737 chip->irq_mask(irq_get_irq_data(i));3838- set_irq_chip(i, chip);3939- set_irq_handler(i, handle_level_irq);3838+ irq_set_chip_and_handler(i, chip, handle_level_irq);4039 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);4140 }4241
+6-7
arch/arm/plat-stmp3xxx/pinmux.c
···489489490490static void stmp3xxx_gpio_irq(u32 irq, struct irq_desc *desc)491491{492492- struct stmp3xxx_pinmux_bank *pm = get_irq_data(irq);492492+ struct stmp3xxx_pinmux_bank *pm = irq_get_handler_data(irq);493493 int gpio_irq = pm->virq;494494 u32 stat = __raw_readl(pm->irqstat);495495496496 while (stat) {497497 if (stat & 1)498498- irq_desc[gpio_irq].handle_irq(gpio_irq,499499- &irq_desc[gpio_irq]);498498+ generic_handle_irq(gpio_irq);500499 gpio_irq++;501500 stat >>= 1;502501 }···533534534535 for (virq = pm->virq; virq < pm->virq; virq++) {535536 gpio_irq_chip.irq_mask(irq_get_irq_data(virq));536536- set_irq_chip(virq, &gpio_irq_chip);537537- set_irq_handler(virq, handle_level_irq);537537+ irq_set_chip_and_handler(virq, &gpio_irq_chip,538538+ handle_level_irq);538539 set_irq_flags(virq, IRQF_VALID);539540 }540541 r = gpiochip_add(&pm->chip);541542 if (r < 0)542543 break;543543- set_irq_chained_handler(pm->irq, stmp3xxx_gpio_irq);544544- set_irq_data(pm->irq, pm);544544+ irq_set_chained_handler(pm->irq, stmp3xxx_gpio_irq);545545+ irq_set_handler_data(pm->irq, pm);545546 }546547 return r;547548}
+6-6
arch/arm/plat-versatile/fpga-irq.c
···30303131static void fpga_irq_handle(unsigned int irq, struct irq_desc *desc)3232{3333- struct fpga_irq_data *f = get_irq_desc_data(desc);3333+ struct fpga_irq_data *f = irq_desc_get_handler_data(desc);3434 u32 status = readl(f->base + IRQ_STATUS);35353636 if (status == 0) {···5555 f->chip.irq_unmask = fpga_irq_unmask;56565757 if (parent_irq != -1) {5858- set_irq_data(parent_irq, f);5959- set_irq_chained_handler(parent_irq, fpga_irq_handle);5858+ irq_set_handler_data(parent_irq, f);5959+ irq_set_chained_handler(parent_irq, fpga_irq_handle);6060 }61616262 for (i = 0; i < 32; i++) {6363 if (valid & (1 << i)) {6464 unsigned int irq = f->irq_start + i;65656666- set_irq_chip_data(irq, f);6767- set_irq_chip(irq, &f->chip);6868- set_irq_handler(irq, handle_level_irq);6666+ irq_set_chip_data(irq, f);6767+ irq_set_chip_and_handler(irq, &f->chip,6868+ handle_level_irq);6969 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);7070 }7171 }
-1
arch/avr32/Kconfig
···1010 select GENERIC_IRQ_PROBE1111 select HARDIRQS_SW_RESEND1212 select GENERIC_IRQ_SHOW1313- select GENERIC_HARDIRQS_NO_DEPRECATED1413 help1514 AVR32 is a high-performance 32-bit RISC microprocessor core,1615 designed for cost-sensitive embedded applications, with particular
···3434 select GENERIC_ATOMIC643535 select GENERIC_IRQ_PROBE3636 select IRQ_PER_CPU if SMP3737- select GENERIC_HARDIRQS_NO_DEPRECATED38373938config GENERIC_CSUM4039 def_bool y
-1
arch/blackfin/configs/BF527-AD7160-EVAL_defconfig
···4646# CONFIG_WIRELESS is not set4747CONFIG_BLK_DEV_LOOP=y4848CONFIG_BLK_DEV_RAM=y4949-# CONFIG_MISC_DEVICES is not set5049# CONFIG_INPUT_MOUSEDEV is not set5150CONFIG_INPUT_EVDEV=y5251# CONFIG_INPUT_KEYBOARD is not set
-1
arch/blackfin/configs/BF538-EZKIT_defconfig
···7070CONFIG_MTD_PHYSMAP=m7171CONFIG_MTD_NAND=m7272CONFIG_BLK_DEV_RAM=y7373-# CONFIG_MISC_DEVICES is not set7473CONFIG_NETDEVICES=y7574CONFIG_PHYLIB=y7675CONFIG_SMSC_PHY=y
-1
arch/blackfin/configs/BF561-ACVILON_defconfig
···6363CONFIG_BLK_DEV_RAM=y6464CONFIG_BLK_DEV_RAM_COUNT=26565CONFIG_BLK_DEV_RAM_SIZE=163846666-# CONFIG_MISC_DEVICES is not set6766CONFIG_SCSI=y6867# CONFIG_SCSI_PROC_FS is not set6968CONFIG_BLK_DEV_SD=y
···6464CONFIG_MTD_COMPLEX_MAPPINGS=y6565CONFIG_MTD_GPIO_ADDR=y6666CONFIG_BLK_DEV_RAM=y6767-# CONFIG_MISC_DEVICES is not set6867CONFIG_SCSI=y6968CONFIG_BLK_DEV_SD=y7069# CONFIG_SCSI_LOWLEVEL is not set
-1
arch/blackfin/configs/CM-BF533_defconfig
···4444CONFIG_MTD_CFI_INTELEXT=y4545CONFIG_MTD_RAM=y4646CONFIG_MTD_PHYSMAP=y4747-# CONFIG_MISC_DEVICES is not set4847CONFIG_NETDEVICES=y4948# CONFIG_NETDEV_1000 is not set5049# CONFIG_NETDEV_10000 is not set
-1
arch/blackfin/configs/CM-BF548_defconfig
···6363CONFIG_MTD_COMPLEX_MAPPINGS=y6464CONFIG_MTD_PHYSMAP=y6565CONFIG_BLK_DEV_RAM=y6666-# CONFIG_MISC_DEVICES is not set6766CONFIG_SCSI=m6867CONFIG_BLK_DEV_SD=m6968# CONFIG_SCSI_LOWLEVEL is not set
-1
arch/blackfin/configs/DNP5370_defconfig
···5555CONFIG_MTD_NAND_PLATFORM=y5656CONFIG_BLK_DEV_LOOP=y5757CONFIG_BLK_DEV_RAM=y5858-# CONFIG_MISC_DEVICES is not set5958CONFIG_NETDEVICES=y6059CONFIG_DAVICOM_PHY=y6160CONFIG_NET_ETHERNET=y
+1
arch/blackfin/configs/H8606_defconfig
···4545CONFIG_MTD_M25P80=y4646# CONFIG_M25PXX_USE_FAST_READ is not set4747CONFIG_BLK_DEV_RAM=y4848+CONFIG_MISC_DEVICES=y4849CONFIG_EEPROM_AT25=y4950CONFIG_NETDEVICES=y5051CONFIG_NET_ETHERNET=y
+1
arch/blackfin/configs/SRV1_defconfig
···4848CONFIG_MTD_UCLINUX=y4949CONFIG_MTD_NAND=m5050CONFIG_BLK_DEV_RAM=y5151+CONFIG_MISC_DEVICES=y5152CONFIG_EEPROM_AT25=m5253CONFIG_NETDEVICES=y5354# CONFIG_NETDEV_1000 is not set
+3-1
arch/blackfin/include/asm/bitops.h
···2525#include <asm-generic/bitops/const_hweight.h>2626#include <asm-generic/bitops/lock.h>27272828-#include <asm-generic/bitops/le.h>2928#include <asm-generic/bitops/ext2-atomic.h>30293130#ifndef CONFIG_SMP···111112#undef test_bit112113113114#endif /* CONFIG_SMP */115115+116116+/* Needs to be after test_bit and friends */117117+#include <asm-generic/bitops/le.h>114118115119/*116120 * hweightN: returns the hamming weight (i.e. the number
···44 * Licensed under the GPL-2 or later55 */6677-#define pr_fmt(fmt) "module %s: " fmt77+#define pr_fmt(fmt) "module %s: " fmt, mod->name8899#include <linux/moduleloader.h>1010#include <linux/elf.h>···5757 dest = l1_inst_sram_alloc(s->sh_size);5858 mod->arch.text_l1 = dest;5959 if (dest == NULL) {6060- pr_err("L1 inst memory allocation failed\n",6161- mod->name);6060+ pr_err("L1 inst memory allocation failed\n");6261 return -1;6362 }6463 dma_memcpy(dest, (void *)s->sh_addr, s->sh_size);···6970 dest = l1_data_sram_alloc(s->sh_size);7071 mod->arch.data_a_l1 = dest;7172 if (dest == NULL) {7272- pr_err("L1 data memory allocation failed\n",7373- mod->name);7373+ pr_err("L1 data memory allocation failed\n");7474 return -1;7575 }7676 memcpy(dest, (void *)s->sh_addr, s->sh_size);···8183 dest = l1_data_sram_zalloc(s->sh_size);8284 mod->arch.bss_a_l1 = dest;8385 if (dest == NULL) {8484- pr_err("L1 data memory allocation failed\n",8585- mod->name);8686+ pr_err("L1 data memory allocation failed\n");8687 return -1;8788 }8889···9093 dest = l1_data_B_sram_alloc(s->sh_size);9194 mod->arch.data_b_l1 = dest;9295 if (dest == NULL) {9393- pr_err("L1 data memory allocation failed\n",9494- mod->name);9696+ pr_err("L1 data memory allocation failed\n");9597 return -1;9698 }9799 memcpy(dest, (void *)s->sh_addr, s->sh_size);···100104 dest = l1_data_B_sram_alloc(s->sh_size);101105 mod->arch.bss_b_l1 = dest;102106 if (dest == NULL) {103103- pr_err("L1 data memory allocation failed\n",104104- mod->name);107107+ pr_err("L1 data memory allocation failed\n");105108 return -1;106109 }107110 memset(dest, 0, s->sh_size);···112117 dest = l2_sram_alloc(s->sh_size);113118 mod->arch.text_l2 = dest;114119 if (dest == NULL) {115115- pr_err("L2 SRAM allocation failed\n",116116- mod->name);120120+ pr_err("L2 SRAM allocation failed\n");117121 return -1;118122 }119123 memcpy(dest, (void *)s->sh_addr, s->sh_size);···124130 dest = l2_sram_alloc(s->sh_size);125131 mod->arch.data_l2 = dest;126132 if (dest == NULL) {127127- pr_err("L2 SRAM allocation failed\n",128128- mod->name);133133+ pr_err("L2 SRAM allocation failed\n");129134 return -1;130135 }131136 memcpy(dest, (void *)s->sh_addr, s->sh_size);···136143 dest = l2_sram_zalloc(s->sh_size);137144 mod->arch.bss_l2 = dest;138145 if (dest == NULL) {139139- pr_err("L2 SRAM allocation failed\n",140140- mod->name);146146+ pr_err("L2 SRAM allocation failed\n");141147 return -1;142148 }143149···152160153161int154162apply_relocate(Elf_Shdr * sechdrs, const char *strtab,155155- unsigned int symindex, unsigned int relsec, struct module *me)163163+ unsigned int symindex, unsigned int relsec, struct module *mod)156164{157157- pr_err(".rel unsupported\n", me->name);165165+ pr_err(".rel unsupported\n");158166 return -ENOEXEC;159167}160168···178186 Elf32_Sym *sym;179187 unsigned long location, value, size;180188181181- pr_debug("applying relocate section %u to %u\n", mod->name,189189+ pr_debug("applying relocate section %u to %u\n",182190 relsec, sechdrs[relsec].sh_info);183191184192 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {···195203196204#ifdef CONFIG_SMP197205 if (location >= COREB_L1_DATA_A_START) {198198- pr_err("cannot relocate in L1: %u (SMP kernel)",199199- mod->name, ELF32_R_TYPE(rel[i].r_info));206206+ pr_err("cannot relocate in L1: %u (SMP kernel)\n",207207+ ELF32_R_TYPE(rel[i].r_info));200208 return -ENOEXEC;201209 }202210#endif203211204212 pr_debug("location is %lx, value is %lx type is %d\n",205205- mod->name, location, value, ELF32_R_TYPE(rel[i].r_info));213213+ location, value, ELF32_R_TYPE(rel[i].r_info));206214207215 switch (ELF32_R_TYPE(rel[i].r_info)) {208216···222230 case R_BFIN_PCREL12_JUMP_S:223231 case R_BFIN_PCREL10:224232 pr_err("unsupported relocation: %u (no -mlong-calls?)\n",225225- mod->name, ELF32_R_TYPE(rel[i].r_info));233233+ ELF32_R_TYPE(rel[i].r_info));226234 return -ENOEXEC;227235228236 default:229229- pr_err("unknown relocation: %u\n", mod->name,237237+ pr_err("unknown relocation: %u\n",230238 ELF32_R_TYPE(rel[i].r_info));231239 return -ENOEXEC;232240 }···243251 isram_memcpy((void *)location, &value, size);244252 break;245253 default:246246- pr_err("invalid relocation for %#lx\n",247247- mod->name, location);254254+ pr_err("invalid relocation for %#lx\n", location);248255 return -ENOEXEC;249256 }250257 }
+4-3
arch/blackfin/kernel/trace.c
···912912 /* if no interrupts are going off, don't print this out */913913 if (fp->ipend & ~0x3F) {914914 for (i = 0; i < (NR_IRQS - 1); i++) {915915+ struct irq_desc *desc = irq_to_desc(i);915916 if (!in_atomic)916916- raw_spin_lock_irqsave(&irq_desc[i].lock, flags);917917+ raw_spin_lock_irqsave(&desc->lock, flags);917918918918- action = irq_desc[i].action;919919+ action = desc->action;919920 if (!action)920921 goto unlock;921922···929928 pr_cont("\n");930929unlock:931930 if (!in_atomic)932932- raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);931931+ raw_spin_unlock_irqrestore(&desc->lock, flags);933932 }934933 }935934
+3-3
arch/blackfin/mach-bf561/smp.c
···154154void __cpuinit bfin_local_timer_setup(void)155155{156156#if defined(CONFIG_TICKSOURCE_CORETMR)157157- struct irq_chip *chip = get_irq_chip(IRQ_CORETMR);158158- struct irq_desc *desc = irq_to_desc(IRQ_CORETMR);157157+ struct irq_data *data = irq_get_irq_data(IRQ_CORETMR);158158+ struct irq_chip *chip = irq_data_get_irq_chip(data);159159160160 bfin_coretmr_init();161161 bfin_coretmr_clockevent_init();162162163163- chip->irq_unmask(&desc->irq_data);163163+ chip->irq_unmask(data);164164#else165165 /* Power down the core timer, just to play safe. */166166 bfin_write_TCNTL(0);
···2626 select GENERIC_IRQ_PROBE2727 select GENERIC_PENDING_IRQ if SMP2828 select IRQ_PER_CPU2929+ select GENERIC_IRQ_SHOW2930 default y3031 help3132 The Itanium Processor Family is Intel's 64-bit successor to
···677677int migrate_platform_irqs(unsigned int cpu)678678{679679 int new_cpei_cpu;680680- struct irq_desc *desc = NULL;680680+ struct irq_data *data = NULL;681681 const struct cpumask *mask;682682 int retval = 0;683683···693693 new_cpei_cpu = any_online_cpu(cpu_online_map);694694 mask = cpumask_of(new_cpei_cpu);695695 set_cpei_target_cpu(new_cpei_cpu);696696- desc = irq_desc + ia64_cpe_irq;696696+ data = irq_get_irq_data(ia64_cpe_irq);697697 /*698698 * Switch for now, immediately, we need to do fake intr699699 * as other interrupts, but need to study CPEI behaviour with700700 * polling before making changes.701701 */702702- if (desc) {703703- desc->chip->disable(ia64_cpe_irq);704704- desc->chip->set_affinity(ia64_cpe_irq, mask);705705- desc->chip->enable(ia64_cpe_irq);702702+ if (data && data->chip) {703703+ data->chip->irq_disable(data);704704+ data->chip->irq_set_affinity(data, mask, false);705705+ data->chip->irq_enable(data);706706 printk ("Re-targetting CPEI to cpu %d\n", new_cpei_cpu);707707 }708708 }709709- if (!desc) {709709+ if (!data) {710710 printk ("Unable to retarget CPEI, offline cpu [%d] failed\n", cpu);711711 retval = -EBUSY;712712 }
+28-69
arch/ia64/sn/kernel/irq.c
···2323#include <asm/sn/sn_sal.h>2424#include <asm/sn/sn_feature_sets.h>25252626-static void force_interrupt(int irq);2726static void register_intr_pda(struct sn_irq_info *sn_irq_info);2827static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);29283030-int sn_force_interrupt_flag = 1;3129extern int sn_ioif_inited;3230struct list_head **sn_irq_lh;3331static DEFINE_SPINLOCK(sn_irq_info_lock); /* non-IRQ lock */···7678 return ret_stuff.status;7779}78807979-static unsigned int sn_startup_irq(unsigned int irq)8181+static unsigned int sn_startup_irq(struct irq_data *data)8082{8183 return 0;8284}83858484-static void sn_shutdown_irq(unsigned int irq)8686+static void sn_shutdown_irq(struct irq_data *data)8587{8688}87898890extern void ia64_mca_register_cpev(int);89919090-static void sn_disable_irq(unsigned int irq)9292+static void sn_disable_irq(struct irq_data *data)9193{9292- if (irq == local_vector_to_irq(IA64_CPE_VECTOR))9494+ if (data->irq == local_vector_to_irq(IA64_CPE_VECTOR))9395 ia64_mca_register_cpev(0);9496}95979696-static void sn_enable_irq(unsigned int irq)9898+static void sn_enable_irq(struct irq_data *data)9799{9898- if (irq == local_vector_to_irq(IA64_CPE_VECTOR))9999- ia64_mca_register_cpev(irq);100100+ if (data->irq == local_vector_to_irq(IA64_CPE_VECTOR))101101+ ia64_mca_register_cpev(data->irq);100102}101103102102-static void sn_ack_irq(unsigned int irq)104104+static void sn_ack_irq(struct irq_data *data)103105{104106 u64 event_occurred, mask;107107+ unsigned int irq = data->irq & 0xff;105108106106- irq = irq & 0xff;107109 event_occurred = HUB_L((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED));108110 mask = event_occurred & SH_ALL_INT_MASK;109111 HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), mask);110112 __set_bit(irq, (volatile void *)pda->sn_in_service_ivecs);111113112112- move_native_irq(irq);113113-}114114-115115-static void sn_end_irq(unsigned int irq)116116-{117117- int ivec;118118- u64 event_occurred;119119-120120- ivec = irq & 0xff;121121- if (ivec == SGI_UART_VECTOR) {122122- event_occurred = HUB_L((u64*)LOCAL_MMR_ADDR (SH_EVENT_OCCURRED));123123- /* If the UART bit is set here, we may have received an124124- * interrupt from the UART that the driver missed. To125125- * make sure, we IPI ourselves to force us to look again.126126- */127127- if (event_occurred & SH_EVENT_OCCURRED_UART_INT_MASK) {128128- platform_send_ipi(smp_processor_id(), SGI_UART_VECTOR,129129- IA64_IPI_DM_INT, 0);130130- }131131- }132132- __clear_bit(ivec, (volatile void *)pda->sn_in_service_ivecs);133133- if (sn_force_interrupt_flag)134134- force_interrupt(irq);114114+ irq_move_irq(data);135115}136116137117static void sn_irq_info_free(struct rcu_head *head);···204228 return new_irq_info;205229}206230207207-static int sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)231231+static int sn_set_affinity_irq(struct irq_data *data,232232+ const struct cpumask *mask, bool force)208233{209234 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;235235+ unsigned int irq = data->irq;210236 nasid_t nasid;211237 int slice;212238···237259#endif238260239261static void240240-sn_mask_irq(unsigned int irq)262262+sn_mask_irq(struct irq_data *data)241263{242264}243265244266static void245245-sn_unmask_irq(unsigned int irq)267267+sn_unmask_irq(struct irq_data *data)246268{247269}248270249271struct irq_chip irq_type_sn = {250250- .name = "SN hub",251251- .startup = sn_startup_irq,252252- .shutdown = sn_shutdown_irq,253253- .enable = sn_enable_irq,254254- .disable = sn_disable_irq,255255- .ack = sn_ack_irq,256256- .end = sn_end_irq,257257- .mask = sn_mask_irq,258258- .unmask = sn_unmask_irq,259259- .set_affinity = sn_set_affinity_irq272272+ .name = "SN hub",273273+ .irq_startup = sn_startup_irq,274274+ .irq_shutdown = sn_shutdown_irq,275275+ .irq_enable = sn_enable_irq,276276+ .irq_disable = sn_disable_irq,277277+ .irq_ack = sn_ack_irq,278278+ .irq_mask = sn_mask_irq,279279+ .irq_unmask = sn_unmask_irq,280280+ .irq_set_affinity = sn_set_affinity_irq260281};261282262283ia64_vector sn_irq_to_vector(int irq)···273296void sn_irq_init(void)274297{275298 int i;276276- struct irq_desc *base_desc = irq_desc;277299278300 ia64_first_device_vector = IA64_SN2_FIRST_DEVICE_VECTOR;279301 ia64_last_device_vector = IA64_SN2_LAST_DEVICE_VECTOR;280302281303 for (i = 0; i < NR_IRQS; i++) {282282- if (base_desc[i].chip == &no_irq_chip) {283283- base_desc[i].chip = &irq_type_sn;284284- }304304+ if (irq_get_chip(i) == &no_irq_chip)305305+ irq_set_chip(i, &irq_type_sn);285306 }286307}287308···353378 int cpu = nasid_slice_to_cpuid(nasid, slice);354379#ifdef CONFIG_SMP355380 int cpuphys;356356- struct irq_desc *desc;357381#endif358382359383 pci_dev_get(pci_dev);···369395#ifdef CONFIG_SMP370396 cpuphys = cpu_physical_id(cpu);371397 set_irq_affinity_info(sn_irq_info->irq_irq, cpuphys, 0);372372- desc = irq_to_desc(sn_irq_info->irq_irq);373398 /*374399 * Affinity was set by the PROM, prevent it from375400 * being reset by the request_irq() path.376401 */377377- desc->status |= IRQ_AFFINITY_SET;402402+ irqd_mark_affinity_was_set(irq_get_irq_data(sn_irq_info->irq_irq));378403#endif379404}380405···412439 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type];413440414441 /* Don't force an interrupt if the irq has been disabled */415415- if (!(irq_desc[sn_irq_info->irq_irq].status & IRQ_DISABLED) &&442442+ if (!irqd_irq_disabled(sn_irq_info->irq_irq) &&416443 pci_provider && pci_provider->force_interrupt)417444 (*pci_provider->force_interrupt)(sn_irq_info);418418-}419419-420420-static void force_interrupt(int irq)421421-{422422- struct sn_irq_info *sn_irq_info;423423-424424- if (!sn_ioif_inited)425425- return;426426-427427- rcu_read_lock();428428- list_for_each_entry_rcu(sn_irq_info, sn_irq_lh[irq], list)429429- sn_call_force_intr_provider(sn_irq_info);430430-431431- rcu_read_unlock();432445}433446434447/*
···138138__xen_register_percpu_irq(unsigned int cpu, unsigned int vec,139139 struct irqaction *action, int save)140140{141141- struct irq_desc *desc;142141 int irq = 0;143142144143 if (xen_slab_ready) {···222223 * mark the interrupt for migrations and trigger it223224 * on cpu hotplug.224225 */225225- desc = irq_desc + irq;226226- desc->status |= IRQ_PER_CPU;226226+ irq_set_status_flags(irq, IRQ_PER_CPU);227227 }228228 }229229
···55 select HAVE_AOUT if MMU66 select GENERIC_ATOMIC64 if MMU77 select HAVE_GENERIC_HARDIRQS if !MMU88- select GENERIC_HARDIRQS_NO_DEPRECATED if !MMU98109config RWSEM_GENERIC_SPINLOCK1110 bool
+1-1
arch/m68k/kernel/irq.c
···4444 if (ap) {4545 seq_printf(p, "%3d: ", irq);4646 seq_printf(p, "%10u ", kstat_irqs(irq));4747- seq_printf(p, "%14s ", get_irq_desc_chip(desc)->name);4747+ seq_printf(p, "%14s ", irq_desc_get_chip(desc)->name);48484949 seq_printf(p, "%s", ap->name);5050 for (ap = ap->next; ap; ap = ap->next)
···119119 for (i = 0; i < 40; i++) {120120 writel(i, REG(CHNL_OFFSET(i)));121121 /* Primary IRQ's */122122- set_irq_chip_and_handler(base + i, &ar7_irq_type,122122+ irq_set_chip_and_handler(base + i, &ar7_irq_type,123123 handle_level_irq);124124 /* Secondary IRQ's */125125 if (i < 32)126126- set_irq_chip_and_handler(base + i + 40,126126+ irq_set_chip_and_handler(base + i + 40,127127 &ar7_sec_irq_type,128128 handle_level_irq);129129 }
+2-2
arch/mips/ath79/irq.c
···124124125125 for (i = ATH79_MISC_IRQ_BASE;126126 i < ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT; i++) {127127- set_irq_chip_and_handler(i, &ath79_misc_irq_chip,127127+ irq_set_chip_and_handler(i, &ath79_misc_irq_chip,128128 handle_level_irq);129129 }130130131131- set_irq_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler);131131+ irq_set_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler);132132}133133134134asmlinkage void plat_irq_dispatch(void)
+2-2
arch/mips/bcm63xx/irq.c
···230230231231 mips_cpu_irq_init();232232 for (i = IRQ_INTERNAL_BASE; i < NR_IRQS; ++i)233233- set_irq_chip_and_handler(i, &bcm63xx_internal_irq_chip,233233+ irq_set_chip_and_handler(i, &bcm63xx_internal_irq_chip,234234 handle_level_irq);235235236236 for (i = IRQ_EXT_BASE; i < IRQ_EXT_BASE + 4; ++i)237237- set_irq_chip_and_handler(i, &bcm63xx_external_irq_chip,237237+ irq_set_chip_and_handler(i, &bcm63xx_external_irq_chip,238238 handle_edge_irq);239239240240 setup_irq(IRQ_MIPS_BASE + 2, &cpu_ip2_cascade_action);
+852-681
arch/mips/cavium-octeon/octeon-irq.c
···33 * License. See the file "COPYING" in the main directory of this archive44 * for more details.55 *66- * Copyright (C) 2004-2008, 2009, 2010 Cavium Networks66+ * Copyright (C) 2004-2008, 2009, 2010, 2011 Cavium Networks77 */88-#include <linux/irq.h>88+99#include <linux/interrupt.h>1010+#include <linux/bitops.h>1111+#include <linux/percpu.h>1212+#include <linux/irq.h>1013#include <linux/smp.h>11141215#include <asm/octeon/octeon.h>13161417static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock);1518static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock);1919+2020+static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu0_en_mirror);2121+static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu1_en_mirror);2222+2323+static __read_mostly u8 octeon_irq_ciu_to_irq[8][64];2424+2525+union octeon_ciu_chip_data {2626+ void *p;2727+ unsigned long l;2828+ struct {2929+ unsigned int line:6;3030+ unsigned int bit:6;3131+ } s;3232+};3333+3434+struct octeon_core_chip_data {3535+ struct mutex core_irq_mutex;3636+ bool current_en;3737+ bool desired_en;3838+ u8 bit;3939+};4040+4141+#define MIPS_CORE_IRQ_LINES 84242+4343+static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES];4444+4545+static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit,4646+ struct irq_chip *chip,4747+ irq_flow_handler_t handler)4848+{4949+ union octeon_ciu_chip_data cd;5050+5151+ irq_set_chip_and_handler(irq, chip, handler);5252+5353+ cd.l = 0;5454+ cd.s.line = line;5555+ cd.s.bit = bit;5656+5757+ irq_set_chip_data(irq, cd.p);5858+ octeon_irq_ciu_to_irq[line][bit] = irq;5959+}16601761static int octeon_coreid_for_cpu(int cpu)1862{···6723#endif6824}69257070-static void octeon_irq_core_ack(unsigned int irq)2626+static int octeon_cpu_for_coreid(int coreid)7127{7272- unsigned int bit = irq - OCTEON_IRQ_SW0;2828+#ifdef CONFIG_SMP2929+ return cpu_number_map(coreid);3030+#else3131+ return smp_processor_id();3232+#endif3333+}3434+3535+static void octeon_irq_core_ack(struct irq_data *data)3636+{3737+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);3838+ unsigned int bit = cd->bit;3939+7340 /*7441 * We don't need to disable IRQs to make these atomic since7542 * they are already disabled earlier in the low level···9237 clear_c0_cause(0x100 << bit);9338}94399595-static void octeon_irq_core_eoi(unsigned int irq)4040+static void octeon_irq_core_eoi(struct irq_data *data)9641{9797- struct irq_desc *desc = irq_to_desc(irq);9898- unsigned int bit = irq - OCTEON_IRQ_SW0;9999- /*100100- * If an IRQ is being processed while we are disabling it the101101- * handler will attempt to unmask the interrupt after it has102102- * been disabled.103103- */104104- if ((unlikely(desc->status & IRQ_DISABLED)))105105- return;4242+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);4343+10644 /*10745 * We don't need to disable IRQs to make these atomic since10846 * they are already disabled earlier in the low level10947 * interrupt code.11048 */111111- set_c0_status(0x100 << bit);4949+ set_c0_status(0x100 << cd->bit);11250}11351114114-static void octeon_irq_core_enable(unsigned int irq)5252+static void octeon_irq_core_set_enable_local(void *arg)11553{116116- unsigned long flags;117117- unsigned int bit = irq - OCTEON_IRQ_SW0;5454+ struct irq_data *data = arg;5555+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);5656+ unsigned int mask = 0x100 << cd->bit;1185711958 /*120120- * We need to disable interrupts to make sure our updates are121121- * atomic.5959+ * Interrupts are already disabled, so these are atomic.12260 */123123- local_irq_save(flags);124124- set_c0_status(0x100 << bit);125125- local_irq_restore(flags);6161+ if (cd->desired_en)6262+ set_c0_status(mask);6363+ else6464+ clear_c0_status(mask);6565+12666}12767128128-static void octeon_irq_core_disable_local(unsigned int irq)6868+static void octeon_irq_core_disable(struct irq_data *data)12969{130130- unsigned long flags;131131- unsigned int bit = irq - OCTEON_IRQ_SW0;132132- /*133133- * We need to disable interrupts to make sure our updates are134134- * atomic.135135- */136136- local_irq_save(flags);137137- clear_c0_status(0x100 << bit);138138- local_irq_restore(flags);7070+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);7171+ cd->desired_en = false;13972}14073141141-static void octeon_irq_core_disable(unsigned int irq)7474+static void octeon_irq_core_enable(struct irq_data *data)14275{143143-#ifdef CONFIG_SMP144144- on_each_cpu((void (*)(void *)) octeon_irq_core_disable_local,145145- (void *) (long) irq, 1);146146-#else147147- octeon_irq_core_disable_local(irq);148148-#endif7676+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);7777+ cd->desired_en = true;7878+}7979+8080+static void octeon_irq_core_bus_lock(struct irq_data *data)8181+{8282+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);8383+8484+ mutex_lock(&cd->core_irq_mutex);8585+}8686+8787+static void octeon_irq_core_bus_sync_unlock(struct irq_data *data)8888+{8989+ struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);9090+9191+ if (cd->desired_en != cd->current_en) {9292+ on_each_cpu(octeon_irq_core_set_enable_local, data, 1);9393+9494+ cd->current_en = cd->desired_en;9595+ }9696+9797+ mutex_unlock(&cd->core_irq_mutex);14998}15099151100static struct irq_chip octeon_irq_chip_core = {152101 .name = "Core",153153- .enable = octeon_irq_core_enable,154154- .disable = octeon_irq_core_disable,155155- .ack = octeon_irq_core_ack,156156- .eoi = octeon_irq_core_eoi,102102+ .irq_enable = octeon_irq_core_enable,103103+ .irq_disable = octeon_irq_core_disable,104104+ .irq_ack = octeon_irq_core_ack,105105+ .irq_eoi = octeon_irq_core_eoi,106106+ .irq_bus_lock = octeon_irq_core_bus_lock,107107+ .irq_bus_sync_unlock = octeon_irq_core_bus_sync_unlock,108108+109109+ .irq_cpu_online = octeon_irq_core_eoi,110110+ .irq_cpu_offline = octeon_irq_core_ack,111111+ .flags = IRQCHIP_ONOFFLINE_ENABLED,157112};158113159159-160160-static void octeon_irq_ciu0_ack(unsigned int irq)114114+static void __init octeon_irq_init_core(void)161115{162162- switch (irq) {163163- case OCTEON_IRQ_GMX_DRP0:164164- case OCTEON_IRQ_GMX_DRP1:165165- case OCTEON_IRQ_IPD_DRP:166166- case OCTEON_IRQ_KEY_ZERO:167167- case OCTEON_IRQ_TIMER0:168168- case OCTEON_IRQ_TIMER1:169169- case OCTEON_IRQ_TIMER2:170170- case OCTEON_IRQ_TIMER3:171171- {172172- int index = cvmx_get_core_num() * 2;173173- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);174174- /*175175- * CIU timer type interrupts must be acknoleged by176176- * writing a '1' bit to their sum0 bit.177177- */178178- cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);179179- break;180180- }181181- default:182182- break;183183- }116116+ int i;117117+ int irq;118118+ struct octeon_core_chip_data *cd;184119185185- /*186186- * In order to avoid any locking accessing the CIU, we187187- * acknowledge CIU interrupts by disabling all of them. This188188- * way we can use a per core register and avoid any out of189189- * core locking requirements. This has the side affect that190190- * CIU interrupts can't be processed recursively.191191- *192192- * We don't need to disable IRQs to make these atomic since193193- * they are already disabled earlier in the low level194194- * interrupt code.195195- */196196- clear_c0_status(0x100 << 2);120120+ for (i = 0; i < MIPS_CORE_IRQ_LINES; i++) {121121+ cd = &octeon_irq_core_chip_data[i];122122+ cd->current_en = false;123123+ cd->desired_en = false;124124+ cd->bit = i;125125+ mutex_init(&cd->core_irq_mutex);126126+127127+ irq = OCTEON_IRQ_SW0 + i;128128+ switch (irq) {129129+ case OCTEON_IRQ_TIMER:130130+ case OCTEON_IRQ_SW0:131131+ case OCTEON_IRQ_SW1:132132+ case OCTEON_IRQ_5:133133+ case OCTEON_IRQ_PERF:134134+ irq_set_chip_data(irq, cd);135135+ irq_set_chip_and_handler(irq, &octeon_irq_chip_core,136136+ handle_percpu_irq);137137+ break;138138+ default:139139+ break;140140+ }141141+ }197142}198143199199-static void octeon_irq_ciu0_eoi(unsigned int irq)200200-{201201- /*202202- * Enable all CIU interrupts again. We don't need to disable203203- * IRQs to make these atomic since they are already disabled204204- * earlier in the low level interrupt code.205205- */206206- set_c0_status(0x100 << 2);207207-}208208-209209-static int next_coreid_for_irq(struct irq_desc *desc)144144+static int next_cpu_for_irq(struct irq_data *data)210145{211146212147#ifdef CONFIG_SMP213213- int coreid;214214- int weight = cpumask_weight(desc->affinity);148148+ int cpu;149149+ int weight = cpumask_weight(data->affinity);215150216151 if (weight > 1) {217217- int cpu = smp_processor_id();152152+ cpu = smp_processor_id();218153 for (;;) {219219- cpu = cpumask_next(cpu, desc->affinity);154154+ cpu = cpumask_next(cpu, data->affinity);220155 if (cpu >= nr_cpu_ids) {221156 cpu = -1;222157 continue;···214169 break;215170 }216171 }217217- coreid = octeon_coreid_for_cpu(cpu);218172 } else if (weight == 1) {219219- coreid = octeon_coreid_for_cpu(cpumask_first(desc->affinity));173173+ cpu = cpumask_first(data->affinity);220174 } else {221221- coreid = cvmx_get_core_num();175175+ cpu = smp_processor_id();222176 }223223- return coreid;177177+ return cpu;224178#else225225- return cvmx_get_core_num();179179+ return smp_processor_id();226180#endif227181}228182229229-static void octeon_irq_ciu0_enable(unsigned int irq)183183+static void octeon_irq_ciu_enable(struct irq_data *data)230184{231231- struct irq_desc *desc = irq_to_desc(irq);232232- int coreid = next_coreid_for_irq(desc);185185+ int cpu = next_cpu_for_irq(data);186186+ int coreid = octeon_coreid_for_cpu(cpu);187187+ unsigned long *pen;233188 unsigned long flags;234234- uint64_t en0;235235- int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */189189+ union octeon_ciu_chip_data cd;236190237237- raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);238238- en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));239239- en0 |= 1ull << bit;240240- cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);241241- cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));242242- raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);243243-}191191+ cd.p = irq_data_get_irq_chip_data(data);244192245245-static void octeon_irq_ciu0_enable_mbox(unsigned int irq)246246-{247247- int coreid = cvmx_get_core_num();248248- unsigned long flags;249249- uint64_t en0;250250- int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */251251-252252- raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);253253- en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));254254- en0 |= 1ull << bit;255255- cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);256256- cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));257257- raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);258258-}259259-260260-static void octeon_irq_ciu0_disable(unsigned int irq)261261-{262262- int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */263263- unsigned long flags;264264- uint64_t en0;265265- int cpu;266266- raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);267267- for_each_online_cpu(cpu) {268268- int coreid = octeon_coreid_for_cpu(cpu);269269- en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));270270- en0 &= ~(1ull << bit);271271- cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);193193+ if (cd.s.line == 0) {194194+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);195195+ pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);196196+ set_bit(cd.s.bit, pen);197197+ cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);198198+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);199199+ } else {200200+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);201201+ pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);202202+ set_bit(cd.s.bit, pen);203203+ cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);204204+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);272205 }273273- /*274274- * We need to do a read after the last update to make sure all275275- * of them are done.276276- */277277- cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));278278- raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);206206+}207207+208208+static void octeon_irq_ciu_enable_local(struct irq_data *data)209209+{210210+ unsigned long *pen;211211+ unsigned long flags;212212+ union octeon_ciu_chip_data cd;213213+214214+ cd.p = irq_data_get_irq_chip_data(data);215215+216216+ if (cd.s.line == 0) {217217+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);218218+ pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror);219219+ set_bit(cd.s.bit, pen);220220+ cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen);221221+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);222222+ } else {223223+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);224224+ pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror);225225+ set_bit(cd.s.bit, pen);226226+ cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen);227227+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);228228+ }229229+}230230+231231+static void octeon_irq_ciu_disable_local(struct irq_data *data)232232+{233233+ unsigned long *pen;234234+ unsigned long flags;235235+ union octeon_ciu_chip_data cd;236236+237237+ cd.p = irq_data_get_irq_chip_data(data);238238+239239+ if (cd.s.line == 0) {240240+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);241241+ pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror);242242+ clear_bit(cd.s.bit, pen);243243+ cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen);244244+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);245245+ } else {246246+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);247247+ pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror);248248+ clear_bit(cd.s.bit, pen);249249+ cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen);250250+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);251251+ }252252+}253253+254254+static void octeon_irq_ciu_disable_all(struct irq_data *data)255255+{256256+ unsigned long flags;257257+ unsigned long *pen;258258+ int cpu;259259+ union octeon_ciu_chip_data cd;260260+261261+ wmb(); /* Make sure flag changes arrive before register updates. */262262+263263+ cd.p = irq_data_get_irq_chip_data(data);264264+265265+ if (cd.s.line == 0) {266266+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);267267+ for_each_online_cpu(cpu) {268268+ int coreid = octeon_coreid_for_cpu(cpu);269269+ pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);270270+ clear_bit(cd.s.bit, pen);271271+ cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);272272+ }273273+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);274274+ } else {275275+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);276276+ for_each_online_cpu(cpu) {277277+ int coreid = octeon_coreid_for_cpu(cpu);278278+ pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);279279+ clear_bit(cd.s.bit, pen);280280+ cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);281281+ }282282+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);283283+ }284284+}285285+286286+static void octeon_irq_ciu_enable_all(struct irq_data *data)287287+{288288+ unsigned long flags;289289+ unsigned long *pen;290290+ int cpu;291291+ union octeon_ciu_chip_data cd;292292+293293+ cd.p = irq_data_get_irq_chip_data(data);294294+295295+ if (cd.s.line == 0) {296296+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);297297+ for_each_online_cpu(cpu) {298298+ int coreid = octeon_coreid_for_cpu(cpu);299299+ pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);300300+ set_bit(cd.s.bit, pen);301301+ cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);302302+ }303303+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);304304+ } else {305305+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);306306+ for_each_online_cpu(cpu) {307307+ int coreid = octeon_coreid_for_cpu(cpu);308308+ pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);309309+ set_bit(cd.s.bit, pen);310310+ cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);311311+ }312312+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);313313+ }279314}280315281316/*282317 * Enable the irq on the next core in the affinity set for chips that283318 * have the EN*_W1{S,C} registers.284319 */285285-static void octeon_irq_ciu0_enable_v2(unsigned int irq)320320+static void octeon_irq_ciu_enable_v2(struct irq_data *data)286321{287287- int index;288288- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);289289- struct irq_desc *desc = irq_to_desc(irq);322322+ u64 mask;323323+ int cpu = next_cpu_for_irq(data);324324+ union octeon_ciu_chip_data cd;290325291291- if ((desc->status & IRQ_DISABLED) == 0) {292292- index = next_coreid_for_irq(desc) * 2;326326+ cd.p = irq_data_get_irq_chip_data(data);327327+ mask = 1ull << (cd.s.bit);328328+329329+ /*330330+ * Called under the desc lock, so these should never get out331331+ * of sync.332332+ */333333+ if (cd.s.line == 0) {334334+ int index = octeon_coreid_for_cpu(cpu) * 2;335335+ set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));293336 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);337337+ } else {338338+ int index = octeon_coreid_for_cpu(cpu) * 2 + 1;339339+ set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));340340+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);294341 }295342}296343···390253 * Enable the irq on the current CPU for chips that391254 * have the EN*_W1{S,C} registers.392255 */393393-static void octeon_irq_ciu0_enable_mbox_v2(unsigned int irq)256256+static void octeon_irq_ciu_enable_local_v2(struct irq_data *data)394257{395395- int index;396396- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);258258+ u64 mask;259259+ union octeon_ciu_chip_data cd;397260398398- index = cvmx_get_core_num() * 2;399399- cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);400400-}261261+ cd.p = irq_data_get_irq_chip_data(data);262262+ mask = 1ull << (cd.s.bit);401263402402-/*403403- * Disable the irq on the current core for chips that have the EN*_W1{S,C}404404- * registers.405405- */406406-static void octeon_irq_ciu0_ack_v2(unsigned int irq)407407-{408408- int index = cvmx_get_core_num() * 2;409409- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);410410-411411- switch (irq) {412412- case OCTEON_IRQ_GMX_DRP0:413413- case OCTEON_IRQ_GMX_DRP1:414414- case OCTEON_IRQ_IPD_DRP:415415- case OCTEON_IRQ_KEY_ZERO:416416- case OCTEON_IRQ_TIMER0:417417- case OCTEON_IRQ_TIMER1:418418- case OCTEON_IRQ_TIMER2:419419- case OCTEON_IRQ_TIMER3:420420- /*421421- * CIU timer type interrupts must be acknoleged by422422- * writing a '1' bit to their sum0 bit.423423- */424424- cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);425425- break;426426- default:427427- break;428428- }429429-430430- cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);431431-}432432-433433-/*434434- * Enable the irq on the current core for chips that have the EN*_W1{S,C}435435- * registers.436436- */437437-static void octeon_irq_ciu0_eoi_mbox_v2(unsigned int irq)438438-{439439- struct irq_desc *desc = irq_to_desc(irq);440440- int index = cvmx_get_core_num() * 2;441441- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);442442-443443- if (likely((desc->status & IRQ_DISABLED) == 0))264264+ if (cd.s.line == 0) {265265+ int index = cvmx_get_core_num() * 2;266266+ set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror));444267 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);268268+ } else {269269+ int index = cvmx_get_core_num() * 2 + 1;270270+ set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror));271271+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);272272+ }445273}446274447447-/*448448- * Disable the irq on the all cores for chips that have the EN*_W1{S,C}449449- * registers.450450- */451451-static void octeon_irq_ciu0_disable_all_v2(unsigned int irq)275275+static void octeon_irq_ciu_disable_local_v2(struct irq_data *data)452276{453453- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);454454- int index;455455- int cpu;456456- for_each_online_cpu(cpu) {457457- index = octeon_coreid_for_cpu(cpu) * 2;277277+ u64 mask;278278+ union octeon_ciu_chip_data cd;279279+280280+ cd.p = irq_data_get_irq_chip_data(data);281281+ mask = 1ull << (cd.s.bit);282282+283283+ if (cd.s.line == 0) {284284+ int index = cvmx_get_core_num() * 2;285285+ clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror));458286 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);459459- }460460-}461461-462462-#ifdef CONFIG_SMP463463-static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *dest)464464-{465465- int cpu;466466- struct irq_desc *desc = irq_to_desc(irq);467467- int enable_one = (desc->status & IRQ_DISABLED) == 0;468468- unsigned long flags;469469- int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */470470-471471- /*472472- * For non-v2 CIU, we will allow only single CPU affinity.473473- * This removes the need to do locking in the .ack/.eoi474474- * functions.475475- */476476- if (cpumask_weight(dest) != 1)477477- return -EINVAL;478478-479479- raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);480480- for_each_online_cpu(cpu) {481481- int coreid = octeon_coreid_for_cpu(cpu);482482- uint64_t en0 =483483- cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));484484- if (cpumask_test_cpu(cpu, dest) && enable_one) {485485- enable_one = 0;486486- en0 |= 1ull << bit;487487- } else {488488- en0 &= ~(1ull << bit);489489- }490490- cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);491491- }492492- /*493493- * We need to do a read after the last update to make sure all494494- * of them are done.495495- */496496- cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2));497497- raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);498498-499499- return 0;500500-}501501-502502-/*503503- * Set affinity for the irq for chips that have the EN*_W1{S,C}504504- * registers.505505- */506506-static int octeon_irq_ciu0_set_affinity_v2(unsigned int irq,507507- const struct cpumask *dest)508508-{509509- int cpu;510510- int index;511511- struct irq_desc *desc = irq_to_desc(irq);512512- int enable_one = (desc->status & IRQ_DISABLED) == 0;513513- u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);514514-515515- for_each_online_cpu(cpu) {516516- index = octeon_coreid_for_cpu(cpu) * 2;517517- if (cpumask_test_cpu(cpu, dest) && enable_one) {518518- enable_one = 0;519519- cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);520520- } else {521521- cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);522522- }523523- }524524- return 0;525525-}526526-#endif527527-528528-/*529529- * Newer octeon chips have support for lockless CIU operation.530530- */531531-static struct irq_chip octeon_irq_chip_ciu0_v2 = {532532- .name = "CIU0",533533- .enable = octeon_irq_ciu0_enable_v2,534534- .disable = octeon_irq_ciu0_disable_all_v2,535535- .eoi = octeon_irq_ciu0_enable_v2,536536-#ifdef CONFIG_SMP537537- .set_affinity = octeon_irq_ciu0_set_affinity_v2,538538-#endif539539-};540540-541541-static struct irq_chip octeon_irq_chip_ciu0 = {542542- .name = "CIU0",543543- .enable = octeon_irq_ciu0_enable,544544- .disable = octeon_irq_ciu0_disable,545545- .eoi = octeon_irq_ciu0_eoi,546546-#ifdef CONFIG_SMP547547- .set_affinity = octeon_irq_ciu0_set_affinity,548548-#endif549549-};550550-551551-/* The mbox versions don't do any affinity or round-robin. */552552-static struct irq_chip octeon_irq_chip_ciu0_mbox_v2 = {553553- .name = "CIU0-M",554554- .enable = octeon_irq_ciu0_enable_mbox_v2,555555- .disable = octeon_irq_ciu0_disable,556556- .eoi = octeon_irq_ciu0_eoi_mbox_v2,557557-};558558-559559-static struct irq_chip octeon_irq_chip_ciu0_mbox = {560560- .name = "CIU0-M",561561- .enable = octeon_irq_ciu0_enable_mbox,562562- .disable = octeon_irq_ciu0_disable,563563- .eoi = octeon_irq_ciu0_eoi,564564-};565565-566566-static void octeon_irq_ciu1_ack(unsigned int irq)567567-{568568- /*569569- * In order to avoid any locking accessing the CIU, we570570- * acknowledge CIU interrupts by disabling all of them. This571571- * way we can use a per core register and avoid any out of572572- * core locking requirements. This has the side affect that573573- * CIU interrupts can't be processed recursively. We don't574574- * need to disable IRQs to make these atomic since they are575575- * already disabled earlier in the low level interrupt code.576576- */577577- clear_c0_status(0x100 << 3);578578-}579579-580580-static void octeon_irq_ciu1_eoi(unsigned int irq)581581-{582582- /*583583- * Enable all CIU interrupts again. We don't need to disable584584- * IRQs to make these atomic since they are already disabled585585- * earlier in the low level interrupt code.586586- */587587- set_c0_status(0x100 << 3);588588-}589589-590590-static void octeon_irq_ciu1_enable(unsigned int irq)591591-{592592- struct irq_desc *desc = irq_to_desc(irq);593593- int coreid = next_coreid_for_irq(desc);594594- unsigned long flags;595595- uint64_t en1;596596- int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */597597-598598- raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);599599- en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));600600- en1 |= 1ull << bit;601601- cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);602602- cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));603603- raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);604604-}605605-606606-/*607607- * Watchdog interrupts are special. They are associated with a single608608- * core, so we hardwire the affinity to that core.609609- */610610-static void octeon_irq_ciu1_wd_enable(unsigned int irq)611611-{612612- unsigned long flags;613613- uint64_t en1;614614- int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */615615- int coreid = bit;616616-617617- raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);618618- en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));619619- en1 |= 1ull << bit;620620- cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);621621- cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));622622- raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);623623-}624624-625625-static void octeon_irq_ciu1_disable(unsigned int irq)626626-{627627- int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */628628- unsigned long flags;629629- uint64_t en1;630630- int cpu;631631- raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);632632- for_each_online_cpu(cpu) {633633- int coreid = octeon_coreid_for_cpu(cpu);634634- en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));635635- en1 &= ~(1ull << bit);636636- cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);637637- }638638- /*639639- * We need to do a read after the last update to make sure all640640- * of them are done.641641- */642642- cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));643643- raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);644644-}645645-646646-/*647647- * Enable the irq on the current core for chips that have the EN*_W1{S,C}648648- * registers.649649- */650650-static void octeon_irq_ciu1_enable_v2(unsigned int irq)651651-{652652- int index;653653- u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);654654- struct irq_desc *desc = irq_to_desc(irq);655655-656656- if ((desc->status & IRQ_DISABLED) == 0) {657657- index = next_coreid_for_irq(desc) * 2 + 1;658658- cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);659659- }660660-}661661-662662-/*663663- * Watchdog interrupts are special. They are associated with a single664664- * core, so we hardwire the affinity to that core.665665- */666666-static void octeon_irq_ciu1_wd_enable_v2(unsigned int irq)667667-{668668- int index;669669- int coreid = irq - OCTEON_IRQ_WDOG0;670670- u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);671671- struct irq_desc *desc = irq_to_desc(irq);672672-673673- if ((desc->status & IRQ_DISABLED) == 0) {674674- index = coreid * 2 + 1;675675- cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);676676- }677677-}678678-679679-/*680680- * Disable the irq on the current core for chips that have the EN*_W1{S,C}681681- * registers.682682- */683683-static void octeon_irq_ciu1_ack_v2(unsigned int irq)684684-{685685- int index = cvmx_get_core_num() * 2 + 1;686686- u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);687687-688688- cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);689689-}690690-691691-/*692692- * Disable the irq on the all cores for chips that have the EN*_W1{S,C}693693- * registers.694694- */695695-static void octeon_irq_ciu1_disable_all_v2(unsigned int irq)696696-{697697- u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);698698- int index;699699- int cpu;700700- for_each_online_cpu(cpu) {701701- index = octeon_coreid_for_cpu(cpu) * 2 + 1;287287+ } else {288288+ int index = cvmx_get_core_num() * 2 + 1;289289+ clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror));702290 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);703291 }704292}705293706706-#ifdef CONFIG_SMP707707-static int octeon_irq_ciu1_set_affinity(unsigned int irq,708708- const struct cpumask *dest)294294+/*295295+ * Write to the W1C bit in CVMX_CIU_INTX_SUM0 to clear the irq.296296+ */297297+static void octeon_irq_ciu_ack(struct irq_data *data)298298+{299299+ u64 mask;300300+ union octeon_ciu_chip_data cd;301301+302302+ cd.p = data->chip_data;303303+ mask = 1ull << (cd.s.bit);304304+305305+ if (cd.s.line == 0) {306306+ int index = cvmx_get_core_num() * 2;307307+ cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);308308+ } else {309309+ cvmx_write_csr(CVMX_CIU_INT_SUM1, mask);310310+ }311311+}312312+313313+/*314314+ * Disable the irq on the all cores for chips that have the EN*_W1{S,C}315315+ * registers.316316+ */317317+static void octeon_irq_ciu_disable_all_v2(struct irq_data *data)709318{710319 int cpu;711711- struct irq_desc *desc = irq_to_desc(irq);712712- int enable_one = (desc->status & IRQ_DISABLED) == 0;320320+ u64 mask;321321+ union octeon_ciu_chip_data cd;322322+323323+ wmb(); /* Make sure flag changes arrive before register updates. */324324+325325+ cd.p = data->chip_data;326326+ mask = 1ull << (cd.s.bit);327327+328328+ if (cd.s.line == 0) {329329+ for_each_online_cpu(cpu) {330330+ int index = octeon_coreid_for_cpu(cpu) * 2;331331+ clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));332332+ cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);333333+ }334334+ } else {335335+ for_each_online_cpu(cpu) {336336+ int index = octeon_coreid_for_cpu(cpu) * 2 + 1;337337+ clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));338338+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);339339+ }340340+ }341341+}342342+343343+/*344344+ * Enable the irq on the all cores for chips that have the EN*_W1{S,C}345345+ * registers.346346+ */347347+static void octeon_irq_ciu_enable_all_v2(struct irq_data *data)348348+{349349+ int cpu;350350+ u64 mask;351351+ union octeon_ciu_chip_data cd;352352+353353+ cd.p = data->chip_data;354354+ mask = 1ull << (cd.s.bit);355355+356356+ if (cd.s.line == 0) {357357+ for_each_online_cpu(cpu) {358358+ int index = octeon_coreid_for_cpu(cpu) * 2;359359+ set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));360360+ cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);361361+ }362362+ } else {363363+ for_each_online_cpu(cpu) {364364+ int index = octeon_coreid_for_cpu(cpu) * 2 + 1;365365+ set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));366366+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);367367+ }368368+ }369369+}370370+371371+#ifdef CONFIG_SMP372372+373373+static void octeon_irq_cpu_offline_ciu(struct irq_data *data)374374+{375375+ int cpu = smp_processor_id();376376+ cpumask_t new_affinity;377377+378378+ if (!cpumask_test_cpu(cpu, data->affinity))379379+ return;380380+381381+ if (cpumask_weight(data->affinity) > 1) {382382+ /*383383+ * It has multi CPU affinity, just remove this CPU384384+ * from the affinity set.385385+ */386386+ cpumask_copy(&new_affinity, data->affinity);387387+ cpumask_clear_cpu(cpu, &new_affinity);388388+ } else {389389+ /* Otherwise, put it on lowest numbered online CPU. */390390+ cpumask_clear(&new_affinity);391391+ cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);392392+ }393393+ __irq_set_affinity_locked(data, &new_affinity);394394+}395395+396396+static int octeon_irq_ciu_set_affinity(struct irq_data *data,397397+ const struct cpumask *dest, bool force)398398+{399399+ int cpu;400400+ bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);713401 unsigned long flags;714714- int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */402402+ union octeon_ciu_chip_data cd;403403+404404+ cd.p = data->chip_data;715405716406 /*717407 * For non-v2 CIU, we will allow only single CPU affinity.···548584 if (cpumask_weight(dest) != 1)549585 return -EINVAL;550586551551- raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);552552- for_each_online_cpu(cpu) {553553- int coreid = octeon_coreid_for_cpu(cpu);554554- uint64_t en1 =555555- cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));556556- if (cpumask_test_cpu(cpu, dest) && enable_one) {557557- enable_one = 0;558558- en1 |= 1ull << bit;559559- } else {560560- en1 &= ~(1ull << bit);561561- }562562- cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);563563- }564564- /*565565- * We need to do a read after the last update to make sure all566566- * of them are done.567567- */568568- cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1));569569- raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);587587+ if (!enable_one)588588+ return 0;570589590590+ if (cd.s.line == 0) {591591+ raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);592592+ for_each_online_cpu(cpu) {593593+ int coreid = octeon_coreid_for_cpu(cpu);594594+ unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);595595+596596+ if (cpumask_test_cpu(cpu, dest) && enable_one) {597597+ enable_one = false;598598+ set_bit(cd.s.bit, pen);599599+ } else {600600+ clear_bit(cd.s.bit, pen);601601+ }602602+ cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);603603+ }604604+ raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);605605+ } else {606606+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);607607+ for_each_online_cpu(cpu) {608608+ int coreid = octeon_coreid_for_cpu(cpu);609609+ unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);610610+611611+ if (cpumask_test_cpu(cpu, dest) && enable_one) {612612+ enable_one = false;613613+ set_bit(cd.s.bit, pen);614614+ } else {615615+ clear_bit(cd.s.bit, pen);616616+ }617617+ cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);618618+ }619619+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);620620+ }571621 return 0;572622}573623···589611 * Set affinity for the irq for chips that have the EN*_W1{S,C}590612 * registers.591613 */592592-static int octeon_irq_ciu1_set_affinity_v2(unsigned int irq,593593- const struct cpumask *dest)614614+static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,615615+ const struct cpumask *dest,616616+ bool force)594617{595618 int cpu;596596- int index;597597- struct irq_desc *desc = irq_to_desc(irq);598598- int enable_one = (desc->status & IRQ_DISABLED) == 0;599599- u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);600600- for_each_online_cpu(cpu) {601601- index = octeon_coreid_for_cpu(cpu) * 2 + 1;602602- if (cpumask_test_cpu(cpu, dest) && enable_one) {603603- enable_one = 0;604604- cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);605605- } else {606606- cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);619619+ bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);620620+ u64 mask;621621+ union octeon_ciu_chip_data cd;622622+623623+ if (!enable_one)624624+ return 0;625625+626626+ cd.p = data->chip_data;627627+ mask = 1ull << cd.s.bit;628628+629629+ if (cd.s.line == 0) {630630+ for_each_online_cpu(cpu) {631631+ unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);632632+ int index = octeon_coreid_for_cpu(cpu) * 2;633633+ if (cpumask_test_cpu(cpu, dest) && enable_one) {634634+ enable_one = false;635635+ set_bit(cd.s.bit, pen);636636+ cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);637637+ } else {638638+ clear_bit(cd.s.bit, pen);639639+ cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);640640+ }641641+ }642642+ } else {643643+ for_each_online_cpu(cpu) {644644+ unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);645645+ int index = octeon_coreid_for_cpu(cpu) * 2 + 1;646646+ if (cpumask_test_cpu(cpu, dest) && enable_one) {647647+ enable_one = false;648648+ set_bit(cd.s.bit, pen);649649+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);650650+ } else {651651+ clear_bit(cd.s.bit, pen);652652+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);653653+ }607654 }608655 }609656 return 0;···636633#endif637634638635/*636636+ * The v1 CIU code already masks things, so supply a dummy version to637637+ * the core chip code.638638+ */639639+static void octeon_irq_dummy_mask(struct irq_data *data)640640+{641641+}642642+643643+/*639644 * Newer octeon chips have support for lockless CIU operation.640645 */641641-static struct irq_chip octeon_irq_chip_ciu1_v2 = {642642- .name = "CIU1",643643- .enable = octeon_irq_ciu1_enable_v2,644644- .disable = octeon_irq_ciu1_disable_all_v2,645645- .eoi = octeon_irq_ciu1_enable_v2,646646+static struct irq_chip octeon_irq_chip_ciu_v2 = {647647+ .name = "CIU",648648+ .irq_enable = octeon_irq_ciu_enable_v2,649649+ .irq_disable = octeon_irq_ciu_disable_all_v2,650650+ .irq_mask = octeon_irq_ciu_disable_local_v2,651651+ .irq_unmask = octeon_irq_ciu_enable_v2,646652#ifdef CONFIG_SMP647647- .set_affinity = octeon_irq_ciu1_set_affinity_v2,653653+ .irq_set_affinity = octeon_irq_ciu_set_affinity_v2,654654+ .irq_cpu_offline = octeon_irq_cpu_offline_ciu,648655#endif649656};650657651651-static struct irq_chip octeon_irq_chip_ciu1 = {652652- .name = "CIU1",653653- .enable = octeon_irq_ciu1_enable,654654- .disable = octeon_irq_ciu1_disable,655655- .eoi = octeon_irq_ciu1_eoi,658658+static struct irq_chip octeon_irq_chip_ciu_edge_v2 = {659659+ .name = "CIU-E",660660+ .irq_enable = octeon_irq_ciu_enable_v2,661661+ .irq_disable = octeon_irq_ciu_disable_all_v2,662662+ .irq_ack = octeon_irq_ciu_ack,663663+ .irq_mask = octeon_irq_ciu_disable_local_v2,664664+ .irq_unmask = octeon_irq_ciu_enable_v2,656665#ifdef CONFIG_SMP657657- .set_affinity = octeon_irq_ciu1_set_affinity,666666+ .irq_set_affinity = octeon_irq_ciu_set_affinity_v2,667667+ .irq_cpu_offline = octeon_irq_cpu_offline_ciu,658668#endif659669};660670661661-static struct irq_chip octeon_irq_chip_ciu1_wd_v2 = {662662- .name = "CIU1-W",663663- .enable = octeon_irq_ciu1_wd_enable_v2,664664- .disable = octeon_irq_ciu1_disable_all_v2,665665- .eoi = octeon_irq_ciu1_wd_enable_v2,671671+static struct irq_chip octeon_irq_chip_ciu = {672672+ .name = "CIU",673673+ .irq_enable = octeon_irq_ciu_enable,674674+ .irq_disable = octeon_irq_ciu_disable_all,675675+ .irq_mask = octeon_irq_dummy_mask,676676+#ifdef CONFIG_SMP677677+ .irq_set_affinity = octeon_irq_ciu_set_affinity,678678+ .irq_cpu_offline = octeon_irq_cpu_offline_ciu,679679+#endif666680};667681668668-static struct irq_chip octeon_irq_chip_ciu1_wd = {669669- .name = "CIU1-W",670670- .enable = octeon_irq_ciu1_wd_enable,671671- .disable = octeon_irq_ciu1_disable,672672- .eoi = octeon_irq_ciu1_eoi,682682+static struct irq_chip octeon_irq_chip_ciu_edge = {683683+ .name = "CIU-E",684684+ .irq_enable = octeon_irq_ciu_enable,685685+ .irq_disable = octeon_irq_ciu_disable_all,686686+ .irq_mask = octeon_irq_dummy_mask,687687+ .irq_ack = octeon_irq_ciu_ack,688688+#ifdef CONFIG_SMP689689+ .irq_set_affinity = octeon_irq_ciu_set_affinity,690690+ .irq_cpu_offline = octeon_irq_cpu_offline_ciu,691691+#endif673692};674693675675-static void (*octeon_ciu0_ack)(unsigned int);676676-static void (*octeon_ciu1_ack)(unsigned int);694694+/* The mbox versions don't do any affinity or round-robin. */695695+static struct irq_chip octeon_irq_chip_ciu_mbox_v2 = {696696+ .name = "CIU-M",697697+ .irq_enable = octeon_irq_ciu_enable_all_v2,698698+ .irq_disable = octeon_irq_ciu_disable_all_v2,699699+ .irq_ack = octeon_irq_ciu_disable_local_v2,700700+ .irq_eoi = octeon_irq_ciu_enable_local_v2,701701+702702+ .irq_cpu_online = octeon_irq_ciu_enable_local_v2,703703+ .irq_cpu_offline = octeon_irq_ciu_disable_local_v2,704704+ .flags = IRQCHIP_ONOFFLINE_ENABLED,705705+};706706+707707+static struct irq_chip octeon_irq_chip_ciu_mbox = {708708+ .name = "CIU-M",709709+ .irq_enable = octeon_irq_ciu_enable_all,710710+ .irq_disable = octeon_irq_ciu_disable_all,711711+712712+ .irq_cpu_online = octeon_irq_ciu_enable_local,713713+ .irq_cpu_offline = octeon_irq_ciu_disable_local,714714+ .flags = IRQCHIP_ONOFFLINE_ENABLED,715715+};716716+717717+/*718718+ * Watchdog interrupts are special. They are associated with a single719719+ * core, so we hardwire the affinity to that core.720720+ */721721+static void octeon_irq_ciu_wd_enable(struct irq_data *data)722722+{723723+ unsigned long flags;724724+ unsigned long *pen;725725+ int coreid = data->irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */726726+ int cpu = octeon_cpu_for_coreid(coreid);727727+728728+ raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);729729+ pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);730730+ set_bit(coreid, pen);731731+ cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);732732+ raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);733733+}734734+735735+/*736736+ * Watchdog interrupts are special. They are associated with a single737737+ * core, so we hardwire the affinity to that core.738738+ */739739+static void octeon_irq_ciu1_wd_enable_v2(struct irq_data *data)740740+{741741+ int coreid = data->irq - OCTEON_IRQ_WDOG0;742742+ int cpu = octeon_cpu_for_coreid(coreid);743743+744744+ set_bit(coreid, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));745745+ cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(coreid * 2 + 1), 1ull << coreid);746746+}747747+748748+749749+static struct irq_chip octeon_irq_chip_ciu_wd_v2 = {750750+ .name = "CIU-W",751751+ .irq_enable = octeon_irq_ciu1_wd_enable_v2,752752+ .irq_disable = octeon_irq_ciu_disable_all_v2,753753+ .irq_mask = octeon_irq_ciu_disable_local_v2,754754+ .irq_unmask = octeon_irq_ciu_enable_local_v2,755755+};756756+757757+static struct irq_chip octeon_irq_chip_ciu_wd = {758758+ .name = "CIU-W",759759+ .irq_enable = octeon_irq_ciu_wd_enable,760760+ .irq_disable = octeon_irq_ciu_disable_all,761761+ .irq_mask = octeon_irq_dummy_mask,762762+};763763+764764+static void octeon_irq_ip2_v1(void)765765+{766766+ const unsigned long core_id = cvmx_get_core_num();767767+ u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2));768768+769769+ ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror);770770+ clear_c0_status(STATUSF_IP2);771771+ if (likely(ciu_sum)) {772772+ int bit = fls64(ciu_sum) - 1;773773+ int irq = octeon_irq_ciu_to_irq[0][bit];774774+ if (likely(irq))775775+ do_IRQ(irq);776776+ else777777+ spurious_interrupt();778778+ } else {779779+ spurious_interrupt();780780+ }781781+ set_c0_status(STATUSF_IP2);782782+}783783+784784+static void octeon_irq_ip2_v2(void)785785+{786786+ const unsigned long core_id = cvmx_get_core_num();787787+ u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2));788788+789789+ ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror);790790+ if (likely(ciu_sum)) {791791+ int bit = fls64(ciu_sum) - 1;792792+ int irq = octeon_irq_ciu_to_irq[0][bit];793793+ if (likely(irq))794794+ do_IRQ(irq);795795+ else796796+ spurious_interrupt();797797+ } else {798798+ spurious_interrupt();799799+ }800800+}801801+static void octeon_irq_ip3_v1(void)802802+{803803+ u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1);804804+805805+ ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror);806806+ clear_c0_status(STATUSF_IP3);807807+ if (likely(ciu_sum)) {808808+ int bit = fls64(ciu_sum) - 1;809809+ int irq = octeon_irq_ciu_to_irq[1][bit];810810+ if (likely(irq))811811+ do_IRQ(irq);812812+ else813813+ spurious_interrupt();814814+ } else {815815+ spurious_interrupt();816816+ }817817+ set_c0_status(STATUSF_IP3);818818+}819819+820820+static void octeon_irq_ip3_v2(void)821821+{822822+ u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1);823823+824824+ ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror);825825+ if (likely(ciu_sum)) {826826+ int bit = fls64(ciu_sum) - 1;827827+ int irq = octeon_irq_ciu_to_irq[1][bit];828828+ if (likely(irq))829829+ do_IRQ(irq);830830+ else831831+ spurious_interrupt();832832+ } else {833833+ spurious_interrupt();834834+ }835835+}836836+837837+static void octeon_irq_ip4_mask(void)838838+{839839+ clear_c0_status(STATUSF_IP4);840840+ spurious_interrupt();841841+}842842+843843+static void (*octeon_irq_ip2)(void);844844+static void (*octeon_irq_ip3)(void);845845+static void (*octeon_irq_ip4)(void);846846+847847+void __cpuinitdata (*octeon_irq_setup_secondary)(void);848848+849849+static void __cpuinit octeon_irq_percpu_enable(void)850850+{851851+ irq_cpu_online();852852+}853853+854854+static void __cpuinit octeon_irq_init_ciu_percpu(void)855855+{856856+ int coreid = cvmx_get_core_num();857857+ /*858858+ * Disable All CIU Interrupts. The ones we need will be859859+ * enabled later. Read the SUM register so we know the write860860+ * completed.861861+ */862862+ cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2)), 0);863863+ cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2 + 1)), 0);864864+ cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2)), 0);865865+ cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2 + 1)), 0);866866+ cvmx_read_csr(CVMX_CIU_INTX_SUM0((coreid * 2)));867867+}868868+869869+static void __cpuinit octeon_irq_setup_secondary_ciu(void)870870+{871871+872872+ __get_cpu_var(octeon_irq_ciu0_en_mirror) = 0;873873+ __get_cpu_var(octeon_irq_ciu1_en_mirror) = 0;874874+875875+ octeon_irq_init_ciu_percpu();876876+ octeon_irq_percpu_enable();877877+878878+ /* Enable the CIU lines */879879+ set_c0_status(STATUSF_IP3 | STATUSF_IP2);880880+ clear_c0_status(STATUSF_IP4);881881+}882882+883883+static void __init octeon_irq_init_ciu(void)884884+{885885+ unsigned int i;886886+ struct irq_chip *chip;887887+ struct irq_chip *chip_edge;888888+ struct irq_chip *chip_mbox;889889+ struct irq_chip *chip_wd;890890+891891+ octeon_irq_init_ciu_percpu();892892+ octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu;893893+894894+ if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) ||895895+ OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||896896+ OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X) ||897897+ OCTEON_IS_MODEL(OCTEON_CN6XXX)) {898898+ octeon_irq_ip2 = octeon_irq_ip2_v2;899899+ octeon_irq_ip3 = octeon_irq_ip3_v2;900900+ chip = &octeon_irq_chip_ciu_v2;901901+ chip_edge = &octeon_irq_chip_ciu_edge_v2;902902+ chip_mbox = &octeon_irq_chip_ciu_mbox_v2;903903+ chip_wd = &octeon_irq_chip_ciu_wd_v2;904904+ } else {905905+ octeon_irq_ip2 = octeon_irq_ip2_v1;906906+ octeon_irq_ip3 = octeon_irq_ip3_v1;907907+ chip = &octeon_irq_chip_ciu;908908+ chip_edge = &octeon_irq_chip_ciu_edge;909909+ chip_mbox = &octeon_irq_chip_ciu_mbox;910910+ chip_wd = &octeon_irq_chip_ciu_wd;911911+ }912912+ octeon_irq_ip4 = octeon_irq_ip4_mask;913913+914914+ /* Mips internal */915915+ octeon_irq_init_core();916916+917917+ /* CIU_0 */918918+ for (i = 0; i < 16; i++)919919+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq);920920+ for (i = 0; i < 16; i++)921921+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GPIO0, 0, i + 16, chip, handle_level_irq);922922+923923+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq);924924+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq);925925+926926+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART0, 0, 34, chip, handle_level_irq);927927+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART1, 0, 35, chip, handle_level_irq);928928+929929+ for (i = 0; i < 4; i++)930930+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq);931931+ for (i = 0; i < 4; i++)932932+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq);933933+934934+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI, 0, 45, chip, handle_level_irq);935935+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq);936936+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_TRACE0, 0, 47, chip, handle_level_irq);937937+938938+ for (i = 0; i < 2; i++)939939+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GMX_DRP0, 0, i + 48, chip_edge, handle_edge_irq);940940+941941+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD_DRP, 0, 50, chip_edge, handle_edge_irq);942942+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY_ZERO, 0, 51, chip_edge, handle_edge_irq);943943+944944+ for (i = 0; i < 4; i++)945945+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip_edge, handle_edge_irq);946946+947947+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq);948948+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PCM, 0, 57, chip, handle_level_irq);949949+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MPI, 0, 58, chip, handle_level_irq);950950+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI2, 0, 59, chip, handle_level_irq);951951+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_POWIQ, 0, 60, chip, handle_level_irq);952952+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPDPPTHR, 0, 61, chip, handle_level_irq);953953+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII0, 0, 62, chip, handle_level_irq);954954+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq);955955+956956+ /* CIU_1 */957957+ for (i = 0; i < 16; i++)958958+ octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq);959959+960960+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART2, 1, 16, chip, handle_level_irq);961961+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq);962962+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII1, 1, 18, chip, handle_level_irq);963963+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_NAND, 1, 19, chip, handle_level_irq);964964+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_MIO, 1, 20, chip, handle_level_irq);965965+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_IOB, 1, 21, chip, handle_level_irq);966966+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_FPA, 1, 22, chip, handle_level_irq);967967+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_POW, 1, 23, chip, handle_level_irq);968968+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_L2C, 1, 24, chip, handle_level_irq);969969+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD, 1, 25, chip, handle_level_irq);970970+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PIP, 1, 26, chip, handle_level_irq);971971+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PKO, 1, 27, chip, handle_level_irq);972972+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_ZIP, 1, 28, chip, handle_level_irq);973973+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_TIM, 1, 29, chip, handle_level_irq);974974+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_RAD, 1, 30, chip, handle_level_irq);975975+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY, 1, 31, chip, handle_level_irq);976976+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFA, 1, 32, chip, handle_level_irq);977977+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_USBCTL, 1, 33, chip, handle_level_irq);978978+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_SLI, 1, 34, chip, handle_level_irq);979979+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_DPI, 1, 35, chip, handle_level_irq);980980+981981+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGX0, 1, 36, chip, handle_level_irq);982982+983983+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGL, 1, 46, chip, handle_level_irq);984984+985985+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PTP, 1, 47, chip_edge, handle_edge_irq);986986+987987+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM0, 1, 48, chip, handle_level_irq);988988+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM1, 1, 49, chip, handle_level_irq);989989+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO0, 1, 50, chip, handle_level_irq);990990+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO1, 1, 51, chip, handle_level_irq);991991+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_LMC0, 1, 52, chip, handle_level_irq);992992+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFM, 1, 56, chip, handle_level_irq);993993+ octeon_irq_set_ciu_mapping(OCTEON_IRQ_RST, 1, 63, chip, handle_level_irq);994994+995995+ /* Enable the CIU lines */996996+ set_c0_status(STATUSF_IP3 | STATUSF_IP2);997997+ clear_c0_status(STATUSF_IP4);998998+}6779996781000void __init arch_init_irq(void)6791001{680680- unsigned int irq;681681- struct irq_chip *chip0;682682- struct irq_chip *chip0_mbox;683683- struct irq_chip *chip1;684684- struct irq_chip *chip1_wd;685685-6861002#ifdef CONFIG_SMP6871003 /* Set the default affinity to the boot cpu. */6881004 cpumask_clear(irq_default_affinity);6891005 cpumask_set_cpu(smp_processor_id(), irq_default_affinity);6901006#endif691691-692692- if (NR_IRQS < OCTEON_IRQ_LAST)693693- pr_err("octeon_irq_init: NR_IRQS is set too low\n");694694-695695- if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) ||696696- OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||697697- OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X)) {698698- octeon_ciu0_ack = octeon_irq_ciu0_ack_v2;699699- octeon_ciu1_ack = octeon_irq_ciu1_ack_v2;700700- chip0 = &octeon_irq_chip_ciu0_v2;701701- chip0_mbox = &octeon_irq_chip_ciu0_mbox_v2;702702- chip1 = &octeon_irq_chip_ciu1_v2;703703- chip1_wd = &octeon_irq_chip_ciu1_wd_v2;704704- } else {705705- octeon_ciu0_ack = octeon_irq_ciu0_ack;706706- octeon_ciu1_ack = octeon_irq_ciu1_ack;707707- chip0 = &octeon_irq_chip_ciu0;708708- chip0_mbox = &octeon_irq_chip_ciu0_mbox;709709- chip1 = &octeon_irq_chip_ciu1;710710- chip1_wd = &octeon_irq_chip_ciu1_wd;711711- }712712-713713- /* 0 - 15 reserved for i8259 master and slave controller. */714714-715715- /* 17 - 23 Mips internal */716716- for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++) {717717- set_irq_chip_and_handler(irq, &octeon_irq_chip_core,718718- handle_percpu_irq);719719- }720720-721721- /* 24 - 87 CIU_INT_SUM0 */722722- for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) {723723- switch (irq) {724724- case OCTEON_IRQ_MBOX0:725725- case OCTEON_IRQ_MBOX1:726726- set_irq_chip_and_handler(irq, chip0_mbox, handle_percpu_irq);727727- break;728728- default:729729- set_irq_chip_and_handler(irq, chip0, handle_fasteoi_irq);730730- break;731731- }732732- }733733-734734- /* 88 - 151 CIU_INT_SUM1 */735735- for (irq = OCTEON_IRQ_WDOG0; irq <= OCTEON_IRQ_WDOG15; irq++)736736- set_irq_chip_and_handler(irq, chip1_wd, handle_fasteoi_irq);737737-738738- for (irq = OCTEON_IRQ_UART2; irq <= OCTEON_IRQ_RESERVED151; irq++)739739- set_irq_chip_and_handler(irq, chip1, handle_fasteoi_irq);740740-741741- set_c0_status(0x300 << 2);10071007+ octeon_irq_init_ciu();7421008}74310097441010asmlinkage void plat_irq_dispatch(void)7451011{746746- const unsigned long core_id = cvmx_get_core_num();747747- const uint64_t ciu_sum0_address = CVMX_CIU_INTX_SUM0(core_id * 2);748748- const uint64_t ciu_en0_address = CVMX_CIU_INTX_EN0(core_id * 2);749749- const uint64_t ciu_sum1_address = CVMX_CIU_INT_SUM1;750750- const uint64_t ciu_en1_address = CVMX_CIU_INTX_EN1(core_id * 2 + 1);7511012 unsigned long cop0_cause;7521013 unsigned long cop0_status;753753- uint64_t ciu_en;754754- uint64_t ciu_sum;755755- unsigned int irq;75610147571015 while (1) {7581016 cop0_cause = read_c0_cause();···1021757 cop0_cause &= cop0_status;1022758 cop0_cause &= ST0_IM;102375910241024- if (unlikely(cop0_cause & STATUSF_IP2)) {10251025- ciu_sum = cvmx_read_csr(ciu_sum0_address);10261026- ciu_en = cvmx_read_csr(ciu_en0_address);10271027- ciu_sum &= ciu_en;10281028- if (likely(ciu_sum)) {10291029- irq = fls64(ciu_sum) + OCTEON_IRQ_WORKQ0 - 1;10301030- octeon_ciu0_ack(irq);10311031- do_IRQ(irq);10321032- } else {10331033- spurious_interrupt();10341034- }10351035- } else if (unlikely(cop0_cause & STATUSF_IP3)) {10361036- ciu_sum = cvmx_read_csr(ciu_sum1_address);10371037- ciu_en = cvmx_read_csr(ciu_en1_address);10381038- ciu_sum &= ciu_en;10391039- if (likely(ciu_sum)) {10401040- irq = fls64(ciu_sum) + OCTEON_IRQ_WDOG0 - 1;10411041- octeon_ciu1_ack(irq);10421042- do_IRQ(irq);10431043- } else {10441044- spurious_interrupt();10451045- }10461046- } else if (likely(cop0_cause)) {760760+ if (unlikely(cop0_cause & STATUSF_IP2))761761+ octeon_irq_ip2();762762+ else if (unlikely(cop0_cause & STATUSF_IP3))763763+ octeon_irq_ip3();764764+ else if (unlikely(cop0_cause & STATUSF_IP4))765765+ octeon_irq_ip4();766766+ else if (likely(cop0_cause))1047767 do_IRQ(fls(cop0_cause) - 9 + MIPS_CPU_IRQ_BASE);10481048- } else {768768+ else1049769 break;10501050- }1051770 }1052771}1053772···10387911039792void fixup_irqs(void)1040793{10411041- int irq;10421042- struct irq_desc *desc;10431043- cpumask_t new_affinity;10441044- unsigned long flags;10451045- int do_set_affinity;10461046- int cpu;10471047-10481048- cpu = smp_processor_id();10491049-10501050- for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++)10511051- octeon_irq_core_disable_local(irq);10521052-10531053- for (irq = OCTEON_IRQ_WORKQ0; irq < OCTEON_IRQ_LAST; irq++) {10541054- desc = irq_to_desc(irq);10551055- switch (irq) {10561056- case OCTEON_IRQ_MBOX0:10571057- case OCTEON_IRQ_MBOX1:10581058- /* The eoi function will disable them on this CPU. */10591059- desc->chip->eoi(irq);10601060- break;10611061- case OCTEON_IRQ_WDOG0:10621062- case OCTEON_IRQ_WDOG1:10631063- case OCTEON_IRQ_WDOG2:10641064- case OCTEON_IRQ_WDOG3:10651065- case OCTEON_IRQ_WDOG4:10661066- case OCTEON_IRQ_WDOG5:10671067- case OCTEON_IRQ_WDOG6:10681068- case OCTEON_IRQ_WDOG7:10691069- case OCTEON_IRQ_WDOG8:10701070- case OCTEON_IRQ_WDOG9:10711071- case OCTEON_IRQ_WDOG10:10721072- case OCTEON_IRQ_WDOG11:10731073- case OCTEON_IRQ_WDOG12:10741074- case OCTEON_IRQ_WDOG13:10751075- case OCTEON_IRQ_WDOG14:10761076- case OCTEON_IRQ_WDOG15:10771077- /*10781078- * These have special per CPU semantics and10791079- * are handled in the watchdog driver.10801080- */10811081- break;10821082- default:10831083- raw_spin_lock_irqsave(&desc->lock, flags);10841084- /*10851085- * If this irq has an action, it is in use and10861086- * must be migrated if it has affinity to this10871087- * cpu.10881088- */10891089- if (desc->action && cpumask_test_cpu(cpu, desc->affinity)) {10901090- if (cpumask_weight(desc->affinity) > 1) {10911091- /*10921092- * It has multi CPU affinity,10931093- * just remove this CPU from10941094- * the affinity set.10951095- */10961096- cpumask_copy(&new_affinity, desc->affinity);10971097- cpumask_clear_cpu(cpu, &new_affinity);10981098- } else {10991099- /*11001100- * Otherwise, put it on lowest11011101- * numbered online CPU.11021102- */11031103- cpumask_clear(&new_affinity);11041104- cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);11051105- }11061106- do_set_affinity = 1;11071107- } else {11081108- do_set_affinity = 0;11091109- }11101110- raw_spin_unlock_irqrestore(&desc->lock, flags);11111111-11121112- if (do_set_affinity)11131113- irq_set_affinity(irq, &new_affinity);11141114-11151115- break;11161116- }11171117- }794794+ irq_cpu_offline();1118795}11197961120797#endif /* CONFIG_HOTPLUG_CPU */
-12
arch/mips/cavium-octeon/setup.c
···420420void __init prom_init(void)421421{422422 struct cvmx_sysinfo *sysinfo;423423- const int coreid = cvmx_get_core_num();424423 int i;425424 int argc;426425#ifdef CONFIG_CAVIUM_RESERVE32···535536 octeon_check_cpu_bist();536537537538 octeon_uart = octeon_get_boot_uart();538538-539539- /*540540- * Disable All CIU Interrupts. The ones we need will be541541- * enabled later. Read the SUM register so we know the write542542- * completed.543543- */544544- cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2)), 0);545545- cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2 + 1)), 0);546546- cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2)), 0);547547- cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2 + 1)), 0);548548- cvmx_read_csr(CVMX_CIU_INTX_SUM0((coreid * 2)));549539550540#ifdef CONFIG_SMP551541 octeon_write_lcd("LinuxSMP");
+18-31
arch/mips/cavium-octeon/smp.c
···171171 * After we've done initial boot, this function is called to allow the172172 * board code to clean up state, if needed173173 */174174-static void octeon_init_secondary(void)174174+static void __cpuinit octeon_init_secondary(void)175175{176176- const int coreid = cvmx_get_core_num();177177- union cvmx_ciu_intx_sum0 interrupt_enable;178176 unsigned int sr;179177178178+ sr = set_c0_status(ST0_BEV);179179+ write_c0_ebase((u32)ebase);180180+ write_c0_status(sr);181181+182182+ octeon_check_cpu_bist();183183+ octeon_init_cvmcount();184184+185185+ octeon_irq_setup_secondary();186186+ raw_local_irq_enable();187187+}188188+189189+/**190190+ * Callout to firmware before smp_init191191+ *192192+ */193193+void octeon_prepare_cpus(unsigned int max_cpus)194194+{180195#ifdef CONFIG_HOTPLUG_CPU181196 struct linux_app_boot_info *labi;182197···201186 panic("The bootloader version on this board is incorrect.");202187#endif203188204204- sr = set_c0_status(ST0_BEV);205205- write_c0_ebase((u32)ebase);206206- write_c0_status(sr);207207-208208- octeon_check_cpu_bist();209209- octeon_init_cvmcount();210210- /*211211- pr_info("SMP: CPU%d (CoreId %lu) started\n", cpu, coreid);212212- */213213- /* Enable Mailbox interrupts to this core. These are the only214214- interrupts allowed on line 3 */215215- cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), 0xffffffff);216216- interrupt_enable.u64 = 0;217217- interrupt_enable.s.mbox = 0x3;218218- cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2)), interrupt_enable.u64);219219- cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2 + 1)), 0);220220- cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2)), 0);221221- cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2 + 1)), 0);222222- /* Enable core interrupt processing for 2,3 and 7 */223223- set_c0_status(0x8c01);224224-}225225-226226-/**227227- * Callout to firmware before smp_init228228- *229229- */230230-void octeon_prepare_cpus(unsigned int max_cpus)231231-{232189 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cvmx_get_core_num()), 0xffffffff);233190 if (request_irq(OCTEON_IRQ_MBOX0, mailbox_interrupt, IRQF_DISABLED,234191 "mailbox0", mailbox_interrupt)) {
+2-2
arch/mips/dec/ioasic-irq.c
···6868 fast_iob();69697070 for (i = base; i < base + IO_INR_DMA; i++)7171- set_irq_chip_and_handler(i, &ioasic_irq_type,7171+ irq_set_chip_and_handler(i, &ioasic_irq_type,7272 handle_level_irq);7373 for (; i < base + IO_IRQ_LINES; i++)7474- set_irq_chip(i, &ioasic_dma_irq_type);7474+ irq_set_chip(i, &ioasic_dma_irq_type);75757676 ioasic_irq_base = base;7777}
+1-1
arch/mips/dec/kn02-irq.c
···7373 iob();74747575 for (i = base; i < base + KN02_IRQ_LINES; i++)7676- set_irq_chip_and_handler(i, &kn02_irq_type, handle_level_irq);7676+ irq_set_chip_and_handler(i, &kn02_irq_type, handle_level_irq);77777878 kn02_irq_base = base;7979}
+3-3
arch/mips/emma/markeins/irq.c
···6969 u32 i;70707171 for (i = 0; i < NUM_EMMA2RH_IRQ; i++)7272- set_irq_chip_and_handler_name(EMMA2RH_IRQ_BASE + i,7272+ irq_set_chip_and_handler_name(EMMA2RH_IRQ_BASE + i,7373 &emma2rh_irq_controller,7474 handle_level_irq, "level");7575}···105105 u32 i;106106107107 for (i = 0; i < NUM_EMMA2RH_IRQ_SW; i++)108108- set_irq_chip_and_handler_name(EMMA2RH_SW_IRQ_BASE + i,108108+ irq_set_chip_and_handler_name(EMMA2RH_SW_IRQ_BASE + i,109109 &emma2rh_sw_irq_controller,110110 handle_level_irq, "level");111111}···162162 u32 i;163163164164 for (i = 0; i < NUM_EMMA2RH_IRQ_GPIO; i++)165165- set_irq_chip_and_handler_name(EMMA2RH_GPIO_IRQ_BASE + i,165165+ irq_set_chip_and_handler_name(EMMA2RH_GPIO_IRQ_BASE + i,166166 &emma2rh_gpio_irq_controller,167167 handle_edge_irq, "edge");168168}
···110110void make_8259A_irq(unsigned int irq)111111{112112 disable_irq_nosync(irq);113113- set_irq_chip_and_handler(irq, &i8259A_chip, handle_level_irq);113113+ irq_set_chip_and_handler(irq, &i8259A_chip, handle_level_irq);114114 enable_irq(irq);115115}116116···336336 init_8259A(0);337337338338 for (i = I8259A_IRQ_BASE; i < I8259A_IRQ_BASE + 16; i++) {339339- set_irq_chip_and_handler(i, &i8259A_chip, handle_level_irq);340340- set_irq_probe(i);339339+ irq_set_chip_and_handler(i, &i8259A_chip, handle_level_irq);340340+ irq_set_probe(i);341341 }342342343343 setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
+1-1
arch/mips/kernel/irq-gic.c
···229229 vpe_local_setup(numvpes);230230231231 for (i = _irqbase; i < (_irqbase + numintrs); i++)232232- set_irq_chip(i, &gic_irq_controller);232232+ irq_set_chip(i, &gic_irq_controller);233233}234234235235void __init gic_init(unsigned long gic_base_addr,
+2-2
arch/mips/kernel/irq-gt641xx.c
···126126 * bit31: logical or of bits[25:1].127127 */128128 for (i = 1; i < 30; i++)129129- set_irq_chip_and_handler(GT641XX_IRQ_BASE + i,130130- >641xx_irq_chip, handle_level_irq);129129+ irq_set_chip_and_handler(GT641XX_IRQ_BASE + i,130130+ >641xx_irq_chip, handle_level_irq);131131}
···4545 clear_c0_intcontrol(0x00000f00); /* Mask all */46464747 for (i = base; i < base + 4; i++)4848- set_irq_chip_and_handler(i, &rm7k_irq_controller,4848+ irq_set_chip_and_handler(i, &rm7k_irq_controller,4949 handle_percpu_irq);5050}
+2-2
arch/mips/kernel/irq-rm9000.c
···9898 clear_c0_intcontrol(0x0000f000); /* Mask all */9999100100 for (i = base; i < base + 4; i++)101101- set_irq_chip_and_handler(i, &rm9k_irq_controller,101101+ irq_set_chip_and_handler(i, &rm9k_irq_controller,102102 handle_level_irq);103103104104 rm9000_perfcount_irq = base + 1;105105- set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,105105+ irq_set_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,106106 handle_percpu_irq);107107}
···172172 pci_write_config_word(dev, desc->msi_attrib.pos + PCI_MSI_FLAGS,173173 control);174174175175- set_irq_msi(irq, desc);175175+ irq_set_msi_desc(irq, desc);176176 write_msi_msg(irq, &msg);177177 return 0;178178}···259259static u64 msi_rcv_reg[4];260260static u64 mis_ena_reg[4];261261262262-static void octeon_irq_msi_enable_pcie(unsigned int irq)262262+static void octeon_irq_msi_enable_pcie(struct irq_data *data)263263{264264 u64 en;265265 unsigned long flags;266266- int msi_number = irq - OCTEON_IRQ_MSI_BIT0;266266+ int msi_number = data->irq - OCTEON_IRQ_MSI_BIT0;267267 int irq_index = msi_number >> 6;268268 int irq_bit = msi_number & 0x3f;269269···275275 raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);276276}277277278278-static void octeon_irq_msi_disable_pcie(unsigned int irq)278278+static void octeon_irq_msi_disable_pcie(struct irq_data *data)279279{280280 u64 en;281281 unsigned long flags;282282- int msi_number = irq - OCTEON_IRQ_MSI_BIT0;282282+ int msi_number = data->irq - OCTEON_IRQ_MSI_BIT0;283283 int irq_index = msi_number >> 6;284284 int irq_bit = msi_number & 0x3f;285285···293293294294static struct irq_chip octeon_irq_chip_msi_pcie = {295295 .name = "MSI",296296- .enable = octeon_irq_msi_enable_pcie,297297- .disable = octeon_irq_msi_disable_pcie,296296+ .irq_enable = octeon_irq_msi_enable_pcie,297297+ .irq_disable = octeon_irq_msi_disable_pcie,298298};299299300300-static void octeon_irq_msi_enable_pci(unsigned int irq)300300+static void octeon_irq_msi_enable_pci(struct irq_data *data)301301{302302 /*303303 * Octeon PCI doesn't have the ability to mask/unmask MSI···308308 */309309}310310311311-static void octeon_irq_msi_disable_pci(unsigned int irq)311311+static void octeon_irq_msi_disable_pci(struct irq_data *data)312312{313313 /* See comment in enable */314314}315315316316static struct irq_chip octeon_irq_chip_msi_pci = {317317 .name = "MSI",318318- .enable = octeon_irq_msi_enable_pci,319319- .disable = octeon_irq_msi_disable_pci,318318+ .irq_enable = octeon_irq_msi_enable_pci,319319+ .irq_disable = octeon_irq_msi_disable_pci,320320};321321322322/*···388388 }389389390390 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++)391391- set_irq_chip_and_handler(irq, msi, handle_simple_irq);391391+ irq_set_chip_and_handler(irq, msi, handle_simple_irq);392392393393 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {394394 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
+1-1
arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
···182182183183 /* initialize all the IRQ descriptors */184184 for (i = MSP_CIC_INTBASE ; i < MSP_CIC_INTBASE + 32 ; i++) {185185- set_irq_chip_and_handler(i, &msp_cic_irq_controller,185185+ irq_set_chip_and_handler(i, &msp_cic_irq_controller,186186 handle_level_irq);187187#ifdef CONFIG_MIPS_MT_SMTC188188 /* Mask of CIC interrupt */
+1-1
arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
···77777878 /* initialize all the IRQ descriptors */7979 for (i = MSP_SLP_INTBASE; i < MSP_PER_INTBASE + 32; i++)8080- set_irq_chip_and_handler(i, &msp_slp_irq_controller,8080+ irq_set_chip_and_handler(i, &msp_slp_irq_controller,8181 handle_level_irq);8282}8383
···259259 /* Set IRQ information in irq_desc */260260 for (irq = PNX833X_PIC_IRQ_BASE; irq < (PNX833X_PIC_IRQ_BASE + PNX833X_PIC_NUM_IRQ); irq++) {261261 pnx833x_hard_disable_pic_irq(irq);262262- set_irq_chip_and_handler(irq, &pnx833x_pic_irq_type, handle_simple_irq);262262+ irq_set_chip_and_handler(irq, &pnx833x_pic_irq_type,263263+ handle_simple_irq);263264 }264265265266 for (irq = PNX833X_GPIO_IRQ_BASE; irq < (PNX833X_GPIO_IRQ_BASE + PNX833X_GPIO_NUM_IRQ); irq++)266266- set_irq_chip_and_handler(irq, &pnx833x_gpio_irq_type, handle_simple_irq);267267+ irq_set_chip_and_handler(irq, &pnx833x_gpio_irq_type,268268+ handle_simple_irq);267269268270 /* Set PIC priority limiter register to 0 */269271 PNX833X_PIC_INT_PRIORITY = 0;
+5-5
arch/mips/pnx8550/common/int.c
···183183 int configPR;184184185185 for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++)186186- set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);186186+ irq_set_chip_and_handler(i, &level_irq_type, handle_level_irq);187187188188 /* init of GIC/IPC interrupts */189189 /* should be done before cp0 since cp0 init enables the GIC int */···206206 /* mask/priority is still 0 so we will not get any207207 * interrupts until it is unmasked */208208209209- set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);209209+ irq_set_chip_and_handler(i, &level_irq_type, handle_level_irq);210210 }211211212212 /* Priority level 0 */···215215 /* Set int vector table address */216216 PNX8550_GIC_VECTOR_0 = PNX8550_GIC_VECTOR_1 = 0;217217218218- set_irq_chip_and_handler(MIPS_CPU_GIC_IRQ, &level_irq_type,218218+ irq_set_chip_and_handler(MIPS_CPU_GIC_IRQ, &level_irq_type,219219 handle_level_irq);220220 setup_irq(MIPS_CPU_GIC_IRQ, &gic_action);221221222222 /* init of Timer interrupts */223223 for (i = PNX8550_INT_TIMER_MIN; i <= PNX8550_INT_TIMER_MAX; i++)224224- set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq);224224+ irq_set_chip_and_handler(i, &level_irq_type, handle_level_irq);225225226226 /* Stop Timer 1-3 */227227 configPR = read_c0_config7();228228 configPR |= 0x00000038;229229 write_c0_config7(configPR);230230231231- set_irq_chip_and_handler(MIPS_CPU_TIMER_IRQ, &level_irq_type,231231+ irq_set_chip_and_handler(MIPS_CPU_TIMER_IRQ, &level_irq_type,232232 handle_level_irq);233233 setup_irq(MIPS_CPU_TIMER_IRQ, &timer_action);234234}
+1-1
arch/mips/powertv/asic/irq_asic.c
···112112 * Initialize interrupt handlers.113113 */114114 for (i = 0; i < NR_IRQS; i++)115115- set_irq_chip_and_handler(i, &asic_irq_chip, handle_level_irq);115115+ irq_set_chip_and_handler(i, &asic_irq_chip, handle_level_irq);116116}
+2-2
arch/mips/rb532/irq.c
···207207 pr_info("Initializing IRQ's: %d out of %d\n", RC32434_NR_IRQS, NR_IRQS);208208209209 for (i = 0; i < RC32434_NR_IRQS; i++)210210- set_irq_chip_and_handler(i, &rc32434_irq_type,211211- handle_level_irq);210210+ irq_set_chip_and_handler(i, &rc32434_irq_type,211211+ handle_level_irq);212212}213213214214/* Main Interrupt dispatcher */
+1-1
arch/mips/sgi-ip22/ip22-int.c
···312312 else313313 handler = &ip22_local3_irq_type;314314315315- set_irq_chip_and_handler(i, handler, handle_level_irq);315315+ irq_set_chip_and_handler(i, handler, handle_level_irq);316316 }317317318318 /* vector handler. this register the IRQ as non-sharable */
···153153 panic("Allocation of irq number for timer failed");154154 } while (xchg(&rt_timer_irq, irq));155155156156- set_irq_chip_and_handler(irq, &rt_irq_type, handle_percpu_irq);156156+ irq_set_chip_and_handler(irq, &rt_irq_type, handle_percpu_irq);157157 setup_irq(irq, &hub_rt_irqaction);158158}159159
+24-16
arch/mips/sgi-ip32/ip32-irq.c
···451451 for (irq = CRIME_IRQ_BASE; irq <= IP32_IRQ_MAX; irq++) {452452 switch (irq) {453453 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:454454- set_irq_chip_and_handler_name(irq,&ip32_mace_interrupt,455455- handle_level_irq, "level");454454+ irq_set_chip_and_handler_name(irq,455455+ &ip32_mace_interrupt,456456+ handle_level_irq,457457+ "level");456458 break;457459458460 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ:459459- set_irq_chip_and_handler_name(irq,460460- &ip32_macepci_interrupt, handle_level_irq,461461- "level");461461+ irq_set_chip_and_handler_name(irq,462462+ &ip32_macepci_interrupt,463463+ handle_level_irq,464464+ "level");462465 break;463466464467 case CRIME_CPUERR_IRQ:465468 case CRIME_MEMERR_IRQ:466466- set_irq_chip_and_handler_name(irq,467467- &crime_level_interrupt, handle_level_irq,468468- "level");469469+ irq_set_chip_and_handler_name(irq,470470+ &crime_level_interrupt,471471+ handle_level_irq,472472+ "level");469473 break;470474471475 case CRIME_GBE0_IRQ ... CRIME_GBE3_IRQ:472476 case CRIME_RE_EMPTY_E_IRQ ... CRIME_RE_IDLE_E_IRQ:473477 case CRIME_SOFT0_IRQ ... CRIME_SOFT2_IRQ:474478 case CRIME_VICE_IRQ:475475- set_irq_chip_and_handler_name(irq,476476- &crime_edge_interrupt, handle_edge_irq, "edge");479479+ irq_set_chip_and_handler_name(irq,480480+ &crime_edge_interrupt,481481+ handle_edge_irq,482482+ "edge");477483 break;478484479485 case MACEISA_PARALLEL_IRQ:480486 case MACEISA_SERIAL1_TDMAPR_IRQ:481487 case MACEISA_SERIAL2_TDMAPR_IRQ:482482- set_irq_chip_and_handler_name(irq,483483- &ip32_maceisa_edge_interrupt, handle_edge_irq,484484- "edge");488488+ irq_set_chip_and_handler_name(irq,489489+ &ip32_maceisa_edge_interrupt,490490+ handle_edge_irq,491491+ "edge");485492 break;486493487494 default:488488- set_irq_chip_and_handler_name(irq,489489- &ip32_maceisa_level_interrupt, handle_level_irq,490490- "level");495495+ irq_set_chip_and_handler_name(irq,496496+ &ip32_maceisa_level_interrupt,497497+ handle_level_irq,498498+ "level");491499 break;492500 }493501 }
+2-1
arch/mips/sibyte/bcm1480/irq.c
···216216 int i;217217218218 for (i = 0; i < BCM1480_NR_IRQS; i++) {219219- set_irq_chip_and_handler(i, &bcm1480_irq_type, handle_level_irq);219219+ irq_set_chip_and_handler(i, &bcm1480_irq_type,220220+ handle_level_irq);220221 bcm1480_irq_owner[i] = 0;221222 }222223}
+2-1
arch/mips/sibyte/sb1250/irq.c
···190190 int i;191191192192 for (i = 0; i < SB1250_NR_IRQS; i++) {193193- set_irq_chip_and_handler(i, &sb1250_irq_type, handle_level_irq);193193+ irq_set_chip_and_handler(i, &sb1250_irq_type,194194+ handle_level_irq);194195 sb1250_irq_owner[i] = 0;195196 }196197}
+1-1
arch/mips/sni/a20r.c
···209209 int i;210210211211 for (i = SNI_A20R_IRQ_BASE + 2 ; i < SNI_A20R_IRQ_BASE + 8; i++)212212- set_irq_chip_and_handler(i, &a20r_irq_type, handle_level_irq);212212+ irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq);213213 sni_hwint = a20r_hwint;214214 change_c0_status(ST0_IM, IE_IRQ0);215215 setup_irq(SNI_A20R_IRQ_BASE + 3, &sni_isa_irq);
+1-1
arch/mips/sni/pcimt.c
···296296 mips_cpu_irq_init();297297 /* Actually we've got more interrupts to handle ... */298298 for (i = PCIMT_IRQ_INT2; i <= PCIMT_IRQ_SCSI; i++)299299- set_irq_chip_and_handler(i, &pcimt_irq_type, handle_level_irq);299299+ irq_set_chip_and_handler(i, &pcimt_irq_type, handle_level_irq);300300 sni_hwint = sni_pcimt_hwint;301301 change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ3);302302}
+2-2
arch/mips/sni/pcit.c
···238238239239 mips_cpu_irq_init();240240 for (i = SNI_PCIT_INT_START; i <= SNI_PCIT_INT_END; i++)241241- set_irq_chip_and_handler(i, &pcit_irq_type, handle_level_irq);241241+ irq_set_chip_and_handler(i, &pcit_irq_type, handle_level_irq);242242 *(volatile u32 *)SNI_PCIT_INT_REG = 0;243243 sni_hwint = sni_pcit_hwint;244244 change_c0_status(ST0_IM, IE_IRQ1);···251251252252 mips_cpu_irq_init();253253 for (i = SNI_PCIT_INT_START; i <= SNI_PCIT_INT_END; i++)254254- set_irq_chip_and_handler(i, &pcit_irq_type, handle_level_irq);254254+ irq_set_chip_and_handler(i, &pcit_irq_type, handle_level_irq);255255 *(volatile u32 *)SNI_PCIT_INT_REG = 0x40000000;256256 sni_hwint = sni_pcit_hwint_cplus;257257 change_c0_status(ST0_IM, IE_IRQ0);
+2-2
arch/mips/sni/rm200.c
···413413 sni_rm200_init_8259A();414414415415 for (i = RM200_I8259A_IRQ_BASE; i < RM200_I8259A_IRQ_BASE + 16; i++)416416- set_irq_chip_and_handler(i, &sni_rm200_i8259A_chip,416416+ irq_set_chip_and_handler(i, &sni_rm200_i8259A_chip,417417 handle_level_irq);418418419419 setup_irq(RM200_I8259A_IRQ_BASE + PIC_CASCADE_IR, &sni_rm200_irq2);···477477 mips_cpu_irq_init();478478 /* Actually we've got more interrupts to handle ... */479479 for (i = SNI_RM200_INT_START; i <= SNI_RM200_INT_END; i++)480480- set_irq_chip_and_handler(i, &rm200_irq_type, handle_level_irq);480480+ irq_set_chip_and_handler(i, &rm200_irq_type, handle_level_irq);481481 sni_hwint = sni_rm200_hwint;482482 change_c0_status(ST0_IM, IE_IRQ0);483483 setup_irq(SNI_RM200_INT_START + 0, &sni_rm200_i8259A_irq);
···156156 u16 tmp16;157157158158 /* set up the reschedule IPI */159159- set_irq_chip_and_handler(RESCHEDULE_IPI,160160- &mn10300_ipi_type, handle_percpu_irq);159159+ irq_set_chip_and_handler(RESCHEDULE_IPI, &mn10300_ipi_type,160160+ handle_percpu_irq);161161 setup_irq(RESCHEDULE_IPI, &reschedule_ipi);162162 set_intr_level(RESCHEDULE_IPI, RESCHEDULE_GxICR_LV);163163 mn10300_ipi_enable(RESCHEDULE_IPI);164164165165 /* set up the call function IPI */166166- set_irq_chip_and_handler(CALL_FUNC_SINGLE_IPI,167167- &mn10300_ipi_type, handle_percpu_irq);166166+ irq_set_chip_and_handler(CALL_FUNC_SINGLE_IPI, &mn10300_ipi_type,167167+ handle_percpu_irq);168168 setup_irq(CALL_FUNC_SINGLE_IPI, &call_function_ipi);169169 set_intr_level(CALL_FUNC_SINGLE_IPI, CALL_FUNCTION_GxICR_LV);170170 mn10300_ipi_enable(CALL_FUNC_SINGLE_IPI);···172172 /* set up the local timer IPI */173173#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || \174174 defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)175175- set_irq_chip_and_handler(LOCAL_TIMER_IPI,176176- &mn10300_ipi_type, handle_percpu_irq);175175+ irq_set_chip_and_handler(LOCAL_TIMER_IPI, &mn10300_ipi_type,176176+ handle_percpu_irq);177177 setup_irq(LOCAL_TIMER_IPI, &local_timer_ipi);178178 set_intr_level(LOCAL_TIMER_IPI, LOCAL_TIMER_GxICR_LV);179179 mn10300_ipi_enable(LOCAL_TIMER_IPI);
+2-1
arch/mn10300/unit-asb2364/irq-fpga.c
···100100 SyncExBus();101101102102 for (irq = NR_CPU_IRQS; irq < NR_IRQS; irq++)103103- set_irq_chip_and_handler(irq, &asb2364_fpga_pic, handle_level_irq);103103+ irq_set_chip_and_handler(irq, &asb2364_fpga_pic,104104+ handle_level_irq);104105105106 /* the FPGA drives the XIRQ1 input on the CPU PIC */106107 setup_irq(XIRQ1, &fpga_irq[0]);
-1
arch/parisc/Kconfig
···1515 select HAVE_GENERIC_HARDIRQS1616 select GENERIC_IRQ_PROBE1717 select IRQ_PER_CPU1818- select GENERIC_HARDIRQS_NO_DEPRECATED19182019 help2120 The PA-RISC microprocessor is designed by Hewlett-Packard and used
+14-18
arch/parisc/kernel/irq.c
···113113 int cpu_dest;114114115115 /* timer and ipi have to always be received on all CPUs */116116- if (CHECK_IRQ_PER_CPU(irq_to_desc(d->irq)->status)) {117117- /* Bad linux design decision. The mask has already118118- * been set; we must reset it. Will fix - tglx119119- */120120- cpumask_setall(d->affinity);116116+ if (irqd_is_per_cpu(d))121117 return -EINVAL;122122- }123118124119 /* whatever mask they set, we just allow one CPU */125120 cpu_dest = first_cpu(*dest);···169174 }170175171176 if (i < NR_IRQS) {177177+ struct irq_desc *desc = irq_to_desc(i);172178 struct irqaction *action;173179174174- raw_spin_lock_irqsave(&irq_desc[i].lock, flags);175175- action = irq_desc[i].action;180180+ raw_spin_lock_irqsave(&desc->lock, flags);181181+ action = desc->action;176182 if (!action)177183 goto skip;178184 seq_printf(p, "%3d: ", i);···184188 seq_printf(p, "%10u ", kstat_irqs(i));185189#endif186190187187- seq_printf(p, " %14s", irq_desc[i].irq_data.chip->name);191191+ seq_printf(p, " %14s", irq_desc_get_chip(desc)->name);188192#ifndef PARISC_IRQ_CR16_COUNTS189193 seq_printf(p, " %s", action->name);190194···216220217221 seq_putc(p, '\n');218222 skip:219219- raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);223223+ raw_spin_unlock_irqrestore(&desc->lock, flags);220224 }221225222226 return 0;···234238235239int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)236240{237237- if (irq_desc[irq].action)241241+ if (irq_has_action(irq))238242 return -EBUSY;239239- if (get_irq_chip(irq) != &cpu_interrupt_type)243243+ if (irq_get_chip(irq) != &cpu_interrupt_type)240244 return -EBUSY;241245242246 /* for iosapic interrupts */243247 if (type) {244244- set_irq_chip_and_handler(irq, type, handle_percpu_irq);245245- set_irq_chip_data(irq, data);248248+ irq_set_chip_and_handler(irq, type, handle_percpu_irq);249249+ irq_set_chip_data(irq, data);246250 __cpu_unmask_irq(irq);247251 }248252 return 0;···353357#ifdef CONFIG_SMP354358 desc = irq_to_desc(irq);355359 cpumask_copy(&dest, desc->irq_data.affinity);356356- if (CHECK_IRQ_PER_CPU(desc->status) &&360360+ if (irqd_is_per_cpu(&desc->irq_data) &&357361 !cpu_isset(smp_processor_id(), dest)) {358362 int cpu = first_cpu(dest);359363···394398{395399 int i;396400 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) {397397- set_irq_chip_and_handler(i, &cpu_interrupt_type,401401+ irq_set_chip_and_handler(i, &cpu_interrupt_type,398402 handle_percpu_irq);399403 }400404401401- set_irq_handler(TIMER_IRQ, handle_percpu_irq);405405+ irq_set_handler(TIMER_IRQ, handle_percpu_irq);402406 setup_irq(TIMER_IRQ, &timer_action);403407#ifdef CONFIG_SMP404404- set_irq_handler(IPI_IRQ, handle_percpu_irq);408408+ irq_set_handler(IPI_IRQ, handle_percpu_irq);405409 setup_irq(IPI_IRQ, &ipi_action);406410#endif407411}
···3232CONFIG_BLK_DEV_LOOP=y3333CONFIG_BLK_DEV_RAM=y3434CONFIG_BLK_DEV_RAM_SIZE=1310723535+CONFIG_MISC_DEVICES=y3536CONFIG_EEPROM_LEGACY=y3637CONFIG_INPUT_FF_MEMLESS=m3738# CONFIG_INPUT_MOUSEDEV is not set
···6161CONFIG_BLK_DEV_RAM_COUNT=16262CONFIG_BLK_DEV_RAM_SIZE=81926363CONFIG_BLK_DEV_XIP=y6464+CONFIG_MISC_DEVICES=y6465CONFIG_EEPROM_AT24=y6566CONFIG_SCSI=y6667# CONFIG_SCSI_PROC_FS is not set
···977977 rfid978978 b . /* prevent speculative execution */979979980980-/*981981- * Space for CPU0's segment table.982982- *983983- * On iSeries, the hypervisor must fill in at least one entry before984984- * we get control (with relocate on). The address is given to the hv985985- * as a page number (see xLparMap below), so this must be at a986986- * fixed address (the linker can't compute (u64)&initial_stab >>987987- * PAGE_SHIFT).988988- */989989- . = STAB0_OFFSET /* 0x6000 */990990- .globl initial_stab991991-initial_stab:992992- .space 4096993993-994980#ifdef CONFIG_PPC_PSERIES995981/*996982 * Data area reserved for FWNMI option.···10131027#ifdef CONFIG_PPC_PSERIES10141028 . = 0x800010151029#endif /* CONFIG_PPC_PSERIES */10301030+10311031+/*10321032+ * Space for CPU0's segment table.10331033+ *10341034+ * On iSeries, the hypervisor must fill in at least one entry before10351035+ * we get control (with relocate on). The address is given to the hv10361036+ * as a page number (see xLparMap above), so this must be at a10371037+ * fixed address (the linker can't compute (u64)&initial_stab >>10381038+ * PAGE_SHIFT).10391039+ */10401040+ . = STAB0_OFFSET /* 0x8000 */10411041+ .globl initial_stab10421042+initial_stab:10431043+ .space 4096
+12-69
arch/powerpc/kernel/irq.c
···195195EXPORT_SYMBOL(arch_local_irq_restore);196196#endif /* CONFIG_PPC64 */197197198198-static int show_other_interrupts(struct seq_file *p, int prec)198198+int arch_show_interrupts(struct seq_file *p, int prec)199199{200200 int j;201201···231231 return 0;232232}233233234234-int show_interrupts(struct seq_file *p, void *v)235235-{236236- unsigned long flags, any_count = 0;237237- int i = *(loff_t *) v, j, prec;238238- struct irqaction *action;239239- struct irq_desc *desc;240240- struct irq_chip *chip;241241-242242- if (i > nr_irqs)243243- return 0;244244-245245- for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)246246- j *= 10;247247-248248- if (i == nr_irqs)249249- return show_other_interrupts(p, prec);250250-251251- /* print header */252252- if (i == 0) {253253- seq_printf(p, "%*s", prec + 8, "");254254- for_each_online_cpu(j)255255- seq_printf(p, "CPU%-8d", j);256256- seq_putc(p, '\n');257257- }258258-259259- desc = irq_to_desc(i);260260- if (!desc)261261- return 0;262262-263263- raw_spin_lock_irqsave(&desc->lock, flags);264264- for_each_online_cpu(j)265265- any_count |= kstat_irqs_cpu(i, j);266266- action = desc->action;267267- if (!action && !any_count)268268- goto out;269269-270270- seq_printf(p, "%*d: ", prec, i);271271- for_each_online_cpu(j)272272- seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));273273-274274- chip = get_irq_desc_chip(desc);275275- if (chip)276276- seq_printf(p, " %-16s", chip->name);277277- else278278- seq_printf(p, " %-16s", "None");279279- seq_printf(p, " %-8s", (desc->status & IRQ_LEVEL) ? "Level" : "Edge");280280-281281- if (action) {282282- seq_printf(p, " %s", action->name);283283- while ((action = action->next) != NULL)284284- seq_printf(p, ", %s", action->name);285285- }286286-287287- seq_putc(p, '\n');288288-out:289289- raw_spin_unlock_irqrestore(&desc->lock, flags);290290- return 0;291291-}292292-293234/*294235 * /proc/stat helpers295236 */···256315 alloc_cpumask_var(&mask, GFP_KERNEL);257316258317 for_each_irq(irq) {318318+ struct irq_data *data;259319 struct irq_chip *chip;260320261321 desc = irq_to_desc(irq);262322 if (!desc)263323 continue;264324265265- if (desc->status & IRQ_PER_CPU)325325+ data = irq_desc_get_irq_data(desc);326326+ if (irqd_is_per_cpu(data))266327 continue;267328268268- chip = get_irq_desc_chip(desc);329329+ chip = irq_data_get_irq_chip(data);269330270270- cpumask_and(mask, desc->irq_data.affinity, map);331331+ cpumask_and(mask, data->affinity, map);271332 if (cpumask_any(mask) >= nr_cpu_ids) {272333 printk("Breaking affinity for irq %i\n", irq);273334 cpumask_copy(mask, map);274335 }275336 if (chip->irq_set_affinity)276276- chip->irq_set_affinity(&desc->irq_data, mask, true);337337+ chip->irq_set_affinity(data, mask, true);277338 else if (desc->action && !(warned++))278339 printk("Cannot set affinity for irq %i\n", irq);279340 }···561618 smp_wmb();562619563620 /* Clear norequest flags */564564- irq_to_desc(i)->status &= ~IRQ_NOREQUEST;621621+ irq_clear_status_flags(i, IRQ_NOREQUEST);565622566623 /* Legacy flags are left to default at this point,567624 * one can then use irq_create_mapping() to···770827771828 /* Set type if specified and different than the current one */772829 if (type != IRQ_TYPE_NONE &&773773- type != (irq_to_desc(virq)->status & IRQF_TRIGGER_MASK))774774- set_irq_type(virq, type);830830+ type != (irqd_get_trigger_type(irq_get_irq_data(virq))))831831+ irq_set_irq_type(virq, type);775832 return virq;776833}777834EXPORT_SYMBOL_GPL(irq_create_of_mapping);···794851 return;795852796853 /* remove chip and handler */797797- set_irq_chip_and_handler(virq, NULL, NULL);854854+ irq_set_chip_and_handler(virq, NULL, NULL);798855799856 /* Make sure it's completed */800857 synchronize_irq(virq);···10991156 seq_printf(m, "%5d ", i);11001157 seq_printf(m, "0x%05lx ", virq_to_hw(i));1101115811021102- chip = get_irq_desc_chip(desc);11591159+ chip = irq_desc_get_chip(desc);11031160 if (chip && chip->name)11041161 p = chip->name;11051162 else
+3-3
arch/powerpc/kernel/machine_kexec.c
···3131 if (!desc)3232 continue;33333434- chip = get_irq_desc_chip(desc);3434+ chip = irq_desc_get_chip(desc);3535 if (!chip)3636 continue;37373838- if (chip->irq_eoi && desc->status & IRQ_INPROGRESS)3838+ if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))3939 chip->irq_eoi(&desc->irq_data);40404141 if (chip->irq_mask)4242 chip->irq_mask(&desc->irq_data);43434444- if (chip->irq_disable && !(desc->status & IRQ_DISABLED))4444+ if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))4545 chip->irq_disable(&desc->irq_data);4646 }4747}
···356356 }357357 get_paca()->user_time_scaled += user_scaled;358358359359- if (in_irq() || idle_task(smp_processor_id()) != tsk) {359359+ if (in_interrupt() || idle_task(smp_processor_id()) != tsk) {360360 account_system_time(tsk, 0, delta, sys_scaled);361361 if (stolen)362362 account_steal_time(stolen);
+20
arch/powerpc/mm/dma-noncoherent.c
···399399#endif400400}401401EXPORT_SYMBOL(__dma_sync_page);402402+403403+/*404404+ * Return the PFN for a given cpu virtual address returned by405405+ * __dma_alloc_coherent. This is used by dma_mmap_coherent()406406+ */407407+unsigned long __dma_get_coherent_pfn(unsigned long cpu_addr)408408+{409409+ /* This should always be populated, so we don't test every410410+ * level. If that fails, we'll have a nice crash which411411+ * will be as good as a BUG_ON()412412+ */413413+ pgd_t *pgd = pgd_offset_k(cpu_addr);414414+ pud_t *pud = pud_offset(pgd, cpu_addr);415415+ pmd_t *pmd = pmd_offset(pud, cpu_addr);416416+ pte_t *ptep = pte_offset_kernel(pmd, cpu_addr);417417+418418+ if (pte_none(*ptep) || !pte_present(*ptep))419419+ return 0;420420+ return pte_pfn(*ptep);421421+}
···192192193193void mpc52xx_gpt_irq_cascade(unsigned int virq, struct irq_desc *desc)194194{195195- struct mpc52xx_gpt_priv *gpt = get_irq_data(virq);195195+ struct mpc52xx_gpt_priv *gpt = irq_get_handler_data(virq);196196 int sub_virq;197197 u32 status;198198···209209 struct mpc52xx_gpt_priv *gpt = h->host_data;210210211211 dev_dbg(gpt->dev, "%s: h=%p, virq=%i\n", __func__, h, virq);212212- set_irq_chip_data(virq, gpt);213213- set_irq_chip_and_handler(virq, &mpc52xx_gpt_irq_chip, handle_edge_irq);212212+ irq_set_chip_data(virq, gpt);213213+ irq_set_chip_and_handler(virq, &mpc52xx_gpt_irq_chip, handle_edge_irq);214214215215 return 0;216216}···259259 }260260261261 gpt->irqhost->host_data = gpt;262262- set_irq_data(cascade_virq, gpt);263263- set_irq_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade);262262+ irq_set_handler_data(cascade_virq, gpt);263263+ irq_set_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade);264264265265 /* If the GPT is currently disabled, then change it to be in Input266266 * Capture mode. If the mode is non-zero, then the pin could be
···175175176176 /* We block the internal cascade */177177 if (hw == 2)178178- irq_to_desc(virq)->status |= IRQ_NOREQUEST;178178+ irq_set_status_flags(virq, IRQ_NOREQUEST);179179180180 /* We use the level handler only for now, we might want to181181 * be more cautious here but that works for now182182 */183183- irq_to_desc(virq)->status |= IRQ_LEVEL;184184- set_irq_chip_and_handler(virq, &i8259_pic, handle_level_irq);183183+ irq_set_status_flags(virq, IRQ_LEVEL);184184+ irq_set_chip_and_handler(virq, &i8259_pic, handle_level_irq);185185 return 0;186186}187187···191191 i8259_mask_irq(irq_get_irq_data(virq));192192193193 /* remove chip and handler */194194- set_irq_chip_and_handler(virq, NULL, NULL);194194+ irq_set_chip_and_handler(virq, NULL, NULL);195195196196 /* Make sure it's completed */197197 synchronize_irq(virq);
+10-12
arch/powerpc/sysdev/ipic.c
···605605{606606 struct ipic *ipic = ipic_from_irq(d->irq);607607 unsigned int src = ipic_irq_to_hw(d->irq);608608- struct irq_desc *desc = irq_to_desc(d->irq);609608 unsigned int vold, vnew, edibit;610609611610 if (flow_type == IRQ_TYPE_NONE)···622623 printk(KERN_ERR "ipic: edge sense not supported on internal "623624 "interrupts\n");624625 return -EINVAL;626626+625627 }626628627627- desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);628628- desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;629629+ irqd_set_trigger_type(d, flow_type);629630 if (flow_type & IRQ_TYPE_LEVEL_LOW) {630630- desc->status |= IRQ_LEVEL;631631- desc->handle_irq = handle_level_irq;632632- desc->irq_data.chip = &ipic_level_irq_chip;631631+ __irq_set_handler_locked(d->irq, handle_level_irq);632632+ d->chip = &ipic_level_irq_chip;633633 } else {634634- desc->handle_irq = handle_edge_irq;635635- desc->irq_data.chip = &ipic_edge_irq_chip;634634+ __irq_set_handler_locked(d->irq, handle_edge_irq);635635+ d->chip = &ipic_edge_irq_chip;636636 }637637638638 /* only EXT IRQ senses are programmable on ipic···653655 }654656 if (vold != vnew)655657 ipic_write(ipic->regs, IPIC_SECNR, vnew);656656- return 0;658658+ return IRQ_SET_MASK_OK_NOCOPY;657659}658660659661/* level interrupts and edge interrupts have different ack operations */···685687{686688 struct ipic *ipic = h->host_data;687689688688- set_irq_chip_data(virq, ipic);689689- set_irq_chip_and_handler(virq, &ipic_level_irq_chip, handle_level_irq);690690+ irq_set_chip_data(virq, ipic);691691+ irq_set_chip_and_handler(virq, &ipic_level_irq_chip, handle_level_irq);690692691693 /* Set default irq type */692692- set_irq_type(virq, IRQ_TYPE_NONE);694694+ irq_set_irq_type(virq, IRQ_TYPE_NONE);693695694696 return 0;695697}
···2323 select HAVE_SPARSE_IRQ2424 select RTC_LIB2525 select GENERIC_ATOMIC642626- select GENERIC_HARDIRQS_NO_DEPRECATED2726 select GENERIC_IRQ_SHOW2827 help2928 The SuperH is a RISC processor targeted for use in embedded systems
···135135136136 /* Set default: per-line enable/disable, priority driven ack/eoi */137137 for (i = 0; i < NR_INTC_IRQS; i++)138138- set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq);138138+ irq_set_chip_and_handler(i, &intc_irq_type, handle_level_irq);139139140140141141 /* Disable all interrupts and set all priorities to 0 to avoid trouble */
···316316 irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT);317317 irq_set_affinity(adev->irq, cpumask_of(adev->cpu));318318 /* APB timer irqs are set up as mp_irqs, timer is edge type */319319- __set_irq_handler(adev->irq, handle_edge_irq, 0, "edge");319319+ __irq_set_handler(adev->irq, handle_edge_irq, 0, "edge");320320321321 if (system_state == SYSTEM_BOOTING) {322322 if (request_irq(adev->irq, apbt_interrupt_handler,
+6-4
arch/x86/xen/p2m.c
···497497 return true;498498}499499500500-bool __early_alloc_p2m(unsigned long pfn)500500+static bool __init __early_alloc_p2m(unsigned long pfn)501501{502502 unsigned topidx, mididx, idx;503503···530530 }531531 return idx != 0;532532}533533-unsigned long set_phys_range_identity(unsigned long pfn_s,533533+unsigned long __init set_phys_range_identity(unsigned long pfn_s,534534 unsigned long pfn_e)535535{536536 unsigned long pfn;···671671 page->private = mfn;672672 page->index = pfn_to_mfn(pfn);673673674674- __set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));674674+ if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))675675+ return -ENOMEM;676676+675677 if (!PageHighMem(page))676678 /* Just zap old mapping for now */677679 pte_clear(&init_mm, address, ptep);···711709 spin_lock_irqsave(&m2p_override_lock, flags);712710 list_del(&page->lru);713711 spin_unlock_irqrestore(&m2p_override_lock, flags);714714- __set_phys_to_machine(pfn, page->index);712712+ set_phys_to_machine(pfn, page->index);715713716714 if (!PageHighMem(page))717715 set_pte_at(&init_mm, address, ptep,
-1
arch/xtensa/Kconfig
···99 select HAVE_IDE1010 select HAVE_GENERIC_HARDIRQS1111 select GENERIC_IRQ_SHOW1212- select GENERIC_HARDIRQS_NO_DEPRECATED1312 help1413 Xtensa processors are 32-bit RISC machines designed by Tensilica1514 primarily for embedded systems. These processors are both
···416416417417config AB8500_GPIO418418 bool "ST-Ericsson AB8500 Mixed Signal Circuit gpio functions"419419- depends on AB8500_CORE419419+ depends on AB8500_CORE && BROKEN420420 help421421 Select this to enable the AB8500 IC GPIO driver422422endif
+1-1
drivers/hwmon/gpio-fan.c
···116116 return 0;117117118118 INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);119119- set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);119119+ irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);120120 err = request_irq(alarm_irq, fan_alarm_irq_handler, IRQF_SHARED,121121 "GPIO fan alarm", fan_data);122122 if (err)
···149149 * at FIQ level, switch back from edge to simple interrupt handler150150 * to avoid bad interaction.151151 */152152- set_irq_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),152152+ irq_set_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),153153 handle_simple_irq);154154155155 serio_register_port(ams_delta_serio);
···6060 This driver supports the ASIC3 multifunction chip found on many6161 PDAs (mainly iPAQ and HTC based ones)62626363-config MFD_SH_MOBILE_SDHI6464- bool "Support for SuperH Mobile SDHI"6565- depends on SUPERH || ARCH_SHMOBILE6666- select MFD_CORE6767- select TMIO_MMC_DMA6868- ---help---6969- This driver supports the SDHI hardware block found in many7070- SuperH Mobile SoCs.7171-7263config MFD_DAVINCI_VOICECODEC7364 tristate7465 select MFD_CORE···256265config MFD_TMIO257266 bool258267 default n259259-260260-config TMIO_MMC_DMA261261- bool262262- select DMA_ENGINE263263- select DMADEVICES264268265269config MFD_T7L66XB266270 bool "Support Toshiba T7L66XB"
···99 * your option) any later version.1010 */11111212+#include <linux/slab.h>1213#include <linux/types.h>1314#include <linux/scatterlist.h>1415···253252 struct mmc_command cmd;254253 struct mmc_data data;255254 struct scatterlist sg;255255+ void *data_buf;256256257257 BUG_ON(!card);258258 BUG_ON(!card->host);···264262 err = mmc_app_cmd(card->host, card);265263 if (err)266264 return err;265265+266266+ /* dma onto stack is unsafe/nonportable, but callers to this267267+ * routine normally provide temporary on-stack buffers ...268268+ */269269+ data_buf = kmalloc(sizeof(card->raw_scr), GFP_KERNEL);270270+ if (data_buf == NULL)271271+ return -ENOMEM;267272268273 memset(&mrq, 0, sizeof(struct mmc_request));269274 memset(&cmd, 0, sizeof(struct mmc_command));···289280 data.sg = &sg;290281 data.sg_len = 1;291282292292- sg_init_one(&sg, scr, 8);283283+ sg_init_one(&sg, data_buf, 8);293284294285 mmc_set_data_timeout(&data, card);295286296287 mmc_wait_for_req(card->host, &mrq);288288+289289+ memcpy(scr, data_buf, sizeof(card->raw_scr));290290+ kfree(data_buf);297291298292 if (cmd.error)299293 return cmd.error;
+13-1
drivers/mmc/host/Kconfig
···439439 To compile this driver as a module, choose M here: the440440 module will be called sdricoh_cs.441441442442+config MMC_TMIO_CORE443443+ tristate444444+442445config MMC_TMIO443446 tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support"444444- depends on MFD_TMIO || MFD_ASIC3 || MFD_SH_MOBILE_SDHI447447+ depends on MFD_TMIO || MFD_ASIC3448448+ select MMC_TMIO_CORE445449 help446450 This provides support for the SD/MMC cell found in TC6393XB,447451 T7L66XB and also HTC ASIC3452452+453453+config MMC_SDHI454454+ tristate "SH-Mobile SDHI SD/SDIO controller support"455455+ depends on SUPERH || ARCH_SHMOBILE456456+ select MMC_TMIO_CORE457457+ help458458+ This provides support for the SDHI SD/SDIO controller found in459459+ SuperH and ARM SH-Mobile SoCs448460449461config MMC_CB710450462 tristate "ENE CB710 MMC/SD Interface support"
···11/*22- * linux/drivers/mmc/tmio_mmc.c22+ * linux/drivers/mmc/host/tmio_mmc.c33 *44- * Copyright (C) 2004 Ian Molton55- * Copyright (C) 2007 Ian Molton44+ * Copyright (C) 2007 Ian Molton55+ * Copyright (C) 2004 Ian Molton66 *77 * This program is free software; you can redistribute it and/or modify88 * it under the terms of the GNU General Public License version 2 as···1111 * Driver for the MMC / SD / SDIO cell found in:1212 *1313 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC31414- *1515- * This driver draws mainly on scattered spec sheets, Reverse engineering1616- * of the toshiba e800 SD driver and some parts of the 2.4 ASIC3 driver (4 bit1717- * support). (Further 4 bit support from a later datasheet).1818- *1919- * TODO:2020- * Investigate using a workqueue for PIO transfers2121- * Eliminate FIXMEs2222- * SDIO support2323- * Better Power management2424- * Handle MMC errors better2525- * double buffer support2626- *2714 */28152929-#include <linux/delay.h>3016#include <linux/device.h>3131-#include <linux/dmaengine.h>3232-#include <linux/highmem.h>3333-#include <linux/interrupt.h>3434-#include <linux/io.h>3535-#include <linux/irq.h>3617#include <linux/mfd/core.h>3718#include <linux/mfd/tmio.h>3819#include <linux/mmc/host.h>3920#include <linux/module.h>4021#include <linux/pagemap.h>4122#include <linux/scatterlist.h>4242-#include <linux/workqueue.h>4343-#include <linux/spinlock.h>44234545-#define CTL_SD_CMD 0x004646-#define CTL_ARG_REG 0x044747-#define CTL_STOP_INTERNAL_ACTION 0x084848-#define CTL_XFER_BLK_COUNT 0xa4949-#define CTL_RESPONSE 0x0c5050-#define CTL_STATUS 0x1c5151-#define CTL_IRQ_MASK 0x205252-#define CTL_SD_CARD_CLK_CTL 0x245353-#define CTL_SD_XFER_LEN 0x265454-#define CTL_SD_MEM_CARD_OPT 0x285555-#define CTL_SD_ERROR_DETAIL_STATUS 0x2c5656-#define CTL_SD_DATA_PORT 0x305757-#define CTL_TRANSACTION_CTL 0x345858-#define CTL_SDIO_STATUS 0x365959-#define CTL_SDIO_IRQ_MASK 0x386060-#define CTL_RESET_SD 0xe06161-#define CTL_SDIO_REGS 0x1006262-#define CTL_CLK_AND_WAIT_CTL 0x1386363-#define CTL_RESET_SDIO 0x1e06464-6565-/* Definitions for values the CTRL_STATUS register can take. */6666-#define TMIO_STAT_CMDRESPEND 0x000000016767-#define TMIO_STAT_DATAEND 0x000000046868-#define TMIO_STAT_CARD_REMOVE 0x000000086969-#define TMIO_STAT_CARD_INSERT 0x000000107070-#define TMIO_STAT_SIGSTATE 0x000000207171-#define TMIO_STAT_WRPROTECT 0x000000807272-#define TMIO_STAT_CARD_REMOVE_A 0x000001007373-#define TMIO_STAT_CARD_INSERT_A 0x000002007474-#define TMIO_STAT_SIGSTATE_A 0x000004007575-#define TMIO_STAT_CMD_IDX_ERR 0x000100007676-#define TMIO_STAT_CRCFAIL 0x000200007777-#define TMIO_STAT_STOPBIT_ERR 0x000400007878-#define TMIO_STAT_DATATIMEOUT 0x000800007979-#define TMIO_STAT_RXOVERFLOW 0x001000008080-#define TMIO_STAT_TXUNDERRUN 0x002000008181-#define TMIO_STAT_CMDTIMEOUT 0x004000008282-#define TMIO_STAT_RXRDY 0x010000008383-#define TMIO_STAT_TXRQ 0x020000008484-#define TMIO_STAT_ILL_FUNC 0x200000008585-#define TMIO_STAT_CMD_BUSY 0x400000008686-#define TMIO_STAT_ILL_ACCESS 0x800000008787-8888-/* Definitions for values the CTRL_SDIO_STATUS register can take. */8989-#define TMIO_SDIO_STAT_IOIRQ 0x00019090-#define TMIO_SDIO_STAT_EXPUB52 0x40009191-#define TMIO_SDIO_STAT_EXWT 0x80009292-#define TMIO_SDIO_MASK_ALL 0xc0079393-9494-/* Define some IRQ masks */9595-/* This is the mask used at reset by the chip */9696-#define TMIO_MASK_ALL 0x837f031d9797-#define TMIO_MASK_READOP (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND)9898-#define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND)9999-#define TMIO_MASK_CMD (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT | \100100- TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)101101-#define TMIO_MASK_IRQ (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)102102-103103-#define enable_mmc_irqs(host, i) \104104- do { \105105- u32 mask;\106106- mask = sd_ctrl_read32((host), CTL_IRQ_MASK); \107107- mask &= ~((i) & TMIO_MASK_IRQ); \108108- sd_ctrl_write32((host), CTL_IRQ_MASK, mask); \109109- } while (0)110110-111111-#define disable_mmc_irqs(host, i) \112112- do { \113113- u32 mask;\114114- mask = sd_ctrl_read32((host), CTL_IRQ_MASK); \115115- mask |= ((i) & TMIO_MASK_IRQ); \116116- sd_ctrl_write32((host), CTL_IRQ_MASK, mask); \117117- } while (0)118118-119119-#define ack_mmc_irqs(host, i) \120120- do { \121121- sd_ctrl_write32((host), CTL_STATUS, ~(i)); \122122- } while (0)123123-124124-/* This is arbitrary, just noone needed any higher alignment yet */125125-#define MAX_ALIGN 4126126-127127-struct tmio_mmc_host {128128- void __iomem *ctl;129129- unsigned long bus_shift;130130- struct mmc_command *cmd;131131- struct mmc_request *mrq;132132- struct mmc_data *data;133133- struct mmc_host *mmc;134134- int irq;135135- unsigned int sdio_irq_enabled;136136-137137- /* Callbacks for clock / power control */138138- void (*set_pwr)(struct platform_device *host, int state);139139- void (*set_clk_div)(struct platform_device *host, int state);140140-141141- /* pio related stuff */142142- struct scatterlist *sg_ptr;143143- struct scatterlist *sg_orig;144144- unsigned int sg_len;145145- unsigned int sg_off;146146-147147- struct platform_device *pdev;148148-149149- /* DMA support */150150- struct dma_chan *chan_rx;151151- struct dma_chan *chan_tx;152152- struct tasklet_struct dma_complete;153153- struct tasklet_struct dma_issue;154154-#ifdef CONFIG_TMIO_MMC_DMA155155- u8 bounce_buf[PAGE_CACHE_SIZE] __attribute__((aligned(MAX_ALIGN)));156156- struct scatterlist bounce_sg;157157-#endif158158-159159- /* Track lost interrupts */160160- struct delayed_work delayed_reset_work;161161- spinlock_t lock;162162- unsigned long last_req_ts;163163-};164164-165165-static void tmio_check_bounce_buffer(struct tmio_mmc_host *host);166166-167167-static u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)168168-{169169- return readw(host->ctl + (addr << host->bus_shift));170170-}171171-172172-static void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,173173- u16 *buf, int count)174174-{175175- readsw(host->ctl + (addr << host->bus_shift), buf, count);176176-}177177-178178-static u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)179179-{180180- return readw(host->ctl + (addr << host->bus_shift)) |181181- readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;182182-}183183-184184-static void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)185185-{186186- writew(val, host->ctl + (addr << host->bus_shift));187187-}188188-189189-static void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,190190- u16 *buf, int count)191191-{192192- writesw(host->ctl + (addr << host->bus_shift), buf, count);193193-}194194-195195-static void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)196196-{197197- writew(val, host->ctl + (addr << host->bus_shift));198198- writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));199199-}200200-201201-static void tmio_mmc_init_sg(struct tmio_mmc_host *host, struct mmc_data *data)202202-{203203- host->sg_len = data->sg_len;204204- host->sg_ptr = data->sg;205205- host->sg_orig = data->sg;206206- host->sg_off = 0;207207-}208208-209209-static int tmio_mmc_next_sg(struct tmio_mmc_host *host)210210-{211211- host->sg_ptr = sg_next(host->sg_ptr);212212- host->sg_off = 0;213213- return --host->sg_len;214214-}215215-216216-static char *tmio_mmc_kmap_atomic(struct scatterlist *sg, unsigned long *flags)217217-{218218- local_irq_save(*flags);219219- return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;220220-}221221-222222-static void tmio_mmc_kunmap_atomic(struct scatterlist *sg, unsigned long *flags, void *virt)223223-{224224- kunmap_atomic(virt - sg->offset, KM_BIO_SRC_IRQ);225225- local_irq_restore(*flags);226226-}227227-228228-#ifdef CONFIG_MMC_DEBUG229229-230230-#define STATUS_TO_TEXT(a, status, i) \231231- do { \232232- if (status & TMIO_STAT_##a) { \233233- if (i++) \234234- printk(" | "); \235235- printk(#a); \236236- } \237237- } while (0)238238-239239-void pr_debug_status(u32 status)240240-{241241- int i = 0;242242- printk(KERN_DEBUG "status: %08x = ", status);243243- STATUS_TO_TEXT(CARD_REMOVE, status, i);244244- STATUS_TO_TEXT(CARD_INSERT, status, i);245245- STATUS_TO_TEXT(SIGSTATE, status, i);246246- STATUS_TO_TEXT(WRPROTECT, status, i);247247- STATUS_TO_TEXT(CARD_REMOVE_A, status, i);248248- STATUS_TO_TEXT(CARD_INSERT_A, status, i);249249- STATUS_TO_TEXT(SIGSTATE_A, status, i);250250- STATUS_TO_TEXT(CMD_IDX_ERR, status, i);251251- STATUS_TO_TEXT(STOPBIT_ERR, status, i);252252- STATUS_TO_TEXT(ILL_FUNC, status, i);253253- STATUS_TO_TEXT(CMD_BUSY, status, i);254254- STATUS_TO_TEXT(CMDRESPEND, status, i);255255- STATUS_TO_TEXT(DATAEND, status, i);256256- STATUS_TO_TEXT(CRCFAIL, status, i);257257- STATUS_TO_TEXT(DATATIMEOUT, status, i);258258- STATUS_TO_TEXT(CMDTIMEOUT, status, i);259259- STATUS_TO_TEXT(RXOVERFLOW, status, i);260260- STATUS_TO_TEXT(TXUNDERRUN, status, i);261261- STATUS_TO_TEXT(RXRDY, status, i);262262- STATUS_TO_TEXT(TXRQ, status, i);263263- STATUS_TO_TEXT(ILL_ACCESS, status, i);264264- printk("\n");265265-}266266-267267-#else268268-#define pr_debug_status(s) do { } while (0)269269-#endif270270-271271-static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)272272-{273273- struct tmio_mmc_host *host = mmc_priv(mmc);274274-275275- if (enable) {276276- host->sdio_irq_enabled = 1;277277- sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);278278- sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK,279279- (TMIO_SDIO_MASK_ALL & ~TMIO_SDIO_STAT_IOIRQ));280280- } else {281281- sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, TMIO_SDIO_MASK_ALL);282282- sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);283283- host->sdio_irq_enabled = 0;284284- }285285-}286286-287287-static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)288288-{289289- u32 clk = 0, clock;290290-291291- if (new_clock) {292292- for (clock = host->mmc->f_min, clk = 0x80000080;293293- new_clock >= (clock<<1); clk >>= 1)294294- clock <<= 1;295295- clk |= 0x100;296296- }297297-298298- if (host->set_clk_div)299299- host->set_clk_div(host->pdev, (clk>>22) & 1);300300-301301- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff);302302-}303303-304304-static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)305305-{306306- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);307307-308308- /*309309- * Testing on sh-mobile showed that SDIO IRQs are unmasked when310310- * CTL_CLK_AND_WAIT_CTL gets written, so we have to disable the311311- * device IRQ here and restore the SDIO IRQ mask before312312- * re-enabling the device IRQ.313313- */314314- if (pdata->flags & TMIO_MMC_SDIO_IRQ)315315- disable_irq(host->irq);316316- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);317317- msleep(10);318318- if (pdata->flags & TMIO_MMC_SDIO_IRQ) {319319- tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);320320- enable_irq(host->irq);321321- }322322- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &323323- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));324324- msleep(10);325325-}326326-327327-static void tmio_mmc_clk_start(struct tmio_mmc_host *host)328328-{329329- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);330330-331331- sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |332332- sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));333333- msleep(10);334334- /* see comment in tmio_mmc_clk_stop above */335335- if (pdata->flags & TMIO_MMC_SDIO_IRQ)336336- disable_irq(host->irq);337337- sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);338338- msleep(10);339339- if (pdata->flags & TMIO_MMC_SDIO_IRQ) {340340- tmio_mmc_enable_sdio_irq(host->mmc, host->sdio_irq_enabled);341341- enable_irq(host->irq);342342- }343343-}344344-345345-static void reset(struct tmio_mmc_host *host)346346-{347347- /* FIXME - should we set stop clock reg here */348348- sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);349349- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);350350- msleep(10);351351- sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);352352- sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);353353- msleep(10);354354-}355355-356356-static void tmio_mmc_reset_work(struct work_struct *work)357357-{358358- struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host,359359- delayed_reset_work.work);360360- struct mmc_request *mrq;361361- unsigned long flags;362362-363363- spin_lock_irqsave(&host->lock, flags);364364- mrq = host->mrq;365365-366366- /* request already finished */367367- if (!mrq368368- || time_is_after_jiffies(host->last_req_ts +369369- msecs_to_jiffies(2000))) {370370- spin_unlock_irqrestore(&host->lock, flags);371371- return;372372- }373373-374374- dev_warn(&host->pdev->dev,375375- "timeout waiting for hardware interrupt (CMD%u)\n",376376- mrq->cmd->opcode);377377-378378- if (host->data)379379- host->data->error = -ETIMEDOUT;380380- else if (host->cmd)381381- host->cmd->error = -ETIMEDOUT;382382- else383383- mrq->cmd->error = -ETIMEDOUT;384384-385385- host->cmd = NULL;386386- host->data = NULL;387387- host->mrq = NULL;388388-389389- spin_unlock_irqrestore(&host->lock, flags);390390-391391- reset(host);392392-393393- mmc_request_done(host->mmc, mrq);394394-}395395-396396-static void397397-tmio_mmc_finish_request(struct tmio_mmc_host *host)398398-{399399- struct mmc_request *mrq = host->mrq;400400-401401- if (!mrq)402402- return;403403-404404- host->mrq = NULL;405405- host->cmd = NULL;406406- host->data = NULL;407407-408408- cancel_delayed_work(&host->delayed_reset_work);409409-410410- mmc_request_done(host->mmc, mrq);411411-}412412-413413-/* These are the bitmasks the tmio chip requires to implement the MMC response414414- * types. Note that R1 and R6 are the same in this scheme. */415415-#define APP_CMD 0x0040416416-#define RESP_NONE 0x0300417417-#define RESP_R1 0x0400418418-#define RESP_R1B 0x0500419419-#define RESP_R2 0x0600420420-#define RESP_R3 0x0700421421-#define DATA_PRESENT 0x0800422422-#define TRANSFER_READ 0x1000423423-#define TRANSFER_MULTI 0x2000424424-#define SECURITY_CMD 0x4000425425-426426-static int427427-tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)428428-{429429- struct mmc_data *data = host->data;430430- int c = cmd->opcode;431431-432432- /* Command 12 is handled by hardware */433433- if (cmd->opcode == 12 && !cmd->arg) {434434- sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x001);435435- return 0;436436- }437437-438438- switch (mmc_resp_type(cmd)) {439439- case MMC_RSP_NONE: c |= RESP_NONE; break;440440- case MMC_RSP_R1: c |= RESP_R1; break;441441- case MMC_RSP_R1B: c |= RESP_R1B; break;442442- case MMC_RSP_R2: c |= RESP_R2; break;443443- case MMC_RSP_R3: c |= RESP_R3; break;444444- default:445445- pr_debug("Unknown response type %d\n", mmc_resp_type(cmd));446446- return -EINVAL;447447- }448448-449449- host->cmd = cmd;450450-451451-/* FIXME - this seems to be ok commented out but the spec suggest this bit452452- * should be set when issuing app commands.453453- * if(cmd->flags & MMC_FLAG_ACMD)454454- * c |= APP_CMD;455455- */456456- if (data) {457457- c |= DATA_PRESENT;458458- if (data->blocks > 1) {459459- sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x100);460460- c |= TRANSFER_MULTI;461461- }462462- if (data->flags & MMC_DATA_READ)463463- c |= TRANSFER_READ;464464- }465465-466466- enable_mmc_irqs(host, TMIO_MASK_CMD);467467-468468- /* Fire off the command */469469- sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg);470470- sd_ctrl_write16(host, CTL_SD_CMD, c);471471-472472- return 0;473473-}474474-475475-/*476476- * This chip always returns (at least?) as much data as you ask for.477477- * I'm unsure what happens if you ask for less than a block. This should be478478- * looked into to ensure that a funny length read doesnt hose the controller.479479- */480480-static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)481481-{482482- struct mmc_data *data = host->data;483483- void *sg_virt;484484- unsigned short *buf;485485- unsigned int count;486486- unsigned long flags;487487-488488- if (!data) {489489- pr_debug("Spurious PIO IRQ\n");490490- return;491491- }492492-493493- sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags);494494- buf = (unsigned short *)(sg_virt + host->sg_off);495495-496496- count = host->sg_ptr->length - host->sg_off;497497- if (count > data->blksz)498498- count = data->blksz;499499-500500- pr_debug("count: %08x offset: %08x flags %08x\n",501501- count, host->sg_off, data->flags);502502-503503- /* Transfer the data */504504- if (data->flags & MMC_DATA_READ)505505- sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);506506- else507507- sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);508508-509509- host->sg_off += count;510510-511511- tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt);512512-513513- if (host->sg_off == host->sg_ptr->length)514514- tmio_mmc_next_sg(host);515515-516516- return;517517-}518518-519519-/* needs to be called with host->lock held */520520-static void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)521521-{522522- struct mmc_data *data = host->data;523523- struct mmc_command *stop;524524-525525- host->data = NULL;526526-527527- if (!data) {528528- dev_warn(&host->pdev->dev, "Spurious data end IRQ\n");529529- return;530530- }531531- stop = data->stop;532532-533533- /* FIXME - return correct transfer count on errors */534534- if (!data->error)535535- data->bytes_xfered = data->blocks * data->blksz;536536- else537537- data->bytes_xfered = 0;538538-539539- pr_debug("Completed data request\n");540540-541541- /*542542- * FIXME: other drivers allow an optional stop command of any given type543543- * which we dont do, as the chip can auto generate them.544544- * Perhaps we can be smarter about when to use auto CMD12 and545545- * only issue the auto request when we know this is the desired546546- * stop command, allowing fallback to the stop command the547547- * upper layers expect. For now, we do what works.548548- */549549-550550- if (data->flags & MMC_DATA_READ) {551551- if (!host->chan_rx)552552- disable_mmc_irqs(host, TMIO_MASK_READOP);553553- else554554- tmio_check_bounce_buffer(host);555555- dev_dbg(&host->pdev->dev, "Complete Rx request %p\n",556556- host->mrq);557557- } else {558558- if (!host->chan_tx)559559- disable_mmc_irqs(host, TMIO_MASK_WRITEOP);560560- dev_dbg(&host->pdev->dev, "Complete Tx request %p\n",561561- host->mrq);562562- }563563-564564- if (stop) {565565- if (stop->opcode == 12 && !stop->arg)566566- sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x000);567567- else568568- BUG();569569- }570570-571571- tmio_mmc_finish_request(host);572572-}573573-574574-static void tmio_mmc_data_irq(struct tmio_mmc_host *host)575575-{576576- struct mmc_data *data;577577- spin_lock(&host->lock);578578- data = host->data;579579-580580- if (!data)581581- goto out;582582-583583- if (host->chan_tx && (data->flags & MMC_DATA_WRITE)) {584584- /*585585- * Has all data been written out yet? Testing on SuperH showed,586586- * that in most cases the first interrupt comes already with the587587- * BUSY status bit clear, but on some operations, like mount or588588- * in the beginning of a write / sync / umount, there is one589589- * DATAEND interrupt with the BUSY bit set, in this cases590590- * waiting for one more interrupt fixes the problem.591591- */592592- if (!(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_CMD_BUSY)) {593593- disable_mmc_irqs(host, TMIO_STAT_DATAEND);594594- tasklet_schedule(&host->dma_complete);595595- }596596- } else if (host->chan_rx && (data->flags & MMC_DATA_READ)) {597597- disable_mmc_irqs(host, TMIO_STAT_DATAEND);598598- tasklet_schedule(&host->dma_complete);599599- } else {600600- tmio_mmc_do_data_irq(host);601601- }602602-out:603603- spin_unlock(&host->lock);604604-}605605-606606-static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,607607- unsigned int stat)608608-{609609- struct mmc_command *cmd = host->cmd;610610- int i, addr;611611-612612- spin_lock(&host->lock);613613-614614- if (!host->cmd) {615615- pr_debug("Spurious CMD irq\n");616616- goto out;617617- }618618-619619- host->cmd = NULL;620620-621621- /* This controller is sicker than the PXA one. Not only do we need to622622- * drop the top 8 bits of the first response word, we also need to623623- * modify the order of the response for short response command types.624624- */625625-626626- for (i = 3, addr = CTL_RESPONSE ; i >= 0 ; i--, addr += 4)627627- cmd->resp[i] = sd_ctrl_read32(host, addr);628628-629629- if (cmd->flags & MMC_RSP_136) {630630- cmd->resp[0] = (cmd->resp[0] << 8) | (cmd->resp[1] >> 24);631631- cmd->resp[1] = (cmd->resp[1] << 8) | (cmd->resp[2] >> 24);632632- cmd->resp[2] = (cmd->resp[2] << 8) | (cmd->resp[3] >> 24);633633- cmd->resp[3] <<= 8;634634- } else if (cmd->flags & MMC_RSP_R3) {635635- cmd->resp[0] = cmd->resp[3];636636- }637637-638638- if (stat & TMIO_STAT_CMDTIMEOUT)639639- cmd->error = -ETIMEDOUT;640640- else if (stat & TMIO_STAT_CRCFAIL && cmd->flags & MMC_RSP_CRC)641641- cmd->error = -EILSEQ;642642-643643- /* If there is data to handle we enable data IRQs here, and644644- * we will ultimatley finish the request in the data_end handler.645645- * If theres no data or we encountered an error, finish now.646646- */647647- if (host->data && !cmd->error) {648648- if (host->data->flags & MMC_DATA_READ) {649649- if (!host->chan_rx)650650- enable_mmc_irqs(host, TMIO_MASK_READOP);651651- } else {652652- if (!host->chan_tx)653653- enable_mmc_irqs(host, TMIO_MASK_WRITEOP);654654- else655655- tasklet_schedule(&host->dma_issue);656656- }657657- } else {658658- tmio_mmc_finish_request(host);659659- }660660-661661-out:662662- spin_unlock(&host->lock);663663-664664- return;665665-}666666-667667-static irqreturn_t tmio_mmc_irq(int irq, void *devid)668668-{669669- struct tmio_mmc_host *host = devid;670670- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);671671- unsigned int ireg, irq_mask, status;672672- unsigned int sdio_ireg, sdio_irq_mask, sdio_status;673673-674674- pr_debug("MMC IRQ begin\n");675675-676676- status = sd_ctrl_read32(host, CTL_STATUS);677677- irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);678678- ireg = status & TMIO_MASK_IRQ & ~irq_mask;679679-680680- sdio_ireg = 0;681681- if (!ireg && pdata->flags & TMIO_MMC_SDIO_IRQ) {682682- sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS);683683- sdio_irq_mask = sd_ctrl_read16(host, CTL_SDIO_IRQ_MASK);684684- sdio_ireg = sdio_status & TMIO_SDIO_MASK_ALL & ~sdio_irq_mask;685685-686686- sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status & ~TMIO_SDIO_MASK_ALL);687687-688688- if (sdio_ireg && !host->sdio_irq_enabled) {689689- pr_warning("tmio_mmc: Spurious SDIO IRQ, disabling! 0x%04x 0x%04x 0x%04x\n",690690- sdio_status, sdio_irq_mask, sdio_ireg);691691- tmio_mmc_enable_sdio_irq(host->mmc, 0);692692- goto out;693693- }694694-695695- if (host->mmc->caps & MMC_CAP_SDIO_IRQ &&696696- sdio_ireg & TMIO_SDIO_STAT_IOIRQ)697697- mmc_signal_sdio_irq(host->mmc);698698-699699- if (sdio_ireg)700700- goto out;701701- }702702-703703- pr_debug_status(status);704704- pr_debug_status(ireg);705705-706706- if (!ireg) {707707- disable_mmc_irqs(host, status & ~irq_mask);708708-709709- pr_warning("tmio_mmc: Spurious irq, disabling! "710710- "0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg);711711- pr_debug_status(status);712712-713713- goto out;714714- }715715-716716- while (ireg) {717717- /* Card insert / remove attempts */718718- if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {719719- ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |720720- TMIO_STAT_CARD_REMOVE);721721- mmc_detect_change(host->mmc, msecs_to_jiffies(100));722722- }723723-724724- /* CRC and other errors */725725-/* if (ireg & TMIO_STAT_ERR_IRQ)726726- * handled |= tmio_error_irq(host, irq, stat);727727- */728728-729729- /* Command completion */730730- if (ireg & (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT)) {731731- ack_mmc_irqs(host,732732- TMIO_STAT_CMDRESPEND |733733- TMIO_STAT_CMDTIMEOUT);734734- tmio_mmc_cmd_irq(host, status);735735- }736736-737737- /* Data transfer */738738- if (ireg & (TMIO_STAT_RXRDY | TMIO_STAT_TXRQ)) {739739- ack_mmc_irqs(host, TMIO_STAT_RXRDY | TMIO_STAT_TXRQ);740740- tmio_mmc_pio_irq(host);741741- }742742-743743- /* Data transfer completion */744744- if (ireg & TMIO_STAT_DATAEND) {745745- ack_mmc_irqs(host, TMIO_STAT_DATAEND);746746- tmio_mmc_data_irq(host);747747- }748748-749749- /* Check status - keep going until we've handled it all */750750- status = sd_ctrl_read32(host, CTL_STATUS);751751- irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);752752- ireg = status & TMIO_MASK_IRQ & ~irq_mask;753753-754754- pr_debug("Status at end of loop: %08x\n", status);755755- pr_debug_status(status);756756- }757757- pr_debug("MMC IRQ end\n");758758-759759-out:760760- return IRQ_HANDLED;761761-}762762-763763-#ifdef CONFIG_TMIO_MMC_DMA764764-static void tmio_check_bounce_buffer(struct tmio_mmc_host *host)765765-{766766- if (host->sg_ptr == &host->bounce_sg) {767767- unsigned long flags;768768- void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags);769769- memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length);770770- tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr);771771- }772772-}773773-774774-static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)775775-{776776-#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)777777- /* Switch DMA mode on or off - SuperH specific? */778778- sd_ctrl_write16(host, 0xd8, enable ? 2 : 0);779779-#endif780780-}781781-782782-static void tmio_dma_complete(void *arg)783783-{784784- struct tmio_mmc_host *host = arg;785785-786786- dev_dbg(&host->pdev->dev, "Command completed\n");787787-788788- if (!host->data)789789- dev_warn(&host->pdev->dev, "NULL data in DMA completion!\n");790790- else791791- enable_mmc_irqs(host, TMIO_STAT_DATAEND);792792-}793793-794794-static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)795795-{796796- struct scatterlist *sg = host->sg_ptr, *sg_tmp;797797- struct dma_async_tx_descriptor *desc = NULL;798798- struct dma_chan *chan = host->chan_rx;799799- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);800800- dma_cookie_t cookie;801801- int ret, i;802802- bool aligned = true, multiple = true;803803- unsigned int align = (1 << pdata->dma->alignment_shift) - 1;804804-805805- for_each_sg(sg, sg_tmp, host->sg_len, i) {806806- if (sg_tmp->offset & align)807807- aligned = false;808808- if (sg_tmp->length & align) {809809- multiple = false;810810- break;811811- }812812- }813813-814814- if ((!aligned && (host->sg_len > 1 || sg->length > PAGE_CACHE_SIZE ||815815- align >= MAX_ALIGN)) || !multiple) {816816- ret = -EINVAL;817817- goto pio;818818- }819819-820820- /* The only sg element can be unaligned, use our bounce buffer then */821821- if (!aligned) {822822- sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);823823- host->sg_ptr = &host->bounce_sg;824824- sg = host->sg_ptr;825825- }826826-827827- ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);828828- if (ret > 0)829829- desc = chan->device->device_prep_slave_sg(chan, sg, ret,830830- DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);831831-832832- if (desc) {833833- desc->callback = tmio_dma_complete;834834- desc->callback_param = host;835835- cookie = dmaengine_submit(desc);836836- dma_async_issue_pending(chan);837837- }838838- dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",839839- __func__, host->sg_len, ret, cookie, host->mrq);840840-841841-pio:842842- if (!desc) {843843- /* DMA failed, fall back to PIO */844844- if (ret >= 0)845845- ret = -EIO;846846- host->chan_rx = NULL;847847- dma_release_channel(chan);848848- /* Free the Tx channel too */849849- chan = host->chan_tx;850850- if (chan) {851851- host->chan_tx = NULL;852852- dma_release_channel(chan);853853- }854854- dev_warn(&host->pdev->dev,855855- "DMA failed: %d, falling back to PIO\n", ret);856856- tmio_mmc_enable_dma(host, false);857857- }858858-859859- dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__,860860- desc, cookie, host->sg_len);861861-}862862-863863-static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)864864-{865865- struct scatterlist *sg = host->sg_ptr, *sg_tmp;866866- struct dma_async_tx_descriptor *desc = NULL;867867- struct dma_chan *chan = host->chan_tx;868868- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);869869- dma_cookie_t cookie;870870- int ret, i;871871- bool aligned = true, multiple = true;872872- unsigned int align = (1 << pdata->dma->alignment_shift) - 1;873873-874874- for_each_sg(sg, sg_tmp, host->sg_len, i) {875875- if (sg_tmp->offset & align)876876- aligned = false;877877- if (sg_tmp->length & align) {878878- multiple = false;879879- break;880880- }881881- }882882-883883- if ((!aligned && (host->sg_len > 1 || sg->length > PAGE_CACHE_SIZE ||884884- align >= MAX_ALIGN)) || !multiple) {885885- ret = -EINVAL;886886- goto pio;887887- }888888-889889- /* The only sg element can be unaligned, use our bounce buffer then */890890- if (!aligned) {891891- unsigned long flags;892892- void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags);893893- sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);894894- memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length);895895- tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr);896896- host->sg_ptr = &host->bounce_sg;897897- sg = host->sg_ptr;898898- }899899-900900- ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);901901- if (ret > 0)902902- desc = chan->device->device_prep_slave_sg(chan, sg, ret,903903- DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);904904-905905- if (desc) {906906- desc->callback = tmio_dma_complete;907907- desc->callback_param = host;908908- cookie = dmaengine_submit(desc);909909- }910910- dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",911911- __func__, host->sg_len, ret, cookie, host->mrq);912912-913913-pio:914914- if (!desc) {915915- /* DMA failed, fall back to PIO */916916- if (ret >= 0)917917- ret = -EIO;918918- host->chan_tx = NULL;919919- dma_release_channel(chan);920920- /* Free the Rx channel too */921921- chan = host->chan_rx;922922- if (chan) {923923- host->chan_rx = NULL;924924- dma_release_channel(chan);925925- }926926- dev_warn(&host->pdev->dev,927927- "DMA failed: %d, falling back to PIO\n", ret);928928- tmio_mmc_enable_dma(host, false);929929- }930930-931931- dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__,932932- desc, cookie);933933-}934934-935935-static void tmio_mmc_start_dma(struct tmio_mmc_host *host,936936- struct mmc_data *data)937937-{938938- if (data->flags & MMC_DATA_READ) {939939- if (host->chan_rx)940940- tmio_mmc_start_dma_rx(host);941941- } else {942942- if (host->chan_tx)943943- tmio_mmc_start_dma_tx(host);944944- }945945-}946946-947947-static void tmio_issue_tasklet_fn(unsigned long priv)948948-{949949- struct tmio_mmc_host *host = (struct tmio_mmc_host *)priv;950950- struct dma_chan *chan = host->chan_tx;951951-952952- dma_async_issue_pending(chan);953953-}954954-955955-static void tmio_tasklet_fn(unsigned long arg)956956-{957957- struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg;958958- unsigned long flags;959959-960960- spin_lock_irqsave(&host->lock, flags);961961-962962- if (!host->data)963963- goto out;964964-965965- if (host->data->flags & MMC_DATA_READ)966966- dma_unmap_sg(host->chan_rx->device->dev,967967- host->sg_ptr, host->sg_len,968968- DMA_FROM_DEVICE);969969- else970970- dma_unmap_sg(host->chan_tx->device->dev,971971- host->sg_ptr, host->sg_len,972972- DMA_TO_DEVICE);973973-974974- tmio_mmc_do_data_irq(host);975975-out:976976- spin_unlock_irqrestore(&host->lock, flags);977977-}978978-979979-/* It might be necessary to make filter MFD specific */980980-static bool tmio_mmc_filter(struct dma_chan *chan, void *arg)981981-{982982- dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);983983- chan->private = arg;984984- return true;985985-}986986-987987-static void tmio_mmc_request_dma(struct tmio_mmc_host *host,988988- struct tmio_mmc_data *pdata)989989-{990990- /* We can only either use DMA for both Tx and Rx or not use it at all */991991- if (pdata->dma) {992992- dma_cap_mask_t mask;993993-994994- dma_cap_zero(mask);995995- dma_cap_set(DMA_SLAVE, mask);996996-997997- host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,998998- pdata->dma->chan_priv_tx);999999- dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,10001000- host->chan_tx);10011001-10021002- if (!host->chan_tx)10031003- return;10041004-10051005- host->chan_rx = dma_request_channel(mask, tmio_mmc_filter,10061006- pdata->dma->chan_priv_rx);10071007- dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,10081008- host->chan_rx);10091009-10101010- if (!host->chan_rx) {10111011- dma_release_channel(host->chan_tx);10121012- host->chan_tx = NULL;10131013- return;10141014- }10151015-10161016- tasklet_init(&host->dma_complete, tmio_tasklet_fn, (unsigned long)host);10171017- tasklet_init(&host->dma_issue, tmio_issue_tasklet_fn, (unsigned long)host);10181018-10191019- tmio_mmc_enable_dma(host, true);10201020- }10211021-}10221022-10231023-static void tmio_mmc_release_dma(struct tmio_mmc_host *host)10241024-{10251025- if (host->chan_tx) {10261026- struct dma_chan *chan = host->chan_tx;10271027- host->chan_tx = NULL;10281028- dma_release_channel(chan);10291029- }10301030- if (host->chan_rx) {10311031- struct dma_chan *chan = host->chan_rx;10321032- host->chan_rx = NULL;10331033- dma_release_channel(chan);10341034- }10351035-}10361036-#else10371037-static void tmio_check_bounce_buffer(struct tmio_mmc_host *host)10381038-{10391039-}10401040-10411041-static void tmio_mmc_start_dma(struct tmio_mmc_host *host,10421042- struct mmc_data *data)10431043-{10441044-}10451045-10461046-static void tmio_mmc_request_dma(struct tmio_mmc_host *host,10471047- struct tmio_mmc_data *pdata)10481048-{10491049- host->chan_tx = NULL;10501050- host->chan_rx = NULL;10511051-}10521052-10531053-static void tmio_mmc_release_dma(struct tmio_mmc_host *host)10541054-{10551055-}10561056-#endif10571057-10581058-static int tmio_mmc_start_data(struct tmio_mmc_host *host,10591059- struct mmc_data *data)10601060-{10611061- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);10621062-10631063- pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n",10641064- data->blksz, data->blocks);10651065-10661066- /* Some hardware cannot perform 2 byte requests in 4 bit mode */10671067- if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {10681068- int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;10691069-10701070- if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {10711071- pr_err("%s: %d byte block unsupported in 4 bit mode\n",10721072- mmc_hostname(host->mmc), data->blksz);10731073- return -EINVAL;10741074- }10751075- }10761076-10771077- tmio_mmc_init_sg(host, data);10781078- host->data = data;10791079-10801080- /* Set transfer length / blocksize */10811081- sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);10821082- sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);10831083-10841084- tmio_mmc_start_dma(host, data);10851085-10861086- return 0;10871087-}10881088-10891089-/* Process requests from the MMC layer */10901090-static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)10911091-{10921092- struct tmio_mmc_host *host = mmc_priv(mmc);10931093- int ret;10941094-10951095- if (host->mrq)10961096- pr_debug("request not null\n");10971097-10981098- host->last_req_ts = jiffies;10991099- wmb();11001100- host->mrq = mrq;11011101-11021102- if (mrq->data) {11031103- ret = tmio_mmc_start_data(host, mrq->data);11041104- if (ret)11051105- goto fail;11061106- }11071107-11081108- ret = tmio_mmc_start_command(host, mrq->cmd);11091109- if (!ret) {11101110- schedule_delayed_work(&host->delayed_reset_work,11111111- msecs_to_jiffies(2000));11121112- return;11131113- }11141114-11151115-fail:11161116- host->mrq = NULL;11171117- mrq->cmd->error = ret;11181118- mmc_request_done(mmc, mrq);11191119-}11201120-11211121-/* Set MMC clock / power.11221122- * Note: This controller uses a simple divider scheme therefore it cannot11231123- * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as11241124- * MMC wont run that fast, it has to be clocked at 12MHz which is the next11251125- * slowest setting.11261126- */11271127-static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)11281128-{11291129- struct tmio_mmc_host *host = mmc_priv(mmc);11301130-11311131- if (ios->clock)11321132- tmio_mmc_set_clock(host, ios->clock);11331133-11341134- /* Power sequence - OFF -> ON -> UP */11351135- switch (ios->power_mode) {11361136- case MMC_POWER_OFF: /* power down SD bus */11371137- if (host->set_pwr)11381138- host->set_pwr(host->pdev, 0);11391139- tmio_mmc_clk_stop(host);11401140- break;11411141- case MMC_POWER_ON: /* power up SD bus */11421142- if (host->set_pwr)11431143- host->set_pwr(host->pdev, 1);11441144- break;11451145- case MMC_POWER_UP: /* start bus clock */11461146- tmio_mmc_clk_start(host);11471147- break;11481148- }11491149-11501150- switch (ios->bus_width) {11511151- case MMC_BUS_WIDTH_1:11521152- sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);11531153- break;11541154- case MMC_BUS_WIDTH_4:11551155- sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);11561156- break;11571157- }11581158-11591159- /* Let things settle. delay taken from winCE driver */11601160- udelay(140);11611161-}11621162-11631163-static int tmio_mmc_get_ro(struct mmc_host *mmc)11641164-{11651165- struct tmio_mmc_host *host = mmc_priv(mmc);11661166- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);11671167-11681168- return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||11691169- (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)) ? 0 : 1;11701170-}11711171-11721172-static int tmio_mmc_get_cd(struct mmc_host *mmc)11731173-{11741174- struct tmio_mmc_host *host = mmc_priv(mmc);11751175- struct tmio_mmc_data *pdata = mfd_get_data(host->pdev);11761176-11771177- if (!pdata->get_cd)11781178- return -ENOSYS;11791179- else11801180- return pdata->get_cd(host->pdev);11811181-}11821182-11831183-static const struct mmc_host_ops tmio_mmc_ops = {11841184- .request = tmio_mmc_request,11851185- .set_ios = tmio_mmc_set_ios,11861186- .get_ro = tmio_mmc_get_ro,11871187- .get_cd = tmio_mmc_get_cd,11881188- .enable_sdio_irq = tmio_mmc_enable_sdio_irq,11891189-};2424+#include "tmio_mmc.h"119025119126#ifdef CONFIG_PM119227static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)···621227#define tmio_mmc_resume NULL631228#endif6412296565-static int __devinit tmio_mmc_probe(struct platform_device *dev)12301230+static int __devinit tmio_mmc_probe(struct platform_device *pdev)661231{6767- const struct mfd_cell *cell = mfd_get_cell(dev);12321232+ const struct mfd_cell *cell = mfd_get_cell(pdev);681233 struct tmio_mmc_data *pdata;6969- struct resource *res_ctl;701234 struct tmio_mmc_host *host;7171- struct mmc_host *mmc;721235 int ret = -EINVAL;7373- u32 irq_mask = TMIO_MASK_CMD;7412367575- if (dev->num_resources != 2)12371237+ if (pdev->num_resources != 2)761238 goto out;7712397878- res_ctl = platform_get_resource(dev, IORESOURCE_MEM, 0);7979- if (!res_ctl)8080- goto out;8181-8282- pdata = mfd_get_data(dev);12401240+ pdata = mfd_get_data(pdev);831241 if (!pdata || !pdata->hclk)841242 goto out;8512438686- ret = -ENOMEM;8787-8888- mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &dev->dev);8989- if (!mmc)9090- goto out;9191-9292- host = mmc_priv(mmc);9393- host->mmc = mmc;9494- host->pdev = dev;9595- platform_set_drvdata(dev, mmc);9696-9797- host->set_pwr = pdata->set_pwr;9898- host->set_clk_div = pdata->set_clk_div;9999-100100- /* SD control register space size is 0x200, 0x400 for bus_shift=1 */101101- host->bus_shift = resource_size(res_ctl) >> 10;102102-103103- host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));104104- if (!host->ctl)105105- goto host_free;106106-107107- mmc->ops = &tmio_mmc_ops;108108- mmc->caps = MMC_CAP_4_BIT_DATA | pdata->capabilities;109109- mmc->f_max = pdata->hclk;110110- mmc->f_min = mmc->f_max / 512;111111- mmc->max_segs = 32;112112- mmc->max_blk_size = 512;113113- mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *114114- mmc->max_segs;115115- mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;116116- mmc->max_seg_size = mmc->max_req_size;117117- if (pdata->ocr_mask)118118- mmc->ocr_avail = pdata->ocr_mask;119119- else120120- mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;121121-1221244 /* Tell the MFD core we are ready to be enabled */1231245 if (cell->enable) {124124- ret = cell->enable(dev);12461246+ ret = cell->enable(pdev);1251247 if (ret)126126- goto unmap_ctl;12481248+ goto out;1271249 }1281250129129- tmio_mmc_clk_stop(host);130130- reset(host);131131-132132- ret = platform_get_irq(dev, 0);133133- if (ret >= 0)134134- host->irq = ret;135135- else136136- goto cell_disable;137137-138138- disable_mmc_irqs(host, TMIO_MASK_ALL);139139- if (pdata->flags & TMIO_MMC_SDIO_IRQ)140140- tmio_mmc_enable_sdio_irq(mmc, 0);141141-142142- ret = request_irq(host->irq, tmio_mmc_irq, IRQF_DISABLED |143143- IRQF_TRIGGER_FALLING, dev_name(&dev->dev), host);12511251+ ret = tmio_mmc_host_probe(&host, pdev, pdata);1441252 if (ret)1451253 goto cell_disable;1461254147147- spin_lock_init(&host->lock);148148-149149- /* Init delayed work for request timeouts */150150- INIT_DELAYED_WORK(&host->delayed_reset_work, tmio_mmc_reset_work);151151-152152- /* See if we also get DMA */153153- tmio_mmc_request_dma(host, pdata);154154-155155- mmc_add_host(mmc);156156-1571255 pr_info("%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc),1581256 (unsigned long)host->ctl, host->irq);159159-160160- /* Unmask the IRQs we want to know about */161161- if (!host->chan_rx)162162- irq_mask |= TMIO_MASK_READOP;163163- if (!host->chan_tx)164164- irq_mask |= TMIO_MASK_WRITEOP;165165- enable_mmc_irqs(host, irq_mask);16612571671258 return 0;16812591691260cell_disable:1701261 if (cell->disable)171171- cell->disable(dev);172172-unmap_ctl:173173- iounmap(host->ctl);174174-host_free:175175- mmc_free_host(mmc);12621262+ cell->disable(pdev);1761263out:1771264 return ret;1781265}1791266180180-static int __devexit tmio_mmc_remove(struct platform_device *dev)12671267+static int __devexit tmio_mmc_remove(struct platform_device *pdev)1811268{182182- const struct mfd_cell *cell = mfd_get_cell(dev);183183- struct mmc_host *mmc = platform_get_drvdata(dev);12691269+ const struct mfd_cell *cell = mfd_get_cell(pdev);12701270+ struct mmc_host *mmc = platform_get_drvdata(pdev);1841271185185- platform_set_drvdata(dev, NULL);12721272+ platform_set_drvdata(pdev, NULL);18612731871274 if (mmc) {188188- struct tmio_mmc_host *host = mmc_priv(mmc);189189- mmc_remove_host(mmc);190190- cancel_delayed_work_sync(&host->delayed_reset_work);191191- tmio_mmc_release_dma(host);192192- free_irq(host->irq, host);12751275+ tmio_mmc_host_remove(mmc_priv(mmc));1931276 if (cell->disable)194194- cell->disable(dev);195195- iounmap(host->ctl);196196- mmc_free_host(mmc);12771277+ cell->disable(pdev);1971278 }19812791991280 return 0;
+123
drivers/mmc/host/tmio_mmc.h
···11+/*22+ * linux/drivers/mmc/host/tmio_mmc.h33+ *44+ * Copyright (C) 2007 Ian Molton55+ * Copyright (C) 2004 Ian Molton66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+ * Driver for the MMC / SD / SDIO cell found in:1212+ *1313+ * TC6393XB TC6391XB TC6387XB T7L66XB ASIC31414+ */1515+1616+#ifndef TMIO_MMC_H1717+#define TMIO_MMC_H1818+1919+#include <linux/highmem.h>2020+#include <linux/mmc/tmio.h>2121+#include <linux/pagemap.h>2222+2323+/* Definitions for values the CTRL_SDIO_STATUS register can take. */2424+#define TMIO_SDIO_STAT_IOIRQ 0x00012525+#define TMIO_SDIO_STAT_EXPUB52 0x40002626+#define TMIO_SDIO_STAT_EXWT 0x80002727+#define TMIO_SDIO_MASK_ALL 0xc0072828+2929+/* Define some IRQ masks */3030+/* This is the mask used at reset by the chip */3131+#define TMIO_MASK_ALL 0x837f031d3232+#define TMIO_MASK_READOP (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND)3333+#define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND)3434+#define TMIO_MASK_CMD (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT | \3535+ TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)3636+#define TMIO_MASK_IRQ (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)3737+3838+struct tmio_mmc_data;3939+4040+struct tmio_mmc_host {4141+ void __iomem *ctl;4242+ unsigned long bus_shift;4343+ struct mmc_command *cmd;4444+ struct mmc_request *mrq;4545+ struct mmc_data *data;4646+ struct mmc_host *mmc;4747+ int irq;4848+ unsigned int sdio_irq_enabled;4949+5050+ /* Callbacks for clock / power control */5151+ void (*set_pwr)(struct platform_device *host, int state);5252+ void (*set_clk_div)(struct platform_device *host, int state);5353+5454+ /* pio related stuff */5555+ struct scatterlist *sg_ptr;5656+ struct scatterlist *sg_orig;5757+ unsigned int sg_len;5858+ unsigned int sg_off;5959+6060+ struct platform_device *pdev;6161+ struct tmio_mmc_data *pdata;6262+6363+ /* DMA support */6464+ bool force_pio;6565+ struct dma_chan *chan_rx;6666+ struct dma_chan *chan_tx;6767+ struct tasklet_struct dma_complete;6868+ struct tasklet_struct dma_issue;6969+ struct scatterlist bounce_sg;7070+ u8 *bounce_buf;7171+7272+ /* Track lost interrupts */7373+ struct delayed_work delayed_reset_work;7474+ spinlock_t lock;7575+ unsigned long last_req_ts;7676+};7777+7878+int tmio_mmc_host_probe(struct tmio_mmc_host **host,7979+ struct platform_device *pdev,8080+ struct tmio_mmc_data *pdata);8181+void tmio_mmc_host_remove(struct tmio_mmc_host *host);8282+void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);8383+8484+void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);8585+void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);8686+8787+static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,8888+ unsigned long *flags)8989+{9090+ local_irq_save(*flags);9191+ return kmap_atomic(sg_page(sg), KM_BIO_SRC_IRQ) + sg->offset;9292+}9393+9494+static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg,9595+ unsigned long *flags, void *virt)9696+{9797+ kunmap_atomic(virt - sg->offset, KM_BIO_SRC_IRQ);9898+ local_irq_restore(*flags);9999+}100100+101101+#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)102102+void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);103103+void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);104104+void tmio_mmc_release_dma(struct tmio_mmc_host *host);105105+#else106106+static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,107107+ struct mmc_data *data)108108+{109109+}110110+111111+static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,112112+ struct tmio_mmc_data *pdata)113113+{114114+ host->chan_tx = NULL;115115+ host->chan_rx = NULL;116116+}117117+118118+static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host)119119+{120120+}121121+#endif122122+123123+#endif
+317
drivers/mmc/host/tmio_mmc_dma.c
···11+/*22+ * linux/drivers/mmc/tmio_mmc_dma.c33+ *44+ * Copyright (C) 2010-2011 Guennadi Liakhovetski55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License version 2 as88+ * published by the Free Software Foundation.99+ *1010+ * DMA function for TMIO MMC implementations1111+ */1212+1313+#include <linux/device.h>1414+#include <linux/dmaengine.h>1515+#include <linux/mfd/tmio.h>1616+#include <linux/mmc/host.h>1717+#include <linux/mmc/tmio.h>1818+#include <linux/pagemap.h>1919+#include <linux/scatterlist.h>2020+2121+#include "tmio_mmc.h"2222+2323+#define TMIO_MMC_MIN_DMA_LEN 82424+2525+static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)2626+{2727+#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)2828+ /* Switch DMA mode on or off - SuperH specific? */2929+ writew(enable ? 2 : 0, host->ctl + (0xd8 << host->bus_shift));3030+#endif3131+}3232+3333+static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)3434+{3535+ struct scatterlist *sg = host->sg_ptr, *sg_tmp;3636+ struct dma_async_tx_descriptor *desc = NULL;3737+ struct dma_chan *chan = host->chan_rx;3838+ struct tmio_mmc_data *pdata = host->pdata;3939+ dma_cookie_t cookie;4040+ int ret, i;4141+ bool aligned = true, multiple = true;4242+ unsigned int align = (1 << pdata->dma->alignment_shift) - 1;4343+4444+ for_each_sg(sg, sg_tmp, host->sg_len, i) {4545+ if (sg_tmp->offset & align)4646+ aligned = false;4747+ if (sg_tmp->length & align) {4848+ multiple = false;4949+ break;5050+ }5151+ }5252+5353+ if ((!aligned && (host->sg_len > 1 || sg->length > PAGE_CACHE_SIZE ||5454+ (align & PAGE_MASK))) || !multiple) {5555+ ret = -EINVAL;5656+ goto pio;5757+ }5858+5959+ if (sg->length < TMIO_MMC_MIN_DMA_LEN) {6060+ host->force_pio = true;6161+ return;6262+ }6363+6464+ tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_RXRDY);6565+6666+ /* The only sg element can be unaligned, use our bounce buffer then */6767+ if (!aligned) {6868+ sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);6969+ host->sg_ptr = &host->bounce_sg;7070+ sg = host->sg_ptr;7171+ }7272+7373+ ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);7474+ if (ret > 0)7575+ desc = chan->device->device_prep_slave_sg(chan, sg, ret,7676+ DMA_FROM_DEVICE, DMA_CTRL_ACK);7777+7878+ if (desc) {7979+ cookie = dmaengine_submit(desc);8080+ if (cookie < 0) {8181+ desc = NULL;8282+ ret = cookie;8383+ }8484+ }8585+ dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",8686+ __func__, host->sg_len, ret, cookie, host->mrq);8787+8888+pio:8989+ if (!desc) {9090+ /* DMA failed, fall back to PIO */9191+ if (ret >= 0)9292+ ret = -EIO;9393+ host->chan_rx = NULL;9494+ dma_release_channel(chan);9595+ /* Free the Tx channel too */9696+ chan = host->chan_tx;9797+ if (chan) {9898+ host->chan_tx = NULL;9999+ dma_release_channel(chan);100100+ }101101+ dev_warn(&host->pdev->dev,102102+ "DMA failed: %d, falling back to PIO\n", ret);103103+ tmio_mmc_enable_dma(host, false);104104+ }105105+106106+ dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__,107107+ desc, cookie, host->sg_len);108108+}109109+110110+static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)111111+{112112+ struct scatterlist *sg = host->sg_ptr, *sg_tmp;113113+ struct dma_async_tx_descriptor *desc = NULL;114114+ struct dma_chan *chan = host->chan_tx;115115+ struct tmio_mmc_data *pdata = host->pdata;116116+ dma_cookie_t cookie;117117+ int ret, i;118118+ bool aligned = true, multiple = true;119119+ unsigned int align = (1 << pdata->dma->alignment_shift) - 1;120120+121121+ for_each_sg(sg, sg_tmp, host->sg_len, i) {122122+ if (sg_tmp->offset & align)123123+ aligned = false;124124+ if (sg_tmp->length & align) {125125+ multiple = false;126126+ break;127127+ }128128+ }129129+130130+ if ((!aligned && (host->sg_len > 1 || sg->length > PAGE_CACHE_SIZE ||131131+ (align & PAGE_MASK))) || !multiple) {132132+ ret = -EINVAL;133133+ goto pio;134134+ }135135+136136+ if (sg->length < TMIO_MMC_MIN_DMA_LEN) {137137+ host->force_pio = true;138138+ return;139139+ }140140+141141+ tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_TXRQ);142142+143143+ /* The only sg element can be unaligned, use our bounce buffer then */144144+ if (!aligned) {145145+ unsigned long flags;146146+ void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags);147147+ sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);148148+ memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length);149149+ tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr);150150+ host->sg_ptr = &host->bounce_sg;151151+ sg = host->sg_ptr;152152+ }153153+154154+ ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);155155+ if (ret > 0)156156+ desc = chan->device->device_prep_slave_sg(chan, sg, ret,157157+ DMA_TO_DEVICE, DMA_CTRL_ACK);158158+159159+ if (desc) {160160+ cookie = dmaengine_submit(desc);161161+ if (cookie < 0) {162162+ desc = NULL;163163+ ret = cookie;164164+ }165165+ }166166+ dev_dbg(&host->pdev->dev, "%s(): mapped %d -> %d, cookie %d, rq %p\n",167167+ __func__, host->sg_len, ret, cookie, host->mrq);168168+169169+pio:170170+ if (!desc) {171171+ /* DMA failed, fall back to PIO */172172+ if (ret >= 0)173173+ ret = -EIO;174174+ host->chan_tx = NULL;175175+ dma_release_channel(chan);176176+ /* Free the Rx channel too */177177+ chan = host->chan_rx;178178+ if (chan) {179179+ host->chan_rx = NULL;180180+ dma_release_channel(chan);181181+ }182182+ dev_warn(&host->pdev->dev,183183+ "DMA failed: %d, falling back to PIO\n", ret);184184+ tmio_mmc_enable_dma(host, false);185185+ }186186+187187+ dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__,188188+ desc, cookie);189189+}190190+191191+void tmio_mmc_start_dma(struct tmio_mmc_host *host,192192+ struct mmc_data *data)193193+{194194+ if (data->flags & MMC_DATA_READ) {195195+ if (host->chan_rx)196196+ tmio_mmc_start_dma_rx(host);197197+ } else {198198+ if (host->chan_tx)199199+ tmio_mmc_start_dma_tx(host);200200+ }201201+}202202+203203+static void tmio_mmc_issue_tasklet_fn(unsigned long priv)204204+{205205+ struct tmio_mmc_host *host = (struct tmio_mmc_host *)priv;206206+ struct dma_chan *chan = NULL;207207+208208+ spin_lock_irq(&host->lock);209209+210210+ if (host && host->data) {211211+ if (host->data->flags & MMC_DATA_READ)212212+ chan = host->chan_rx;213213+ else214214+ chan = host->chan_tx;215215+ }216216+217217+ spin_unlock_irq(&host->lock);218218+219219+ tmio_mmc_enable_mmc_irqs(host, TMIO_STAT_DATAEND);220220+221221+ if (chan)222222+ dma_async_issue_pending(chan);223223+}224224+225225+static void tmio_mmc_tasklet_fn(unsigned long arg)226226+{227227+ struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg;228228+229229+ spin_lock_irq(&host->lock);230230+231231+ if (!host->data)232232+ goto out;233233+234234+ if (host->data->flags & MMC_DATA_READ)235235+ dma_unmap_sg(host->chan_rx->device->dev,236236+ host->sg_ptr, host->sg_len,237237+ DMA_FROM_DEVICE);238238+ else239239+ dma_unmap_sg(host->chan_tx->device->dev,240240+ host->sg_ptr, host->sg_len,241241+ DMA_TO_DEVICE);242242+243243+ tmio_mmc_do_data_irq(host);244244+out:245245+ spin_unlock_irq(&host->lock);246246+}247247+248248+/* It might be necessary to make filter MFD specific */249249+static bool tmio_mmc_filter(struct dma_chan *chan, void *arg)250250+{251251+ dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);252252+ chan->private = arg;253253+ return true;254254+}255255+256256+void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata)257257+{258258+ /* We can only either use DMA for both Tx and Rx or not use it at all */259259+ if (pdata->dma) {260260+ dma_cap_mask_t mask;261261+262262+ dma_cap_zero(mask);263263+ dma_cap_set(DMA_SLAVE, mask);264264+265265+ host->chan_tx = dma_request_channel(mask, tmio_mmc_filter,266266+ pdata->dma->chan_priv_tx);267267+ dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,268268+ host->chan_tx);269269+270270+ if (!host->chan_tx)271271+ return;272272+273273+ host->chan_rx = dma_request_channel(mask, tmio_mmc_filter,274274+ pdata->dma->chan_priv_rx);275275+ dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,276276+ host->chan_rx);277277+278278+ if (!host->chan_rx)279279+ goto ereqrx;280280+281281+ host->bounce_buf = (u8 *)__get_free_page(GFP_KERNEL | GFP_DMA);282282+ if (!host->bounce_buf)283283+ goto ebouncebuf;284284+285285+ tasklet_init(&host->dma_complete, tmio_mmc_tasklet_fn, (unsigned long)host);286286+ tasklet_init(&host->dma_issue, tmio_mmc_issue_tasklet_fn, (unsigned long)host);287287+288288+ tmio_mmc_enable_dma(host, true);289289+290290+ return;291291+ebouncebuf:292292+ dma_release_channel(host->chan_rx);293293+ host->chan_rx = NULL;294294+ereqrx:295295+ dma_release_channel(host->chan_tx);296296+ host->chan_tx = NULL;297297+ return;298298+ }299299+}300300+301301+void tmio_mmc_release_dma(struct tmio_mmc_host *host)302302+{303303+ if (host->chan_tx) {304304+ struct dma_chan *chan = host->chan_tx;305305+ host->chan_tx = NULL;306306+ dma_release_channel(chan);307307+ }308308+ if (host->chan_rx) {309309+ struct dma_chan *chan = host->chan_rx;310310+ host->chan_rx = NULL;311311+ dma_release_channel(chan);312312+ }313313+ if (host->bounce_buf) {314314+ free_pages((unsigned long)host->bounce_buf, 0);315315+ host->bounce_buf = NULL;316316+ }317317+}
+897
drivers/mmc/host/tmio_mmc_pio.c
···11+/*22+ * linux/drivers/mmc/host/tmio_mmc_pio.c33+ *44+ * Copyright (C) 2011 Guennadi Liakhovetski55+ * Copyright (C) 2007 Ian Molton66+ * Copyright (C) 2004 Ian Molton77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+ *1212+ * Driver for the MMC / SD / SDIO IP found in:1313+ *1414+ * TC6393XB, TC6391XB, TC6387XB, T7L66XB, ASIC3, SH-Mobile SoCs1515+ *1616+ * This driver draws mainly on scattered spec sheets, Reverse engineering1717+ * of the toshiba e800 SD driver and some parts of the 2.4 ASIC3 driver (4 bit1818+ * support). (Further 4 bit support from a later datasheet).1919+ *2020+ * TODO:2121+ * Investigate using a workqueue for PIO transfers2222+ * Eliminate FIXMEs2323+ * SDIO support2424+ * Better Power management2525+ * Handle MMC errors better2626+ * double buffer support2727+ *2828+ */2929+3030+#include <linux/delay.h>3131+#include <linux/device.h>3232+#include <linux/highmem.h>3333+#include <linux/interrupt.h>3434+#include <linux/io.h>3535+#include <linux/irq.h>3636+#include <linux/mfd/tmio.h>3737+#include <linux/mmc/host.h>3838+#include <linux/mmc/tmio.h>3939+#include <linux/module.h>4040+#include <linux/pagemap.h>4141+#include <linux/platform_device.h>4242+#include <linux/scatterlist.h>4343+#include <linux/workqueue.h>4444+#include <linux/spinlock.h>4545+4646+#include "tmio_mmc.h"4747+4848+static u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)4949+{5050+ return readw(host->ctl + (addr << host->bus_shift));5151+}5252+5353+static void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,5454+ u16 *buf, int count)5555+{5656+ readsw(host->ctl + (addr << host->bus_shift), buf, count);5757+}5858+5959+static u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)6060+{6161+ return readw(host->ctl + (addr << host->bus_shift)) |6262+ readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;6363+}6464+6565+static void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)6666+{6767+ writew(val, host->ctl + (addr << host->bus_shift));6868+}6969+7070+static void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,7171+ u16 *buf, int count)7272+{7373+ writesw(host->ctl + (addr << host->bus_shift), buf, count);7474+}7575+7676+static void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)7777+{7878+ writew(val, host->ctl + (addr << host->bus_shift));7979+ writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));8080+}8181+8282+void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i)8383+{8484+ u32 mask = sd_ctrl_read32(host, CTL_IRQ_MASK) & ~(i & TMIO_MASK_IRQ);8585+ sd_ctrl_write32(host, CTL_IRQ_MASK, mask);8686+}8787+8888+void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i)8989+{9090+ u32 mask = sd_ctrl_read32(host, CTL_IRQ_MASK) | (i & TMIO_MASK_IRQ);9191+ sd_ctrl_write32(host, CTL_IRQ_MASK, mask);9292+}9393+9494+static void tmio_mmc_ack_mmc_irqs(struct tmio_mmc_host *host, u32 i)9595+{9696+ sd_ctrl_write32(host, CTL_STATUS, ~i);9797+}9898+9999+static void tmio_mmc_init_sg(struct tmio_mmc_host *host, struct mmc_data *data)100100+{101101+ host->sg_len = data->sg_len;102102+ host->sg_ptr = data->sg;103103+ host->sg_orig = data->sg;104104+ host->sg_off = 0;105105+}106106+107107+static int tmio_mmc_next_sg(struct tmio_mmc_host *host)108108+{109109+ host->sg_ptr = sg_next(host->sg_ptr);110110+ host->sg_off = 0;111111+ return --host->sg_len;112112+}113113+114114+#ifdef CONFIG_MMC_DEBUG115115+116116+#define STATUS_TO_TEXT(a, status, i) \117117+ do { \118118+ if (status & TMIO_STAT_##a) { \119119+ if (i++) \120120+ printk(" | "); \121121+ printk(#a); \122122+ } \123123+ } while (0)124124+125125+static void pr_debug_status(u32 status)126126+{127127+ int i = 0;128128+ printk(KERN_DEBUG "status: %08x = ", status);129129+ STATUS_TO_TEXT(CARD_REMOVE, status, i);130130+ STATUS_TO_TEXT(CARD_INSERT, status, i);131131+ STATUS_TO_TEXT(SIGSTATE, status, i);132132+ STATUS_TO_TEXT(WRPROTECT, status, i);133133+ STATUS_TO_TEXT(CARD_REMOVE_A, status, i);134134+ STATUS_TO_TEXT(CARD_INSERT_A, status, i);135135+ STATUS_TO_TEXT(SIGSTATE_A, status, i);136136+ STATUS_TO_TEXT(CMD_IDX_ERR, status, i);137137+ STATUS_TO_TEXT(STOPBIT_ERR, status, i);138138+ STATUS_TO_TEXT(ILL_FUNC, status, i);139139+ STATUS_TO_TEXT(CMD_BUSY, status, i);140140+ STATUS_TO_TEXT(CMDRESPEND, status, i);141141+ STATUS_TO_TEXT(DATAEND, status, i);142142+ STATUS_TO_TEXT(CRCFAIL, status, i);143143+ STATUS_TO_TEXT(DATATIMEOUT, status, i);144144+ STATUS_TO_TEXT(CMDTIMEOUT, status, i);145145+ STATUS_TO_TEXT(RXOVERFLOW, status, i);146146+ STATUS_TO_TEXT(TXUNDERRUN, status, i);147147+ STATUS_TO_TEXT(RXRDY, status, i);148148+ STATUS_TO_TEXT(TXRQ, status, i);149149+ STATUS_TO_TEXT(ILL_ACCESS, status, i);150150+ printk("\n");151151+}152152+153153+#else154154+#define pr_debug_status(s) do { } while (0)155155+#endif156156+157157+static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)158158+{159159+ struct tmio_mmc_host *host = mmc_priv(mmc);160160+161161+ if (enable) {162162+ host->sdio_irq_enabled = 1;163163+ sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);164164+ sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK,165165+ (TMIO_SDIO_MASK_ALL & ~TMIO_SDIO_STAT_IOIRQ));166166+ } else {167167+ sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, TMIO_SDIO_MASK_ALL);168168+ sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);169169+ host->sdio_irq_enabled = 0;170170+ }171171+}172172+173173+static void tmio_mmc_set_clock(struct tmio_mmc_host *host, int new_clock)174174+{175175+ u32 clk = 0, clock;176176+177177+ if (new_clock) {178178+ for (clock = host->mmc->f_min, clk = 0x80000080;179179+ new_clock >= (clock<<1); clk >>= 1)180180+ clock <<= 1;181181+ clk |= 0x100;182182+ }183183+184184+ if (host->set_clk_div)185185+ host->set_clk_div(host->pdev, (clk>>22) & 1);186186+187187+ sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff);188188+}189189+190190+static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)191191+{192192+ struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);193193+194194+ /* implicit BUG_ON(!res) */195195+ if (resource_size(res) > 0x100) {196196+ sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000);197197+ msleep(10);198198+ }199199+200200+ sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 &201201+ sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));202202+ msleep(10);203203+}204204+205205+static void tmio_mmc_clk_start(struct tmio_mmc_host *host)206206+{207207+ struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);208208+209209+ sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 |210210+ sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));211211+ msleep(10);212212+213213+ /* implicit BUG_ON(!res) */214214+ if (resource_size(res) > 0x100) {215215+ sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);216216+ msleep(10);217217+ }218218+}219219+220220+static void tmio_mmc_reset(struct tmio_mmc_host *host)221221+{222222+ struct resource *res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);223223+224224+ /* FIXME - should we set stop clock reg here */225225+ sd_ctrl_write16(host, CTL_RESET_SD, 0x0000);226226+ /* implicit BUG_ON(!res) */227227+ if (resource_size(res) > 0x100)228228+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000);229229+ msleep(10);230230+ sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);231231+ if (resource_size(res) > 0x100)232232+ sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);233233+ msleep(10);234234+}235235+236236+static void tmio_mmc_reset_work(struct work_struct *work)237237+{238238+ struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host,239239+ delayed_reset_work.work);240240+ struct mmc_request *mrq;241241+ unsigned long flags;242242+243243+ spin_lock_irqsave(&host->lock, flags);244244+ mrq = host->mrq;245245+246246+ /* request already finished */247247+ if (!mrq248248+ || time_is_after_jiffies(host->last_req_ts +249249+ msecs_to_jiffies(2000))) {250250+ spin_unlock_irqrestore(&host->lock, flags);251251+ return;252252+ }253253+254254+ dev_warn(&host->pdev->dev,255255+ "timeout waiting for hardware interrupt (CMD%u)\n",256256+ mrq->cmd->opcode);257257+258258+ if (host->data)259259+ host->data->error = -ETIMEDOUT;260260+ else if (host->cmd)261261+ host->cmd->error = -ETIMEDOUT;262262+ else263263+ mrq->cmd->error = -ETIMEDOUT;264264+265265+ host->cmd = NULL;266266+ host->data = NULL;267267+ host->mrq = NULL;268268+ host->force_pio = false;269269+270270+ spin_unlock_irqrestore(&host->lock, flags);271271+272272+ tmio_mmc_reset(host);273273+274274+ mmc_request_done(host->mmc, mrq);275275+}276276+277277+static void tmio_mmc_finish_request(struct tmio_mmc_host *host)278278+{279279+ struct mmc_request *mrq = host->mrq;280280+281281+ if (!mrq)282282+ return;283283+284284+ host->mrq = NULL;285285+ host->cmd = NULL;286286+ host->data = NULL;287287+ host->force_pio = false;288288+289289+ cancel_delayed_work(&host->delayed_reset_work);290290+291291+ mmc_request_done(host->mmc, mrq);292292+}293293+294294+/* These are the bitmasks the tmio chip requires to implement the MMC response295295+ * types. Note that R1 and R6 are the same in this scheme. */296296+#define APP_CMD 0x0040297297+#define RESP_NONE 0x0300298298+#define RESP_R1 0x0400299299+#define RESP_R1B 0x0500300300+#define RESP_R2 0x0600301301+#define RESP_R3 0x0700302302+#define DATA_PRESENT 0x0800303303+#define TRANSFER_READ 0x1000304304+#define TRANSFER_MULTI 0x2000305305+#define SECURITY_CMD 0x4000306306+307307+static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)308308+{309309+ struct mmc_data *data = host->data;310310+ int c = cmd->opcode;311311+312312+ /* Command 12 is handled by hardware */313313+ if (cmd->opcode == 12 && !cmd->arg) {314314+ sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x001);315315+ return 0;316316+ }317317+318318+ switch (mmc_resp_type(cmd)) {319319+ case MMC_RSP_NONE: c |= RESP_NONE; break;320320+ case MMC_RSP_R1: c |= RESP_R1; break;321321+ case MMC_RSP_R1B: c |= RESP_R1B; break;322322+ case MMC_RSP_R2: c |= RESP_R2; break;323323+ case MMC_RSP_R3: c |= RESP_R3; break;324324+ default:325325+ pr_debug("Unknown response type %d\n", mmc_resp_type(cmd));326326+ return -EINVAL;327327+ }328328+329329+ host->cmd = cmd;330330+331331+/* FIXME - this seems to be ok commented out but the spec suggest this bit332332+ * should be set when issuing app commands.333333+ * if(cmd->flags & MMC_FLAG_ACMD)334334+ * c |= APP_CMD;335335+ */336336+ if (data) {337337+ c |= DATA_PRESENT;338338+ if (data->blocks > 1) {339339+ sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x100);340340+ c |= TRANSFER_MULTI;341341+ }342342+ if (data->flags & MMC_DATA_READ)343343+ c |= TRANSFER_READ;344344+ }345345+346346+ tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_CMD);347347+348348+ /* Fire off the command */349349+ sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg);350350+ sd_ctrl_write16(host, CTL_SD_CMD, c);351351+352352+ return 0;353353+}354354+355355+/*356356+ * This chip always returns (at least?) as much data as you ask for.357357+ * I'm unsure what happens if you ask for less than a block. This should be358358+ * looked into to ensure that a funny length read doesnt hose the controller.359359+ */360360+static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)361361+{362362+ struct mmc_data *data = host->data;363363+ void *sg_virt;364364+ unsigned short *buf;365365+ unsigned int count;366366+ unsigned long flags;367367+368368+ if ((host->chan_tx || host->chan_rx) && !host->force_pio) {369369+ pr_err("PIO IRQ in DMA mode!\n");370370+ return;371371+ } else if (!data) {372372+ pr_debug("Spurious PIO IRQ\n");373373+ return;374374+ }375375+376376+ sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags);377377+ buf = (unsigned short *)(sg_virt + host->sg_off);378378+379379+ count = host->sg_ptr->length - host->sg_off;380380+ if (count > data->blksz)381381+ count = data->blksz;382382+383383+ pr_debug("count: %08x offset: %08x flags %08x\n",384384+ count, host->sg_off, data->flags);385385+386386+ /* Transfer the data */387387+ if (data->flags & MMC_DATA_READ)388388+ sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);389389+ else390390+ sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);391391+392392+ host->sg_off += count;393393+394394+ tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt);395395+396396+ if (host->sg_off == host->sg_ptr->length)397397+ tmio_mmc_next_sg(host);398398+399399+ return;400400+}401401+402402+static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host)403403+{404404+ if (host->sg_ptr == &host->bounce_sg) {405405+ unsigned long flags;406406+ void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags);407407+ memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length);408408+ tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr);409409+ }410410+}411411+412412+/* needs to be called with host->lock held */413413+void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)414414+{415415+ struct mmc_data *data = host->data;416416+ struct mmc_command *stop;417417+418418+ host->data = NULL;419419+420420+ if (!data) {421421+ dev_warn(&host->pdev->dev, "Spurious data end IRQ\n");422422+ return;423423+ }424424+ stop = data->stop;425425+426426+ /* FIXME - return correct transfer count on errors */427427+ if (!data->error)428428+ data->bytes_xfered = data->blocks * data->blksz;429429+ else430430+ data->bytes_xfered = 0;431431+432432+ pr_debug("Completed data request\n");433433+434434+ /*435435+ * FIXME: other drivers allow an optional stop command of any given type436436+ * which we dont do, as the chip can auto generate them.437437+ * Perhaps we can be smarter about when to use auto CMD12 and438438+ * only issue the auto request when we know this is the desired439439+ * stop command, allowing fallback to the stop command the440440+ * upper layers expect. For now, we do what works.441441+ */442442+443443+ if (data->flags & MMC_DATA_READ) {444444+ if (host->chan_rx && !host->force_pio)445445+ tmio_mmc_check_bounce_buffer(host);446446+ dev_dbg(&host->pdev->dev, "Complete Rx request %p\n",447447+ host->mrq);448448+ } else {449449+ dev_dbg(&host->pdev->dev, "Complete Tx request %p\n",450450+ host->mrq);451451+ }452452+453453+ if (stop) {454454+ if (stop->opcode == 12 && !stop->arg)455455+ sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x000);456456+ else457457+ BUG();458458+ }459459+460460+ tmio_mmc_finish_request(host);461461+}462462+463463+static void tmio_mmc_data_irq(struct tmio_mmc_host *host)464464+{465465+ struct mmc_data *data;466466+ spin_lock(&host->lock);467467+ data = host->data;468468+469469+ if (!data)470470+ goto out;471471+472472+ if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) {473473+ /*474474+ * Has all data been written out yet? Testing on SuperH showed,475475+ * that in most cases the first interrupt comes already with the476476+ * BUSY status bit clear, but on some operations, like mount or477477+ * in the beginning of a write / sync / umount, there is one478478+ * DATAEND interrupt with the BUSY bit set, in this cases479479+ * waiting for one more interrupt fixes the problem.480480+ */481481+ if (!(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_CMD_BUSY)) {482482+ tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);483483+ tasklet_schedule(&host->dma_complete);484484+ }485485+ } else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) {486486+ tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);487487+ tasklet_schedule(&host->dma_complete);488488+ } else {489489+ tmio_mmc_do_data_irq(host);490490+ tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP | TMIO_MASK_WRITEOP);491491+ }492492+out:493493+ spin_unlock(&host->lock);494494+}495495+496496+static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,497497+ unsigned int stat)498498+{499499+ struct mmc_command *cmd = host->cmd;500500+ int i, addr;501501+502502+ spin_lock(&host->lock);503503+504504+ if (!host->cmd) {505505+ pr_debug("Spurious CMD irq\n");506506+ goto out;507507+ }508508+509509+ host->cmd = NULL;510510+511511+ /* This controller is sicker than the PXA one. Not only do we need to512512+ * drop the top 8 bits of the first response word, we also need to513513+ * modify the order of the response for short response command types.514514+ */515515+516516+ for (i = 3, addr = CTL_RESPONSE ; i >= 0 ; i--, addr += 4)517517+ cmd->resp[i] = sd_ctrl_read32(host, addr);518518+519519+ if (cmd->flags & MMC_RSP_136) {520520+ cmd->resp[0] = (cmd->resp[0] << 8) | (cmd->resp[1] >> 24);521521+ cmd->resp[1] = (cmd->resp[1] << 8) | (cmd->resp[2] >> 24);522522+ cmd->resp[2] = (cmd->resp[2] << 8) | (cmd->resp[3] >> 24);523523+ cmd->resp[3] <<= 8;524524+ } else if (cmd->flags & MMC_RSP_R3) {525525+ cmd->resp[0] = cmd->resp[3];526526+ }527527+528528+ if (stat & TMIO_STAT_CMDTIMEOUT)529529+ cmd->error = -ETIMEDOUT;530530+ else if (stat & TMIO_STAT_CRCFAIL && cmd->flags & MMC_RSP_CRC)531531+ cmd->error = -EILSEQ;532532+533533+ /* If there is data to handle we enable data IRQs here, and534534+ * we will ultimatley finish the request in the data_end handler.535535+ * If theres no data or we encountered an error, finish now.536536+ */537537+ if (host->data && !cmd->error) {538538+ if (host->data->flags & MMC_DATA_READ) {539539+ if (host->force_pio || !host->chan_rx)540540+ tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP);541541+ else542542+ tasklet_schedule(&host->dma_issue);543543+ } else {544544+ if (host->force_pio || !host->chan_tx)545545+ tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP);546546+ else547547+ tasklet_schedule(&host->dma_issue);548548+ }549549+ } else {550550+ tmio_mmc_finish_request(host);551551+ }552552+553553+out:554554+ spin_unlock(&host->lock);555555+}556556+557557+static irqreturn_t tmio_mmc_irq(int irq, void *devid)558558+{559559+ struct tmio_mmc_host *host = devid;560560+ struct tmio_mmc_data *pdata = host->pdata;561561+ unsigned int ireg, irq_mask, status;562562+ unsigned int sdio_ireg, sdio_irq_mask, sdio_status;563563+564564+ pr_debug("MMC IRQ begin\n");565565+566566+ status = sd_ctrl_read32(host, CTL_STATUS);567567+ irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);568568+ ireg = status & TMIO_MASK_IRQ & ~irq_mask;569569+570570+ sdio_ireg = 0;571571+ if (!ireg && pdata->flags & TMIO_MMC_SDIO_IRQ) {572572+ sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS);573573+ sdio_irq_mask = sd_ctrl_read16(host, CTL_SDIO_IRQ_MASK);574574+ sdio_ireg = sdio_status & TMIO_SDIO_MASK_ALL & ~sdio_irq_mask;575575+576576+ sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status & ~TMIO_SDIO_MASK_ALL);577577+578578+ if (sdio_ireg && !host->sdio_irq_enabled) {579579+ pr_warning("tmio_mmc: Spurious SDIO IRQ, disabling! 0x%04x 0x%04x 0x%04x\n",580580+ sdio_status, sdio_irq_mask, sdio_ireg);581581+ tmio_mmc_enable_sdio_irq(host->mmc, 0);582582+ goto out;583583+ }584584+585585+ if (host->mmc->caps & MMC_CAP_SDIO_IRQ &&586586+ sdio_ireg & TMIO_SDIO_STAT_IOIRQ)587587+ mmc_signal_sdio_irq(host->mmc);588588+589589+ if (sdio_ireg)590590+ goto out;591591+ }592592+593593+ pr_debug_status(status);594594+ pr_debug_status(ireg);595595+596596+ if (!ireg) {597597+ tmio_mmc_disable_mmc_irqs(host, status & ~irq_mask);598598+599599+ pr_warning("tmio_mmc: Spurious irq, disabling! "600600+ "0x%08x 0x%08x 0x%08x\n", status, irq_mask, ireg);601601+ pr_debug_status(status);602602+603603+ goto out;604604+ }605605+606606+ while (ireg) {607607+ /* Card insert / remove attempts */608608+ if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {609609+ tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |610610+ TMIO_STAT_CARD_REMOVE);611611+ mmc_detect_change(host->mmc, msecs_to_jiffies(100));612612+ }613613+614614+ /* CRC and other errors */615615+/* if (ireg & TMIO_STAT_ERR_IRQ)616616+ * handled |= tmio_error_irq(host, irq, stat);617617+ */618618+619619+ /* Command completion */620620+ if (ireg & (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT)) {621621+ tmio_mmc_ack_mmc_irqs(host,622622+ TMIO_STAT_CMDRESPEND |623623+ TMIO_STAT_CMDTIMEOUT);624624+ tmio_mmc_cmd_irq(host, status);625625+ }626626+627627+ /* Data transfer */628628+ if (ireg & (TMIO_STAT_RXRDY | TMIO_STAT_TXRQ)) {629629+ tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_RXRDY | TMIO_STAT_TXRQ);630630+ tmio_mmc_pio_irq(host);631631+ }632632+633633+ /* Data transfer completion */634634+ if (ireg & TMIO_STAT_DATAEND) {635635+ tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_DATAEND);636636+ tmio_mmc_data_irq(host);637637+ }638638+639639+ /* Check status - keep going until we've handled it all */640640+ status = sd_ctrl_read32(host, CTL_STATUS);641641+ irq_mask = sd_ctrl_read32(host, CTL_IRQ_MASK);642642+ ireg = status & TMIO_MASK_IRQ & ~irq_mask;643643+644644+ pr_debug("Status at end of loop: %08x\n", status);645645+ pr_debug_status(status);646646+ }647647+ pr_debug("MMC IRQ end\n");648648+649649+out:650650+ return IRQ_HANDLED;651651+}652652+653653+static int tmio_mmc_start_data(struct tmio_mmc_host *host,654654+ struct mmc_data *data)655655+{656656+ struct tmio_mmc_data *pdata = host->pdata;657657+658658+ pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n",659659+ data->blksz, data->blocks);660660+661661+ /* Some hardware cannot perform 2 byte requests in 4 bit mode */662662+ if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {663663+ int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;664664+665665+ if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {666666+ pr_err("%s: %d byte block unsupported in 4 bit mode\n",667667+ mmc_hostname(host->mmc), data->blksz);668668+ return -EINVAL;669669+ }670670+ }671671+672672+ tmio_mmc_init_sg(host, data);673673+ host->data = data;674674+675675+ /* Set transfer length / blocksize */676676+ sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);677677+ sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);678678+679679+ tmio_mmc_start_dma(host, data);680680+681681+ return 0;682682+}683683+684684+/* Process requests from the MMC layer */685685+static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)686686+{687687+ struct tmio_mmc_host *host = mmc_priv(mmc);688688+ int ret;689689+690690+ if (host->mrq)691691+ pr_debug("request not null\n");692692+693693+ host->last_req_ts = jiffies;694694+ wmb();695695+ host->mrq = mrq;696696+697697+ if (mrq->data) {698698+ ret = tmio_mmc_start_data(host, mrq->data);699699+ if (ret)700700+ goto fail;701701+ }702702+703703+ ret = tmio_mmc_start_command(host, mrq->cmd);704704+ if (!ret) {705705+ schedule_delayed_work(&host->delayed_reset_work,706706+ msecs_to_jiffies(2000));707707+ return;708708+ }709709+710710+fail:711711+ host->mrq = NULL;712712+ host->force_pio = false;713713+ mrq->cmd->error = ret;714714+ mmc_request_done(mmc, mrq);715715+}716716+717717+/* Set MMC clock / power.718718+ * Note: This controller uses a simple divider scheme therefore it cannot719719+ * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as720720+ * MMC wont run that fast, it has to be clocked at 12MHz which is the next721721+ * slowest setting.722722+ */723723+static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)724724+{725725+ struct tmio_mmc_host *host = mmc_priv(mmc);726726+727727+ if (ios->clock)728728+ tmio_mmc_set_clock(host, ios->clock);729729+730730+ /* Power sequence - OFF -> UP -> ON */731731+ if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {732732+ /* power down SD bus */733733+ if (ios->power_mode == MMC_POWER_OFF && host->set_pwr)734734+ host->set_pwr(host->pdev, 0);735735+ tmio_mmc_clk_stop(host);736736+ } else if (ios->power_mode == MMC_POWER_UP) {737737+ /* power up SD bus */738738+ if (host->set_pwr)739739+ host->set_pwr(host->pdev, 1);740740+ } else {741741+ /* start bus clock */742742+ tmio_mmc_clk_start(host);743743+ }744744+745745+ switch (ios->bus_width) {746746+ case MMC_BUS_WIDTH_1:747747+ sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);748748+ break;749749+ case MMC_BUS_WIDTH_4:750750+ sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);751751+ break;752752+ }753753+754754+ /* Let things settle. delay taken from winCE driver */755755+ udelay(140);756756+}757757+758758+static int tmio_mmc_get_ro(struct mmc_host *mmc)759759+{760760+ struct tmio_mmc_host *host = mmc_priv(mmc);761761+ struct tmio_mmc_data *pdata = host->pdata;762762+763763+ return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||764764+ !(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));765765+}766766+767767+static int tmio_mmc_get_cd(struct mmc_host *mmc)768768+{769769+ struct tmio_mmc_host *host = mmc_priv(mmc);770770+ struct tmio_mmc_data *pdata = host->pdata;771771+772772+ if (!pdata->get_cd)773773+ return -ENOSYS;774774+ else775775+ return pdata->get_cd(host->pdev);776776+}777777+778778+static const struct mmc_host_ops tmio_mmc_ops = {779779+ .request = tmio_mmc_request,780780+ .set_ios = tmio_mmc_set_ios,781781+ .get_ro = tmio_mmc_get_ro,782782+ .get_cd = tmio_mmc_get_cd,783783+ .enable_sdio_irq = tmio_mmc_enable_sdio_irq,784784+};785785+786786+int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,787787+ struct platform_device *pdev,788788+ struct tmio_mmc_data *pdata)789789+{790790+ struct tmio_mmc_host *_host;791791+ struct mmc_host *mmc;792792+ struct resource *res_ctl;793793+ int ret;794794+ u32 irq_mask = TMIO_MASK_CMD;795795+796796+ res_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 0);797797+ if (!res_ctl)798798+ return -EINVAL;799799+800800+ mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);801801+ if (!mmc)802802+ return -ENOMEM;803803+804804+ _host = mmc_priv(mmc);805805+ _host->pdata = pdata;806806+ _host->mmc = mmc;807807+ _host->pdev = pdev;808808+ platform_set_drvdata(pdev, mmc);809809+810810+ _host->set_pwr = pdata->set_pwr;811811+ _host->set_clk_div = pdata->set_clk_div;812812+813813+ /* SD control register space size is 0x200, 0x400 for bus_shift=1 */814814+ _host->bus_shift = resource_size(res_ctl) >> 10;815815+816816+ _host->ctl = ioremap(res_ctl->start, resource_size(res_ctl));817817+ if (!_host->ctl) {818818+ ret = -ENOMEM;819819+ goto host_free;820820+ }821821+822822+ mmc->ops = &tmio_mmc_ops;823823+ mmc->caps = MMC_CAP_4_BIT_DATA | pdata->capabilities;824824+ mmc->f_max = pdata->hclk;825825+ mmc->f_min = mmc->f_max / 512;826826+ mmc->max_segs = 32;827827+ mmc->max_blk_size = 512;828828+ mmc->max_blk_count = (PAGE_CACHE_SIZE / mmc->max_blk_size) *829829+ mmc->max_segs;830830+ mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;831831+ mmc->max_seg_size = mmc->max_req_size;832832+ if (pdata->ocr_mask)833833+ mmc->ocr_avail = pdata->ocr_mask;834834+ else835835+ mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;836836+837837+ tmio_mmc_clk_stop(_host);838838+ tmio_mmc_reset(_host);839839+840840+ ret = platform_get_irq(pdev, 0);841841+ if (ret < 0)842842+ goto unmap_ctl;843843+844844+ _host->irq = ret;845845+846846+ tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);847847+ if (pdata->flags & TMIO_MMC_SDIO_IRQ)848848+ tmio_mmc_enable_sdio_irq(mmc, 0);849849+850850+ ret = request_irq(_host->irq, tmio_mmc_irq, IRQF_DISABLED |851851+ IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), _host);852852+ if (ret)853853+ goto unmap_ctl;854854+855855+ spin_lock_init(&_host->lock);856856+857857+ /* Init delayed work for request timeouts */858858+ INIT_DELAYED_WORK(&_host->delayed_reset_work, tmio_mmc_reset_work);859859+860860+ /* See if we also get DMA */861861+ tmio_mmc_request_dma(_host, pdata);862862+863863+ mmc_add_host(mmc);864864+865865+ /* Unmask the IRQs we want to know about */866866+ if (!_host->chan_rx)867867+ irq_mask |= TMIO_MASK_READOP;868868+ if (!_host->chan_tx)869869+ irq_mask |= TMIO_MASK_WRITEOP;870870+871871+ tmio_mmc_enable_mmc_irqs(_host, irq_mask);872872+873873+ *host = _host;874874+875875+ return 0;876876+877877+unmap_ctl:878878+ iounmap(_host->ctl);879879+host_free:880880+ mmc_free_host(mmc);881881+882882+ return ret;883883+}884884+EXPORT_SYMBOL(tmio_mmc_host_probe);885885+886886+void tmio_mmc_host_remove(struct tmio_mmc_host *host)887887+{888888+ mmc_remove_host(host->mmc);889889+ cancel_delayed_work_sync(&host->delayed_reset_work);890890+ tmio_mmc_release_dma(host);891891+ free_irq(host->irq, host);892892+ iounmap(host->ctl);893893+ mmc_free_host(host->mmc);894894+}895895+EXPORT_SYMBOL(tmio_mmc_host_remove);896896+897897+MODULE_LICENSE("GPL v2");
+2-3
drivers/mmc/host/via-sdmmc.c
···10871087 struct mmc_host *mmc;10881088 struct via_crdr_mmc_host *sdhost;10891089 u32 base, len;10901090- u8 rev, gatt;10901090+ u8 gatt;10911091 int ret;1092109210931093- pci_read_config_byte(pcidev, PCI_CLASS_REVISION, &rev);10941093 pr_info(DRV_NAME10951094 ": VIA SDMMC controller found at %s [%04x:%04x] (rev %x)\n",10961095 pci_name(pcidev), (int)pcidev->vendor, (int)pcidev->device,10971097- (int)rev);10961096+ (int)pcidev->revision);1098109710991098 ret = pci_enable_device(pcidev);11001099 if (ret)
+11-2
drivers/net/bfin_mac.c
···1237123712381238 if (phydev->interface == PHY_INTERFACE_MODE_RMII) {12391239 opmode |= RMII; /* For Now only 100MBit are supported */12401240-#if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) && CONFIG_BF_REV_0_212411241- opmode |= TE;12401240+#if defined(CONFIG_BF537) || defined(CONFIG_BF536)12411241+ if (__SILICON_REVISION__ < 3) {12421242+ /*12431243+ * This isn't publicly documented (fun times!), but in12441244+ * silicon <=0.2, the RX and TX pins are clocked together.12451245+ * So in order to recv, we must enable the transmit side12461246+ * as well. This will cause a spurious TX interrupt too,12471247+ * but we can easily consume that.12481248+ */12491249+ opmode |= TE;12501250+ }12421251#endif12431252 }12441253
···12061206 iommu_disable_translation(iommu);1207120712081208 if (iommu->irq) {12091209- set_irq_data(iommu->irq, NULL);12091209+ irq_set_handler_data(iommu->irq, NULL);12101210 /* This will mask the irq */12111211 free_irq(iommu->irq, iommu);12121212 destroy_irq(iommu->irq);
···181181 /* all other (older) Db1x00 boards use a GPIO to show182182 * card detection status: use both-edge triggers.183183 */184184- set_irq_type(sock->insert_irq, IRQ_TYPE_EDGE_BOTH);184184+ irq_set_irq_type(sock->insert_irq, IRQ_TYPE_EDGE_BOTH);185185 ret = request_irq(sock->insert_irq, db1000_pcmcia_cdirq,186186 0, "pcmcia_carddetect", sock);187187
+50-85
drivers/pcmcia/pxa2xx_colibri.c
···3434#define COLIBRI320_DETECT_GPIO 813535#define COLIBRI320_READY_GPIO 2936363737-static struct {3838- int reset_gpio;3939- int ppen_gpio;4040- int bvd1_gpio;4141- int bvd2_gpio;4242- int detect_gpio;4343- int ready_gpio;4444-} colibri_pcmcia_gpio;3737+enum {3838+ DETECT = 0,3939+ READY = 1,4040+ BVD1 = 2,4141+ BVD2 = 3,4242+ PPEN = 4,4343+ RESET = 5,4444+};4545+4646+/* Contents of this array are configured on-the-fly in init function */4747+static struct gpio colibri_pcmcia_gpios[] = {4848+ { 0, GPIOF_IN, "PCMCIA Detect" },4949+ { 0, GPIOF_IN, "PCMCIA Ready" },5050+ { 0, GPIOF_IN, "PCMCIA BVD1" },5151+ { 0, GPIOF_IN, "PCMCIA BVD2" },5252+ { 0, GPIOF_INIT_LOW, "PCMCIA PPEN" },5353+ { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" },5454+};45554656static struct pcmcia_irqs colibri_irqs[] = {4757 {···6454{6555 int ret;66566767- ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT");5757+ ret = gpio_request_array(colibri_pcmcia_gpios,5858+ ARRAY_SIZE(colibri_pcmcia_gpios));6859 if (ret)6960 goto err1;7070- ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);7171- if (ret)7272- goto err2;73617474- ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");7575- if (ret)7676- goto err2;7777- ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);7878- if (ret)7979- goto err3;6262+ colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio);6363+ skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio);80648181- ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1");8282- if (ret)8383- goto err3;8484- ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);8585- if (ret)8686- goto err4;8787-8888- ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2");8989- if (ret)9090- goto err4;9191- ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);9292- if (ret)9393- goto err5;9494-9595- ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");9696- if (ret)9797- goto err5;9898- ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);9999- if (ret)100100- goto err6;101101-102102- ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");103103- if (ret)104104- goto err6;105105- ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);106106- if (ret)107107- goto err7;108108-109109- colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);110110- skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);111111-112112- return soc_pcmcia_request_irqs(skt, colibri_irqs,6565+ ret = soc_pcmcia_request_irqs(skt, colibri_irqs,11366 ARRAY_SIZE(colibri_irqs));6767+ if (ret)6868+ goto err2;11469115115-err7:116116- gpio_free(colibri_pcmcia_gpio.detect_gpio);117117-err6:118118- gpio_free(colibri_pcmcia_gpio.ready_gpio);119119-err5:120120- gpio_free(colibri_pcmcia_gpio.bvd1_gpio);121121-err4:122122- gpio_free(colibri_pcmcia_gpio.bvd2_gpio);123123-err3:124124- gpio_free(colibri_pcmcia_gpio.reset_gpio);7070+ return ret;7171+12572err2:126126- gpio_free(colibri_pcmcia_gpio.ppen_gpio);7373+ gpio_free_array(colibri_pcmcia_gpios,7474+ ARRAY_SIZE(colibri_pcmcia_gpios));12775err1:12876 return ret;12977}1307813179static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)13280{133133- gpio_free(colibri_pcmcia_gpio.detect_gpio);134134- gpio_free(colibri_pcmcia_gpio.ready_gpio);135135- gpio_free(colibri_pcmcia_gpio.bvd1_gpio);136136- gpio_free(colibri_pcmcia_gpio.bvd2_gpio);137137- gpio_free(colibri_pcmcia_gpio.reset_gpio);138138- gpio_free(colibri_pcmcia_gpio.ppen_gpio);8181+ gpio_free_array(colibri_pcmcia_gpios,8282+ ARRAY_SIZE(colibri_pcmcia_gpios));13983}1408414185static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,14286 struct pcmcia_state *state)14387{14488145145- state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio);146146- state->ready = !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio);147147- state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio);148148- state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio);8989+ state->detect = !!gpio_get_value(colibri_pcmcia_gpios[DETECT].gpio);9090+ state->ready = !!gpio_get_value(colibri_pcmcia_gpios[READY].gpio);9191+ state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpios[BVD1].gpio);9292+ state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpios[BVD2].gpio);14993 state->wrprot = 0;15094 state->vs_3v = 1;15195 state->vs_Xv = 0;···109145colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,110146 const socket_state_t *state)111147{112112- gpio_set_value(colibri_pcmcia_gpio.ppen_gpio,148148+ gpio_set_value(colibri_pcmcia_gpios[PPEN].gpio,113149 !(state->Vcc == 33 && state->Vpp < 50));114114- gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET);150150+ gpio_set_value(colibri_pcmcia_gpios[RESET].gpio,151151+ state->flags & SS_RESET);115152 return 0;116153}117154···155190156191 /* Colibri PXA270 */157192 if (machine_is_colibri()) {158158- colibri_pcmcia_gpio.reset_gpio = COLIBRI270_RESET_GPIO;159159- colibri_pcmcia_gpio.ppen_gpio = COLIBRI270_PPEN_GPIO;160160- colibri_pcmcia_gpio.bvd1_gpio = COLIBRI270_BVD1_GPIO;161161- colibri_pcmcia_gpio.bvd2_gpio = COLIBRI270_BVD2_GPIO;162162- colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;163163- colibri_pcmcia_gpio.ready_gpio = COLIBRI270_READY_GPIO;193193+ colibri_pcmcia_gpios[RESET].gpio = COLIBRI270_RESET_GPIO;194194+ colibri_pcmcia_gpios[PPEN].gpio = COLIBRI270_PPEN_GPIO;195195+ colibri_pcmcia_gpios[BVD1].gpio = COLIBRI270_BVD1_GPIO;196196+ colibri_pcmcia_gpios[BVD2].gpio = COLIBRI270_BVD2_GPIO;197197+ colibri_pcmcia_gpios[DETECT].gpio = COLIBRI270_DETECT_GPIO;198198+ colibri_pcmcia_gpios[READY].gpio = COLIBRI270_READY_GPIO;164199 /* Colibri PXA320 */165200 } else if (machine_is_colibri320()) {166166- colibri_pcmcia_gpio.reset_gpio = COLIBRI320_RESET_GPIO;167167- colibri_pcmcia_gpio.ppen_gpio = COLIBRI320_PPEN_GPIO;168168- colibri_pcmcia_gpio.bvd1_gpio = COLIBRI320_BVD1_GPIO;169169- colibri_pcmcia_gpio.bvd2_gpio = COLIBRI320_BVD2_GPIO;170170- colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO;171171- colibri_pcmcia_gpio.ready_gpio = COLIBRI320_READY_GPIO;201201+ colibri_pcmcia_gpios[RESET].gpio = COLIBRI320_RESET_GPIO;202202+ colibri_pcmcia_gpios[PPEN].gpio = COLIBRI320_PPEN_GPIO;203203+ colibri_pcmcia_gpios[BVD1].gpio = COLIBRI320_BVD1_GPIO;204204+ colibri_pcmcia_gpios[BVD2].gpio = COLIBRI320_BVD2_GPIO;205205+ colibri_pcmcia_gpios[DETECT].gpio = COLIBRI320_DETECT_GPIO;206206+ colibri_pcmcia_gpios[READY].gpio = COLIBRI320_READY_GPIO;172207 }173208174209 ret = platform_device_add_data(colibri_pcmcia_device,
+10-32
drivers/pcmcia/pxa2xx_palmld.c
···44 * Driver for Palm LifeDrive PCMCIA55 *66 * Copyright (C) 2006 Alex Osborne <ato@meshy.org>77- * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com>77+ * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>88 *99 * This program is free software; you can redistribute it and/or modify1010 * it under the terms of the GNU General Public License version 2 as···2020#include <mach/palmld.h>2121#include "soc_common.h"22222323+static struct gpio palmld_pcmcia_gpios[] = {2424+ { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" },2525+ { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },2626+ { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },2727+};2828+2329static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)2430{2531 int ret;26322727- ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR");2828- if (ret)2929- goto err1;3030- ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0);3131- if (ret)3232- goto err2;3333-3434- ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST");3535- if (ret)3636- goto err2;3737- ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1);3838- if (ret)3939- goto err3;4040-4141- ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY");4242- if (ret)4343- goto err3;4444- ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY);4545- if (ret)4646- goto err4;3333+ ret = gpio_request_array(palmld_pcmcia_gpios,3434+ ARRAY_SIZE(palmld_pcmcia_gpios));47354836 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY);4949- return 0;50375151-err4:5252- gpio_free(GPIO_NR_PALMLD_PCMCIA_READY);5353-err3:5454- gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);5555-err2:5656- gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);5757-err1:5838 return ret;5939}60406141static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)6242{6363- gpio_free(GPIO_NR_PALMLD_PCMCIA_READY);6464- gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);6565- gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);4343+ gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios));6644}67456846static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+13-62
drivers/pcmcia/pxa2xx_palmtc.c
···44 * Driver for Palm Tungsten|C PCMCIA55 *66 * Copyright (C) 2008 Alex Osborne <ato@meshy.org>77- * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com>77+ * Copyright (C) 2009-2011 Marek Vasut <marek.vasut@gmail.com>88 *99 * This program is free software; you can redistribute it and/or modify1010 * it under the terms of the GNU General Public License version 2 as···2121#include <mach/palmtc.h>2222#include "soc_common.h"23232424+static struct gpio palmtc_pcmcia_gpios[] = {2525+ { GPIO_NR_PALMTC_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },2626+ { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },2727+ { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" },2828+ { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },2929+ { GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },3030+ { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" },3131+};3232+2433static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)2534{2635 int ret;27362828- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1");2929- if (ret)3030- goto err1;3131- ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);3232- if (ret)3333- goto err2;3434-3535- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2");3636- if (ret)3737- goto err2;3838- ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);3939- if (ret)4040- goto err3;4141-4242- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3");4343- if (ret)4444- goto err3;4545- ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);4646- if (ret)4747- goto err4;4848-4949- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST");5050- if (ret)5151- goto err4;5252- ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1);5353- if (ret)5454- goto err5;5555-5656- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY");5757- if (ret)5858- goto err5;5959- ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY);6060- if (ret)6161- goto err6;6262-6363- ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY");6464- if (ret)6565- goto err6;6666- ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY);6767- if (ret)6868- goto err7;3737+ ret = gpio_request_array(palmtc_pcmcia_gpios,3838+ ARRAY_SIZE(palmtc_pcmcia_gpios));69397040 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY);7171- return 0;72417373-err7:7474- gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);7575-err6:7676- gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);7777-err5:7878- gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);7979-err4:8080- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);8181-err3:8282- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);8383-err2:8484- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);8585-err1:8642 return ret;8743}88448945static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)9046{9191- gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);9292- gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);9393- gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);9494- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);9595- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);9696- gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);4747+ gpio_free_array(palmtc_pcmcia_gpios, ARRAY_SIZE(palmtc_pcmcia_gpios));9748}98499950static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+12-45
drivers/pcmcia/pxa2xx_palmtx.c
···33 *44 * Driver for Palm T|X PCMCIA55 *66- * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com>66+ * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>77 *88 * This program is free software; you can redistribute it and/or modify99 * it under the terms of the GNU General Public License version 2 as···13131414#include <linux/module.h>1515#include <linux/platform_device.h>1616+#include <linux/gpio.h>16171718#include <asm/mach-types.h>1818-1919-#include <mach/gpio.h>2019#include <mach/palmtx.h>2121-2220#include "soc_common.h"2121+2222+static struct gpio palmtx_pcmcia_gpios[] = {2323+ { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },2424+ { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },2525+ { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },2626+ { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },2727+};23282429static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)2530{2631 int ret;27322828- ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1");2929- if (ret)3030- goto err1;3131- ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0);3232- if (ret)3333- goto err2;3434-3535- ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2");3636- if (ret)3737- goto err2;3838- ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0);3939- if (ret)4040- goto err3;4141-4242- ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST");4343- if (ret)4444- goto err3;4545- ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1);4646- if (ret)4747- goto err4;4848-4949- ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY");5050- if (ret)5151- goto err4;5252- ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY);5353- if (ret)5454- goto err5;3333+ ret = gpio_request_array(palmtx_pcmcia_gpios,3434+ ARRAY_SIZE(palmtx_pcmcia_gpios));55355636 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY);5757- return 0;58375959-err5:6060- gpio_free(GPIO_NR_PALMTX_PCMCIA_READY);6161-err4:6262- gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);6363-err3:6464- gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);6565-err2:6666- gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);6767-err1:6838 return ret;6939}70407141static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)7242{7373- gpio_free(GPIO_NR_PALMTX_PCMCIA_READY);7474- gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);7575- gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);7676- gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);4343+ gpio_free_array(palmtx_pcmcia_gpios, ARRAY_SIZE(palmtx_pcmcia_gpios));7744}78457946static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+30-80
drivers/pcmcia/pxa2xx_vpac270.c
···33 *44 * Driver for Voipac PXA270 PCMCIA and CF sockets55 *66- * Copyright (C) 201077- * Marek Vasut <marek.vasut@gmail.com>66+ * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>87 *98 * This program is free software; you can redistribute it and/or modify109 * it under the terms of the GNU General Public License version 2 as···2021#include <mach/vpac270.h>21222223#include "soc_common.h"2424+2525+static struct gpio vpac270_pcmcia_gpios[] = {2626+ { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" },2727+ { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" },2828+ { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" },2929+ { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" },3030+};3131+3232+static struct gpio vpac270_cf_gpios[] = {3333+ { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" },3434+ { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" },3535+ { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" },3636+};23372438static struct pcmcia_irqs cd_irqs[] = {2539 {···5240 int ret;53415442 if (skt->nr == 0) {5555- ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD");5656- if (ret)5757- goto err1;5858- ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD);5959- if (ret)6060- goto err2;6161-6262- ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY");6363- if (ret)6464- goto err2;6565- ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY);6666- if (ret)6767- goto err3;6868-6969- ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN");7070- if (ret)7171- goto err3;7272- ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0);7373- if (ret)7474- goto err4;7575-7676- ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET");7777- if (ret)7878- goto err4;7979- ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0);8080- if (ret)8181- goto err5;4343+ ret = gpio_request_array(vpac270_pcmcia_gpios,4444+ ARRAY_SIZE(vpac270_pcmcia_gpios));82458346 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY);84478585- return soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1);8686-8787-err5:8888- gpio_free(GPIO11_VPAC270_PCMCIA_RESET);8989-err4:9090- gpio_free(GPIO107_VPAC270_PCMCIA_PPEN);9191-err3:9292- gpio_free(GPIO35_VPAC270_PCMCIA_RDY);9393-err2:9494- gpio_free(GPIO84_VPAC270_PCMCIA_CD);9595-err1:9696- return ret;9797-4848+ if (!ret)4949+ ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1);9850 } else {9999- ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD");100100- if (ret)101101- goto err6;102102- ret = gpio_direction_input(GPIO17_VPAC270_CF_CD);103103- if (ret)104104- goto err7;105105-106106- ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY");107107- if (ret)108108- goto err7;109109- ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY);110110- if (ret)111111- goto err8;112112-113113- ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET");114114- if (ret)115115- goto err8;116116- ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0);117117- if (ret)118118- goto err9;5151+ ret = gpio_request_array(vpac270_cf_gpios,5252+ ARRAY_SIZE(vpac270_cf_gpios));1195312054 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY);12155122122- return soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1);123123-124124-err9:125125- gpio_free(GPIO16_VPAC270_CF_RESET);126126-err8:127127- gpio_free(GPIO12_VPAC270_CF_RDY);128128-err7:129129- gpio_free(GPIO17_VPAC270_CF_CD);130130-err6:131131- return ret;132132-5656+ if (!ret)5757+ ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1);13358 }5959+6060+ return ret;13461}1356213663static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)13764{138138- gpio_free(GPIO11_VPAC270_PCMCIA_RESET);139139- gpio_free(GPIO107_VPAC270_PCMCIA_PPEN);140140- gpio_free(GPIO35_VPAC270_PCMCIA_RDY);141141- gpio_free(GPIO84_VPAC270_PCMCIA_CD);142142- gpio_free(GPIO16_VPAC270_CF_RESET);143143- gpio_free(GPIO12_VPAC270_CF_RDY);144144- gpio_free(GPIO17_VPAC270_CF_CD);6565+ if (skt->nr == 0)6666+ gpio_request_array(vpac270_pcmcia_gpios,6767+ ARRAY_SIZE(vpac270_pcmcia_gpios));6868+ else6969+ gpio_request_array(vpac270_cf_gpios,7070+ ARRAY_SIZE(vpac270_cf_gpios));14571}1467214773static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
···597597 int result;598598 int irq_pin = AST_INT;599599600600- set_irq_type(OMAP_GPIO_IRQ(irq_pin), IRQ_TYPE_LEVEL_LOW);600600+ irq_set_irq_type(OMAP_GPIO_IRQ(irq_pin), IRQ_TYPE_LEVEL_LOW);601601602602 /*603603 * for shared IRQS must provide non NULL device ptr
+1-1
drivers/tty/hvc/hvc_xen.c
···178178 if (xencons_irq < 0)179179 xencons_irq = 0; /* NO_IRQ */180180 else181181- set_irq_noprobe(xencons_irq);181181+ irq_set_noprobe(xencons_irq);182182183183 hp = hvc_alloc(HVC_COOKIE, xencons_irq, ops, 256);184184 if (IS_ERR(hp))
+2-2
drivers/tty/serial/msm_serial_hs.c
···16441644 if (unlikely(uport->irq < 0))16451645 return -ENXIO;1646164616471647- if (unlikely(set_irq_wake(uport->irq, 1)))16471647+ if (unlikely(irq_set_irq_wake(uport->irq, 1)))16481648 return -ENXIO;1649164916501650 if (pdata == NULL || pdata->rx_wakeup_irq < 0)···16581658 if (unlikely(msm_uport->rx_wakeup.irq < 0))16591659 return -ENXIO;1660166016611661- if (unlikely(set_irq_wake(msm_uport->rx_wakeup.irq, 1)))16611661+ if (unlikely(irq_set_irq_wake(msm_uport->rx_wakeup.irq, 1)))16621662 return -ENXIO;16631663 }16641664
+7-69
drivers/usb/gadget/pxa25x_udc.c
···139139static void pxa25x_ep_fifo_flush (struct usb_ep *ep);140140static void nuke (struct pxa25x_ep *, int status);141141142142-/* one GPIO should be used to detect VBUS from the host */143143-static int is_vbus_present(void)144144-{145145- struct pxa2xx_udc_mach_info *mach = the_controller->mach;146146-147147- if (gpio_is_valid(mach->gpio_vbus)) {148148- int value = gpio_get_value(mach->gpio_vbus);149149-150150- if (mach->gpio_vbus_inverted)151151- return !value;152152- else153153- return !!value;154154- }155155- if (mach->udc_is_connected)156156- return mach->udc_is_connected();157157- return 1;158158-}159159-160142/* one GPIO should control a D+ pullup, so host sees this device (or not) */161143static void pullup_off(void)162144{···10371055 "%s version: %s\nGadget driver: %s\nHost %s\n\n",10381056 driver_name, DRIVER_VERSION SIZE_STR "(pio)",10391057 dev->driver ? dev->driver->driver.name : "(none)",10401040- is_vbus_present() ? "full speed" : "disconnected");10581058+ dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected");1041105910421060 /* registers for device and ep0 */10431061 seq_printf(m,···10761094 (tmp & UDCCFR_ACM) ? " acm" : "");10771095 }1078109610791079- if (!is_vbus_present() || !dev->driver)10971097+ if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver)10801098 goto done;1081109910821100 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",···1417143514181436#endif1419143714201420-static irqreturn_t udc_vbus_irq(int irq, void *_dev)14211421-{14221422- struct pxa25x_udc *dev = _dev;14231423-14241424- pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present());14251425- return IRQ_HANDLED;14261426-}14271427-1428143814291439/*-------------------------------------------------------------------------*/14301440···17401766 if (unlikely(udccr & UDCCR_SUSIR)) {17411767 udc_ack_int_UDCCR(UDCCR_SUSIR);17421768 handled = 1;17431743- DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present()17441744- ? "" : "+disconnect");17691769+ DBG(DBG_VERBOSE, "USB suspend\n");1745177017461746- if (!is_vbus_present())17471747- stop_activity(dev, dev->driver);17481748- else if (dev->gadget.speed != USB_SPEED_UNKNOWN17711771+ if (dev->gadget.speed != USB_SPEED_UNKNOWN17491772 && dev->driver17501773 && dev->driver->suspend)17511774 dev->driver->suspend(&dev->gadget);···1757178617581787 if (dev->gadget.speed != USB_SPEED_UNKNOWN17591788 && dev->driver17601760- && dev->driver->resume17611761- && is_vbus_present())17891789+ && dev->driver->resume)17621790 dev->driver->resume(&dev->gadget);17631791 }17641792···21072137static int __init pxa25x_udc_probe(struct platform_device *pdev)21082138{21092139 struct pxa25x_udc *dev = &memory;21102110- int retval, vbus_irq, irq;21402140+ int retval, irq;21112141 u32 chiprev;2112214221132143 /* insist on Intel/ARM/XScale */···2169219921702200 dev->transceiver = otg_get_transceiver();2171220121722172- if (gpio_is_valid(dev->mach->gpio_vbus)) {21732173- if ((retval = gpio_request(dev->mach->gpio_vbus,21742174- "pxa25x_udc GPIO VBUS"))) {21752175- dev_dbg(&pdev->dev,21762176- "can't get vbus gpio %d, err: %d\n",21772177- dev->mach->gpio_vbus, retval);21782178- goto err_gpio_vbus;21792179- }21802180- gpio_direction_input(dev->mach->gpio_vbus);21812181- vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);21822182- } else21832183- vbus_irq = 0;21842184-21852202 if (gpio_is_valid(dev->mach->gpio_pullup)) {21862203 if ((retval = gpio_request(dev->mach->gpio_pullup,21872204 "pca25x_udc GPIO PULLUP"))) {···21942237 udc_disable(dev);21952238 udc_reinit(dev);2196223921972197- dev->vbus = !!is_vbus_present();22402240+ dev->vbus = 0;2198224121992242 /* irq setup after old hardware state is cleaned up */22002243 retval = request_irq(irq, pxa25x_udc_irq,···22302273 }22312274 } else22322275#endif22332233- if (vbus_irq) {22342234- retval = request_irq(vbus_irq, udc_vbus_irq,22352235- IRQF_DISABLED | IRQF_SAMPLE_RANDOM |22362236- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,22372237- driver_name, dev);22382238- if (retval != 0) {22392239- pr_err("%s: can't get irq %i, err %d\n",22402240- driver_name, vbus_irq, retval);22412241- goto err_vbus_irq;22422242- }22432243- }22442276 create_debug_files(dev);2245227722462278 return 0;2247227922482248- err_vbus_irq:22492280#ifdef CONFIG_ARCH_LUBBOCK22502281 free_irq(LUBBOCK_USB_DISC_IRQ, dev);22512282 err_irq_lub:···22432298 if (gpio_is_valid(dev->mach->gpio_pullup))22442299 gpio_free(dev->mach->gpio_pullup);22452300 err_gpio_pullup:22462246- if (gpio_is_valid(dev->mach->gpio_vbus))22472247- gpio_free(dev->mach->gpio_vbus);22482248- err_gpio_vbus:22492301 if (dev->transceiver) {22502302 otg_put_transceiver(dev->transceiver);22512303 dev->transceiver = NULL;···22792337 free_irq(LUBBOCK_USB_IRQ, dev);22802338 }22812339#endif22822282- if (gpio_is_valid(dev->mach->gpio_vbus)) {22832283- free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev);22842284- gpio_free(dev->mach->gpio_vbus);22852285- }22862340 if (gpio_is_valid(dev->mach->gpio_pullup))22872341 gpio_free(dev->mach->gpio_pullup);22882342
+1-1
drivers/usb/host/oxu210hp-hcd.c
···38323832 return -EBUSY;38333833 }3834383438353835- ret = set_irq_type(irq, IRQF_TRIGGER_FALLING);38353835+ ret = irq_set_irq_type(irq, IRQF_TRIGGER_FALLING);38363836 if (ret) {38373837 dev_err(&pdev->dev, "error setting irq type\n");38383838 ret = -EFAULT;
+1-1
drivers/usb/musb/tusb6010.c
···943943 musb_writel(tbase, TUSB_INT_CTRL_CONF,944944 TUSB_INT_CTRL_CONF_INT_RELCYC(0));945945946946- set_irq_type(musb->nIrq, IRQ_TYPE_LEVEL_LOW);946946+ irq_set_irq_type(musb->nIrq, IRQ_TYPE_LEVEL_LOW);947947948948 /* maybe force into the Default-A OTG state machine */949949 if (!(musb_readl(tbase, TUSB_DEV_OTG_STAT)
+89-47
drivers/video/pxafb.c
···627627628628static void overlay1fb_disable(struct pxafb_layer *ofb)629629{630630- uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);630630+ uint32_t lccr5;631631+632632+ if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))633633+ return;634634+635635+ lccr5 = lcd_readl(ofb->fbi, LCCR5);631636632637 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);633638···690685691686static void overlay2fb_disable(struct pxafb_layer *ofb)692687{693693- uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);688688+ uint32_t lccr5;689689+690690+ if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))691691+ return;692692+693693+ lccr5 = lcd_readl(ofb->fbi, LCCR5);694694695695 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);696696···730720 if (user == 0)731721 return -ENODEV;732722733733- /* allow only one user at a time */734734- if (atomic_inc_and_test(&ofb->usage))735735- return -EBUSY;723723+ if (ofb->usage++ == 0)724724+ /* unblank the base framebuffer */725725+ fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);736726737737- /* unblank the base framebuffer */738738- fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);739727 return 0;740728}741729···741733{742734 struct pxafb_layer *ofb = (struct pxafb_layer*) info;743735744744- atomic_dec(&ofb->usage);745745- ofb->ops->disable(ofb);736736+ if (ofb->usage == 1) {737737+ ofb->ops->disable(ofb);738738+ ofb->fb.var.height = -1;739739+ ofb->fb.var.width = -1;740740+ ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;741741+ ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;746742747747- free_pages_exact(ofb->video_mem, ofb->video_mem_size);748748- ofb->video_mem = NULL;749749- ofb->video_mem_size = 0;743743+ ofb->usage--;744744+ }750745 return 0;751746}752747···761750 int xpos, ypos, pfor, bpp;762751763752 xpos = NONSTD_TO_XPOS(var->nonstd);764764- ypos = NONSTD_TO_XPOS(var->nonstd);753753+ ypos = NONSTD_TO_YPOS(var->nonstd);765754 pfor = NONSTD_TO_PFOR(var->nonstd);766755767756 bpp = pxafb_var_to_bpp(var);···805794 return 0;806795}807796808808-static int overlayfb_map_video_memory(struct pxafb_layer *ofb)797797+static int overlayfb_check_video_memory(struct pxafb_layer *ofb)809798{810799 struct fb_var_screeninfo *var = &ofb->fb.var;811800 int pfor = NONSTD_TO_PFOR(var->nonstd);···823812824813 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);825814826826- /* don't re-allocate if the original video memory is enough */827815 if (ofb->video_mem) {828816 if (ofb->video_mem_size >= size)829817 return 0;830830-831831- free_pages_exact(ofb->video_mem, ofb->video_mem_size);832818 }833833-834834- ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);835835- if (ofb->video_mem == NULL)836836- return -ENOMEM;837837-838838- ofb->video_mem_phys = virt_to_phys(ofb->video_mem);839839- ofb->video_mem_size = size;840840-841841- mutex_lock(&ofb->fb.mm_lock);842842- ofb->fb.fix.smem_start = ofb->video_mem_phys;843843- ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual;844844- mutex_unlock(&ofb->fb.mm_lock);845845- ofb->fb.screen_base = ofb->video_mem;846846- return 0;819819+ return -EINVAL;847820}848821849822static int overlayfb_set_par(struct fb_info *info)···836841 struct fb_var_screeninfo *var = &info->var;837842 int xpos, ypos, pfor, bpp, ret;838843839839- ret = overlayfb_map_video_memory(ofb);844844+ ret = overlayfb_check_video_memory(ofb);840845 if (ret)841846 return ret;842847843848 bpp = pxafb_var_to_bpp(var);844849 xpos = NONSTD_TO_XPOS(var->nonstd);845845- ypos = NONSTD_TO_XPOS(var->nonstd);850850+ ypos = NONSTD_TO_YPOS(var->nonstd);846851 pfor = NONSTD_TO_PFOR(var->nonstd);847852848853 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |···886891887892 ofb->id = id;888893 ofb->ops = &ofb_ops[id];889889- atomic_set(&ofb->usage, 0);894894+ ofb->usage = 0;890895 ofb->fbi = fbi;891896 init_completion(&ofb->branch_done);892897}···899904 return 0;900905}901906902902-static int __devinit pxafb_overlay_init(struct pxafb_info *fbi)907907+static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,908908+ struct pxafb_layer *ofb)909909+{910910+ /* We assume that user will use at most video_mem_size for overlay fb,911911+ * anyway, it's useless to use 16bpp main plane and 24bpp overlay912912+ */913913+ ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),914914+ GFP_KERNEL | __GFP_ZERO);915915+ if (ofb->video_mem == NULL)916916+ return -ENOMEM;917917+918918+ ofb->video_mem_phys = virt_to_phys(ofb->video_mem);919919+ ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);920920+921921+ mutex_lock(&ofb->fb.mm_lock);922922+ ofb->fb.fix.smem_start = ofb->video_mem_phys;923923+ ofb->fb.fix.smem_len = pxafb->video_mem_size;924924+ mutex_unlock(&ofb->fb.mm_lock);925925+926926+ ofb->fb.screen_base = ofb->video_mem;927927+928928+ return 0;929929+}930930+931931+static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)903932{904933 int i, ret;905934906935 if (!pxafb_overlay_supported())907907- return 0;936936+ return;908937909938 for (i = 0; i < 2; i++) {910910- init_pxafb_overlay(fbi, &fbi->overlay[i], i);911911- ret = register_framebuffer(&fbi->overlay[i].fb);939939+ struct pxafb_layer *ofb = &fbi->overlay[i];940940+ init_pxafb_overlay(fbi, ofb, i);941941+ ret = register_framebuffer(&ofb->fb);912942 if (ret) {913943 dev_err(fbi->dev, "failed to register overlay %d\n", i);914914- return ret;944944+ continue;915945 }946946+ ret = pxafb_overlay_map_video_memory(fbi, ofb);947947+ if (ret) {948948+ dev_err(fbi->dev,949949+ "failed to map video memory for overlay %d\n",950950+ i);951951+ unregister_framebuffer(&ofb->fb);952952+ continue;953953+ }954954+ ofb->registered = 1;916955 }917956918957 /* mask all IU/BS/EOF/SOF interrupts */919958 lcd_writel(fbi, LCCR5, ~0);920959921921- /* place overlay(s) on top of base */922922- fbi->lccr0 |= LCCR0_OUC;923960 pr_info("PXA Overlay driver loaded successfully!\n");924924- return 0;925961}926962927963static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)···962936 if (!pxafb_overlay_supported())963937 return;964938965965- for (i = 0; i < 2; i++)966966- unregister_framebuffer(&fbi->overlay[i].fb);939939+ for (i = 0; i < 2; i++) {940940+ struct pxafb_layer *ofb = &fbi->overlay[i];941941+ if (ofb->registered) {942942+ if (ofb->video_mem)943943+ free_pages_exact(ofb->video_mem,944944+ ofb->video_mem_size);945945+ unregister_framebuffer(&ofb->fb);946946+ }947947+ }967948}968949#else969950static inline void pxafb_overlay_init(struct pxafb_info *fbi) {}···14011368 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||14021369 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) ||14031370 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||14041404- (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))13711371+ ((fbi->lccr0 & LCCR0_SDS) &&13721372+ (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])))14051373 pxafb_schedule_work(fbi, C_REENABLE);1406137414071375 return 0;···14541420 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);1455142114561422 lcd_writel(fbi, FDADR0, fbi->fdadr[0]);14571457- lcd_writel(fbi, FDADR1, fbi->fdadr[1]);14231423+ if (fbi->lccr0 & LCCR0_SDS)14241424+ lcd_writel(fbi, FDADR1, fbi->fdadr[1]);14581425 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);14591426}14601427···1648161316491614 switch (val) {16501615 case CPUFREQ_PRECHANGE:16511651- set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);16161616+ if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)16171617+ set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);16521618 break;1653161916541620 case CPUFREQ_POSTCHANGE:···18411805 fbi->task_state = (u_char)-1;1842180618431807 pxafb_decode_mach_info(fbi, inf);18081808+18091809+#ifdef CONFIG_FB_PXA_OVERLAY18101810+ /* place overlay(s) on top of base */18111811+ if (pxafb_overlay_supported())18121812+ fbi->lccr0 |= LCCR0_OUC;18131813+#endif1844181418451815 init_waitqueue_head(&fbi->ctrlr_wait);18461816 INIT_WORK(&fbi->task, pxafb_task);
+2-1
drivers/video/pxafb.h
···9292struct pxafb_layer {9393 struct fb_info fb;9494 int id;9595- atomic_t usage;9595+ int registered;9696+ uint32_t usage;9697 uint32_t control[2];97989899 struct pxafb_layer_ops *ops;
+2-2
drivers/w1/masters/ds1wm.c
···368368 ds1wm_data->active_high = plat->active_high;369369370370 if (res->flags & IORESOURCE_IRQ_HIGHEDGE)371371- set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);371371+ irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);372372 if (res->flags & IORESOURCE_IRQ_LOWEDGE)373373- set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING);373373+ irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_FALLING);374374375375 ret = request_irq(ds1wm_data->irq, ds1wm_isr, IRQF_DISABLED,376376 "ds1wm", ds1wm_data);
+10-12
drivers/watchdog/davinci_wdt.c
···202202static int __devinit davinci_wdt_probe(struct platform_device *pdev)203203{204204 int ret = 0, size;205205- struct resource *res;206205 struct device *dev = &pdev->dev;207206208207 wdt_clk = clk_get(dev, NULL);···215216216217 dev_info(dev, "heartbeat %d sec\n", heartbeat);217218218218- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);219219- if (res == NULL) {219219+ wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);220220+ if (wdt_mem == NULL) {220221 dev_err(dev, "failed to get memory region resource\n");221222 return -ENOENT;222223 }223224224224- size = resource_size(res);225225- wdt_mem = request_mem_region(res->start, size, pdev->name);226226-227227- if (wdt_mem == NULL) {225225+ size = resource_size(wdt_mem);226226+ if (!request_mem_region(wdt_mem->start, size, pdev->name)) {228227 dev_err(dev, "failed to get memory region\n");229228 return -ENOENT;230229 }231230232232- wdt_base = ioremap(res->start, size);231231+ wdt_base = ioremap(wdt_mem->start, size);233232 if (!wdt_base) {234233 dev_err(dev, "failed to map memory region\n");234234+ release_mem_region(wdt_mem->start, size);235235+ wdt_mem = NULL;235236 return -ENOMEM;236237 }237238238239 ret = misc_register(&davinci_wdt_miscdev);239240 if (ret < 0) {240241 dev_err(dev, "cannot register misc device\n");241241- release_resource(wdt_mem);242242- kfree(wdt_mem);242242+ release_mem_region(wdt_mem->start, size);243243+ wdt_mem = NULL;243244 } else {244245 set_bit(WDT_DEVICE_INITED, &wdt_status);245246 }···252253{253254 misc_deregister(&davinci_wdt_miscdev);254255 if (wdt_mem) {255255- release_resource(wdt_mem);256256- kfree(wdt_mem);256256+ release_mem_region(wdt_mem->start, resource_size(wdt_mem));257257 wdt_mem = NULL;258258 }259259
+8-12
drivers/watchdog/max63xx_wdt.c
···270270{271271 int ret = 0;272272 int size;273273- struct resource *res;274273 struct device *dev = &pdev->dev;275274 struct max63xx_timeout *table;276275···293294294295 max63xx_pdev = pdev;295296296296- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);297297- if (res == NULL) {297297+ wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);298298+ if (wdt_mem == NULL) {298299 dev_err(dev, "failed to get memory region resource\n");299300 return -ENOENT;300301 }301302302302- size = resource_size(res);303303- wdt_mem = request_mem_region(res->start, size, pdev->name);304304-305305- if (wdt_mem == NULL) {303303+ size = resource_size(wdt_mem);304304+ if (!request_mem_region(wdt_mem->start, size, pdev->name)) {306305 dev_err(dev, "failed to get memory region\n");307306 return -ENOENT;308307 }309308310310- wdt_base = ioremap(res->start, size);309309+ wdt_base = ioremap(wdt_mem->start, size);311310 if (!wdt_base) {312311 dev_err(dev, "failed to map memory region\n");313312 ret = -ENOMEM;···323326out_unmap:324327 iounmap(wdt_base);325328out_request:326326- release_resource(wdt_mem);327327- kfree(wdt_mem);329329+ release_mem_region(wdt_mem->start, size);330330+ wdt_mem = NULL;328331329332 return ret;330333}···333336{334337 misc_deregister(&max63xx_wdt_miscdev);335338 if (wdt_mem) {336336- release_resource(wdt_mem);337337- kfree(wdt_mem);339339+ release_mem_region(wdt_mem->start, resource_size(wdt_mem));338340 wdt_mem = NULL;339341 }340342
···590590 state->owner = owner;591591 atomic_inc(&owner->so_count);592592 list_add(&state->inode_states, &nfsi->open_states);593593- state->inode = igrab(inode);593593+ ihold(inode);594594+ state->inode = inode;594595 spin_unlock(&inode->i_lock);595596 /* Note: The reclaim code dictates that we add stateless596597 * and read-only stateids to the end of the list */
+5-4
include/linux/can/core.h
···3636 * @prot: pointer to struct proto structure.3737 */3838struct can_proto {3939- int type;4040- int protocol;4141- struct proto_ops *ops;4242- struct proto *prot;3939+ int type;4040+ int protocol;4141+ const struct proto_ops *ops;4242+ struct proto *prot;4343};44444545/* function prototypes for the CAN networklayer core (af_can.c) */···5858 void *data);59596060extern int can_send(struct sk_buff *skb, int loop);6161+extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);61626263#endif /* CAN_CORE_H */
···338338/* IRQ wakeup (PM) control: */339339extern int irq_set_irq_wake(unsigned int irq, unsigned int on);340340341341-#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT342342-/* Please do not use: Use the replacement functions instead */343343-static inline int set_irq_wake(unsigned int irq, unsigned int on)344344-{345345- return irq_set_irq_wake(irq, on);346346-}347347-#endif348348-349341static inline int enable_irq_wake(unsigned int irq)350342{351343 return irq_set_irq_wake(irq, 1);
-128
include/linux/irq.h
···6464 * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set)6565 * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context6666 * IRQ_NESTED_TRHEAD - Interrupt nests into another thread6767- *6868- * Deprecated bits. They are kept updated as long as6969- * CONFIG_GENERIC_HARDIRQS_NO_COMPAT is not set. Will go away soon. These bits7070- * are internal state of the core code and if you really need to acces7171- * them then talk to the genirq maintainer instead of hacking7272- * something weird.7373- *7467 */7568enum {7669 IRQ_TYPE_NONE = 0x00000000,···8592 IRQ_NO_BALANCING = (1 << 13),8693 IRQ_MOVE_PCNTXT = (1 << 14),8794 IRQ_NESTED_THREAD = (1 << 15),8888-8989-#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT9090- IRQ_INPROGRESS = (1 << 16),9191- IRQ_REPLAY = (1 << 17),9292- IRQ_WAITING = (1 << 18),9393- IRQ_DISABLED = (1 << 19),9494- IRQ_PENDING = (1 << 20),9595- IRQ_MASKED = (1 << 21),9696- IRQ_MOVE_PENDING = (1 << 22),9797- IRQ_AFFINITY_SET = (1 << 23),9898- IRQ_WAKEUP = (1 << 24),9999-#endif10095};1019610297#define IRQF_MODIFY_MASK \···302321 */303322struct irq_chip {304323 const char *name;305305-#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED306306- unsigned int (*startup)(unsigned int irq);307307- void (*shutdown)(unsigned int irq);308308- void (*enable)(unsigned int irq);309309- void (*disable)(unsigned int irq);310310-311311- void (*ack)(unsigned int irq);312312- void (*mask)(unsigned int irq);313313- void (*mask_ack)(unsigned int irq);314314- void (*unmask)(unsigned int irq);315315- void (*eoi)(unsigned int irq);316316-317317- void (*end)(unsigned int irq);318318- int (*set_affinity)(unsigned int irq,319319- const struct cpumask *dest);320320- int (*retrigger)(unsigned int irq);321321- int (*set_type)(unsigned int irq, unsigned int flow_type);322322- int (*set_wake)(unsigned int irq, unsigned int on);323323-324324- void (*bus_lock)(unsigned int irq);325325- void (*bus_sync_unlock)(unsigned int irq);326326-#endif327324 unsigned int (*irq_startup)(struct irq_data *data);328325 void (*irq_shutdown)(struct irq_data *data);329326 void (*irq_enable)(struct irq_data *data);···379420#ifdef CONFIG_GENERIC_HARDIRQS380421381422#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)382382-void move_native_irq(int irq);383383-void move_masked_irq(int irq);384423void irq_move_irq(struct irq_data *data);385424void irq_move_masked_irq(struct irq_data *data);386425#else387387-static inline void move_native_irq(int irq) { }388388-static inline void move_masked_irq(int irq) { }389426static inline void irq_move_irq(struct irq_data *data) { }390427static inline void irq_move_masked_irq(struct irq_data *data) { }391428#endif···543588{544589 return d->msi_desc;545590}546546-547547-#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT548548-/* Please do not use: Use the replacement functions instead */549549-static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip)550550-{551551- return irq_set_chip(irq, chip);552552-}553553-static inline int set_irq_data(unsigned int irq, void *data)554554-{555555- return irq_set_handler_data(irq, data);556556-}557557-static inline int set_irq_chip_data(unsigned int irq, void *data)558558-{559559- return irq_set_chip_data(irq, data);560560-}561561-static inline int set_irq_type(unsigned int irq, unsigned int type)562562-{563563- return irq_set_irq_type(irq, type);564564-}565565-static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry)566566-{567567- return irq_set_msi_desc(irq, entry);568568-}569569-static inline struct irq_chip *get_irq_chip(unsigned int irq)570570-{571571- return irq_get_chip(irq);572572-}573573-static inline void *get_irq_chip_data(unsigned int irq)574574-{575575- return irq_get_chip_data(irq);576576-}577577-static inline void *get_irq_data(unsigned int irq)578578-{579579- return irq_get_handler_data(irq);580580-}581581-static inline void *irq_data_get_irq_data(struct irq_data *d)582582-{583583- return irq_data_get_irq_handler_data(d);584584-}585585-static inline struct msi_desc *get_irq_msi(unsigned int irq)586586-{587587- return irq_get_msi_desc(irq);588588-}589589-static inline void set_irq_noprobe(unsigned int irq)590590-{591591- irq_set_noprobe(irq);592592-}593593-static inline void set_irq_probe(unsigned int irq)594594-{595595- irq_set_probe(irq);596596-}597597-static inline void set_irq_nested_thread(unsigned int irq, int nest)598598-{599599- irq_set_nested_thread(irq, nest);600600-}601601-static inline void602602-set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,603603- irq_flow_handler_t handle, const char *name)604604-{605605- irq_set_chip_and_handler_name(irq, chip, handle, name);606606-}607607-static inline void608608-set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,609609- irq_flow_handler_t handle)610610-{611611- irq_set_chip_and_handler(irq, chip, handle);612612-}613613-static inline void614614-__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,615615- const char *name)616616-{617617- __irq_set_handler(irq, handle, is_chained, name);618618-}619619-static inline void set_irq_handler(unsigned int irq, irq_flow_handler_t handle)620620-{621621- irq_set_handler(irq, handle);622622-}623623-static inline void624624-set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle)625625-{626626- irq_set_chained_handler(irq, handle);627627-}628628-#endif629591630592int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);631593void irq_free_descs(unsigned int irq, unsigned int cnt);
+1-59
include/linux/irqdesc.h
···3535 * @name: flow handler name for /proc/interrupts output3636 */3737struct irq_desc {3838-3939-#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED4038 struct irq_data irq_data;4141-#else4242- /*4343- * This union will go away, once we fixed the direct access to4444- * irq_desc all over the place. The direct fields are a 1:14545- * overlay of irq_data.4646- */4747- union {4848- struct irq_data irq_data;4949- struct {5050- unsigned int irq;5151- unsigned int node;5252- unsigned int pad_do_not_even_think_about_it;5353- struct irq_chip *chip;5454- void *handler_data;5555- void *chip_data;5656- struct msi_desc *msi_desc;5757-#ifdef CONFIG_SMP5858- cpumask_var_t affinity;5959-#endif6060- };6161- };6262-#endif6363-6439 struct timer_rand_state *timer_rand_state;6540 unsigned int __percpu *kstat_irqs;6641 irq_flow_handler_t handle_irq;···4368 irq_preflow_handler_t preflow_handler;4469#endif4570 struct irqaction *action; /* IRQ action list */4646-#ifdef CONFIG_GENERIC_HARDIRQS_NO_COMPAT4771 unsigned int status_use_accessors;4848-#else4949- unsigned int status; /* IRQ status */5050-#endif5172 unsigned int core_internal_state__do_not_mess_with_it;5273 unsigned int depth; /* nested irq disables */5374 unsigned int wake_depth; /* nested wake enables */···98127 return desc->irq_data.msi_desc;99128}100129101101-#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT102102-static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc)103103-{104104- return irq_desc_get_chip(desc);105105-}106106-static inline void *get_irq_desc_data(struct irq_desc *desc)107107-{108108- return irq_desc_get_handler_data(desc);109109-}110110-111111-static inline void *get_irq_desc_chip_data(struct irq_desc *desc)112112-{113113- return irq_desc_get_chip_data(desc);114114-}115115-116116-static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc)117117-{118118- return irq_desc_get_msi_desc(desc);119119-}120120-#endif121121-122130/*123131 * Architectures call this to let the generic IRQ layer124132 * handle an interrupt. If the descriptor is attached to an···144194 desc->name = name;145195}146196147147-#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT148148-static inline void __set_irq_handler_unlocked(int irq,149149- irq_flow_handler_t handler)150150-{151151- __irq_set_handler_locked(irq, handler);152152-}153153-154197static inline int irq_balancing_disabled(unsigned int irq)155198{156199 struct irq_desc *desc;157200158201 desc = irq_to_desc(irq);159159- return desc->status & IRQ_NO_BALANCING_MASK;202202+ return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;160203}161161-#endif162204163205static inline void164206irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
···11+/*22+ * include/linux/mmc/tmio.h33+ *44+ * Copyright (C) 2007 Ian Molton55+ * Copyright (C) 2004 Ian Molton66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+ * Driver for the MMC / SD / SDIO cell found in:1212+ *1313+ * TC6393XB TC6391XB TC6387XB T7L66XB ASIC31414+ */1515+#ifndef _LINUX_MMC_TMIO_H_1616+#define _LINUX_MMC_TMIO_H_1717+1818+#define CTL_SD_CMD 0x001919+#define CTL_ARG_REG 0x042020+#define CTL_STOP_INTERNAL_ACTION 0x082121+#define CTL_XFER_BLK_COUNT 0xa2222+#define CTL_RESPONSE 0x0c2323+#define CTL_STATUS 0x1c2424+#define CTL_IRQ_MASK 0x202525+#define CTL_SD_CARD_CLK_CTL 0x242626+#define CTL_SD_XFER_LEN 0x262727+#define CTL_SD_MEM_CARD_OPT 0x282828+#define CTL_SD_ERROR_DETAIL_STATUS 0x2c2929+#define CTL_SD_DATA_PORT 0x303030+#define CTL_TRANSACTION_CTL 0x343131+#define CTL_SDIO_STATUS 0x363232+#define CTL_SDIO_IRQ_MASK 0x383333+#define CTL_RESET_SD 0xe03434+#define CTL_SDIO_REGS 0x1003535+#define CTL_CLK_AND_WAIT_CTL 0x1383636+#define CTL_RESET_SDIO 0x1e03737+3838+/* Definitions for values the CTRL_STATUS register can take. */3939+#define TMIO_STAT_CMDRESPEND 0x000000014040+#define TMIO_STAT_DATAEND 0x000000044141+#define TMIO_STAT_CARD_REMOVE 0x000000084242+#define TMIO_STAT_CARD_INSERT 0x000000104343+#define TMIO_STAT_SIGSTATE 0x000000204444+#define TMIO_STAT_WRPROTECT 0x000000804545+#define TMIO_STAT_CARD_REMOVE_A 0x000001004646+#define TMIO_STAT_CARD_INSERT_A 0x000002004747+#define TMIO_STAT_SIGSTATE_A 0x000004004848+#define TMIO_STAT_CMD_IDX_ERR 0x000100004949+#define TMIO_STAT_CRCFAIL 0x000200005050+#define TMIO_STAT_STOPBIT_ERR 0x000400005151+#define TMIO_STAT_DATATIMEOUT 0x000800005252+#define TMIO_STAT_RXOVERFLOW 0x001000005353+#define TMIO_STAT_TXUNDERRUN 0x002000005454+#define TMIO_STAT_CMDTIMEOUT 0x004000005555+#define TMIO_STAT_RXRDY 0x010000005656+#define TMIO_STAT_TXRQ 0x020000005757+#define TMIO_STAT_ILL_FUNC 0x200000005858+#define TMIO_STAT_CMD_BUSY 0x400000005959+#define TMIO_STAT_ILL_ACCESS 0x800000006060+6161+#define TMIO_BBS 512 /* Boot block size */6262+6363+#endif /* _LINUX_MMC_TMIO_H_ */
+7-1
include/linux/skbuff.h
···122122123123struct sk_buff;124124125125-/* To allow 64K frame to be packed as single skb without frag_list */125125+/* To allow 64K frame to be packed as single skb without frag_list. Since126126+ * GRO uses frags we allocate at least 16 regardless of page size.127127+ */128128+#if (65536/PAGE_SIZE + 2) < 16129129+#define MAX_SKB_FRAGS 16130130+#else126131#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)132132+#endif127133128134typedef struct skb_frag_struct skb_frag_t;129135
+32
include/linux/vmalloc.h
···95959696extern int map_vm_area(struct vm_struct *area, pgprot_t prot,9797 struct page ***pages);9898+#ifdef CONFIG_MMU9899extern int map_kernel_range_noflush(unsigned long start, unsigned long size,99100 pgprot_t prot, struct page **pages);100101extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);101102extern void unmap_kernel_range(unsigned long addr, unsigned long size);103103+#else104104+static inline int105105+map_kernel_range_noflush(unsigned long start, unsigned long size,106106+ pgprot_t prot, struct page **pages)107107+{108108+ return size >> PAGE_SHIFT;109109+}110110+static inline void111111+unmap_kernel_range_noflush(unsigned long addr, unsigned long size)112112+{113113+}114114+static inline void115115+unmap_kernel_range(unsigned long addr, unsigned long size)116116+{117117+}118118+#endif102119103120/* Allocate/destroy a 'vmalloc' VM area. */104121extern struct vm_struct *alloc_vm_area(size_t size);···133116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);134117135118#ifdef CONFIG_SMP119119+# ifdef CONFIG_MMU136120struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,137121 const size_t *sizes, int nr_vms,138122 size_t align);139123140124void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);125125+# else126126+static inline struct vm_struct **127127+pcpu_get_vm_areas(const unsigned long *offsets,128128+ const size_t *sizes, int nr_vms,129129+ size_t align)130130+{131131+ return NULL;132132+}133133+134134+static inline void135135+pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)136136+{137137+}138138+# endif141139#endif142140143141#endif /* _LINUX_VMALLOC_H */
···1010config GENERIC_HARDIRQS1111 def_bool y12121313-# Select this to disable the deprecated stuff1414-config GENERIC_HARDIRQS_NO_DEPRECATED1515- bool1616-1717-config GENERIC_HARDIRQS_NO_COMPAT1818- bool1919-2013# Options selectable by the architecture code21142215# Make sparse irq Kconfig switch below available
+1-3
kernel/irq/autoprobe.c
···7070 raw_spin_lock_irq(&desc->lock);7171 if (!desc->action && irq_settings_can_probe(desc)) {7272 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;7373- if (irq_startup(desc)) {7474- irq_compat_set_pending(desc);7373+ if (irq_startup(desc))7574 desc->istate |= IRQS_PENDING;7676- }7775 }7876 raw_spin_unlock_irq(&desc->lock);7977 }
+1-130
kernel/irq/chip.c
···3434 if (!chip)3535 chip = &no_irq_chip;36363737- irq_chip_set_defaults(chip);3837 desc->irq_data.chip = chip;3938 irq_put_desc_unlock(desc, flags);4039 /*···140141static void irq_state_clr_disabled(struct irq_desc *desc)141142{142143 irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED);143143- irq_compat_clr_disabled(desc);144144}145145146146static void irq_state_set_disabled(struct irq_desc *desc)147147{148148 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);149149- irq_compat_set_disabled(desc);150149}151150152151static void irq_state_clr_masked(struct irq_desc *desc)153152{154153 irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED);155155- irq_compat_clr_masked(desc);156154}157155158156static void irq_state_set_masked(struct irq_desc *desc)159157{160158 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);161161- irq_compat_set_masked(desc);162159}163160164161int irq_startup(struct irq_desc *desc)···202207 desc->irq_data.chip->irq_disable(&desc->irq_data);203208 irq_state_set_masked(desc);204209 }205205-}206206-207207-#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED208208-/* Temporary migration helpers */209209-static void compat_irq_mask(struct irq_data *data)210210-{211211- data->chip->mask(data->irq);212212-}213213-214214-static void compat_irq_unmask(struct irq_data *data)215215-{216216- data->chip->unmask(data->irq);217217-}218218-219219-static void compat_irq_ack(struct irq_data *data)220220-{221221- data->chip->ack(data->irq);222222-}223223-224224-static void compat_irq_mask_ack(struct irq_data *data)225225-{226226- data->chip->mask_ack(data->irq);227227-}228228-229229-static void compat_irq_eoi(struct irq_data *data)230230-{231231- data->chip->eoi(data->irq);232232-}233233-234234-static void compat_irq_enable(struct irq_data *data)235235-{236236- data->chip->enable(data->irq);237237-}238238-239239-static void compat_irq_disable(struct irq_data *data)240240-{241241- data->chip->disable(data->irq);242242-}243243-244244-static void compat_irq_shutdown(struct irq_data *data)245245-{246246- data->chip->shutdown(data->irq);247247-}248248-249249-static unsigned int compat_irq_startup(struct irq_data *data)250250-{251251- return data->chip->startup(data->irq);252252-}253253-254254-static int compat_irq_set_affinity(struct irq_data *data,255255- const struct cpumask *dest, bool force)256256-{257257- return data->chip->set_affinity(data->irq, dest);258258-}259259-260260-static int compat_irq_set_type(struct irq_data *data, unsigned int type)261261-{262262- return data->chip->set_type(data->irq, type);263263-}264264-265265-static int compat_irq_set_wake(struct irq_data *data, unsigned int on)266266-{267267- return data->chip->set_wake(data->irq, on);268268-}269269-270270-static int compat_irq_retrigger(struct irq_data *data)271271-{272272- return data->chip->retrigger(data->irq);273273-}274274-275275-static void compat_bus_lock(struct irq_data *data)276276-{277277- data->chip->bus_lock(data->irq);278278-}279279-280280-static void compat_bus_sync_unlock(struct irq_data *data)281281-{282282- data->chip->bus_sync_unlock(data->irq);283283-}284284-#endif285285-286286-/*287287- * Fixup enable/disable function pointers288288- */289289-void irq_chip_set_defaults(struct irq_chip *chip)290290-{291291-#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED292292- if (chip->enable)293293- chip->irq_enable = compat_irq_enable;294294- if (chip->disable)295295- chip->irq_disable = compat_irq_disable;296296- if (chip->shutdown)297297- chip->irq_shutdown = compat_irq_shutdown;298298- if (chip->startup)299299- chip->irq_startup = compat_irq_startup;300300- if (!chip->end)301301- chip->end = dummy_irq_chip.end;302302- if (chip->bus_lock)303303- chip->irq_bus_lock = compat_bus_lock;304304- if (chip->bus_sync_unlock)305305- chip->irq_bus_sync_unlock = compat_bus_sync_unlock;306306- if (chip->mask)307307- chip->irq_mask = compat_irq_mask;308308- if (chip->unmask)309309- chip->irq_unmask = compat_irq_unmask;310310- if (chip->ack)311311- chip->irq_ack = compat_irq_ack;312312- if (chip->mask_ack)313313- chip->irq_mask_ack = compat_irq_mask_ack;314314- if (chip->eoi)315315- chip->irq_eoi = compat_irq_eoi;316316- if (chip->set_affinity)317317- chip->irq_set_affinity = compat_irq_set_affinity;318318- if (chip->set_type)319319- chip->irq_set_type = compat_irq_set_type;320320- if (chip->set_wake)321321- chip->irq_set_wake = compat_irq_set_wake;322322- if (chip->retrigger)323323- chip->irq_retrigger = compat_irq_retrigger;324324-#endif325210}326211327212static inline void mask_ack_irq(struct irq_desc *desc)···256381 if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))257382 goto out_unlock;258383259259- irq_compat_set_progress(desc);260384 irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);261385 raw_spin_unlock_irq(&desc->lock);262386···265391266392 raw_spin_lock_irq(&desc->lock);267393 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);268268- irq_compat_clr_progress(desc);269394270395out_unlock:271396 raw_spin_unlock_irq(&desc->lock);···387514 * then mask it and get out of here:388515 */389516 if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {390390- irq_compat_set_pending(desc);391517 desc->istate |= IRQS_PENDING;392518 mask_irq(desc);393519 goto out;···439567 if (unlikely(irqd_irq_disabled(&desc->irq_data) ||440568 irqd_irq_inprogress(&desc->irq_data) || !desc->action)) {441569 if (!irq_check_poll(desc)) {442442- irq_compat_set_pending(desc);443570 desc->istate |= IRQS_PENDING;444571 mask_ack_irq(desc);445572 goto out_unlock;···514643 } while ((desc->istate & IRQS_PENDING) &&515644 !irqd_irq_disabled(&desc->irq_data));516645517517-out_unlock:646646+out_eoi:518647 chip->irq_eoi(&desc->irq_data);519648 raw_spin_unlock(&desc->lock);520649}
···364364 return 0;365365}366366367367+#ifndef ACTUAL_NR_IRQS368368+# define ACTUAL_NR_IRQS nr_irqs369369+#endif370370+367371int show_interrupts(struct seq_file *p, void *v)368372{369373 static int prec;···377373 struct irqaction *action;378374 struct irq_desc *desc;379375380380- if (i > nr_irqs)376376+ if (i > ACTUAL_NR_IRQS)381377 return 0;382378383383- if (i == nr_irqs)379379+ if (i == ACTUAL_NR_IRQS)384380 return arch_show_interrupts(p, prec);385381386382 /* print header and calculate the width of the first column */
-1
kernel/irq/resend.c
···6565 if (desc->istate & IRQS_REPLAY)6666 return;6767 if (desc->istate & IRQS_PENDING) {6868- irq_compat_clr_pending(desc);6968 desc->istate &= ~IRQS_PENDING;7069 desc->istate |= IRQS_REPLAY;7170
···9393 * Already running: If it is shared get the other9494 * CPU to go looking for our mystery interrupt too9595 */9696- irq_compat_set_pending(desc);9796 desc->istate |= IRQS_PENDING;9897 goto out;9998 }
+39-13
mm/nommu.c
···19711971}19721972EXPORT_SYMBOL(filemap_fault);1973197319741974-/*19751975- * Access another process' address space.19761976- * - source/target buffer must be kernel space19771977- */19781978-int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)19741974+static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,19751975+ unsigned long addr, void *buf, int len, int write)19791976{19801977 struct vm_area_struct *vma;19811981- struct mm_struct *mm;19821982-19831983- if (addr + len < addr)19841984- return 0;19851985-19861986- mm = get_task_mm(tsk);19871987- if (!mm)19881988- return 0;1989197819901979 down_read(&mm->mmap_sem);19911980···19992010 }2000201120012012 up_read(&mm->mmap_sem);20132013+20142014+ return len;20152015+}20162016+20172017+/**20182018+ * @access_remote_vm - access another process' address space20192019+ * @mm: the mm_struct of the target address space20202020+ * @addr: start address to access20212021+ * @buf: source or destination buffer20222022+ * @len: number of bytes to transfer20232023+ * @write: whether the access is a write20242024+ *20252025+ * The caller must hold a reference on @mm.20262026+ */20272027+int access_remote_vm(struct mm_struct *mm, unsigned long addr,20282028+ void *buf, int len, int write)20292029+{20302030+ return __access_remote_vm(NULL, mm, addr, buf, len, write);20312031+}20322032+20332033+/*20342034+ * Access another process' address space.20352035+ * - source/target buffer must be kernel space20362036+ */20372037+int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)20382038+{20392039+ struct mm_struct *mm;20402040+20412041+ if (addr + len < addr)20422042+ return 0;20432043+20442044+ mm = get_task_mm(tsk);20452045+ if (!mm)20462046+ return 0;20472047+20482048+ len = __access_remote_vm(tsk, mm, addr, buf, len, write);20492049+20022050 mmput(mm);20032051 return len;20042052}
+1-2
mm/percpu.c
···10081008 }1009100910101010 if (in_first_chunk) {10111011- if ((unsigned long)addr < VMALLOC_START ||10121012- (unsigned long)addr >= VMALLOC_END)10111011+ if (!is_vmalloc_addr(addr))10131012 return __pa(addr);10141013 else10151014 return page_to_phys(vmalloc_to_page(addr));
+5-1
net/bridge/br_if.c
···389389{390390 struct net_bridge_port *p;391391 int err = 0;392392+ bool changed_addr;392393393394 /* Don't allow bridging non-ethernet like devices */394395 if ((dev->flags & IFF_LOOPBACK) ||···447446 list_add_rcu(&p->list, &br->port_list);448447449448 spin_lock_bh(&br->lock);450450- br_stp_recalculate_bridge_id(br);449449+ changed_addr = br_stp_recalculate_bridge_id(br);451450 br_features_recompute(br);452451453452 if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) &&···456455 spin_unlock_bh(&br->lock);457456458457 br_ifinfo_notify(RTM_NEWLINK, p);458458+459459+ if (changed_addr)460460+ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);459461460462 dev_set_mtu(br->dev, br_min_mtu(br));461463
···141141}142142EXPORT_SYMBOL(ethtool_op_get_flags);143143144144+/* Check if device can enable (or disable) particular feature coded in "data"145145+ * argument. Flags "supported" describe features that can be toggled by device.146146+ * If feature can not be toggled, it state (enabled or disabled) must match147147+ * hardcoded device features state, otherwise flags are marked as invalid.148148+ */149149+bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported)150150+{151151+ u32 features = dev->features & flags_dup_features;152152+ /* "data" can contain only flags_dup_features bits,153153+ * see __ethtool_set_flags */154154+155155+ return (features & ~supported) != (data & ~supported);156156+}157157+EXPORT_SYMBOL(ethtool_invalid_flags);158158+144159int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported)145160{146146- if (data & ~supported)161161+ if (ethtool_invalid_flags(dev, data, supported))147162 return -EINVAL;148163149164 dev->features = ((dev->features & ~flags_dup_features) |
+2-2
net/ipv4/fib_trie.c
···13651365 err = fib_props[fa->fa_type].error;13661366 if (err) {13671367#ifdef CONFIG_IP_FIB_TRIE_STATS13681368- t->stats.semantic_match_miss++;13681368+ t->stats.semantic_match_passed++;13691369#endif13701370- return 1;13701370+ return err;13711371 }13721372 if (fi->fib_flags & RTNH_F_DEAD)13731373 continue;
···127127 if (!rt)128128 return 0;129129130130+ if (p->id.proto != IPPROTO_ESP)131131+ return -EINVAL;132132+130133 if (p->replay_window != 0)131134 return -EINVAL;132135···360357361358 strcpy(p->alg_name, algo->name);362359 *algpp = p;360360+ return 0;361361+}362362+363363+static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_esn,364364+ struct nlattr *rp)365365+{366366+ struct xfrm_replay_state_esn *up;367367+368368+ if (!replay_esn || !rp)369369+ return 0;370370+371371+ up = nla_data(rp);372372+373373+ if (xfrm_replay_state_esn_len(replay_esn) !=374374+ xfrm_replay_state_esn_len(up))375375+ return -EINVAL;376376+363377 return 0;364378}365379···17841764 return -ESRCH;1785176517861766 if (x->km.state != XFRM_STATE_VALID)17671767+ goto out;17681768+17691769+ err = xfrm_replay_verify_len(x->replay_esn, rp);17701770+ if (err)17871771 goto out;1788177217891773 spin_lock_bh(&x->lock);
+1-1
sound/soc/soc-jack.c
···331331 goto err;332332333333 if (gpios[i].wake) {334334- ret = set_irq_wake(gpio_to_irq(gpios[i].gpio), 1);334334+ ret = irq_set_irq_wake(gpio_to_irq(gpios[i].gpio), 1);335335 if (ret != 0)336336 printk(KERN_ERR337337 "Failed to mark GPIO %d as wake source: %d\n",