PPC4xx PIC rewrite/cleanup
PATCH 1/1 PPC4xx PIC rewrite/cleanup
Patch from Eugene to do some cleanup of the PPC4xx PIC code. Separates the interrupts that can have polarity/triggering modified for platform modification if necessary. Between the two of us, it's tested on most of the affected platforms.
Signed-off-by Eugene Surovegin <[email protected]>
Signed-off-by Matt Porter <[email protected]>
arch/ppc/platforms/4xx/ebony.c +15 -69
@@ -55,73 +55,22 @@static struct ibm44x_clocks clocks__initdata ;/* -* Ebony IRQ triggering/polarity settings +* Ebony external IRQ triggering/polarity settings */ -static u_char ebony_IRQ_initsenses[]__initdata = { - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 0: UART 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 1: UART 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 2: IIC 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 3: IIC 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 4: PCI Inb Mess */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 5: PCI Cmd Wrt */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 6: PCI PM */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 7: PCI MSI 0 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 8: PCI MSI 1 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 9: PCI MSI 2 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 10: MAL TX EOB */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 11: MAL RX EOB */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 12: DMA Chan 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 13: DMA Chan 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 14: DMA Chan 2 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 15: DMA Chan 3 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 16: Reserved */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 17: Reserved */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 18: GPT Timer 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 19: GPT Timer 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 20: GPT Timer 2 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 21: GPT Timer 3 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 22: GPT Timer 4 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 23: Ext Int 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 24: Ext Int 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 25: Ext Int 2 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 26: Ext Int 3 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 27: Ext Int 4 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_NEGATIVE ),/* 28: Ext Int 5 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 29: Ext Int 6 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 30: UIC1 NC Int */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 31: UIC1 Crit Int */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 32: MAL SERR */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 33: MAL TXDE */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 34: MAL RXDE */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 35: ECC Unc Err */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 36: ECC Corr Err */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 37: Ext Bus Ctrl */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 38: Ext Bus Mstr */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 39: OPB->PLB */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 40: PCI MSI 3 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 41: PCI MSI 4 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 42: PCI MSI 5 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 43: PCI MSI 6 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 44: PCI MSI 7 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 45: PCI MSI 8 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 46: PCI MSI 9 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 47: PCI MSI 10 */ - (IRQ_SENSE_EDGE |IRQ_POLARITY_POSITIVE ),/* 48: PCI MSI 11 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 49: PLB Perf Mon */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 50: Ext Int 7 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 51: Ext Int 8 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 52: Ext Int 9 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 53: Ext Int 10 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 54: Ext Int 11 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* 55: Ext Int 12 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 56: Ser ROM Err */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 57: Reserved */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 58: Reserved */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 59: PCI Async Err */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 60: EMAC 0 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 61: EMAC 0 WOL */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 62: EMAC 1 */ - (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* 63: EMAC 1 WOL */ +unsigned char ppc4xx_uic_ext_irq_cfg[]__initdata = { + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ0: PCI slot 0 */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ1: PCI slot 1 */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ2: PCI slot 2 */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ3: PCI slot 3 */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* IRQ4: IRDA */ + (IRQ_SENSE_EDGE |IRQ_POLARITY_NEGATIVE ),/* IRQ5: SMI pushbutton */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ6: PHYs */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* IRQ7: AUX */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ8: EXT */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ9: EXT */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ10: EXT */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_NEGATIVE ),/* IRQ11: EXT */ + (IRQ_SENSE_LEVEL |IRQ_POLARITY_POSITIVE ),/* IRQ12: EXT */ }; static void __init
@@ -357,9 +306,6 @@#endif ebony_early_serial_map (); - - ibm4xxPIC_InitSenses = ebony_IRQ_initsenses; - ibm4xxPIC_NumInitSenses =sizeof (ebony_IRQ_initsenses);/* Identify the system */ printk ("IBM Ebony port (MontaVista Software, Inc. ([email protected]))\n" );
arch/ppc/platforms/4xx/ibm405ep.c +9 -0
@@ -21,6 +21,7 @@#include <asm/ibm4xx.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> #include <platforms/4xx/ibm405ep.h>
@@ -130,5 +131,13 @@ .show = &ocp_show_emac_data }, { .vendor = OCP_VENDOR_INVALID + } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xffff7f80 , + .triggering =0x00000000 , + .ext_irq_mask =0x0000007f ,/* IRQ0 - IRQ6 */ } };
arch/ppc/platforms/4xx/ibm405gp.c +9 -0
@@ -22,6 +22,7 @@#include <platforms/4xx/ibm405gp.h> #include <asm/ibm4xx.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> static struct ocp_func_emac_data ibm405gp_emac0_def = { .rgmii_idx =-1 ,/* No RGMII */
@@ -107,5 +108,13 @@ .show = &ocp_show_emac_data, }, { .vendor = OCP_VENDOR_INVALID + } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xffffff80 , + .triggering =0x10000000 , + .ext_irq_mask =0x0000007f ,/* IRQ0 - IRQ6 */ } };
arch/ppc/platforms/4xx/ibm405gpr.c +9 -0
@@ -18,6 +18,7 @@#include <platforms/4xx/ibm405gpr.h> #include <asm/ibm4xx.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> static struct ocp_func_emac_data ibm405gpr_emac0_def = { .rgmii_idx =-1 ,/* No RGMII */
@@ -104,5 +105,13 @@ .show = &ocp_show_emac_data, }, { .vendor = OCP_VENDOR_INVALID + } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xffffe000 , + .triggering =0x10000000 , + .ext_irq_mask =0x00001fff ,/* IRQ7 - IRQ12, IRQ0 - IRQ6 */ } };
arch/ppc/platforms/4xx/ibm440gp.c +13 -0
@@ -19,6 +19,7 @@#include <linux/module.h> #include <platforms/4xx/ibm440gp.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> static struct ocp_func_emac_data ibm440gp_emac0_def = { .rgmii_idx =-1 ,/* No RGMII */
@@ -148,4 +149,16 @@ }, { .vendor = OCP_VENDOR_INVALID } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xfffffe03 , + .triggering =0x01c00000 , + .ext_irq_mask =0x000001fc ,/* IRQ0 - IRQ6 */ + }, + { .polarity =0xffffc0ff , + .triggering =0x00ff8000 , + .ext_irq_mask =0x00003f00 ,/* IRQ7 - IRQ12 */ + }, };
arch/ppc/platforms/4xx/ibm440gx.c +17 -0
@@ -19,6 +19,7 @@#include <linux/module.h> #include <platforms/4xx/ibm440gx.h> #include <asm/ocp.h> +#include <asm/ppc4xx_pic.h> static struct ocp_func_emac_data ibm440gx_emac0_def = { .rgmii_idx =-1 ,/* No RGMII */
@@ -214,4 +215,20 @@ }, { .vendor = OCP_VENDOR_INVALID } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xfffffe03 , + .triggering =0x01c00000 , + .ext_irq_mask =0x000001fc ,/* IRQ0 - IRQ6 */ + }, + { .polarity =0xffffc0ff , + .triggering =0x00ff8000 , + .ext_irq_mask =0x00003f00 ,/* IRQ7 - IRQ12 */ + }, + { .polarity =0xffff83ff , + .triggering =0x000f83c0 , + .ext_irq_mask =0x00007c00 ,/* IRQ13 - IRQ17 */ + }, };
arch/ppc/platforms/4xx/ibmnp405h.h +1 -3
@@ -132,8 +132,7 @@#define DCRN_UIC1_BASE 0x0D0#define DCRN_CPC0_EPRCSR 0x0F3 -#define UIC0_UIC1NC 30/* UIC1 non-critical interrupt */ -#define UIC0_UIC1CR 31/* UIC1 critical interrupt */ +#define UIC0_UIC1NC 0x00000002#define CHR1_CETE 0x00000004/* CPU external timer enable */ #define UIC0 DCRN_UIC0_BASE
@@ -141,7 +140,6 @@#undef NR_UICS#define NR_UICS 2 -#define UIC_CASCADE_MASK 0x0003/* bits 30 & 31 */ /* EMAC DCRN's FIXME: armin */ #define DCRN_MALRXCTP2R (base) ((base) + 0x42)/* Channel Rx 2 Channel Table Pointer */
arch/ppc/platforms/4xx/ibmstbx25.c +9 -0
@@ -12,6 +12,7 @@#include <linux/init.h> #include <asm/ocp.h> #include <platforms/4xx/ibmstbx25.h> +#include <asm/ppc4xx_pic.h> static struct ocp_func_iic_data ibmstbx25_iic0_def = { .fast_mode =0 ,/* Use standad mode (100Khz) */
@@ -55,5 +56,13 @@ .pm = IBM_CPM_GPIO0, }, { .vendor = OCP_VENDOR_INVALID + } +}; + +/* Polarity and triggering settings for internal interrupt sources */ +struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[]__initdata = { + { .polarity =0xffff8f80 , + .triggering =0x00000000 , + .ext_irq_mask =0x0000707f ,/* IRQ7 - IRQ9, IRQ0 - IRQ6 */ } };
arch/ppc/platforms/4xx/oak.c +2 -28
@@ -101,8 +101,8 @@ ppc_md.setup_arch = oak_setup_arch; ppc_md.show_percpuinfo = oak_show_percpuinfo; ppc_md.irq_canonicalize =NULL ; - ppc_md.init_IRQ = oak_init_IRQ; - ppc_md.get_irq = oak_get_irq; + ppc_md.init_IRQ = ppc4xx_pic_init; + ppc_md.get_irq =NULL ;/* Set in ppc4xx_pic_init() */ ppc_md.init =NULL ; ppc_md.restart = oak_restart;
@@ -153,32 +153,6 @@ bp->bi_busfreq / 1000000);return 0 ; -} - -/* -* Document me. -*/ -void __init -oak_init_IRQ (void ) -{ -int i; - -ppc4xx_pic_init (); - -for (i =0 ; i <NR_IRQS ; i++) { - irq_desc[i].handler = ppc4xx_pic; - } - -return ; -} - -/* -* Document me. -*/ -int -oak_get_irq (struct pt_regs *regs) -{ -return (ppc4xx_pic_get_irq (regs)); }/*
arch/ppc/platforms/4xx/ocotea.c +0 -6
@@ -347,12 +347,6 @@ibm440gx_get_clocks (&clocks,33333333 ,6 *1843200 ); ocp_sys_info.opb_bus_freq = clocks.opb; -/* XXX Fix L2C IRQ triggerring setting (edge-sensitive). -* Firmware (at least PIBS v1.72 OCT/28/2003) sets it incorrectly -* --ebs -*/ -mtdcr (DCRN_UIC_TR (UIC2 ),mfdcr (DCRN_UIC_TR (UIC2 )) |0x00000100 ); -ibm44x_platform_init (); ppc_md.setup_arch = ocotea_setup_arch;
arch/ppc/platforms/4xx/redwood6.c +12 -38
64 lines not on this page · raw message
arch/ppc/platforms/4xx/sycamore.c +15 -37
65 lines not on this page · raw message
arch/ppc/syslib/Makefile +4 -0
@@ -17,7 +17,11 @@ ifeq ($(CONFIG_VIRTEX_II_PRO),y) obj-$(CONFIG_40x) += xilinx_pic.o else +ifeq ($(CONFIG_403),y) +obj-$(CONFIG_40x) += ppc403_pic.o +else obj-$(CONFIG_40x) += ppc4xx_pic.o +endif endif obj-$(CONFIG_44x) += ppc4xx_pic.o obj-$(CONFIG_40x) += ppc4xx_setup.o
arch/ppc/syslib/ibm44x_common.c +1 -11
@@ -142,19 +142,9 @@return mem_size; } -static void __init ibm44x_init_irq (void ) -{ -int i; - -ppc4xx_pic_init (); - -for (i =0 ; i <NR_IRQS ; i++) - irq_desc[i].handler = ppc4xx_pic; -} -void __init ibm44x_platform_init (void ) { - ppc_md.init_IRQ = ibm44x_init_irq; + ppc_md.init_IRQ = ppc4xx_pic_init; ppc_md.find_end_of_memory = ibm44x_find_end_of_memory; ppc_md.restart = ibm44x_restart; ppc_md.power_off = ibm44x_power_off;
arch/ppc/syslib/ppc403_pic.c new file +127 -0
127 lines not on this page · raw message
arch/ppc/syslib/ppc4xx_pic.c +190 -481
714 lines not on this page · raw message
arch/ppc/syslib/ppc4xx_setup.c +0 -5
@@ -133,12 +133,7 @@void __init ppc4xx_init_IRQ (void ) { -int i; -ppc4xx_pic_init (); - -for (i =0 ; i <NR_IRQS ; i++) - irq_desc[i].handler = ppc4xx_pic; } static void
arch/ppc/syslib/xilinx_pic.c +5 -4
@@ -38,9 +38,6 @@#define intc_in_be32 (addr) mfdcr((addr))#endif -/* Global Variables */ -struct hw_interrupt_type *ppc4xx_pic; -static void xilinx_intc_enable (unsigned int irq) {
@@ -115,6 +112,8 @@void __init ppc4xx_pic_init (void ) { +int i; +#if XPAR_XINTC_USE_DCR ==0 intc =ioremap (XPAR_INTC_0_BASEADDR ,32 );
@@ -137,6 +136,8 @@/* Turn on the Master Enable. */ intc_out_be32 (intc +MER ,0x3UL ); - ppc4xx_pic = &xilinx_intc; ppc_md.get_irq = xilinx_pic_get_irq; + +for (i =0 ; i <NR_IRQS ; ++i) + irq_desc[i].handler = &xilinx_intc; }
include/asm-ppc/ibm44x.h +1 -3
@@ -162,8 +162,7 @@#define DCRN_UIC_VR (base) (base + 0x7)#define DCRN_UIC_VCR (base) (base + 0x8) -#define UIC0_UIC1NC 30/* UIC1 non-critical interrupt */ -#define UIC0_UIC1CR 31/* UIC1 critical interrupt */ +#define UIC0_UIC1NC 0x00000002#define UICB_UIC0NC 0x40000000#define UICB_UIC1NC 0x10000000
@@ -518,7 +517,6 @@#else #define NR_UICS 2#endif -#define UIC_CASCADE_MASK 0x0003/* bits 30 & 31 */ #define BD_EMAC_ADDR (e,i) bi_enetaddr[e][i]
include/asm-ppc/ppc4xx_pic.h +38 -13
66 lines not on this page · raw message