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

Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

Pull powerpc fixes from Benjamin Herrenschmidt:
"Here are a few fixes for powerpc. Note the addition to the generic
irq.h. This is part of a 3-patches regression fix for mpic due to
changes in how IRQ_TYPE_NONE is being handled. Thomas agreed to the
addition of the new IRQ_TYPE_DEFAULT contant, however he hasn't
replied with an Ack to the actual patch yet. I don't to wait much
longer with these patches tho."

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
powerpc/mpic: Properly set default triggers
irq: Add IRQ_TYPE_DEFAULT for use by PIC drivers
powerpc/mpic: Fix confusion between hw_irq and virq
powerpc/pmac: Don't add_timer() twice
powerpc/eeh: Fix crash caused by null eeh_dev
powerpc/mpc85xx: add MPIC message dts node
powerpc/mpic_msgr: fix offset error when setting mer register
powerpc/mpic_msgr: add lock for MPIC message global variable
powerpc/mpic_msgr: fix compile error when SMP disabled
powerpc: fix build when CONFIG_BOOKE_WDT is enabled
powerpc/85xx: don't call of_platform_bus_probe() twice

+123 -73
+43
arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi
··· 1 + /* 2 + * PQ3 MPIC Message (Group B) device tree stub [ controller @ offset 0x42400 ] 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + message@42400 { 36 + compatible = "fsl,mpic-v3.1-msgr"; 37 + reg = <0x42400 0x200>; 38 + interrupts = < 39 + 0xb4 2 0 0 40 + 0xb5 2 0 0 41 + 0xb6 2 0 0 42 + 0xb7 2 0 0>; 43 + };
+10
arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
··· 53 53 3 0 3 0>; 54 54 }; 55 55 56 + message@41400 { 57 + compatible = "fsl,mpic-v3.1-msgr"; 58 + reg = <0x41400 0x200>; 59 + interrupts = < 60 + 0xb0 2 0 0 61 + 0xb1 2 0 0 62 + 0xb2 2 0 0 63 + 0xb3 2 0 0>; 64 + }; 65 + 56 66 msi@41600 { 57 67 compatible = "fsl,mpic-msi"; 58 68 reg = <0x41600 0x80>;
-18
arch/powerpc/include/asm/mpic.h
··· 275 275 unsigned int isu_mask; 276 276 /* Number of sources */ 277 277 unsigned int num_sources; 278 - /* default senses array */ 279 - unsigned char *senses; 280 - unsigned int senses_count; 281 278 282 279 /* vector numbers used for internal sources (ipi/timers) */ 283 280 unsigned int ipi_vecs[4]; ··· 411 414 */ 412 415 extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, 413 416 phys_addr_t phys_addr); 414 - 415 - /* Set default sense codes 416 - * 417 - * @mpic: controller 418 - * @senses: array of sense codes 419 - * @count: size of above array 420 - * 421 - * Optionally provide an array (indexed on hardware interrupt numbers 422 - * for this MPIC) of default sense codes for the chip. Those are linux 423 - * sense codes IRQ_TYPE_* 424 - * 425 - * The driver gets ownership of the pointer, don't dispose of it or 426 - * anything like that. __init only. 427 - */ 428 - extern void mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count); 429 417 430 418 431 419 /* Initialize the controller. After this has been called, none of the above
+1
arch/powerpc/include/asm/mpic_msgr.h
··· 13 13 14 14 #include <linux/types.h> 15 15 #include <linux/spinlock.h> 16 + #include <asm/smp.h> 16 17 17 18 struct mpic_msgr { 18 19 u32 __iomem *base;
-5
arch/powerpc/include/asm/reg_booke.h
··· 15 15 #ifndef __ASM_POWERPC_REG_BOOKE_H__ 16 16 #define __ASM_POWERPC_REG_BOOKE_H__ 17 17 18 - #ifdef CONFIG_BOOKE_WDT 19 - extern u32 booke_wdt_enabled; 20 - extern u32 booke_wdt_period; 21 - #endif /* CONFIG_BOOKE_WDT */ 22 - 23 18 /* Machine State Register (MSR) Fields */ 24 19 #define MSR_GS (1<<28) /* Guest state */ 25 20 #define MSR_UCLE (1<<26) /* User-mode cache lock enable */
+3
arch/powerpc/kernel/setup_32.c
··· 150 150 } 151 151 152 152 #ifdef CONFIG_BOOKE_WDT 153 + extern u32 booke_wdt_enabled; 154 + extern u32 booke_wdt_period; 155 + 153 156 /* Checks wdt=x and wdt_period=xx command-line option */ 154 157 notrace int __init early_parse_wdt(char *p) 155 158 {
+6
arch/powerpc/platforms/85xx/common.c
··· 21 21 { .compatible = "fsl,qe", }, 22 22 { .compatible = "fsl,cpm2", }, 23 23 { .compatible = "fsl,srio", }, 24 + /* So that the DMA channel nodes can be probed individually: */ 25 + { .compatible = "fsl,eloplus-dma", }, 26 + /* For the PMC driver */ 27 + { .compatible = "fsl,mpc8548-guts", }, 28 + /* Probably unnecessary? */ 29 + { .compatible = "gpio-leds", }, 24 30 {}, 25 31 }; 26 32
+1 -10
arch/powerpc/platforms/85xx/mpc85xx_mds.c
··· 399 399 machine_arch_initcall(mpc8568_mds, board_fixups); 400 400 machine_arch_initcall(mpc8569_mds, board_fixups); 401 401 402 - static struct of_device_id mpc85xx_ids[] = { 403 - { .compatible = "fsl,mpc8548-guts", }, 404 - { .compatible = "gpio-leds", }, 405 - {}, 406 - }; 407 - 408 402 static int __init mpc85xx_publish_devices(void) 409 403 { 410 404 if (machine_is(mpc8568_mds)) ··· 406 412 if (machine_is(mpc8569_mds)) 407 413 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); 408 414 409 - mpc85xx_common_publish_devices(); 410 - of_platform_bus_probe(NULL, mpc85xx_ids, NULL); 411 - 412 - return 0; 415 + return mpc85xx_common_publish_devices(); 413 416 } 414 417 415 418 machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices);
+1 -12
arch/powerpc/platforms/85xx/p1022_ds.c
··· 460 460 pr_info("Freescale P1022 DS reference board\n"); 461 461 } 462 462 463 - static struct of_device_id __initdata p1022_ds_ids[] = { 464 - /* So that the DMA channel nodes can be probed individually: */ 465 - { .compatible = "fsl,eloplus-dma", }, 466 - {}, 467 - }; 468 - 469 - static int __init p1022_ds_publish_devices(void) 470 - { 471 - mpc85xx_common_publish_devices(); 472 - return of_platform_bus_probe(NULL, p1022_ds_ids, NULL); 473 - } 474 - machine_device_initcall(p1022_ds, p1022_ds_publish_devices); 463 + machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices); 475 464 476 465 machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); 477 466
+9
arch/powerpc/platforms/powermac/low_i2c.c
··· 366 366 unsigned long flags; 367 367 368 368 spin_lock_irqsave(&host->lock, flags); 369 + 370 + /* 371 + * If the timer is pending, that means we raced with the 372 + * irq, in which case we just return 373 + */ 374 + if (timer_pending(&host->timeout_timer)) 375 + goto skip; 376 + 369 377 kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr)); 370 378 if (host->state != state_idle) { 371 379 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT; 372 380 add_timer(&host->timeout_timer); 373 381 } 382 + skip: 374 383 spin_unlock_irqrestore(&host->lock, flags); 375 384 } 376 385
+1 -1
arch/powerpc/platforms/pseries/eeh.c
··· 1076 1076 pr_debug("EEH: Adding device %s\n", pci_name(dev)); 1077 1077 1078 1078 dn = pci_device_to_OF_node(dev); 1079 - edev = pci_dev_to_eeh_dev(dev); 1079 + edev = of_node_to_eeh_dev(dn); 1080 1080 if (edev->pdev == dev) { 1081 1081 pr_debug("EEH: Already referenced !\n"); 1082 1082 return;
+35 -21
arch/powerpc/sysdev/mpic.c
··· 604 604 } 605 605 606 606 /* Determine if the linux irq is an IPI */ 607 - static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq) 607 + static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int src) 608 608 { 609 - unsigned int src = virq_to_hw(irq); 610 - 611 609 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); 612 610 } 613 611 614 612 /* Determine if the linux irq is a timer */ 615 - static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int irq) 613 + static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int src) 616 614 { 617 - unsigned int src = virq_to_hw(irq); 618 - 619 615 return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]); 620 616 } 621 617 ··· 872 876 if (src >= mpic->num_sources) 873 877 return -EINVAL; 874 878 875 - if (flow_type == IRQ_TYPE_NONE) 876 - if (mpic->senses && src < mpic->senses_count) 877 - flow_type = mpic->senses[src]; 878 - if (flow_type == IRQ_TYPE_NONE) 879 - flow_type = IRQ_TYPE_LEVEL_LOW; 879 + vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); 880 880 881 + /* We don't support "none" type */ 882 + if (flow_type == IRQ_TYPE_NONE) 883 + flow_type = IRQ_TYPE_DEFAULT; 884 + 885 + /* Default: read HW settings */ 886 + if (flow_type == IRQ_TYPE_DEFAULT) { 887 + switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) | 888 + MPIC_INFO(VECPRI_SENSE_MASK))) { 889 + case MPIC_INFO(VECPRI_SENSE_EDGE) | 890 + MPIC_INFO(VECPRI_POLARITY_POSITIVE): 891 + flow_type = IRQ_TYPE_EDGE_RISING; 892 + break; 893 + case MPIC_INFO(VECPRI_SENSE_EDGE) | 894 + MPIC_INFO(VECPRI_POLARITY_NEGATIVE): 895 + flow_type = IRQ_TYPE_EDGE_FALLING; 896 + break; 897 + case MPIC_INFO(VECPRI_SENSE_LEVEL) | 898 + MPIC_INFO(VECPRI_POLARITY_POSITIVE): 899 + flow_type = IRQ_TYPE_LEVEL_HIGH; 900 + break; 901 + case MPIC_INFO(VECPRI_SENSE_LEVEL) | 902 + MPIC_INFO(VECPRI_POLARITY_NEGATIVE): 903 + flow_type = IRQ_TYPE_LEVEL_LOW; 904 + break; 905 + } 906 + } 907 + 908 + /* Apply to irq desc */ 881 909 irqd_set_trigger_type(d, flow_type); 882 910 911 + /* Apply to HW */ 883 912 if (mpic_is_ht_interrupt(mpic, src)) 884 913 vecpri = MPIC_VECPRI_POLARITY_POSITIVE | 885 914 MPIC_VECPRI_SENSE_EDGE; 886 915 else 887 916 vecpri = mpic_type_to_vecpri(mpic, flow_type); 888 917 889 - vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); 890 918 vnew = vold & ~(MPIC_INFO(VECPRI_POLARITY_MASK) | 891 919 MPIC_INFO(VECPRI_SENSE_MASK)); 892 920 vnew |= vecpri; ··· 1046 1026 irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); 1047 1027 1048 1028 /* Set default irq type */ 1049 - irq_set_irq_type(virq, IRQ_TYPE_NONE); 1029 + irq_set_irq_type(virq, IRQ_TYPE_DEFAULT); 1050 1030 1051 1031 /* If the MPIC was reset, then all vectors have already been 1052 1032 * initialized. Otherwise, a per source lazy initialization ··· 1437 1417 mpic->num_sources = isu_first + mpic->isu_size; 1438 1418 } 1439 1419 1440 - void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count) 1441 - { 1442 - mpic->senses = senses; 1443 - mpic->senses_count = count; 1444 - } 1445 - 1446 1420 void __init mpic_init(struct mpic *mpic) 1447 1421 { 1448 1422 int i, cpu; ··· 1569 1555 return; 1570 1556 1571 1557 raw_spin_lock_irqsave(&mpic_lock, flags); 1572 - if (mpic_is_ipi(mpic, irq)) { 1558 + if (mpic_is_ipi(mpic, src)) { 1573 1559 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1574 1560 ~MPIC_VECPRI_PRIORITY_MASK; 1575 1561 mpic_ipi_write(src - mpic->ipi_vecs[0], 1576 1562 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 1577 - } else if (mpic_is_tm(mpic, irq)) { 1563 + } else if (mpic_is_tm(mpic, src)) { 1578 1564 reg = mpic_tm_read(src - mpic->timer_vecs[0]) & 1579 1565 ~MPIC_VECPRI_PRIORITY_MASK; 1580 1566 mpic_tm_write(src - mpic->timer_vecs[0],
+6 -6
arch/powerpc/sysdev/mpic_msgr.c
··· 27 27 28 28 static struct mpic_msgr **mpic_msgrs; 29 29 static unsigned int mpic_msgr_count; 30 + static DEFINE_RAW_SPINLOCK(msgrs_lock); 30 31 31 32 static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value) 32 33 { ··· 57 56 if (reg_num >= mpic_msgr_count) 58 57 return ERR_PTR(-ENODEV); 59 58 60 - raw_spin_lock_irqsave(&msgr->lock, flags); 61 - if (mpic_msgrs[reg_num]->in_use == MSGR_FREE) { 62 - msgr = mpic_msgrs[reg_num]; 59 + raw_spin_lock_irqsave(&msgrs_lock, flags); 60 + msgr = mpic_msgrs[reg_num]; 61 + if (msgr->in_use == MSGR_FREE) 63 62 msgr->in_use = MSGR_INUSE; 64 - } 65 - raw_spin_unlock_irqrestore(&msgr->lock, flags); 63 + raw_spin_unlock_irqrestore(&msgrs_lock, flags); 66 64 67 65 return msgr; 68 66 } ··· 228 228 229 229 reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i; 230 230 msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE; 231 - msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET; 231 + msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET); 232 232 msgr->in_use = MSGR_FREE; 233 233 msgr->num = i; 234 234 raw_spin_lock_init(&msgr->lock);
+7
include/linux/irq.h
··· 49 49 * IRQ_TYPE_LEVEL_LOW - low level triggered 50 50 * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits 51 51 * IRQ_TYPE_SENSE_MASK - Mask for all the above bits 52 + * IRQ_TYPE_DEFAULT - For use by some PICs to ask irq_set_type 53 + * to setup the HW to a sane default (used 54 + * by irqdomain map() callbacks to synchronize 55 + * the HW state and SW flags for a newly 56 + * allocated descriptor). 57 + * 52 58 * IRQ_TYPE_PROBE - Special flag for probing in progress 53 59 * 54 60 * Bits which can be modified via irq_set/clear/modify_status_flags() ··· 83 77 IRQ_TYPE_LEVEL_LOW = 0x00000008, 84 78 IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), 85 79 IRQ_TYPE_SENSE_MASK = 0x0000000f, 80 + IRQ_TYPE_DEFAULT = IRQ_TYPE_SENSE_MASK, 86 81 87 82 IRQ_TYPE_PROBE = 0x00000010, 88 83