Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9bd170a authored by Paul Mackerras's avatar Paul Mackerras
Browse files

powerpc: Merge i8259.c into arch/powerpc/sysdev



This changes the parameters for i8259_init so that it takes two
parameters: a physical address for generating an interrupt
acknowledge cycle, and an interrupt number offset.  i8259_init
now sets the irq_desc[] for its interrupts; all the callers
were doing this, and that code is gone now.  This also defines
a CONFIG_PPC_I8259 symbol to select i8259.o for inclusion, and
makes the platforms that need it select that symbol.

Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 25635c71
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -275,11 +275,13 @@ endchoice
config PPC_PSERIES
	depends on PPC_MULTIPLATFORM && PPC64
	bool "  IBM pSeries & new (POWER5-based) iSeries"
	select PPC_I8259
	default y

config PPC_CHRP
	bool "  Common Hardware Reference Platform (CHRP) based machines"
	depends on PPC_MULTIPLATFORM && PPC32
	select PPC_I8259
	select PPC_INDIRECT_PCI
	default y

@@ -298,6 +300,7 @@ config PPC_PMAC64
config PPC_PREP
	bool "  PowerPC Reference Platform (PReP) based machines"
	depends on PPC_MULTIPLATFORM && PPC32
	select PPC_I8259
	select PPC_INDIRECT_PCI
	default y

@@ -628,6 +631,7 @@ menu "Bus options"
config ISA
	bool "Support for ISA-bus hardware"
	depends on PPC_PREP || PPC_CHRP
	select PPC_I8259
	help
	  Find out whether you have ISA slots on your motherboard.  ISA is the
	  name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -640,6 +644,11 @@ config GENERIC_ISA_DMA
	depends on PPC64 || POWER4 || 6xx && !CPM2
	default y

config PPC_I8259
	bool
	default y if 85xx
	default n

config PPC_INDIRECT_PCI
	bool
	depends on PCI
@@ -679,6 +688,7 @@ config MPC83xx_PCI2
config PCI_QSPAN
	bool "QSpan PCI"
	depends on !4xx && !CPM2 && 8xx
	select PPC_I8259
	help
	  Say Y here if you have a system based on a Motorola 8xx-series
	  embedded processor with a QSPAN PCI interface, otherwise say N.
+5 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ config EV64260

config LOPEC
	bool "Motorola-LoPEC"
	select PPC_I8259

config MVME5100
	bool "Motorola-MVME5100"
@@ -55,6 +56,7 @@ config MVME5100

config PPLUS
	bool "Motorola-PowerPlus"
	select PPC_I8259
	select PPC_INDIRECT_PCI

config PRPMC750
@@ -67,12 +69,14 @@ config PRPMC800

config SANDPOINT
	bool "Motorola-Sandpoint"
	select PPC_I8259
	help
	  Select SANDPOINT if configuring for a Motorola Sandpoint X3
	  (any flavor).

config RADSTONE_PPC7D
	bool "Radstone Technology PPC7D board"
	select PPC_I8259

config PAL4
	bool "SBS-Palomar4"
@@ -307,6 +311,7 @@ config HARRIER_STORE_GATHERING
config MVME5100_IPMC761_PRESENT
	bool "MVME5100 configured with an IPMC761"
	depends on MVME5100
	select PPC_I8259

config SPRUCE_BAUD_33M
	bool "Spruce baud clock support"
+4 −15
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ extern int pSeries_machine_check_exception(struct pt_regs *regs);
static void pseries_shared_idle(void);
static void pseries_dedicated_idle(void);

static volatile void __iomem * chrp_int_ack_special;
struct mpic *pSeries_mpic;

void pSeries_show_cpuinfo(struct seq_file *m)
@@ -119,19 +118,11 @@ static void __init fwnmi_init(void)
		fwnmi_active = 1;
}

static int pSeries_irq_cascade(struct pt_regs *regs, void *data)
{
	if (chrp_int_ack_special)
		return readb(chrp_int_ack_special);
	else
		return i8259_irq(regs);
}

static void __init pSeries_init_mpic(void)
{
        unsigned int *addrp;
	struct device_node *np;
        int i;
	unsigned long intack = 0;

	/* All ISUs are setup, complete initialization */
	mpic_init(pSeries_mpic);
@@ -142,16 +133,14 @@ static void __init pSeries_init_mpic(void)
                 get_property(np, "8259-interrupt-acknowledge", NULL)))
                printk(KERN_ERR "Cannot find pci to get ack address\n");
        else
		chrp_int_ack_special = ioremap(addrp[prom_n_addr_cells(np)-1], 1);
		intack = addrp[prom_n_addr_cells(np)-1];
	of_node_put(np);

	/* Setup the legacy interrupts & controller */
        for (i = 0; i < NUM_ISA_INTERRUPTS; i++)
                irq_desc[i].handler = &i8259_pic;
	i8259_init(0);
	i8259_init(intack, 0);

	/* Hook cascade to mpic */
	mpic_setup_cascade(NUM_ISA_INTERRUPTS, pSeries_irq_cascade, NULL);
	mpic_setup_cascade(NUM_ISA_INTERRUPTS, i8259_irq_cascade, NULL);
}

static void __init pSeries_setup_mpic(void)
+1 −0
Original line number Diff line number Diff line
obj-$(CONFIG_MPIC)		+= mpic.o
obj-$(CONFIG_PPC_INDIRECT_PCI)	+= indirect_pci.o
obj-$(CONFIG_PPC_I8259)		+= i8259.o
+39 −26
Original line number Diff line number Diff line
/*
 * i8259 interrupt controller driver.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/i8259.h>

static volatile unsigned char *pci_intack; /* RO, gives us the irq vector */
static volatile void __iomem *pci_intack; /* RO, gives us the irq vector */

unsigned char cached_8259[2] = { 0xff, 0xff };
static unsigned char cached_8259[2] = { 0xff, 0xff };
#define cached_A1 (cached_8259[0])
#define cached_21 (cached_8259[1])

static DEFINE_SPINLOCK(i8259_lock);

int i8259_pic_irq_offset;
static int i8259_pic_irq_offset;

/*
 * Acknowledge the IRQ using either the PCI host bridge's interrupt
@@ -20,8 +28,7 @@ int i8259_pic_irq_offset;
 * which is called.  It should be noted that polling is broken on some
 * IBM and Motorola PReP boxes so we must use the int-ack feature on them.
 */
int
i8259_irq(struct pt_regs *regs)
int i8259_irq(struct pt_regs *regs)
{
	int irq;

@@ -29,7 +36,7 @@ i8259_irq(struct pt_regs *regs)

	/* Either int-ack or poll for the IRQ */
	if (pci_intack)
		irq = *pci_intack;
		irq = readb(pci_intack);
	else {
		/* Perform an interrupt acknowledge cycle on controller 1. */
		outb(0x0C, 0x20);		/* prepare for poll */
@@ -59,7 +66,12 @@ i8259_irq(struct pt_regs *regs)
	}

	spin_unlock(&i8259_lock);
	return irq;
	return irq + i8259_pic_irq_offset;
}

int i8259_irq_cascade(struct pt_regs *regs, void *unused)
{
	return i8259_irq(regs);
}

static void i8259_mask_and_ack_irq(unsigned int irq_nr)
@@ -67,9 +79,7 @@ static void i8259_mask_and_ack_irq(unsigned int irq_nr)
	unsigned long flags;

	spin_lock_irqsave(&i8259_lock, flags);
	if ( irq_nr >= i8259_pic_irq_offset )
	irq_nr -= i8259_pic_irq_offset;

	if (irq_nr > 7) {
		cached_A1 |= 1 << (irq_nr-8);
		inb(0xA1); 	/* DUMMY */
@@ -96,7 +106,6 @@ static void i8259_mask_irq(unsigned int irq_nr)
	unsigned long flags;

	spin_lock_irqsave(&i8259_lock, flags);
	if ( irq_nr >= i8259_pic_irq_offset )
	irq_nr -= i8259_pic_irq_offset;
	if (irq_nr < 8)
		cached_21 |= 1 << irq_nr;
@@ -111,7 +120,6 @@ static void i8259_unmask_irq(unsigned int irq_nr)
	unsigned long flags;

	spin_lock_irqsave(&i8259_lock, flags);
	if ( irq_nr >= i8259_pic_irq_offset )
	irq_nr -= i8259_pic_irq_offset;
	if (irq_nr < 8)
		cached_21 &= ~(1 << irq_nr);
@@ -169,12 +177,14 @@ static struct irqaction i8259_irqaction = {
 * intack_addr - PCI interrupt acknowledge (real) address which will return
 *               the active irq from the 8259
 */
void __init
i8259_init(long intack_addr)
void __init i8259_init(unsigned long intack_addr, int offset)
{
	unsigned long flags;
	int i;

	spin_lock_irqsave(&i8259_lock, flags);
	i8259_pic_irq_offset = offset;

	/* init master interrupt controller */
	outb(0x11, 0x20); /* Start init sequence */
	outb(0x00, 0x21); /* Vector base */
@@ -198,11 +208,14 @@ i8259_init(long intack_addr)
	spin_unlock_irqrestore(&i8259_lock, flags);

	/* reserve our resources */
	setup_irq( i8259_pic_irq_offset + 2, &i8259_irqaction);
	setup_irq(offset + 2, &i8259_irqaction);
	request_resource(&ioport_resource, &pic1_iores);
	request_resource(&ioport_resource, &pic2_iores);
	request_resource(&ioport_resource, &pic_edgectrl_iores);

	if (intack_addr != 0)
		pci_intack = ioremap(intack_addr, 1);

	for (i = 0; i < NUM_ISA_INTERRUPTS; ++i)
		irq_desc[offset + i].handler = &i8259_pic;
}
Loading