ppc-linux EPIC (OpenPIC) and Interrupts on MPC8240

3 messages, 3 authors, 2001-07-09 · open the first message on its own page

ppc-linux EPIC (OpenPIC) and Interrupts on MPC8240

From: James F Dougherty <hidden>
Date: 2001-07-06 21:39:27

Hi,

I am porting a custom designed MPC8240 board to linuxpcc,
have spent about a month or so getting ppcboot running
on it, and am now in the low-level details of getting
linux setup and running. Here's the details of my hardware
configuration:

200Mhz MPC8240 (Embedded MPC107, EPIC, I2C, I2O) + 64MB SDRAM
512K PLCC (Bootrom)
4MB FLASH mapped via PLD to PortX I/O Bus in range:
NS16550  mapped via PLD to PortX I/O bus starting at 0xffe08080
DEC 21143 Ethernet on MPC107 PCI Bus
ALI 1535 Southbridge
PCI Connector

The board is essentially a Motorola Sandpoint design variant, so
I have started with the MontaVista Sandpoint port of linux-2.3.1
and have had gotten into the sandpoint_setup code. I believe the
interrupt controller driver and serial port are currently broken
however.

IRQ mapping on this system is different then the standard PPC/Linux
configurations I have seen so far as it uses the internal OpenPIC
interrupt controller for all interrupts and does not use the 8259
serial port cascade (Winbond and others).

Vector(s)	Assignment
---------	-------------------
0-15		External (and unused serial interrupts)
16-19		Global timers
20		I2C
21-22		DMA
23		I2O message


Also, the MPC8240 EPIC (OpenPIC) has two modes: serial and discrete
interrupt mode. I need to use Discrete interrupt mode, which allows
for my hardwired interrupt mapping :

#define IRQ_ENET	1	/* Hardwired external EPIC Vector 1*/
#define IRQ_PCI		3	/* Hardwired external EPIC Vector 3*/
#define IRQ_UART	4	/* Hardwired external EPIC Vector 4*/

I have several questions:

1) How do the internal linux IRQ numbers map to EPIC interrupts?
2) What is the procedure by which the interrupt controller will invoke
   a linux interrupt? I know doIRQ is called and ppc_md.cannonicalize_irq()
   will re-number interrupts if need be, but I am not sure what interrupt
   numbers these should map to on the EPIC.
3) How should I handle the serial port? The drivers/char/serial.c
   allows for :

	static struct serial_state rs_table[] = {
		{ 0, 9600, 0xffe08080, 4, STD_COM_FLAGS }, /* ttyS0 */
	};

   however I am not sure this will work since I get no console output
   but I do know that my PIO version of the serial driver works (since
   I have written a ppc_md.progress routine and it spits out text indicating
   where I am)

4) Should I add a new interrupt controller driver? I am sure the open_pic.c
   driver works since it works for sandpoint, however, it only handles routing
   the interrupt to the 8259 cascade (which does the SIO interrupt) which is
   not what I am using (I need the 8240 EPIC in discrete mode EXT4 = COM1).

Here is where I am at bootup:

Initializing...
  CPU:   MPC8240 Revision 1.1 at 302 MHz: 16 kB I-Cache 16 kB D-Cache
  Board:   VOOHA MOUSSE MPC8240/KAHLUA - CHRP (MAP B)
  PLD Revision 1
  Local Bus at 2105 MHz
  DRAM:  64 MB
  FLASH: 16 MB
  Scanning function 0 of each PCI device on bus 0
  bus dev fn venID devID class  rev MBAR0    MBAR1    IPIN ILINE
  00  00  00 1057  0003  060000 11  00000008 00000000 01   00
  00  0d  00 1011  0019  020000 41  00810001 00010000 01   01
  In:    serial
  Out:   serial
  Err:   serial

mousse>boot
DC21143 Ethernet adapter(bus=0, device=13, func=0)
DEC Ethernet iobase=0x80000000 eth0: online
ARP broadcast 1
TFTP from server 192.168.1.133; our IP address is 192.168.1.138
Filename 'vmlinux.img'.
Load address: 0x100000
Loading:
################################################################################
#################
done
Bytes transferred = 492694 (78496 hex)
eth_halt
## Booting image at 00100000 ...
   Image Name:   vmlinux.bin.gz
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    492630 Bytes = 481 kB = 0 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
arch: exitinit IRQ
openpic enterOpenPIC v1.2
openpic timeropenpic ipisandpoint irq
openpic spuriousopenpic exitdo_IRQ:irq:00000063

 irq_cannon:00000004
                    irq_cannon:00000000
                                       irq_cannon:00000001
                                                          irq_cannon:00000002

irq_cannon:00000003
                irq_cannon:00000004
                                   irq_cannon:00000003
                                                      irq_cannon:00000004

irq_cannon:00000003


I am pretty sure it is mapping the OpenPIC correctly (I get 1.2 in my VxWorks
driver so that looks good). I am not sure why do_IRQ() is called with IRQ=0x63
though, perhaps this is in need of re-mapping? I wrote the irq_cannonicalize
routine to return the IRQ number, and in a desperate hack attempt to get the
serial port to work, I added the same rs_table entry for IRQ 0-4


I am sure someone out there has had to deal with this issue before, so any
pointers in the right direction would be greatly appreciated.

Many thanks in advance.

					-James
James Dougherty
jfd@gigabitnetworks.com
408-776-6634

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: ppc-linux EPIC (OpenPIC) and Interrupts on MPC8240

From: Dan Malek <hidden>
Date: 2001-07-09 17:57:43

James F Dougherty wrote:
The board is essentially a Motorola Sandpoint design variant, so
I have started with the MontaVista Sandpoint port of linux-2.3.1
What is linux-2.3.1?  Which version of the Sandpoint?

If it is the old Sandpoint X2, and you are using the EPIC with
discrete interrups (IRQ0 - IRQ4) the latest MontaVista HHL 2.0
should be used (it should be used in any case).  The code in
the public BK trees should also match this release.  If you are
using a Sandpoint X3 with the serial mode interrupt EPIC, there
are some patches I'll have to send you.


	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: ppc-linux EPIC (OpenPIC) and Interrupts on MPC8240

From: Andrew Johnson <hidden>
Date: 2001-07-09 20:00:20

James F Dougherty wrote:
I am sure someone out there has had to deal with this issue before, so any
pointers in the right direction would be greatly appreciated.
I have HHL2.0 (Linux-2.4.2) running on an MVME2100 board (MPC8240) which
only uses the interrupts on the built-in EPIC device, no 8259.  I don't
pretend to fully understand PCI interrupts, but I did discover that the
OpenPIC_InitSenses[] array is critical to getting interrupts to work, and
I also had to edit openpic.c to remove the 8259 stuff from
openpic_get_irq() in my configuration.  You're working with an earlier
version though, so YMMV.

The openpic driver gets the default number of IRQs from the register on
the EPIC chip to be 24, but these are not contiguous nor in their
canonical places, so you need to provide the InitSenses array to let it
know the real configuration.  I start with 16 zero entries as the first
EPIC IRQ is offset by 16, then provide up to 16 entries for the real
serial IRQ inputs to the EPIC.  The value you give to each entry
determines the polarity / edge-sensitivity; my setup needs 1 for PCI
devices, but 0 for the 16550 UART.  I'm not sure how you cope with the
large gap before the I2C and DMA IRQ numbers; it looks like openpic.c
needs modifying to properly cope with holes in the IRQ space, but it may
be that you can do this with a cannonicalize_irq() routine (I don't have
one, but I don't need the high IRQs and they're not essential for Linux to
run).

I discovered that even without serial interrupts working it was possible
to type commands to my init shell (mount /proc;cat /proc/interrupts was
very useful); you just have to wait up to 10 seconds for them to arrive,
and don't type more than will fill the FIFO; be prepared to wait a while
for the output to appear too!

- Andrew
--
The world is such a cheerful place when viewed from upside-down
It makes a rise of every fall, a smile of every frown

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help