LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 21/21]: powerpc/cell spidernet DMA coalescing
From: Joel Schopp @ 2006-10-14  2:12 UTC (permalink / raw)
  To: Linas Vepstas
  Cc: akpm, jeff, Arnd Bergmann, netdev, James K Lewis, linux-kernel,
	linuxppc-dev
In-Reply-To: <20061010212324.GR4381@austin.ibm.com>

Linas Vepstas wrote:
> The current driver code performs 512 DMA mappns of a bunch of 
> 32-byte structures. This is silly, as they are all in contiguous 
> memory. Ths patch changes the code to DMA map the entie area
> with just one call.
> 
> Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
> Cc: James K Lewis <jklewis@us.ibm.com>
> Cc: Arnd Bergmann <arnd@arndb.de>

While this patch wasn't useful in the current cell implementation of pci_map_single 
it sounds like people are going to be making changes to that sometime. In light of 
that new information (new to me anyway) this should probably go in after all.  Sorry 
for causing trouble.

Acked-by: Joel Schopp <jschopp@austin.ibm.com>

^ permalink raw reply

* Re: [PATCH 2/5] powerpc: support nested cpu features
From: Olof Johansson @ 2006-10-14  2:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1160726664.4792.223.camel@localhost.localdomain>

On Fri, 13 Oct 2006 18:04:24 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> This patch adds some macros that can be used with an explicit label in
> order to nest cpu features. This should be used very careful but is
> necessary for the upcoming cell TB fixup.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Acked-by: Olof Johansson <olof@lixom.net>

^ permalink raw reply

* Re: [PATCH 5/5] powerpc: Cell timebase bug workaround
From: Olof Johansson @ 2006-10-14  2:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1160726676.4792.226.camel@localhost.localdomain>

On Fri, 13 Oct 2006 18:04:36 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


Better this way :-)

Acked-by: Olof Johansson <olof@lixom.net>

^ permalink raw reply

* problem in running pthread application
From: Ratheesh @ 2006-10-14  6:14 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

Hello everybody,
                         I have a problem in running a pthread based
application whose source is given below.
//sample.c
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *thread1_function(void *);
void *thread2_function(void *);

int main(void)
{
 pthread_t thread1,thread2;
 char *message1 = "Thread 1";
 char *message2 = "Thread 2";
 int iret1,iret2;
 iret1 = pthread_create(&thread1,NULL,thread1_function,(void*)message1);
 iret2 = pthread_create(&thread2,NULL,thread2_function,(void*)message2);

 pthread_join(thread1,iret1);
 pthread_join(thread2,iret2);
 printf("Thread 1 returns: %d\n",iret1);
 printf("Thread 2 returns: %d\n",iret2);
 exit(0);
}

void *thread1_function(void *ptr)
{
 char *message;
 message = (char *) ptr;
 while(1)
 {
  printf("%s\n",message);
  sleep(5);
 }
}

void *thread2_function(void *ptr)
{
 char *message;
 message = (char *) ptr;
 while(1)
 {
  printf("%s\n",message);
  sleep(8);
 }
}
//end of sample.c

I compiled using the command $powerpc-linux-uclibc-gcc -lpthread -o sample
sample.c

when I run on my target board(MPC850 based custom board), I find multiple
copies of the same program(I am invoking only once) is running. ps -e
command show the following output.

PID  Uid     VmSize Stat Command
    1 root        392 S   init
    2 root            SW  [keventd]
    3 root            SWN [ksoftirqd_CPU0]
    4 root            SW  [kswapd]
    5 root            SW  [bdflush]
    6 root            SW  [kupdated]
    7 root            SW  [rpciod]
   36 root       1284 S   /bin/snmpd -Dagentx
   41 root       1024 S   /bin/bash
   42 root        372 S   /sbin/syslogd -n -m 0
   43 root        348 S   /sbin/klogd -n
   51 root        296 S   sample
   52 root        296 S   sample
   53 root        296 S   sample
   54 root        296 S   sample
   56 root        372 R   ps

Why is this program is running multiple copies in the memory? How to avoid
this.If I compile
the same program in PC(x86 with glibc) It is running fine(no multiple
copies). So how to avoid this what is wrong with my program? Please help me.

Regards,

Ratheesh

[-- Attachment #2: Type: text/html, Size: 3718 bytes --]

^ permalink raw reply

* Re: Recently removed io accessors
From: Peter Korsgaard @ 2006-10-14 11:57 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, sfr
In-Reply-To: <17712.7972.493547.357685@cargo.ozlabs.ibm.com>

>>>>> "PM" == Paul Mackerras <paulus@samba.org> writes:

Hi,

>> Endian register set to little endian (default at powerup):
RedBoot> x -b 0x8e000064 -2 -l 4
>> 8E000064: 4321 8765
RedBoot> x -b 0x8e000064 -4 -l 4
>> 8E000064: 43218765

PM> Which is neither big-endian nor little-endian, but something more
PM> like vax-endian (or pdp11-endian), but not exactly that either -
PM> vax-endian would be 65872143.  What a mess.

Yes :/

PM> Clearly the "big endian" bit on the chip doesn't actually switch
PM> between little-endian and big-endian at all, but just acts to
PM> invert the 0x2 bit of the address...

Exactly.

PM> So the two hardware bogosities taken together leave you with only
PM> one combination that is anything like usable.  I suggest that you
PM> code up a loop of readw (or equivalent) in the driver with a big
PM> comment explaining why you need to do it that way.

It doesn't have to be readw (16bit accesses). Enabling the BE mode and
using _outsl/_insl (32bit access with byteswap) works fine.

Let me repeat my question:
Could I get _outsl/_insl re-added to kernel/misc.S or do I have to
reimplement it somewhere else (platform file or smc911x.h)?

-- 
Bye, Peter Korsgaard

^ permalink raw reply

* Re: Handling machine check exception
From: ganesh subramonian @ 2006-10-14 14:04 UTC (permalink / raw)
  To: Segher Boessenkool, Benjamin Herrenschmidt
  Cc: ganesh subramonian, linuxppc-dev
In-Reply-To: <1924CA98-A7C7-4FD2-9709-58EC9DD6BEB6@kernel.crashing.org>

hi
the g2core manual does not say that DAR gets updated
for a machine check exception, but the mpc866um.pdf
manual says so, and it actually does work on my target
board with mpc852t. but no such reference is made in
mpc8272rm.pdf(and dar doesnt get updated on my 8247
based board).

if i cannot find out which address caused the
exception, is there any way by which i can disable
machine check for a particular range of addresses.

thanks
ganesh

--- Segher Boessenkool <segher@kernel.crashing.org>
wrote:

> >> The G2 core definitely has a DAR register (SPR
> 19).
> >>
> >> Look on the Freescale site for G2CORERM.pdf -
> this is
> >> your reference manual, not the one specifically
> for the
> >> 8247.
> >
> > Is DAR set for a machine check ?
> 
> Not on these old cores.
> 
> 
> Segher
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply

* Re: Inquiring about your Linux 2.6.17.1 port to XUP
From: Ameet Patil @ 2006-10-14 17:35 UTC (permalink / raw)
  To: Neil Steiner; +Cc: Dr. Neil Audsley, Ameet Patil, linuxppc-embedded
In-Reply-To: <45300A50.2010000@vt.edu>

Hi Neil,
    Please help yourself! Everything in 
http://www.cs.york.ac.uk/rtslab/demos/amos/xupv2pro/ is for public 
access! And yes! You are right... 
http://www.cs.york.ac.uk/rtslab/demos/amos/ is not for public.
Do post your comments or bugs (if any) on the linux embedded ppc mailing 
list (linuxppc-embedded@ozlabs.org).

cheers,
-Ameet

Neil Steiner wrote:
> Dear Sirs:
> 
> I came across a link to 
> http://www.cs.york.ac.uk/rtslab/demos/amos/xupv2pro/ on comp.arch.fpga, 
> but noticed that http://www.cs.york.ac.uk/rtslab/demos/amos/ requires 
> login access, and so I wasn't sure whether or not your Linux 2.6.17.1 
> files where intended for public consumption.
> 
> I don't have a pressing need for a 2.6 kernel, and have instead been 
> following directions from the University of Washington 
> (http://www.cs.washington.edu/research/lis/empart/xup_ppc_linux.shtml) 
> and Brigham Young University 
> (http://splish.ee.byu.edu/projects/LinuxFPGA/configuring.htm) for a 2.4 
> kernel, but seeing the link to your site did pique my curiosity.
> 
> My question then is simply whether I may refer to your files if they 
> prove to be useful, or if they were supposed to be restricted.
> 
> Neil

^ permalink raw reply

* Gofast float point and 405ep
From: Stelios Koroneos @ 2006-10-14 19:37 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <45311FE5.3080400@cs.york.ac.uk>

Greetings !

Has anyone used the Gofast float point lib instead of the gcc one with the
405?
If yes have you measured significant differences in performance ?

I need to do considerable floating point operations (dtmf detection, echo
cancelation etc) and i was wondering if there are any speed improvents

Stelios

^ permalink raw reply

* Re: preempt crash in 2.6.18
From: Vitaly Bordug @ 2006-10-15  9:20 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1160781278.4792.279.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

On Sat, 14 Oct 2006 09:14:38 +1000
Benjamin Herrenschmidt wrote:

> On Sat, 2006-10-14 at 01:21 +0400, Vitaly Bordug wrote:
> > On Fri, 13 Oct 2006 09:16:52 -0500
> > Rune Torgersen wrote:
> > 
> > > 
> > > This is from a Freescale 8265 running 2.6.18
> > > Anyone have any idea what this is and how to fix it?
> > > 
> > Yes. Actually, I recall alike thing and used to fix with proper
> > spin-locking if the cascade PCI irq, which apparently does do_irq
> > that seems to confuse preempt counters.
> > 
> > Just a pure guess.
> 
> How so ? Cascades shouldn't do do_IRQ with the new irq code anyway
> unless this is still arch/ppc, they should do either __do_IRQ or
> better, generic_handle_irq().
> 
To clarify - I was about __do_IRQ and arch/ppc. 
Anyway, cascade for PCI is the first place I'd give a look.

--
Sincerely,

-Vitaly

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* asm-ppc includes
From: Jeff Stevens @ 2006-10-15 15:02 UTC (permalink / raw)
  To: ELDK Mailing List

I have a AMCC 440SP board, and I am having an issue with the asm includes u=
nder 2.6.17.9.  It seems that almost everything I try to compile is looking=
 for headers files in the asm-ppc directory that aren't there (like asm/err=
no.h, asm/ioctl.h, asm/types.h, asm/posix-types.h, etc.).  Where are these =
files?  I have a few applications that compiled fine under 2.4 that now won=
't compile under 2.6.=0A=0AThanks,=0A   Jeff Stevens=0A=0A=0A=0A

^ permalink raw reply

* Failed to boot kernel 2.6.19-rc2 due to IBM veth problem.
From: Yao Fei Zhu @ 2006-10-15 16:26 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel

Hi, all,

Boot kernel 2.6.19-rc2 on IBM System P5 partitions will fall into xmon.
Here is the boot log,

Please wait, loading kernel...
   Elf64 kernel loaded...
Loading ramdisk...
ramdisk loaded at 02400000, size: 1441 Kbytes
OF stdout device is: /vdevice/vty@30000000
Hypertas detected, assuming LPAR !
command line: ro console=hvc0 rhgb quiet root=LABEL=/ xmon=on sysrq=1 selinux=0
memory layout at init:
  alloc_bottom : 0000000002570000
  alloc_top    : 0000000010000000
  alloc_top_hi : 0000000200000000
  rmo_top      : 0000000010000000
  ram_top      : 0000000200000000
Looking for displays
instantiating rtas at 0x000000000f710000 ... done
0000000000000000 : boot cpu     0000000000000000
0000000000000002 : starting cpu hw idx 0000000000000002... done
copying OF device tree ...
Building dt strings...
Building dt structure...
Device tree strings 0x0000000002880000 -> 0x00000000028810e3
Device tree struct  0x0000000002890000 -> 0x00000000028a0000
Calling quiesce ...
returning from prom_init
Partition configured for 6 cpus.
Starting Linux PPC64 #1 SMP Sun Oct 15 11:36:37 EDT 2006
-----------------------------------------------------
ppc64_pft_size                = 0x1c
physicalMemorySize            = 0x200000000
ppc64_caches.dcache_line_size = 0x80
ppc64_caches.icache_line_size = 0x80
htab_address                  = 0x0000000000000000
htab_hash_mask                = 0x1fffff
-----------------------------------------------------
Linux version 2.6.19-rc2 (root@tc1.cn.ibm.com) (gcc version 4.1.1 20060817 (Red                                              Hat 4.1.1-18)) #1 SMP Sun Oct 15 11:36:37 EDT 2006
[boot]0012 Setup Arch
EEH: No capable adapters found
PPC64 nvram contains 7168 bytes
Zone PFN ranges:
  DMA             0 ->   131072
  Normal     131072 ->   131072
early_node_map[1] active PFN ranges
    0:        0 ->   131072
[boot]0015 Setup Done
Built 1 zonelists.  Total pages: 130944
Kernel command line: ro console=hvc0 rhgb quiet root=LABEL=/ xmon=on sysrq=1 sel                                             inux=0
scan-log-dump not implemented on this system
Red Hat nash version 5.1.2 starting
sda: assuming drive cache: write through
sda: assuming drive cache: write through
sdb: assuming drive cache: write through
sdb: assuming drive cache: write through
ERROR unmounting old /proc/bus/usb: No such file or directory
forcing unmount of /proc/bus/usb
                Welcome to Red Hat Enterprise Linux Server
                Press 'I' to enter interactive startup.
Setting clock  (utc): Sun Oct 15 11:56:20 EDT 2006 [  OK  ]
Starting udev: [  OK  ]
Setting hostname tc1.cn.ibm.com:  [  OK  ]
Setting up Logical Volume Management:   No volume groups found
[  OK  ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/sdb3
/: clean, 388834/5124480 files, 4963350/5120704 blocks
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/sdb2
/boot: clean, 29/26104 files, 70058/104384 blocks
[  OK  ]
Remounting root filesystem in read-write mode:  [  OK  ]
Mounting local filesystems:  [  OK  ]
Enabling local filesystem quotas:  [  OK  ]
Enabling /etc/fstab swaps:  [  OK  ]
INIT: Entering runlevel: 3
Entering non-interactive startup
Starting sysstat:  Calling the system activity data collector (sadc):
[  OK  ]
Starting readahead_early:  Starting background readahead: [  OK  ]
[  OK  ]
Checking for hardware changes [  OK  ]
Applying ip6tables firewall rules: [  OK  ]
Applying iptables firewall rules: [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_ns [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]
Bringing up interface eth1:
Determining IP information for eth1... done.
[  OK  ]
Starting restorecond: Daemon requires SELinux be enabled to run.
[FAILED]
Starting auditd: [  OK  ]
Starting system logger: [  OK  ]
Starting kernel logger: [  OK  ]
WARNING: initlog is deprecated and will be removed in a future release
WARNING: initlog is deprecated and will be removed in a future release
Starting irqbalance: [  OK  ]
Starting iSCSI initiator service: [FAILED]
Starting portmap: [  OK  ]
Starting NFS statd: [  OK  ]
Starting RPC idmapd: [  OK  ]
Starting system message bus: [  OK  ]
[  OK  ] Bluetooth services:[  OK  ]
Mounting other filesystems:  [  OK  ]
Starting PC/SC smart card daemon (pcscd): [  OK  ]
Starting hidd: [  OK  ]
Loading autofs4: [  OK  ]
Starting automount: [  OK  ]
Starting hpiod: [  OK  ]
Starting hpssd: [  OK  ]
Starting ipr initialization daemon[  OK  ]
Starting iprupdate:  Checking ipr microcode levels
Completed ipr microcode updates[  OK  ]
[  OK  ]
Starting ipr dump daemon[  OK  ]
Starting cups: [  OK  ]
Starting sshd: [  OK  ]
Starting xinetd: [  OK  ]
Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state reco                                             very directory
NFSD: starting 90-second grace period
[  OK  ]
Starting NFS mountd: [  OK  ]
Starting vsftpd for vsftpd: [  OK  ]
Starting sendmail: [  OK  ]
Starting sm-client: [  OK  ]
Starting console mouse services: [  OK  ]
Starting crond: [  OK  ]
Starting xfs: [  OK  ]
Starting SMB services: [  OK  ]
Starting NMB services: [  OK  ]
Unable to handle kernel paging request for data at address 0x000000d8
Faulting instruction address: 0xd000000000081ff8
cpu 0x1: Vector: 300 (Data Access) at [c00000000f6f7b00]
    pc: d000000000081ff8: .ibmveth_poll+0x20c/0x470 [ibmveth]
    lr: d000000000081fc8: .ibmveth_poll+0x1dc/0x470 [ibmveth]
    sp: c00000000f6f7d80
   msr: 8000000000009032
   dar: d8
 dsisr: 40010000
  current = 0xc000000001b65330
  paca    = 0xc000000000454800
    pid   = 0, comm = swapper
enter ? for help
[c00000000f6f7e40] c0000000002b77dc .net_rx_action+0xe0/0x288
[c00000000f6f7ef0] c00000000006bb14 .__do_softirq+0xa8/0x168
[c00000000f6f7f90] c000000000026864 .call_do_softirq+0x14/0x24
[c000000001b7b980] c00000000000c2a0 .do_softirq+0x70/0x98
[c000000001b7ba10] c00000000006ba54 .irq_exit+0x5c/0x74
[c000000001b7ba90] c00000000000ca68 .do_IRQ+0x180/0x1bc
[c000000001b7bb20] c0000000000044ec hardware_interrupt_entry+0xc/0x10
--- Exception: 501 (Hardware Interrupt) at c0000000000452b8 .plpar_hcall_norets+                                             0x24/0x90
[link register   ] c0000000000464a0 .pseries_shared_idle_sleep+0x24/0x44
[c000000001b7be10] 0000000000000000 .__start+0x4000000000000000/0x8 (unreliable)
[c000000001b7be80] c000000000012258 .cpu_idle+0x110/0x1e8
[c000000001b7bf00] c000000000029fdc .start_secondary+0x144/0x168
[c000000001b7bf90] c0000000000083bc .start_secondary_prolog+0xc/0x10
1:mon>
1:mon> e
cpu 0x1: Vector: 300 (Data Access) at [c00000000f6f7b00]
    pc: d000000000081ff8: .ibmveth_poll+0x20c/0x470 [ibmveth]
    lr: d000000000081fc8: .ibmveth_poll+0x1dc/0x470 [ibmveth]
    sp: c00000000f6f7d80
   msr: 8000000000009032
   dar: d8
 dsisr: 40010000
  current = 0xc000000001b65330
  paca    = 0xc000000000454800
    pid   = 0, comm = swapper
1:mon> t
[c00000000f6f7e40] c0000000002b77dc .net_rx_action+0xe0/0x288
[c00000000f6f7ef0] c00000000006bb14 .__do_softirq+0xa8/0x168
[c00000000f6f7f90] c000000000026864 .call_do_softirq+0x14/0x24
[c000000001b7b980] c00000000000c2a0 .do_softirq+0x70/0x98
[c000000001b7ba10] c00000000006ba54 .irq_exit+0x5c/0x74
[c000000001b7ba90] c00000000000ca68 .do_IRQ+0x180/0x1bc
[c000000001b7bb20] c0000000000044ec hardware_interrupt_entry+0xc/0x10
--- Exception: 501 (Hardware Interrupt) at c0000000000452b8 .plpar_hcall_norets+0x24/0x90
[link register   ] c0000000000464a0 .pseries_shared_idle_sleep+0x24/0x44
[c000000001b7be10] 0000000000000000 .__start+0x4000000000000000/0x8 (unreliable)
[c000000001b7be80] c000000000012258 .cpu_idle+0x110/0x1e8
[c000000001b7bf00] c000000000029fdc .start_secondary+0x144/0x168
[c000000001b7bf90] c0000000000083bc .start_secondary_prolog+0xc/0x10
1:mon> r
R00 = 0000000000000701   R16 = 0000000000000000
R01 = c00000000f6f7d80   R17 = 0000000000000000
R02 = d000000000092930   R18 = 0000000000000000
R03 = c000000001b3a638   R19 = 0000000000000000
R04 = 8000000000009032   R20 = 0000000000000000
R05 = 00000000000000f1   R21 = 0000000000000000
R06 = 000000000000090f   R22 = 0000000000000010
R07 = 0000000000000001   R23 = c00000000f6f7eb0
R08 = c0000001f7ec0220   R24 = 000000000000006e
R09 = 0000000000000022   R25 = 0000000000000001
R10 = c0000001ffaaa790   R26 = c0000001ffaaa100
R11 = 0000000000000000   R27 = 0000000000000008
R12 = 0000000000004000   R28 = c0000001ffaaa100
R13 = c000000000454800   R29 = 0000000000000000
R14 = 0000000000000000   R30 = d000000000092500
R15 = 000000000f9d82a4   R31 = c0000001ffaaa680
pc  = d000000000081ff8 .ibmveth_poll+0x20c/0x470 [ibmveth]
lr  = d000000000081fc8 .ibmveth_poll+0x1dc/0x470 [ibmveth]
msr = 8000000000009032   cr  = 24000088
ctr = 0000000000000000   xer = 0000000020000000   trap =  300
dar = 00000000000000d8   dsisr = 40010000
1:mon> di d000000000081ff8
d000000000081ff8  e81d00d8      ld      r0,216(r29)
d000000000081ffc  e93d00e0      ld      r9,224(r29)
d000000000082000  7f6b07b4      extsw   r11,r27
d000000000082004  7b040020      clrldi  r4,r24,32
d000000000082008  7c005a14      add     r0,r0,r11
d00000000008200c  7d295a14      add     r9,r9,r11
d000000000082010  f81d00d8      std     r0,216(r29)
d000000000082014  f93d00e0      std     r9,224(r29)
d000000000082018  e81d008e      lwa     r0,140(r29)
d00000000008201c  0b000000      tdnei   r0,0
d000000000082020  e81d00e0      ld      r0,224(r29)
d000000000082024  e97d00e8      ld      r11,232(r29)
d000000000082028  813d0088      lwz     r9,136(r29)
d00000000008202c  7c002214      add     r0,r0,r4
d000000000082030  7d244a14      add     r9,r4,r9
d000000000082034  7fa05840      cmpld   cr7,r0,r11
1:mon> mi
Mem-info:
Node 0 DMA per-cpu:
CPU    0: Hot: hi:    6, btch:   1 usd:   5   Cold: hi:    2, btch:   1 usd:   0
CPU    1: Hot: hi:    6, btch:   1 usd:   0   Cold: hi:    2, btch:   1 usd:   0
CPU    2: Hot: hi:    6, btch:   1 usd:   0   Cold: hi:    2, btch:   1 usd:   0
CPU    3: Hot: hi:    6, btch:   1 usd:   5   Cold: hi:    2, btch:   1 usd:   0
Active:2913 inactive:2098 dirty:191 writeback:1 unstable:0 free:124082 slab:705 mapped:563 pagetables:96
Node 0 DMA free:7941248kB min:11520kB low:14400kB high:17280kB active:186432kB inactive:134272kB present:8380416kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0
Node 0 DMA: 20*64kB 5*128kB 1*256kB 0*512kB 1*1024kB 0*2048kB 0*4096kB 1*8192kB 484*16384kB = 7941248kB
Swap cache: add 0, delete 0, find 0/0, race 0+0
Free swap  = 2096320kB
Total swap = 2096320kB
Free swap:       2096320kB
131072 pages of RAM
581 reserved pages
3372 pages shared
0 pages swap cached
1:mon>

^ permalink raw reply

* Re: asm-ppc includes
From: Josh Boyer @ 2006-10-15 19:06 UTC (permalink / raw)
  To: Jeff Stevens; +Cc: ELDK Mailing List
In-Reply-To: <20061015150217.17117.qmail@web33411.mail.mud.yahoo.com>

On Sun, 2006-10-15 at 08:02 -0700, Jeff Stevens wrote:
> I have a AMCC 440SP board, and I am having an issue with the asm includes under 2.6.17.9.  
> It seems that almost everything I try to compile is looking for headers files in the asm-ppc
>  directory that aren't there (like asm/errno.h, asm/ioctl.h, asm/types.h, asm/posix-types.h,
>  etc.).  Where are these files?  I have a few applications that compiled fine under 2.4 that
>  now won't compile under 2.6.

You're compiling applications against raw kernel headers?  You really
shouldn't do that.  Use the ones provided by glibc.

To answer your "where are they" question, in 2.6.15-ish lots of them
moved to include/asm-powerpc/.  Makefile magic brings them in to kernel
compiles using ARCH=ppc when needed.

josh

^ permalink raw reply

* Re: [PATCH] Xilinx UART Lite 2.6.18 driver
From: David H. Lynch Jr. @ 2006-10-15 21:02 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-embedded
In-Reply-To: <8764eovg81.fsf@sleipner.barco.com>

[-- Attachment #1: Type: text/plain, Size: 4080 bytes --]

Peter Korsgaard wrote:
>>>>>> "David" == David H Lynch <dhlii@dlasys.net> writes:
>>>>>>             
>
> Hi,
>
> David>    Peter's driver uses the IORESOURCE requests to pull platform
> David> data.  Most other serial platformdevices pull a uart_port
> David> object.  My limited understanding of IORESOURCE is that it is
> David> not sufficiently deep to support the parameters that are needed
> David> to support UartLite such as a DCR flag and a regoffset.
>
> I'm still not convinced that DCR access and variable register offsets
> are needed - But it can always be added (through a seperate struct in
> platform_data) - Patches are welcome.
>   
    It does not matter whether you or I are convinced. It matters 
whether there are people that need it.
    Xilinx has a reference design that uses DCR. While I have never 
tripped over an actual implimentation that uses
    DCR there are others on this list that have.

> The same with interrupt-less support if the changes are not too
> intrusive.
>
>   
    Right now I can not get your driver to work. I spent alot of time 
trying to fix it and got nowhere.
    I can not get it to receive at all, and I can not get it to send 
after switching from the console driver
    without dropping characters. I am very busy with other things right 
now and it is going to be a long
    time before I have time to look at your driver again.

    In the meantime, my own driver works - atleast for me. And it is out 
in the real world on production systems.
 
   The most instrusive changes is likely to be fixing whatever is 
causing yours to drop characters - the problem is
    worse when I patch your driver to be timer driven - but that is 
likely because your service routines blindly presume it is
    safe to transmit - true on a Tx empty interrupt, but  not on a timer 
tick.

    But what matters is not whether the changes are intrusive, but  
whether they produce a better result.









> David>    You are welcome to do that. I already patched his driver to
> David> work with my early console support as well as adding the
> David> boot-bash stuff similar to yours. But I gave up actually using
> David> it when I could not get it to work.
>
> Which is odd as I've gotten positive feedback from others.
>   
    I am glad somebody is using your driver and finding it works. But we 
are all better served by fixing the failure cases.

    It is not particularly odd at all. The UartLite despite its 
simplicity is   worse than a normal driver - different
    FPGA implimentations can vary. Normal drivers for fixed inflexible 
hardware often do not work accross
    differing implimentations, why would you expect something like 
UartLite to be invariant ?

    One of the other reasons for implimenting polling is because a 
polled driver tends to work accross
    wider hardware variations. You can not make state assumptions in a 
poll routine,
    and if the poll routine does nto run then the rest of the OS is hosed.

    Even today, flakey hardware interrupts are not unheard of.

    I would also ask what data rates you and others with Working 
UartLites are using ?
    The cases I am dealing with run at 57600 and 115200 respectively - 
it is not that odd for
    driver problems to manifest themselves only or more frequently at 
high baud rates.


> David>    Next time I get an opportunity I am going to try to setup an
> David> ml403 to atleast verify that Peter's driver is working there.
>
> Great.
>   
    Without being difficult - don't hold your breath. It is something I 
would like to do, but
 I do not have  infinite time.


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein


[-- Attachment #2: Type: text/html, Size: 5788 bytes --]

^ permalink raw reply

* Re: uartlite with 2.6.17 kernel and kernel early text messages
From: David H. Lynch Jr. @ 2006-10-15 21:12 UTC (permalink / raw)
  To: Robert Corley; +Cc: linux linuxppc-embedded
In-Reply-To: <20061013204442.52818.qmail@web56308.mail.re3.yahoo.com>

Robert Corley wrote:
> I am still trying to get the UARTLITE to work with 2.6 and a plb_temac design.  I am using EDK 7.1.  I have generated the edk files and copied xparameters_ml300.h to arch/ppc/platforms/4xx/xparameters.xparameters_ml403.h
>
> In an effort to get past the "Rebooting to System ACE Configuration Address 6..." message, I have selected "support for early boot texts over serial port" in kernel debugging.
>   
    I do not think Peter's driver actually supports early boot texts. I 
beleive the patches David  Bolcsfoldi posted add early boot support.

    If you can not get that working I posted a driver in January (as 
part of a patchset for the Pico E12) that has early boot support - 
though on inspection David's patches looked like they should work.


> FYI, I'm using Peter's patches to create the uartlite.c and associated files and have selected the uartlite using make menuconfig.
>
> The first error is as follows:
> athena startup_network # make ARCH=ppc zImage.initrd
>   CHK     include/linux/version.h
>   CHK     include/linux/compile.h
> dnsdomainname: Unknown host
>   CC      arch/ppc/syslib/gen550_dbg.o
> arch/ppc/syslib/gen550_dbg.c:36: error: `RS_TABLE_SIZE' undeclared here (not in a function)
> arch/ppc/syslib/gen550_dbg.c:38: error: empty scalar initializer
> arch/ppc/syslib/gen550_dbg.c:38: error: (near initialization for `rs_table')
> arch/ppc/syslib/gen550_dbg.c:36: error: storage size of `rs_table' isn't known
> arch/ppc/syslib/gen550_dbg.c:36: warning: 'rs_table' defined but not used
> make[1]: *** [arch/ppc/syslib/gen550_dbg.o] Error 1
> make: *** [arch/ppc/syslib] Error 2
>   
    Unless you actually have an 8250 based Uart in your system - and you 
are not configured for one, then arch/ppc/syslib/gen550_dbg should NOT 
be getting built.
    Proper early boot text support for the UartLite requires both a 
replacement for this AND changes to use those instead of gen550_dbg.c

> so, I modified the gen550_dbg.c file to #include the xparameters.h, where the RS_TABLE_SIZE is defined
>  but still get more errors.  Here they are:
>   
    You do not want to touch gen550_dbg.c
    You need a new uartlite_dbg.c and Makefile and other changes to use it.

>   CHK     include/linux/version.h
>   CHK     include/linux/compile.h
> dnsdomainname: Unknown host
>   CC      arch/ppc/syslib/gen550_dbg.o
> arch/ppc/syslib/gen550_dbg.c:37: error: `XPAR_UARTNS550_0_CLOCK_FREQ_HZ' undeclared here (not in a function)
> arch/ppc/syslib/gen550_dbg.c:37: error: initializer element is not constant
> arch/ppc/syslib/gen550_dbg.c:37: error: (near initialization for `rs_table[0].baud_base')
> arch/ppc/syslib/gen550_dbg.c:37: error: `XPAR_INTC_0_UARTNS550_0_VEC_ID' undeclared here (not in a function)
> arch/ppc/syslib/gen550_dbg.c:37: error: initializer element is not constant
> arch/ppc/syslib/gen550_dbg.c:37: error: (near initialization for `rs_table[0].irq')
> arch/ppc/syslib/gen550_dbg.c:37: error: `XPAR_UARTNS550_0_BASEADDR' undeclared here (not in a function)
> arch/ppc/syslib/gen550_dbg.c:37: error: initializer element is not constant
> arch/ppc/syslib/gen550_dbg.c:37: error: (near initialization for `rs_table[0].iomem_base')
> arch/ppc/syslib/gen550_dbg.c:37: error: initializer element is not constant
> arch/ppc/syslib/gen550_dbg.c:37: error: (near initialization for `rs_table[0]')
> make[1]: *** [arch/ppc/syslib/gen550_dbg.o] Error 1
> make: *** [arch/ppc/syslib] Error 2
>
> Questions:
>
> 1.    Now, is this an issue with the UARTLITE driver or is it just not supported for early messaging?
>   
    Peters does not support early boot texts.
    Both David's and my drivers do as do David's patches to Peter's driver./
> 2.   What am I missing w.r.t. getting something out of the serial port?
> 3.    I am assuming that the boot args for a initrd boot are:  "console=ttyUL0 ip=off root=/dev/ram rw", correct?
>   
    Presuming you have no other serial device I think you should not 
need any console= argument at all.
> -corley
>
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>   


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein

^ permalink raw reply

* Strange to me
From: wei.li4 @ 2006-10-15 21:43 UTC (permalink / raw)
  To: linuxppc-embedded

Hi All,

I am trying to add a C function in m8xx_setup.c and call it in 
head_8xx.S. I checked the final assembler and compared it with other 
functions same called in head_8xx.S (e.g.platform_init()), they used 
the different registers for stack poniter, and normal one used r0 to 
store and recover Link register. How to control comlier or linker, so 
that my own function is treated as same way? Thanks.

Here is my code:

void __init
debugger_init(unsigned char case_NO)
{
	//volatile immap_t      *immap;
	volatile cpm8xx_t     *cp;

	// Get pointer to Communication Processor
	cp = cpmp;

	/* PortB setting */
	/* These setting may be different for you.
	   Refer example 16-443 MPC823 Manual*/

// Port B pin 29, 30 configured as Open-Drain general purpose output

	cp->cp_pbodr &= ~0x0009;              // set 0
	cp->cp_pbdir |=  0x0006;              // set 1
	cp->cp_pbpar &= ~0x0009;              // set 0

	switch (case_NO)
	{
	  case 1:
	// Turn on at BP29(=0) and off at BP30(=1)
	    cp->cp_pbdat &= ~0x0004;
	    cp->cp_pbdat |=  0x0002;
	    break;

	  case 2:
	// Turn off at BP29(=1) and on at BP30(=0)
	    cp->cp_pbdat |=  0x0004;
	    cp->cp_pbdat &= ~0x0002;
	    break;

	  default:
	// Turn on at BP29, BP30(=0)
	    cp->cp_pbdat &= ~0x0006;
	    break;
	}

}

It's working fine if put in the utilitise, the fist part of EFL image.


Regard,
Wei

^ permalink raw reply

* Re: which driver for uartlite with 2.6.17?
From: David H. Lynch Jr. @ 2006-10-15 21:55 UTC (permalink / raw)
  To: David Bolcsfoldi; +Cc: Robert Corley, linux linuxppc-embedded
In-Reply-To: <609d5c8e0610130947k5ea1f955sadc8c5e82f693aa8@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 7989 bytes --]

David Bolcsfoldi wrote:
> Hi :-)
>
> Good question. Well I was unaware of the fact that there were other
> uartlite drivers so you should take mine off that list. Peter's driver
> is slated for inclusion in the mainline and I am currently in the
> process of adding a few things to it.
>
> For 2.6.17 support you should probably just remove the IRQF_DISABLED
> flag and change IRQF_SAMPLE_RANDOM to SA_SAMPLE_RANDOM in the
> request_irq call and it should work. I am unaware of any other
> important differences between the two releases affecting this driver.
>
> Cheers,
> David
>
> On 10/13/06, Robert Corley <rcorley@aegis-inc.net> wrote:
>   
>> All,
>>
>> Based on what was posted recently, it appears that there is more than one uartlite driver
>> floating about.
>>
>> Can someone please inform me of which driver works for which kernel?
>>
>> Here is what I see
>>
>> D. Lynch    2.6.15    polled, (Pico E12 board specific?)
>>     
    My driver supports polled and/or interrupt driven use - if you want 
polled you set the IRQ to -1.
    It should not be Pico E12 specific - I just have never tested it on 
anything but the Pico E12 and E14 boards.
    I do not think I have posted a patch that ONLY includes the 
UartLite. At the moment it seems like it would just confuse things.
    Peter and I uses fairly different Platform device initiallization. 
Mine is based on the 8250 code which makes it much easier to impliment
    early boot text support.
    You can actually diff my driver against the 8250 driver and mostly 
will find it is a subset.

    My driver also has boot-bash support.
    supports regshift values other than 2.
   
    I recently patched my driver to use the major and minor nodes Peter 
obtained through lanana.org as well as use his ttyUl0 naming.

    I am not sure which version of the kernel the patch supports,  but I 
have been running my driver from 2.6.13-2.6.18.
    But aside of patch issues, all of the drivers below should work 
across many versions.




  Yoshio Kashiwagi -Nissin Systems - Late January 2006.
    Also provided a UartLite driver that was a drop in replacement for 
the version I posted in January.
    Yoshio's version uses DCR. His should also provide early boot text 
support.

    I am not sure if he posted his version but he provided me with a 
copy with a GPL license so I can
    post it or email it if someone wanted.


>> P. Korsgaard    2.6.18    interrupt driven, official lanana.org nodes
>>     
    Is only interrupt driven, only supports a regshift of 2.
    Does not work for me, but aparently does for some others.
    Does not have early boot text support - Davd Bolcsfoldi has provided 
patches for that - though it would also be trivial to
    use my driver and replace my uartlite.c with Peter's and get early 
boot text support - aside from initialization issues - which appear to 
be ignorable,
    early boot text and the driver are very independent.

    David Bolcsfoldi appears to have a few other quality related patches 
to Peter's drivers which I have not had a chance to try.
>> D. Bolcsfoldi    2.6.18    interrupt driven
>>     
    David's also has early boot text support.
    David also provided early boot text support as a patch to Peter's 
driver.
>> patch locations:
>> D. Lynch    http://ozlabs.org/pipermail/linuxppc-embedded/2006-January/021592.html
>> P. Korsgaard    http://lkml.org/lkml/2006/9/13/71
>> D. Bolcsfoldi    http://ozlabs.org/pipermail/linuxppc-embedded/2006-October/024697.html
>>
>> Comments?
>>     
    Yes, I think including anything in the Kernel at the moment is 
premature. While I wish Peter would have started from something that 
already existed.
    He did do the work to register the major and minor numbers and run 
his through linux-serial - though I think his submission was premature.
  

    I know my driver has a few failure cases - none of which matter in 
my environment. I also know it has not been tested on other uartlite 
implimentations.
    The same is true of all the other UartLite drivers listed.

    Peter's and mine diverge in design almost as much as you can diverge 
while still following the Linux serial driver model.
    I deliberately patterned mine after the 8250 - there are pro and con 
arguments for that, but atleast you know.
    I am very familiar with serial hardware - I have written serial code 
for the past 25 years. I am less familiar with Linux
    Serial drivers. I deliberately patterened mine on an existing driver 
I knew to be well supported, robust, and tolerant of
    disparate and flakey hardware - partly because of my lack of depth 
of Linux Serial Driver knowledge and partly because
    I knew that anything that worked well for 8250's would likely work 
well with other uarts.
    I do not know what Peter's is based on.

    I have tried to reconcile my patches with Peter's driver - basically 
implimenting the functionality I have Peter is missing.
    But Peter's driver does not work on my boards. I have spent a great 
deal of time trying to fix that, and come to the unhappy realization
    it will probably take a great deal more to solve that - much more 
than it took to write my own driver in the first place.

    David Bilosfoldi has posted a patch to Peter's driver that looks 
like it impliments Early Boot Text support. There are minor differences 
between
    What David did and what I did, but on inspection he seems to have 
made all the necescary patches.


    Right now if one of the posted drivers does not work on your 
hardware or configuration, then you are going to have to pick a driver 
and try to fix it.
    Peter appears to be fairly willing to provide assistance with his 
driver. I am equally willing to provide help with mine.
    Aparently Peter's is likely to get accepted. At least that will 
provide a baseline for the rest of us to post fixes.

    I am not having the problems compiling Peter's you are. That is 
something you may have to take up with Peter.
    But until I can get Peter's to work on my hardware, I am not posting 
untested patches.
    And as I have something that works for me, and as Peter's driver 
seriously diverges from mine, I have a strong disincentive to  put time 
into it
    when I have something that works.
   


>> And, lastly, I need a driver for 2.6.17.  Can someone point me in the right direction?
>> I have tried Peter's driver but it fails to compile, showing this:
>>
>> CC      drivers/serial/serial_core.o
>> CC      drivers/serial/uartlite.o
>> drivers/serial/uartlite.c: In function `ulite_startup':
>> drivers/serial/uartlite.c:199: error: `IRQF_DISABLED' undeclared (first use in this function)
>> drivers/serial/uartlite.c:199: error: (Each undeclared identifier is reported only once
>> drivers/serial/uartlite.c:199: error: for each function it appears in.)
>> drivers/serial/uartlite.c:199: error: `IRQF_SAMPLE_RANDOM' undeclared (first use in this function)
>> make[2]: *** [drivers/serial/uartlite.o] Error 1
>> make[1]: *** [drivers/serial] Error 2
>> make: *** [drivers] Error 2
>>     

    I have been able to successfully compile Peter's driver with 2.6.18.
>>
>>
>>
>> _______________________________________________
>> Linuxppc-embedded mailing list
>> Linuxppc-embedded@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>>
>>     
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>   


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein


[-- Attachment #2: Type: text/html, Size: 11111 bytes --]

^ permalink raw reply

* Re: uartlite with 2.6.17 kernel and kernel early text messages
From: David H. Lynch Jr. @ 2006-10-15 22:00 UTC (permalink / raw)
  To: Michael Galassi; +Cc: Robert Corley, linux linuxppc-embedded
In-Reply-To: <200610132226.k9DMQ0xg050310@penguin.ncube.com>

[-- Attachment #1: Type: text/plain, Size: 2053 bytes --]

Michael Galassi wrote:
>> In an effort to get past the "Rebooting to System ACE Configuration
>> Address 6..." message, I have selected "support for early boot texts
>> over serial port" in kernel debugging.
>>     
>
> This will not work.  Unfortunately linux here shows its roots as PS OS,
> there is a vast amount of hardcoded NS8250/NS16550 knowledge in there.
> I'd started modularizing this so we could use a UART lite but the more I
> dug the lower my motivation.  This is really ugly code in an area that
> is of virtually no interest.  For now get rid of support for early boot
> texts over serial port" and use your JTAG to read the buffers if you
> panic before the console is up and running.
>   
   UartLite early boot text support is fairly trivial. It is also fairly 
standalone.
    You basically need about 5 lines  of code to output a character.
   
    David Bolcsfoldi has posted patches to Peter's driver that should work.
    I have had working early boot text support long before I even had a 
working driver.
    There is atleast one other Uart family besides the 8250 with early 
boot text support.
     You can also fairly trivially fold my early boot text code into 
Peter's driver.
   
    The most disconcerting problem is the #ifdef that results with 
something like 4 or cases.

    The non-8250 support could be more modularized - but it still not a 
major pain.



> -michael
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>   


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein


[-- Attachment #2: Type: text/html, Size: 3114 bytes --]

^ permalink raw reply

* Re: [PATCH] Xilinx UART Lite 2.6.18 driver
From: David Bolcsfoldi @ 2006-10-15 23:48 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-embedded
In-Reply-To: <87ac40vgeo.fsf@sleipner.barco.com>

On 10/13/06, Peter Korsgaard <jacmet@sunsite.dk> wrote:

> Could you make it relative to my driver so the changes are easier to
> see?
>

Done and done. Look at the end of this e-mail.

> The PPC is big endian - Did you remember to add 3 to your base
> address?
>

I don't see how reading a single byte would be affected by the
endianess of the platform.
I think it has more to do with the fact that the status and control
registers are both 4 byte wide and when you add 3 to your offset you
read only the LSB. I also suspect that the RX and TX registers are 4
byte wide too, even though this is not stated explicitly in the
documentation I think it would be prudent to access these two as
4-byte wide registers as well.

I guess it is OK to read and write bytes as long as the bitflags don't
change location. But I believe it is stated in the documentation that
the OPB UART Lite device is a big endian device, in my opinion it
would better to honor this and do big endian access of register width.

The patch below is not identical to the one I posted in previously.
This one has some preprocessor hackery in it to have the uartlites as
separate platform devices (VIRTEX_UARTLITE_0 ... VIRTEX_UARTLITE_3) if
they are available. In theory the only thing you'd need to have the
uartlites available would be to edit your xparameters.h with the
correct uartlite info, enable the driver in your config and compile
your kernel.

diff -urN uartlite/arch/ppc/boot/common/misc-common.c
uartlite-mod/arch/ppc/boot/common/misc-common.c
--- uartlite/arch/ppc/boot/common/misc-common.c	2006-10-15
14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/boot/common/misc-common.c	2006-10-15
13:58:51.000000000 -0700
@@ -57,7 +57,8 @@

 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 extern unsigned long com_port;

 extern int serial_tstc(unsigned long com_port);
@@ -80,7 +81,8 @@
 {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	if(keyb_present)
 		return (CRT_tstc() || serial_tstc(com_port));
 	else
@@ -95,7 +97,8 @@
 	while (1) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 		if (serial_tstc(com_port))
 			return (serial_getc(com_port));
 #endif /* serial console */
@@ -112,7 +115,8 @@

 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	serial_putc(com_port, c);
 	if ( c == '\n' )
 		serial_putc(com_port, '\r');
@@ -161,7 +165,8 @@
 	while ( ( c = *s++ ) != '\0' ) {
 #if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
 	        serial_putc(com_port, c);
 	        if ( c == '\n' ) serial_putc(com_port, '\r');
 #endif /* serial console */
diff -urN uartlite/arch/ppc/boot/simple/Makefile
uartlite-mod/arch/ppc/boot/simple/Makefile
--- uartlite/arch/ppc/boot/simple/Makefile	2006-10-15 14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/boot/simple/Makefile	2006-10-15
13:58:51.000000000 -0700
@@ -205,6 +205,7 @@
 endif
 boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE)	+= mpc52xx_tty.o
 boot-$(CONFIG_SERIAL_MPSC_CONSOLE)	+= mv64x60_tty.o
+boot-$(CONFIG_SERIAL_UARTLITE_CONSOLE)	+= uartlite_tty.o

 LIBS				:= $(common)/lib.a $(bootlib)/lib.a
 ifeq ($(CONFIG_PPC_PREP),y)
diff -urN uartlite/arch/ppc/boot/simple/misc.c
uartlite-mod/arch/ppc/boot/simple/misc.c
--- uartlite/arch/ppc/boot/simple/misc.c	2006-10-15 14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/boot/simple/misc.c	2006-10-15 13:58:51.000000000 -0700
@@ -48,7 +48,8 @@
 #if (defined(CONFIG_SERIAL_8250_CONSOLE) \
 	|| defined(CONFIG_VGA_CONSOLE) \
 	|| defined(CONFIG_SERIAL_MPC52xx_CONSOLE) \
-	|| defined(CONFIG_SERIAL_MPSC_CONSOLE)) \
+	|| defined(CONFIG_SERIAL_MPSC_CONSOLE) \
+	|| defined(CONFIG_SERIAL_UARTLITE_CONSOLE)) \
 	&& !defined(CONFIG_GEMINI)
 #define INTERACTIVE_CONSOLE	1
 #endif
diff -urN uartlite/arch/ppc/boot/simple/uartlite_tty.c
uartlite-mod/arch/ppc/boot/simple/uartlite_tty.c
--- uartlite/arch/ppc/boot/simple/uartlite_tty.c	1969-12-31
16:00:00.000000000 -0800
+++ uartlite-mod/arch/ppc/boot/simple/uartlite_tty.c	2006-10-15
13:58:51.000000000 -0700
@@ -0,0 +1,69 @@
+/*
+ * Xilinx UART Lite support.
+ * Right now it only works over UART0 and none other.
+ *
+ * Copyright (C) 2006 David Bolcsfoldi <dbolcsfoldi@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <asm/io.h>
+#include <linux/serial_uartlite.h>
+#include <platforms/4xx/xparameters/xparameters.h>
+
+static inline int is_xmit_full(unsigned int address)
+{
+	return ((in_be32((volatile unsigned *) (address + ULITE_STATUS)) &
ULITE_STATUS_TXFULL) == ULITE_STATUS_TXFULL);
+}
+
+static inline int is_recv_empty(unsigned int address)
+{
+	return ((in_be32((volatile unsigned *) (address + ULITE_STATUS)) &
ULITE_STATUS_RXVALID) != ULITE_STATUS_RXVALID);
+}
+
+unsigned long serial_init(int chan, void *ignored)
+{
+	switch (chan)  {
+	#ifdef XPAR_XUL_UART_0_BASEADDR
+		case 0:
+			return XPAR_XUL_UART_0_BASEADDR;
+	#endif
+	#ifdef XPAR_XUL_UART_1_BASEADDR
+		case 1:		
+			return XPAR_XUL_UART_1_BASEADDR;
+	#endif
+	#ifdef XPAR_XUL_UART_2_BASEADDR
+		case 2:
+			return XPAR_XUL_UART_2_BASEADDR;
+	#endif
+	#ifdef XPAR_XUL_UART_3_BASEADDR
+		case 3:
+			return XPAR_XUL_UART_3_BASEADDR;
+	#endif
+		default:
+			goto out;
+	}
+	
+out:
+	return -1;
+}
+
+void serial_putc(unsigned long com_port, unsigned char c)
+{
+	while(is_xmit_full(XPAR_XUL_UART_0_BASEADDR));
+	out_be32((volatile unsigned *) (XPAR_XUL_UART_0_BASEADDR + ULITE_TX), c);
+}
+
+unsigned char serial_getc(unsigned long com_port)
+{
+	while(is_recv_empty(XPAR_XUL_UART_0_BASEADDR));
+	return in_be32((volatile unsigned *) (XPAR_XUL_UART_0_BASEADDR + ULITE_RX));
+}
+
+int serial_tstc(unsigned long com_port)
+{
+	return !(is_recv_empty(XPAR_XUL_UART_0_BASEADDR));
+}
+
Binary files uartlite/arch/ppc/boot/simple/.uartlite_tty.c.swp and
uartlite-mod/arch/ppc/boot/simple/.uartlite_tty.c.swp differ
diff -urN uartlite/arch/ppc/platforms/4xx/virtex.c
uartlite-mod/arch/ppc/platforms/4xx/virtex.c
--- uartlite/arch/ppc/platforms/4xx/virtex.c	2006-10-15 14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/platforms/4xx/virtex.c	2006-10-15
13:58:52.000000000 -0700
@@ -46,11 +46,91 @@
 	{ }, /* terminated by empty record */
 };

+#define XPAR_UARTLITE(num) { \
+		.uartclk = XPAR_PLB_CLOCK_FREQ_HZ / 16, \
+		.baud	 = XPAR_XUL_UART_##num##_BAUDRATE, \
+		.bits	 = XPAR_XUL_UART_##num##_DATA_BITS, \
+		.parity	 = XPAR_XUL_UART_##num##_USE_PARITY, \
+		.odd_parity = XPAR_XUL_UART_##num##_ODD_PARITY, \
+}
+
+#define UARTLITE_PDEV(num) { \
+	.name = "uartlite", \
+	.id = num, \
+	.dev.platform_data = &uartlite_platform_data[num], \
+	.num_resources = 2, \
+	.resource = (struct resource[]) { \
+		{ \
+			.start = XPAR_XUL_UART_##num##_BASEADDR, \
+			.end = XPAR_XUL_UART_##num##_HIGHADDR, \
+			.flags = IORESOURCE_MEM, \
+		}, \
+		{ \
+			.start = XPAR_INTC_0_XUL_UART_##num##_VEC_ID, \
+			.end = XPAR_INTC_0_XUL_UART_##num##_VEC_ID, \
+			.flags = IORESOURCE_IRQ, \
+		}, \
+	} \
+}
+	
+struct plat_uartlite_data uartlite_platform_data[] = {
+#ifdef XPAR_XUL_UART_0_BASEADDR
+	XPAR_UARTLITE(0),
+#endif
+#ifdef XPAR_XUL_UART_1_BASEADDR
+	XPAR_UARTLITE(1),
+#endif
+#ifdef XPAR_XUL_UART_2_BASEADDR
+	XPAR_UARTLITE(2),
+#endif
+#ifdef XPAR_XUL_UART_3_BASEADDR
+	XPAR_UARTLITE(3),
+#endif
+	{ }, /* terminated by empty record */
+};
+
 struct platform_device ppc_sys_platform_devices[] = {
 	[VIRTEX_UART] = {
 		.name		= "serial8250",
 		.id		= 0,
 		.dev.platform_data = serial_platform_data,
 	},
+
+#ifdef XPAR_XUL_UART_0_BASEADDR
+	[VIRTEX_UARTLITE_0] = UARTLITE_PDEV(0),
+#else
+	[VIRTEX_UARTLITE_0] = { .id = - 1, },
+#endif /* XPAR_XUL_UART_0_BASEADDR */
+
+#ifdef XPAR_XUL_UART_1_BASEADDR
+	[VIRTEX_UARTLITE_1] = UARTLITE_PDEV(1),
+#else
+	[VIRTEX_UARTLITE_1] = { .id = - 1, },
+#endif /* XPAR_XUL_UART_1_BASEADDR */
+
+#ifdef XPAR_XUL_UART_2_BASEADDR
+	[VIRTEX_UARTLITE_2] = UARTLITE_PDEV(2),
+#else
+	[VIRTEX_UARTLITE_2] = { .id = - 1, },
+#endif /* XPAR_XUL_UART_2_BASEADDR */
+
+#ifdef XPAR_XUL_UART_3_BASEADDR
+	[VIRTEX_UARTLITE_3] = UARTLITE_PDEV(3),
+#else
+	[VIRTEX_UARTLITE_3] = { .id = - 1, },
+#endif /* XPAR_XUL_UART_3_BASEADDR */
 };

+/* For early console on the uartlite serial port some way of
+ * getting to the platform_device is needed */
+
+struct platform_device* early_uart_get_pdev(int dev)
+{
+	if (dev < 0 ||
+		dev >= NUM_PPC_SYS_DEVS) {
+		return NULL;
+	}
+
+	return &ppc_sys_platform_devices[dev];
+}
+
diff -urN uartlite/arch/ppc/platforms/4xx/virtex.h
uartlite-mod/arch/ppc/platforms/4xx/virtex.h
--- uartlite/arch/ppc/platforms/4xx/virtex.h	2006-10-15 14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/platforms/4xx/virtex.h	2006-10-15
13:58:52.000000000 -0700
@@ -27,8 +27,22 @@
 /* Device type enumeration for platform bus definitions */
 #ifndef __ASSEMBLY__
 enum ppc_sys_devices {
-	VIRTEX_UART, NUM_PPC_SYS_DEVS,
+	VIRTEX_UART,
+	VIRTEX_UARTLITE_0,
+	VIRTEX_UARTLITE_1,
+	VIRTEX_UARTLITE_2,
+	VIRTEX_UARTLITE_3,
+	NUM_PPC_SYS_DEVS,
 };
+
+struct plat_uartlite_data {
+	unsigned int uartclk;
+	unsigned int baud;
+	unsigned char bits;
+	unsigned char parity;
+	unsigned char odd_parity;
+};
+
 #endif

 #endif				/* __ASM_VIRTEX_H__ */
diff -urN uartlite/arch/ppc/platforms/4xx/xilinx_ml403.c
uartlite-mod/arch/ppc/platforms/4xx/xilinx_ml403.c
--- uartlite/arch/ppc/platforms/4xx/xilinx_ml403.c	2006-10-15
14:09:47.000000000 -0700
+++ uartlite-mod/arch/ppc/platforms/4xx/xilinx_ml403.c	2006-10-15
13:58:52.000000000 -0700
@@ -57,6 +57,10 @@
  *          ppc4xx_pic_init			arch/ppc/syslib/xilinx_pic.c
  */

+#ifndef XPAR_XUARTLITE_NUM_INSTANCES
+#define XPAR_XUARTLITE_NUM_INSTANCES 0
+#endif
+
 /* Board specifications structures */
 struct ppc_sys_spec *cur_ppc_sys_spec;
 struct ppc_sys_spec ppc_sys_specs[] = {
@@ -65,10 +69,22 @@
 		.ppc_sys_name	= "Xilinx ML403 Reference Design",
 		.mask 		= 0x00000000,
 		.value 		= 0x00000000,
-		.num_devices	= 1,
+		.num_devices	= 1 + XPAR_XUARTLITE_NUM_INSTANCES,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			VIRTEX_UART,
+#ifdef XPAR_XUL_UART_0_BASEADDR
+			VIRTEX_UARTLITE_0,
+#endif
+#ifdef XPAR_XUL_UART_1_BASEADDR
+			VIRTEX_UARTLITE_1,
+#endif
+#ifdef XPAR_XUL_UART_2_BASEADDR
+			VIRTEX_UARTLITE_2,
+#endif
+#ifdef XPAR_XUL_UART_3_BASEADDR
+			VIRTEX_UARTLITE_3,
+#endif
 		},
 	},
 };
Binary files uartlite/arch/ppc/platforms/4xx/xparameters/.xparameters_ml403.h.swp
and uartlite-mod/arch/ppc/platforms/4xx/xparameters/.xparameters_ml403.h.swp
differ
diff -urN uartlite/drivers/serial/uartlite.c
uartlite-mod/drivers/serial/uartlite.c
--- uartlite/drivers/serial/uartlite.c	2006-10-15 14:13:30.000000000 -0700
+++ uartlite-mod/drivers/serial/uartlite.c	2006-10-15 13:58:59.000000000 -0700
@@ -17,37 +17,21 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <asm/io.h>
+#include <linux/serial_uartlite.h>

 #define ULITE_MAJOR		204
 #define ULITE_MINOR		187
 #define ULITE_NR_UARTS		4

-/* For register details see datasheet:
-   http://www.xilinx.com/bvdocs/ipcenter/data_sheet/opb_uartlite.pdf
-*/
-#define ULITE_RX		0x00
-#define ULITE_TX		0x04
-#define ULITE_STATUS		0x08
-#define ULITE_CONTROL		0x0c
-
-#define ULITE_REGION		16
-
-#define ULITE_STATUS_RXVALID	0x01
-#define ULITE_STATUS_RXFULL	0x02
-#define ULITE_STATUS_TXEMPTY	0x04
-#define ULITE_STATUS_TXFULL	0x08
-#define ULITE_STATUS_IE		0x10
-#define ULITE_STATUS_OVERRUN	0x20
-#define ULITE_STATUS_FRAME	0x40
-#define ULITE_STATUS_PARITY	0x80
-
-#define ULITE_CONTROL_RST_TX	0x01
-#define ULITE_CONTROL_RST_RX	0x02
-#define ULITE_CONTROL_IE	0x10
-
-
 static struct uart_port ports[ULITE_NR_UARTS];

+/* Place-holder for board-specific stuff */
+struct platform_device* __attribute__ ((weak)) __init
+early_uart_get_pdev(int index)
+{
+	return NULL;
+}
+
 static int ulite_receive(struct uart_port *port, int stat)
 {
 	struct tty_struct *tty = port->info->tty;
@@ -61,7 +45,7 @@
 	/* stats */
 	if (stat & ULITE_STATUS_RXVALID) {
 		port->icount.rx++;
-		ch = readb(port->membase + ULITE_RX);
+		ch = in_be32((unsigned volatile *) (port->membase + ULITE_RX));

 		if (stat & ULITE_STATUS_PARITY)
 			port->icount.parity++;
@@ -106,7 +90,7 @@
 		return 0;

 	if (port->x_char) {
-		writeb(port->x_char, port->membase + ULITE_TX);
+		out_be32((unsigned volatile *) (port->membase + ULITE_TX), port->x_char);
 		port->x_char = 0;
 		port->icount.tx++;
 		return 1;
@@ -115,7 +99,7 @@
 	if (uart_circ_empty(xmit) || uart_tx_stopped(port))
 		return 0;

-	writeb(xmit->buf[xmit->tail], port->membase + ULITE_TX);
+	out_be32((unsigned volatile *) (port->membase + ULITE_TX),
xmit->buf[xmit->tail]);
 	xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE-1);
 	port->icount.tx++;

@@ -131,12 +115,16 @@
 	struct uart_port *port = (struct uart_port *)dev_id;
 	int busy;

+	spin_lock(&port->lock); /* Lock the port in case of printk */
+	
 	do {
-		int stat = readb(port->membase + ULITE_STATUS);
+		int stat = in_be32((unsigned volatile *) (port->membase + ULITE_STATUS));
 		busy  = ulite_receive(port, stat);
 		busy |= ulite_transmit(port, stat);
 	} while (busy);

+	spin_unlock(&port->lock);
+	
 	tty_flip_buffer_push(port->info->tty);

 	return IRQ_HANDLED;
@@ -148,7 +136,7 @@
 	unsigned int ret;

 	spin_lock_irqsave(&port->lock, flags);
-	ret = readb(port->membase + ULITE_STATUS);
+	ret = in_be32((unsigned volatile *) (port->membase + ULITE_STATUS));
 	spin_unlock_irqrestore(&port->lock, flags);

 	return ret & ULITE_STATUS_TXEMPTY ? TIOCSER_TEMT : 0;
@@ -171,7 +159,7 @@

 static void ulite_start_tx(struct uart_port *port)
 {
-	ulite_transmit(port, readb(port->membase + ULITE_STATUS));
+	ulite_transmit(port, in_be32((unsigned volatile *) (port->membase +
ULITE_STATUS)));
 }

 static void ulite_stop_rx(struct uart_port *port)
@@ -200,9 +188,8 @@
 	if (ret)
 		return ret;

-	writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
-	       port->membase + ULITE_CONTROL);
-	writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
+	out_be32((unsigned volatile *) (port->membase + ULITE_CONTROL),
ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX);
+	out_be32((unsigned volatile *) (port->membase + ULITE_CONTROL),
ULITE_CONTROL_IE);

 	return 0;
 }
@@ -216,6 +203,7 @@
 static void ulite_set_termios(struct uart_port *port, struct termios *termios,
 			      struct termios *old)
 {
+	struct plat_uartlite_data *udata;
 	unsigned long flags;
 	unsigned int baud;

@@ -240,7 +228,9 @@
 			| ULITE_STATUS_FRAME | ULITE_STATUS_OVERRUN;

 	/* update timeout */
-	baud = uart_get_baud_rate(port, termios, old, 0, 460800);
+	udata = port->dev->platform_data;
+	
+	baud = uart_get_baud_rate(port, termios, old, udata->baud, udata->baud);
 	uart_update_timeout(port, termios->c_cflag, baud);

 	spin_unlock_irqrestore(&port->lock, flags);
@@ -265,7 +255,10 @@
 		return -EBUSY;
 	}

-	port->membase = ioremap(port->mapbase, ULITE_REGION);
+	if (port->flags & UPF_IOREMAP) {
+		port->membase = ioremap(port->mapbase, ULITE_REGION);
+	}
+	
 	if (!port->membase) {
 		dev_err(port->dev, "Unable to map registers\n");
 		release_mem_region(port->mapbase, ULITE_REGION);
@@ -306,6 +299,35 @@
 	.verify_port	= ulite_verify_port
 };

+static inline int ulite_init_port(struct uart_port *port, struct
platform_device *pdev)
+{
+	struct resource *res;
+	struct plat_uartlite_data *udata = pdev->dev.platform_data;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	port->mapbase = res->start;
+
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res)
+		return -ENODEV;
+
+	port->irq = res->start;
+	port->uartclk = udata->uartclk;
+	port->membase = 0;
+	port->fifosize = 16;
+	port->regshift = 2;
+	port->iobase = 1; /* Mark port in use */
+	port->iotype = UPIO_MEM;
+	port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP;
+	port->ops = &ulite_ops;
+	port->type = PORT_UNKNOWN;
+
+	return 0;
+}
+
 #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
 static void ulite_console_wait_tx(struct uart_port *port)
 {
@@ -313,7 +335,7 @@

 	/* wait up to 10ms for the character(s) to be sent */
 	for (i=0; i<10000; i++) {
-		if (readb(port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY)
+		if (in_be32((unsigned volatile *) (port->membase + ULITE_STATUS)) &
ULITE_STATUS_TXEMPTY)
 			break;
 		udelay(1);
 	}
@@ -322,7 +344,7 @@
 static void ulite_console_putchar(struct uart_port *port, int ch)
 {
 	ulite_console_wait_tx(port);
-	writeb(ch, port->membase + ULITE_TX);
+	out_be32((unsigned volatile *) (port->membase + ULITE_TX), ch);
 }

 static void ulite_console_write(struct console *co, const char *s,
@@ -339,16 +361,18 @@
 		spin_lock_irqsave(&port->lock, flags);

 	/* save and disable interrupt */
-	ier = readb(port->membase + ULITE_STATUS) & ULITE_STATUS_IE;
-	writeb(0, port->membase + ULITE_CONTROL);
-
+	ier = in_be32((unsigned volatile *) (port->membase + ULITE_STATUS))
& ULITE_STATUS_IE;
+	
+	//writeb(0, port->membase + ULITE_CONTROL);
+	out_be32((unsigned volatile *) (port->membase + ULITE_CONTROL), 0);
+	
 	uart_console_write(port, s, count, ulite_console_putchar);

 	ulite_console_wait_tx(port);

 	/* restore interrupt state */
 	if (ier)
-		writeb(ULITE_CONTROL_IE, port->membase + ULITE_CONTROL);
+		out_be32((unsigned volatile *) (port->membase + ULITE_CONTROL),
ULITE_CONTROL_IE);

 	if (locked)
 		spin_unlock_irqrestore(&port->lock, flags);
@@ -356,16 +380,57 @@

 static int __init ulite_console_setup(struct console *co, char *options)
 {
+	int i, ret;
 	struct uart_port *port;
-
+	struct platform_device *pdev;
+	
 	if (co->index < 0 || co->index >= ULITE_NR_UARTS)
 		return -EINVAL;

 	port = &ports[co->index];

 	/* not initialized yet? */
-	if (!port->membase)
-		return -ENODEV;
+	if (!port->membase) {
+		/* We might be early console */
+
+		pdev = NULL;
+
+		/* Loop through the platform devices
+		 * until we find one with correct name
+		 * and device id */
+
+		for (i = 0; i < NUM_PPC_SYS_DEVS; ++i) {
+			pdev = early_uart_get_pdev(0);
+
+			if (pdev->id != - 1 &&
+				pdev->name != NULL &&
+				(strcmp(pdev->name, "uartlite") == 0) &&
+				pdev->id == co->index) {
+				break;
+			}
+		}
+
+		if (pdev == NULL) {
+			return -ENODEV;
+		}
+
+		ret = ulite_init_port(port, pdev);
+
+		if (ret != 0)
+			return ret;
+
+		port->line = co->index;
+		spin_lock_init(&port->lock);
+		port->membase = ioremap(port->mapbase, ULITE_REGION);
+
+		if(port->membase == NULL) {
+			port->iobase = 0;
+			return -EINVAL;
+		}
+
+		/* Clear ioremap since this port has been mapped already */
+		port->flags &= ~UPF_IOREMAP;
+	}

 	return 0;
 }
@@ -406,41 +471,44 @@

 static int __devinit ulite_probe(struct platform_device *pdev)
 {
-	struct resource *res, *res2;
 	struct uart_port *port;
+	int ret;

 	if (pdev->id < 0 || pdev->id >= ULITE_NR_UARTS)
 		return -EINVAL;

-	if (ports[pdev->id].membase)
-		return -EBUSY;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
+	if (ports[pdev->id].membase) {
+		if (ports[pdev->id].flags & UPF_IOREMAP) {	
+			return -EBUSY; /* Port is busy */
+		}
+
+		else {
+			/* This port as be remapped so it must have been an early console */
+			port = &ports[pdev->id];
+			goto add_port;
+		}
+	}

-	res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res2)
-		return -ENODEV;

 	port = &ports[pdev->id];

-	port->fifosize	= 16;
-	port->regshift	= 2;
-	port->iotype	= UPIO_MEM;
-	port->iobase	= 1; /* mark port in use */
-	port->mapbase	= res->start;
-	port->membase	= 0;
-	port->ops	= &ulite_ops;
-	port->irq	= res2->start;
-	port->flags	= UPF_BOOT_AUTOCONF;
-	port->dev	= &pdev->dev;
-	port->type	= PORT_UNKNOWN;
+	ret = ulite_init_port(port, pdev);

-	uart_add_one_port(&ulite_uart_driver, port);
-	platform_set_drvdata(pdev, port);
+	if (ret != 0)
+		goto out;
+	
+	port->line = pdev->id;
+
+add_port:
+	port->dev = &pdev->dev;
+	
+	ret = uart_add_one_port(&ulite_uart_driver, port);

-	return 0;
+	if(ret == 0)
+		platform_set_drvdata(pdev, port);
+
+out:
+	return ret;
 }

 static int ulite_remove(struct platform_device *pdev)
Binary files uartlite/drivers/serial/.uartlite.c.swp and
uartlite-mod/drivers/serial/.uartlite.c.swp differ
diff -urN uartlite/include/linux/serial_uartlite.h
uartlite-mod/include/linux/serial_uartlite.h
--- uartlite/include/linux/serial_uartlite.h	1969-12-31 16:00:00.000000000 -0800
+++ uartlite-mod/include/linux/serial_uartlite.h	2006-10-15
14:22:07.000000000 -0700
@@ -0,0 +1,28 @@
+#ifndef __SERIAL_UARTLITE_H__
+#define __SERIAL_UARTLITE_H__
+
+/* For register details see datasheet:
+   http://www.xilinx.com/bvdocs/ipcenter/data_sheet/opb_uartlite.pdf
+*/
+#define ULITE_RX		0x00
+#define ULITE_TX		0x04
+#define ULITE_STATUS		0x08
+#define ULITE_CONTROL		0x0c
+
+#define ULITE_REGION		16
+
+#define ULITE_STATUS_RXVALID	0x01
+#define ULITE_STATUS_RXFULL	0x02
+#define ULITE_STATUS_TXEMPTY	0x04
+#define ULITE_STATUS_TXFULL	0x08
+#define ULITE_STATUS_IE		0x10
+#define ULITE_STATUS_OVERRUN	0x20
+#define ULITE_STATUS_FRAME	0x40
+#define ULITE_STATUS_PARITY	0x80
+
+#define ULITE_CONTROL_RST_TX	0x01
+#define ULITE_CONTROL_RST_RX	0x02
+#define ULITE_CONTROL_IE	0x10
+
+#endif /* __SERIAL_UARTLITE_H__ */
+
--
Cheers,
David

^ permalink raw reply

* [PATCH 5/5] powerpc: Cell timebase bug workaround (#2)
From: Benjamin Herrenschmidt @ 2006-10-16  1:14 UTC (permalink / raw)
  To: linuxppc-dev list
In-Reply-To: <1160726676.4792.226.camel@localhost.localdomain>

The Cell CPU timebase has an errata. When reading the entire 64 bits of
the timebase with one mftb instruction, there is a handful of cycles
window during which one might read a value with the low order 32 bits
already reset to 0x00000000 but the high order bits not yet incremeted
by one. This fixes it by reading the timebase again until the low order
32 bits is no longer 0. That might introduce occasional latencies if
hitting mftb just at the wrong time, but no more than 70ns on a cell
blade, and that was considered acceptable.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

This is the "new" patch, to be merged.

Index: linux-cell/arch/powerpc/kernel/vdso64/gettimeofday.S
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/vdso64/gettimeofday.S	2006-10-06 13:47:54.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/vdso64/gettimeofday.S	2006-10-13 17:31:57.000000000 +1000
@@ -229,8 +229,10 @@ V_FUNCTION_BEGIN(__do_get_xsec)
 	xor	r0,r8,r8		/* create dependency */
 	add	r3,r3,r0
 
-	/* Get TB & offset it */
-	mftb	r7
+	/* Get TB & offset it. We use the MFTB macro which will generate
+	 * workaround code for Cell.
+	 */
+	MFTB(r7)
 	ld	r9,CFG_TB_ORIG_STAMP(r3)
 	subf	r7,r9,r7
 
Index: linux-cell/include/asm-powerpc/cputable.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/cputable.h	2006-10-13 17:31:53.000000000 +1000
+++ linux-cell/include/asm-powerpc/cputable.h	2006-10-13 17:31:57.000000000 +1000
@@ -143,6 +143,7 @@ extern struct cpu_spec *identify_cpu(uns
 #define CPU_FTR_CI_LARGE_PAGE		LONG_ASM_CONST(0x0000100000000000)
 #define CPU_FTR_PAUSE_ZERO		LONG_ASM_CONST(0x0000200000000000)
 #define CPU_FTR_PURR			LONG_ASM_CONST(0x0000400000000000)
+#define CPU_FTR_CELL_TB_BUG		LONG_ASM_CONST(0x0000800000000000)
 
 #ifndef __ASSEMBLY__
 
@@ -331,7 +332,7 @@ extern struct cpu_spec *identify_cpu(uns
 #define CPU_FTRS_CELL	(CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
 	    CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
 	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
-	    CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
+	    CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
 #define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
 	    CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
 	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
Index: linux-cell/include/asm-powerpc/ppc_asm.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/ppc_asm.h	2006-10-06 13:45:32.000000000 +1000
+++ linux-cell/include/asm-powerpc/ppc_asm.h	2006-10-16 11:07:27.000000000 +1000
@@ -30,9 +30,9 @@ BEGIN_FTR_SECTION;							\
 	mfspr	ra,SPRN_PURR;		/* get processor util. reg */	\
 END_FTR_SECTION_IFSET(CPU_FTR_PURR);					\
 BEGIN_FTR_SECTION;							\
-	mftb	ra;			/* or get TB if no PURR */	\
+	MFTB(ra);			/* or get TB if no PURR */	\
 END_FTR_SECTION_IFCLR(CPU_FTR_PURR);					\
-	ld	rb,PACA_STARTPURR(r13);				\
+	ld	rb,PACA_STARTPURR(r13);					\
 	std	ra,PACA_STARTPURR(r13);					\
 	subf	rb,rb,ra;		/* subtract start value */	\
 	ld	ra,PACA_USER_TIME(r13);					\
@@ -45,9 +45,9 @@ BEGIN_FTR_SECTION;							\
 	mfspr	ra,SPRN_PURR;		/* get processor util. reg */	\
 END_FTR_SECTION_IFSET(CPU_FTR_PURR);					\
 BEGIN_FTR_SECTION;							\
-	mftb	ra;			/* or get TB if no PURR */	\
+	MFTB(ra);			/* or get TB if no PURR */	\
 END_FTR_SECTION_IFCLR(CPU_FTR_PURR);					\
-	ld	rb,PACA_STARTPURR(r13);				\
`+	ld	rb,PACA_STARTPURR(r13);					\
 	std	ra,PACA_STARTPURR(r13);					\
 	subf	rb,rb,ra;		/* subtract start value */	\
 	ld	ra,PACA_SYSTEM_TIME(r13);				\
@@ -274,6 +274,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
 #define ISYNC_601
 #endif
 
+#ifdef CONFIG_PPC_CELL
+#define MFTB(dest)			\
+90:	mftb  dest;			\
+BEGIN_FTR_SECTION_NESTED(96);		\
+	cmpwi dest,0;			\
+	beq-  90b;			\
+END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
+#else
+#define MFTB(dest)			mftb dest
+#endif
 
 #ifndef CONFIG_SMP
 #define TLBSYNC
Index: linux-cell/include/asm-powerpc/reg.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/reg.h	2006-10-09 12:03:34.000000000 +1000
+++ linux-cell/include/asm-powerpc/reg.h	2006-10-16 11:08:14.000000000 +1000
@@ -617,11 +617,33 @@
 			asm volatile("mfspr %0," __stringify(rn) \
 				: "=r" (rval)); rval;})
 #define mtspr(rn, v)	asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
-
+#ifdef CONFIG_PPC_CELL
+#define mftb()		({unsigned long rval;				\
+			asm volatile(					\
+				"90:	mftb %0;\n"			\
+				"97:	cmpwi %0,0;\n"			\
+				"	beq- 90b;\n"			\
+				"99:\n"					\
+				".section __ftr_fixup,\"a\"\n"		\
+				".align 3\n"				\
+				"98:\n"					\
+				"	.llong %1\n"			\
+				"	.llong %1\n"			\
+				"	.llong 97b-98b\n"		\
+				"	.llong 99b-98b\n"		\
+				".previous"				\
+			: "=r" (rval) : "i" (CPU_FTR_CELL_TB_BUG)); rval;})
+#else
 #define mftb()		({unsigned long rval;	\
 			asm volatile("mftb %0" : "=r" (rval)); rval;})
+#endif
+
+#ifndef __powerpc64__
 #define mftbl()		({unsigned long rval;	\
 			asm volatile("mftbl %0" : "=r" (rval)); rval;})
+#define mftbu()		({unsigned long rval;	\
+			asm volatile("mftbu %0" : "=r" (rval)); rval;})
+#endif /* __powerpc64__ */
 
 #define mttbl(v)	asm volatile("mttbl %0":: "r"(v))
 #define mttbu(v)	asm volatile("mttbu %0":: "r"(v))
Index: linux-cell/include/asm-powerpc/time.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/time.h	2006-10-06 13:48:24.000000000 +1000
+++ linux-cell/include/asm-powerpc/time.h	2006-10-13 17:31:57.000000000 +1000
@@ -85,26 +85,28 @@ struct div_result {
 /* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */
 static inline unsigned long get_tbl(void)
 {
-	unsigned long tbl;
-
 #if defined(CONFIG_403GCX)
+	unsigned long tbl;
 	asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
+	return tbl;
+#elif defined(CONFIG_PPC32)
+	return mftbl();
 #else
-	asm volatile("mftb %0" : "=r" (tbl));
+	return mftb();
 #endif
-	return tbl;
 }
 
 static inline unsigned int get_tbu(void)
 {
+#ifdef CONFIG_403GCX
 	unsigned int tbu;
-
-#if defined(CONFIG_403GCX)
 	asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
+	return tbu;
+#elif defined(CONFIG_PPC32)
+	return mftbu();
 #else
-	asm volatile("mftbu %0" : "=r" (tbu));
+	return mftb();
 #endif
-	return tbu;
 }
 
 static inline unsigned int get_rtcl(void)
Index: linux-cell/include/asm-powerpc/timex.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/timex.h	2006-10-13 17:31:53.000000000 +1000
+++ linux-cell/include/asm-powerpc/timex.h	2006-10-13 17:31:57.000000000 +1000
@@ -8,6 +8,7 @@
  */
 
 #include <asm/cputable.h>
+#include <asm/reg.h>
 
 #define CLOCK_TICK_RATE	1024000 /* Underlying HZ */
 
@@ -15,13 +16,11 @@ typedef unsigned long cycles_t;
 
 static inline cycles_t get_cycles(void)
 {
-	cycles_t ret;
-
 #ifdef __powerpc64__
-
-	__asm__ __volatile__("mftb %0" : "=r" (ret) : );
-
+	return mftb();
 #else
+	cycles_t ret;
+
 	/*
 	 * For the "cycle" counter we use the timebase lower half.
 	 * Currently only used on SMP.
@@ -41,9 +40,8 @@ static inline cycles_t get_cycles(void)
 		"	.long 99b-98b\n"
 		".previous"
 		: "=r" (ret) : "i" (CPU_FTR_601));
-#endif
-
 	return ret;
+#endif
 }
 
 #endif	/* __KERNEL__ */

^ permalink raw reply

* Re: Failed to boot kernel 2.6.19-rc2 due to IBM veth problem.
From: David Gibson @ 2006-10-16  1:43 UTC (permalink / raw)
  To: Yao Fei Zhu; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <4532613D.1090107@cn.ibm.com>

On Mon, Oct 16, 2006 at 12:26:37AM +0800, Yao Fei Zhu wrote:
> Hi, all,
> 
> Boot kernel 2.6.19-rc2 on IBM System P5 partitions will fall into xmon.
> Here is the boot log,

This is probably the same bug I recently posted about.  The patch
below should fix it.

ibmveth: Fix index increment calculation

The recent commit 751ae21c6cd1493e3d0a4935b08fb298b9d89773 introduced
a bug in the producer/consumer index calculation in the ibmveth driver
- incautious use of the post-increment ++ operator resulted in an
increment being immediately reverted.  This patch corrects the logic.

Without this patch, the driver oopses almost immediately after
activation on at least some machines.

Signed-off-by: David Gibson <dwg@au1.ibm.com>

Index: working-2.6/drivers/net/ibmveth.c
===================================================================
--- working-2.6.orig/drivers/net/ibmveth.c	2006-10-13 14:19:54.000000000 +1000
+++ working-2.6/drivers/net/ibmveth.c	2006-10-13 14:19:59.000000000 +1000
@@ -212,8 +212,8 @@ static void ibmveth_replenish_buffer_poo
 			break;
 		}
 
-		free_index = pool->consumer_index++ % pool->size;
-		pool->consumer_index = free_index;
+		free_index = pool->consumer_index;
+		pool->consumer_index = (pool->consumer_index + 1) % pool->size;
 		index = pool->free_map[free_index];
 
 		ibmveth_assert(index != IBM_VETH_INVALID_MAP);
@@ -329,8 +329,10 @@ static void ibmveth_remove_buffer_from_p
 			 adapter->rx_buff_pool[pool].buff_size,
 			 DMA_FROM_DEVICE);
 
-	free_index = adapter->rx_buff_pool[pool].producer_index++ % adapter->rx_buff_pool[pool].size;
-	adapter->rx_buff_pool[pool].producer_index = free_index;
+	free_index = adapter->rx_buff_pool[pool].producer_index;
+	adapter->rx_buff_pool[pool].producer_index
+		= (adapter->rx_buff_pool[pool].producer_index + 1)
+		% adapter->rx_buff_pool[pool].size;
 	adapter->rx_buff_pool[pool].free_map[free_index] = index;
 
 	mb();


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH 1/5] powerpc: consolidate feature fixup code
From: Benjamin Herrenschmidt @ 2006-10-16  4:51 UTC (permalink / raw)
  To: linuxppc-dev list
In-Reply-To: <1160726663.4792.222.camel@localhost.localdomain>

On Fri, 2006-10-13 at 18:04 +1000, Benjamin Herrenschmidt wrote:
>  
> Index: linux-cell/include/asm-powerpc/system.h
> ===================================================================
> --- linux-cell.orig/include/asm-powerpc/system.h        2006-10-06 13:48:24.000000000 +1000
> +++ linux-cell/include/asm-powerpc/system.h     2006-10-13 16:24:45.000000000 +1000
> @@ -378,7 +378,11 @@ extern unsigned long reloc_offset(void);
>  extern unsigned long add_reloc_offset(unsigned long);
>  extern void reloc_got2(unsigned long);
>  
> +#ifdef CONFIG_PPC64
> +#define PTRRELOC(x)    x
> +#else
>  #define PTRRELOC(x)    ((typeof(x)) add_reloc_offset((unsigned long)(x)))
> +#endif
>  
>  static inline void create_instruction(unsigned long addr, unsigned int instr)
>  {

And of course that bit of the patch is a stupid "optimisation" that
breaks prom_init.c on ppc64... I'll post a new patch without it and do
more tests (damn, I tested iSeries and figured if it worked there, it
would work everywhere :)

Ben.

^ permalink raw reply

* [PATCH 1/5] powerpc: consolidate feature fixup code #2
From: Benjamin Herrenschmidt @ 2006-10-16  6:25 UTC (permalink / raw)
  To: linuxppc-dev list
In-Reply-To: <1160974286.22522.37.camel@localhost.localdomain>

There are currently two versions of the functions for applying the
feature fixups, one for CPU features and one for firmware features. In
addition, they are both in assembly and with separate implementations
for 32 and 64 bits. identify_cpu() is also implemented in assembly and
separately for 32 and 64 bits.

This patch replaces them with a pair of C functions. The call sites are
slightly moved on ppc64 as well to be called from C instead of from
assembly, though it's a very small change, and thus shouldn't cause any
problem.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

(Minus the bug with PTRRELOC)

Index: linux-cell/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/head_64.S	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/head_64.S	2006-10-13 16:43:05.000000000 +1000
@@ -1580,11 +1580,6 @@ _STATIC(__start_initialization_iSeries)
 	li	r0,0
 	stdu	r0,-STACK_FRAME_OVERHEAD(r1)
 
-	LOAD_REG_IMMEDIATE(r3,cpu_specs)
-	LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
-	li	r5,0
-	bl	.identify_cpu
-
 	LOAD_REG_IMMEDIATE(r2,__toc_start)
 	addi	r2,r2,0x4000
 	addi	r2,r2,0x4000
@@ -1964,13 +1959,6 @@ _STATIC(start_here_multiplatform)
 	addi	r2,r2,0x4000
 	add	r2,r2,r26
 
-	LOAD_REG_IMMEDIATE(r3, cpu_specs)
-	add	r3,r3,r26
-	LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
-	add	r4,r4,r26
-	mr	r5,r26
-	bl	.identify_cpu
-
 	/* Do very early kernel initializations, including initial hash table,
 	 * stab and slb setup before we turn on relocation.	*/
 
@@ -2000,13 +1988,6 @@ _STATIC(start_here_common)
 	li	r0,0
 	stdu	r0,-STACK_FRAME_OVERHEAD(r1)
 
-	/* Apply the CPUs-specific fixups (nop out sections not relevant
-	 * to this CPU
-	 */
-	li	r3,0
-	bl	.do_cpu_ftr_fixups
-	bl	.do_fw_ftr_fixups
-
 	/* ptr to current */
 	LOAD_REG_IMMEDIATE(r4, init_task)
 	std	r4,PACACURRENT(r13)
Index: linux-cell/arch/powerpc/kernel/misc_64.S
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/misc_64.S	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/misc_64.S	2006-10-13 16:40:14.000000000 +1000
@@ -246,130 +246,6 @@ _GLOBAL(__flush_dcache_icache)
 	isync
 	blr
 
-/*
- * identify_cpu and calls setup_cpu
- * In:	r3 = base of the cpu_specs array
- *	r4 = address of cur_cpu_spec
- *	r5 = relocation offset
- */
-_GLOBAL(identify_cpu)
-	mfpvr	r7
-1:
-	lwz	r8,CPU_SPEC_PVR_MASK(r3)
-	and	r8,r8,r7
-	lwz	r9,CPU_SPEC_PVR_VALUE(r3)
-	cmplw	0,r9,r8
-	beq	1f
-	addi	r3,r3,CPU_SPEC_ENTRY_SIZE
-	b	1b
-1:
-	sub	r0,r3,r5
-	std	r0,0(r4)
-	ld	r4,CPU_SPEC_SETUP(r3)
-	cmpdi	0,r4,0
-	add	r4,r4,r5
-	beqlr
-	ld	r4,0(r4)
-	add	r4,r4,r5
-	mtctr	r4
-	/* Calling convention for cpu setup is r3=offset, r4=cur_cpu_spec */
-	mr	r4,r3
-	mr	r3,r5
-	bctr
-
-/*
- * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
- * and writes nop's over sections of code that don't apply for this cpu.
- * r3 = data offset (not changed)
- */
-_GLOBAL(do_cpu_ftr_fixups)
-	/* Get CPU 0 features */
-	LOAD_REG_IMMEDIATE(r6,cur_cpu_spec)
-	sub	r6,r6,r3
-	ld	r4,0(r6)
-	sub	r4,r4,r3
-	ld	r4,CPU_SPEC_FEATURES(r4)
-	/* Get the fixup table */
-	LOAD_REG_IMMEDIATE(r6,__start___ftr_fixup)
-	sub	r6,r6,r3
-	LOAD_REG_IMMEDIATE(r7,__stop___ftr_fixup)
-	sub	r7,r7,r3
-	/* Do the fixup */
-1:	cmpld	r6,r7
-	bgelr
-	addi	r6,r6,32
-	ld	r8,-32(r6)	/* mask */
-	and	r8,r8,r4
-	ld	r9,-24(r6)	/* value */
-	cmpld	r8,r9
-	beq	1b
-	ld	r8,-16(r6)	/* section begin */
-	ld	r9,-8(r6)	/* section end */
-	subf.	r9,r8,r9
-	beq	1b
-	/* write nops over the section of code */
-	/* todo: if large section, add a branch at the start of it */
-	srwi	r9,r9,2
-	mtctr	r9
-	sub	r8,r8,r3
-	lis	r0,0x60000000@h	/* nop */
-3:	stw	r0,0(r8)
-	andi.	r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
-	beq	2f
-	dcbst	0,r8		/* suboptimal, but simpler */
-	sync
-	icbi	0,r8
-2:	addi	r8,r8,4
-	bdnz	3b
-	sync			/* additional sync needed on g4 */
-	isync
-	b	1b
-
-/*
- * do_fw_ftr_fixups - goes through the list of firmware feature fixups
- * and writes nop's over sections of code that don't apply for this firmware.
- * r3 = data offset (not changed)
- */
-_GLOBAL(do_fw_ftr_fixups)
-	/* Get firmware features */
-	LOAD_REG_IMMEDIATE(r6,powerpc_firmware_features)
-	sub	r6,r6,r3
-	ld	r4,0(r6)
-	/* Get the fixup table */
-	LOAD_REG_IMMEDIATE(r6,__start___fw_ftr_fixup)
-	sub	r6,r6,r3
-	LOAD_REG_IMMEDIATE(r7,__stop___fw_ftr_fixup)
-	sub	r7,r7,r3
-	/* Do the fixup */
-1:	cmpld	r6,r7
-	bgelr
-	addi	r6,r6,32
-	ld	r8,-32(r6)	/* mask */
-	and	r8,r8,r4
-	ld	r9,-24(r6)	/* value */
-	cmpld	r8,r9
-	beq	1b
-	ld	r8,-16(r6)	/* section begin */
-	ld	r9,-8(r6)	/* section end */
-	subf.	r9,r8,r9
-	beq	1b
-	/* write nops over the section of code */
-	/* todo: if large section, add a branch at the start of it */
-	srwi	r9,r9,2
-	mtctr	r9
-	sub	r8,r8,r3
-	lis	r0,0x60000000@h	/* nop */
-3:	stw	r0,0(r8)
-BEGIN_FTR_SECTION
-	dcbst	0,r8		/* suboptimal, but simpler */
-	sync
-	icbi	0,r8
-END_FTR_SECTION_IFSET(CPU_FTR_SPLIT_ID_CACHE)
-	addi	r8,r8,4
-	bdnz	3b
-	sync			/* additional sync needed on g4 */
-	isync
-	b	1b
 
 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
 /*
Index: linux-cell/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/setup-common.c	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/setup-common.c	2006-10-13 16:39:03.000000000 +1000
@@ -520,3 +520,39 @@ void __init setup_panic(void)
 {
 	atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
 }
+
+void do_feature_fixups(unsigned long offset, unsigned long value,
+		       void *fixup_start, void *fixup_end)
+{
+	struct fixup_entry {
+		unsigned long	mask;
+		unsigned long	value;
+		unsigned int	*start;
+		unsigned int	*end;
+	} *fcur, *fend;
+
+	fcur = fixup_start;
+	fend = fixup_end;
+
+	for (; fcur < fend; fcur++) {
+		unsigned int *pstart, *pend, *p;
+
+		if ((value & fcur->mask) == fcur->value)
+			continue;
+
+		/* These PTRRELOCs will disappear once the new scheme for
+		 * modules and vdso is implemented
+		 */
+		pstart = PTRRELOC(fcur->start);
+		pend = PTRRELOC(fcur->end);
+
+		for (p = pstart; p < pend; p++) {
+			*p = 0x60000000u;
+			asm volatile ("dcbst 0, %0" : : "r" (p));
+		}
+		asm volatile ("sync" : : : "memory");
+		for (p = pstart; p < pend; p++)
+			asm volatile ("icbi 0,%0" : : "r" (p));
+		asm volatile ("sync; isync" : : : "memory");
+	}
+}
Index: linux-cell/arch/powerpc/kernel/setup.h
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/setup.h	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/setup.h	2006-10-13 16:06:24.000000000 +1000
@@ -1,9 +1,12 @@
 #ifndef _POWERPC_KERNEL_SETUP_H
 #define _POWERPC_KERNEL_SETUP_H
 
-void check_for_initrd(void);
-void do_init_bootmem(void);
-void setup_panic(void);
+extern void check_for_initrd(void);
+extern void do_init_bootmem(void);
+extern void setup_panic(void);
+extern void do_feature_fixups(unsigned long offset, unsigned long value,
+			      void *fixup_start, void *fixup_end);
+
 extern int do_early_xmon;
 
 #endif /* _POWERPC_KERNEL_SETUP_H */
Index: linux-cell/arch/powerpc/kernel/setup_32.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/setup_32.c	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/setup_32.c	2006-10-13 16:38:21.000000000 +1000
@@ -90,7 +90,9 @@ int ucache_bsize;
  */
 unsigned long __init early_init(unsigned long dt_ptr)
 {
+	extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
 	unsigned long offset = reloc_offset();
+	struct cpu_spec *spec;
 
 	/* First zero the BSS -- use memset_io, some platforms don't have
 	 * caches on yet */
@@ -100,8 +102,11 @@ unsigned long __init early_init(unsigned
 	 * Identify the CPU type and fix up code sections
 	 * that depend on which cpu we have.
 	 */
-	identify_cpu(offset, 0);
-	do_cpu_ftr_fixups(offset);
+	spec = identify_cpu(offset);
+
+	do_feature_fixups(offset, spec->cpu_features,
+			  PTRRELOC(&__start___ftr_fixup),
+			  PTRRELOC(&__stop___ftr_fixup));
 
 	return KERNELBASE + offset;
 }
Index: linux-cell/arch/powerpc/kernel/setup_64.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/setup_64.c	2006-10-13 16:04:10.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/setup_64.c	2006-10-13 16:42:44.000000000 +1000
@@ -170,6 +170,9 @@ void __init setup_paca(int cpu)
 
 void __init early_setup(unsigned long dt_ptr)
 {
+	/* Identify CPU type */
+	identify_cpu(0);
+
 	/* Assume we're on cpu 0 for now. Don't write to the paca yet! */
 	setup_paca(0);
 
@@ -346,8 +349,19 @@ static void __init initialize_cache_info
  */
 void __init setup_system(void)
 {
+	extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
+	extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
+
 	DBG(" -> setup_system()\n");
 
+	/* Apply the CPUs-specific and firmware specific fixups to kernel
+	 * text (nop out sections not relevant to this CPU or this firmware)
+	 */
+	do_feature_fixups(0, cur_cpu_spec->cpu_features,
+			  &__start___ftr_fixup, &__stop___ftr_fixup);
+	do_feature_fixups(0, powerpc_firmware_features,
+			  &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
+
 	/*
 	 * Unflatten the device-tree passed by prom_init or kexec
 	 */
Index: linux-cell/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/cputable.c	2006-10-06 13:47:54.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/cputable.c	2006-10-13 16:47:31.000000000 +1000
@@ -73,7 +73,7 @@ extern void __restore_cpu_ppc970(void);
 #define PPC_FEATURE_SPE_COMP	0
 #endif
 
-struct cpu_spec	cpu_specs[] = {
+static struct cpu_spec cpu_specs[] = {
 #ifdef CONFIG_PPC64
 	{	/* Power3 */
 		.pvr_mask		= 0xffff0000,
@@ -1152,3 +1152,25 @@ struct cpu_spec	cpu_specs[] = {
 #endif /* !CLASSIC_PPC */
 #endif /* CONFIG_PPC32 */
 };
+
+struct cpu_spec *identify_cpu(unsigned long offset)
+{
+	struct cpu_spec *s = cpu_specs;
+	struct cpu_spec **cur = &cur_cpu_spec;
+	unsigned int pvr = mfspr(SPRN_PVR);
+	int i;
+
+	s = PTRRELOC(s);
+	cur = PTRRELOC(cur);
+
+	if (*cur != NULL)
+		return PTRRELOC(*cur);
+
+	for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
+		if ((pvr & s->pvr_mask) == s->pvr_value) {
+			*cur = cpu_specs + i;
+			return s;
+		}
+	BUG();
+	return NULL;
+}
Index: linux-cell/arch/powerpc/kernel/misc_32.S
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/misc_32.S	2006-10-06 13:47:54.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/misc_32.S	2006-10-13 16:26:43.000000000 +1000
@@ -102,80 +102,6 @@ _GLOBAL(reloc_got2)
 	blr
 
 /*
- * identify_cpu,
- * called with r3 = data offset and r4 = CPU number
- * doesn't change r3
- */
-_GLOBAL(identify_cpu)
-	addis	r8,r3,cpu_specs@ha
-	addi	r8,r8,cpu_specs@l
-	mfpvr	r7
-1:
-	lwz	r5,CPU_SPEC_PVR_MASK(r8)
-	and	r5,r5,r7
-	lwz	r6,CPU_SPEC_PVR_VALUE(r8)
-	cmplw	0,r6,r5
-	beq	1f
-	addi	r8,r8,CPU_SPEC_ENTRY_SIZE
-	b	1b
-1:
-	addis	r6,r3,cur_cpu_spec@ha
-	addi	r6,r6,cur_cpu_spec@l
-	sub	r8,r8,r3
-	stw	r8,0(r6)
-	blr
-
-/*
- * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
- * and writes nop's over sections of code that don't apply for this cpu.
- * r3 = data offset (not changed)
- */
-_GLOBAL(do_cpu_ftr_fixups)
-	/* Get CPU 0 features */
-	addis	r6,r3,cur_cpu_spec@ha
-	addi	r6,r6,cur_cpu_spec@l
-	lwz	r4,0(r6)
-	add	r4,r4,r3
-	lwz	r4,CPU_SPEC_FEATURES(r4)
-
-	/* Get the fixup table */
-	addis	r6,r3,__start___ftr_fixup@ha
-	addi	r6,r6,__start___ftr_fixup@l
-	addis	r7,r3,__stop___ftr_fixup@ha
-	addi	r7,r7,__stop___ftr_fixup@l
-
-	/* Do the fixup */
-1:	cmplw	0,r6,r7
-	bgelr
-	addi	r6,r6,16
-	lwz	r8,-16(r6)	/* mask */
-	and	r8,r8,r4
-	lwz	r9,-12(r6)	/* value */
-	cmplw	0,r8,r9
-	beq	1b
-	lwz	r8,-8(r6)	/* section begin */
-	lwz	r9,-4(r6)	/* section end */
-	subf.	r9,r8,r9
-	beq	1b
-	/* write nops over the section of code */
-	/* todo: if large section, add a branch at the start of it */
-	srwi	r9,r9,2
-	mtctr	r9
-	add	r8,r8,r3
-	lis	r0,0x60000000@h	/* nop */
-3:	stw	r0,0(r8)
-	andi.	r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
-	beq	2f
-	dcbst	0,r8		/* suboptimal, but simpler */
-	sync
-	icbi	0,r8
-2:	addi	r8,r8,4
-	bdnz	3b
-	sync			/* additional sync needed on g4 */
-	isync
-	b	1b
-
-/*
  * call_setup_cpu - call the setup_cpu function for this cpu
  * r3 = data offset, r24 = cpu number
  *
Index: linux-cell/include/asm-powerpc/cputable.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/cputable.h	2006-10-13 16:00:28.000000000 +1000
+++ linux-cell/include/asm-powerpc/cputable.h	2006-10-13 16:19:51.000000000 +1000
@@ -89,8 +89,7 @@ struct cpu_spec {
 
 extern struct cpu_spec		*cur_cpu_spec;
 
-extern void identify_cpu(unsigned long offset, unsigned long cpu);
-extern void do_cpu_ftr_fixups(unsigned long offset);
+extern struct cpu_spec *identify_cpu(unsigned long offset);
 
 #endif /* __ASSEMBLY__ */
 
Index: linux-cell/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/iseries/setup.c	2006-10-06 13:47:54.000000000 +1000
+++ linux-cell/arch/powerpc/platforms/iseries/setup.c	2006-10-13 16:49:14.000000000 +1000
@@ -694,6 +694,11 @@ void * __init iSeries_early_setup(void)
 {
 	unsigned long phys_mem_size;
 
+	/* Identify CPU type. This is done again by the common code later
+	 * on but calling this function multiple times is fine.
+	 */
+	identify_cpu(0);
+
 	powerpc_firmware_features |= FW_FEATURE_ISERIES;
 	powerpc_firmware_features |= FW_FEATURE_LPAR;
 

^ permalink raw reply

* [PATCH] powerpc: New DCR access methods
From: Benjamin Herrenschmidt @ 2006-10-16  7:44 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: cbe-oss-dev@ozlabs.org

This patch adds new dcr_map/dcr_read/dcr_write accessors for DCRs that
can be used by drivers to transparently address either native DCRs or
memory mapped DCRs. The implementation for memory mapped DCRs is done
after the binding being currently worked on for SLOF and the Axon
chipset. This patch enables it for the cell native platform

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-cell/include/asm-powerpc/dcr.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/include/asm-powerpc/dcr.h	2006-10-16 16:42:32.000000000 +1000
@@ -0,0 +1,42 @@
+/*
+ * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
+ *                    <benh@kernel.crashing.org>
+ *
+ *   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.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _ASM_POWERPC_DCR_H
+#define _ASM_POWERPC_DCR_H
+#ifdef __KERNEL__
+
+#ifdef CONFIG_PPC_DCR_NATIVE
+#include <asm/dcr-native.h>
+#else
+#include <asm/dcr-mmio.h>
+#endif
+
+/*
+ * On CONFIG_PPC_MERGE, we have additional helpers to read the DCR
+ * base from the device-tree
+ */
+#ifdef CONFIG_PPC_MERGE
+extern unsigned int dcr_resource_start(struct device_node *np,
+				       unsigned int index);
+extern unsigned int dcr_resource_len(struct device_node *np,
+				     unsigned int index);
+#endif /* CONFIG_PPC_MERGE */
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_DCR_H */
Index: linux-cell/arch/powerpc/Kconfig
===================================================================
--- linux-cell.orig/arch/powerpc/Kconfig	2006-10-16 15:05:04.000000000 +1000
+++ linux-cell/arch/powerpc/Kconfig	2006-10-16 17:20:38.000000000 +1000
@@ -160,9 +160,11 @@ config PPC_86xx
 
 config 40x
 	bool "AMCC 40x"
+	select PPC_DCR_NATIVE
 
 config 44x
 	bool "AMCC 44x"
+	select PPC_DCR_NATIVE
 
 config 8xx
 	bool "Freescale 8xx"
@@ -208,6 +210,19 @@ config PPC_FPU
 	bool
 	default y if PPC64
 
+config PPC_DCR_NATIVE
+	bool
+	default n
+
+config PPC_DCR_MMIO
+	bool
+	default n
+
+config PPC_DCR
+	bool
+	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
+	default y
+
 config BOOKE
 	bool
 	depends on E200 || E500
@@ -445,6 +460,7 @@ config PPC_CELL
 config PPC_CELL_NATIVE
 	bool
 	select PPC_CELL
+	select PPC_DCR_MMIO
 	default n
 
 config PPC_IBM_CELL_BLADE
Index: linux-cell/include/asm-powerpc/dcr-mmio.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/include/asm-powerpc/dcr-mmio.h	2006-10-16 17:20:37.000000000 +1000
@@ -0,0 +1,51 @@
+/*
+ * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
+ *                    <benh@kernel.crashing.org>
+ *
+ *   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.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _ASM_POWERPC_DCR_MMIO_H
+#define _ASM_POWERPC_DCR_MMIO_H
+#ifdef __KERNEL__
+
+#include <asm/io.h>
+
+typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
+
+#define DCR_MAP_OK(host)	((host).token != NULL)
+
+extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
+			  unsigned int dcr_c);
+extern void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c);
+
+static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n)
+{
+	return in_be32(host.token + dcr_n * host.stride);
+}
+
+static inline void dcr_write(dcr_host_t host, unsigned int dcr_n, u32 value)
+{
+	out_be32(host.token + dcr_n * host.stride, value);
+}
+
+extern u64 of_translate_dcr_address(struct device_node *dev,
+				    unsigned int dcr_n,
+				    unsigned int *stride);
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_DCR_MMIO_H */
+
+
Index: linux-cell/include/asm-powerpc/dcr-native.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/include/asm-powerpc/dcr-native.h	2006-10-16 15:05:06.000000000 +1000
@@ -0,0 +1,39 @@
+/*
+ * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
+ *                    <benh@kernel.crashing.org>
+ *
+ *   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.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _ASM_POWERPC_DCR_NATIVE_H
+#define _ASM_POWERPC_DCR_NATIVE_H
+#ifdef __KERNEL__
+
+#include <asm/reg.h>
+
+typedef struct {} dcr_host_t;
+
+#define DCR_MAP_OK(host)	(1)
+
+#define dcr_map(dev, dcr_n, dcr_c)	{}
+#define dcr_unmap(host, dcr_n, dcr_c)	{}
+#define dcr_read(host, dcr_n)		mfdcr(dcr_n)
+#define dcr_write(host, dcr_n, value)	mtdcr(dcr_n, value)
+
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_DCR_NATIVE_H */
+
+
Index: linux-cell/arch/ppc/Kconfig
===================================================================
--- linux-cell.orig/arch/ppc/Kconfig	2006-10-16 15:05:04.000000000 +1000
+++ linux-cell/arch/ppc/Kconfig	2006-10-16 15:05:06.000000000 +1000
@@ -77,9 +77,11 @@ config 6xx
 
 config 40x
 	bool "40x"
+	select PPC_DCR_NATIVE
 
 config 44x
 	bool "44x"
+	select PPC_DCR_NATIVE
 
 config 8xx
 	bool "8xx"
@@ -95,6 +97,15 @@ endchoice
 config PPC_FPU
 	bool
 
+config PPC_DCR_NATIVE
+	bool
+	default n
+
+config PPC_DCR
+	bool
+	depends on PPC_DCR_NATIVE
+	default y
+
 config BOOKE
 	bool
 	depends on E200 || E500
Index: linux-cell/arch/powerpc/kernel/Makefile
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/Makefile	2006-10-16 15:05:04.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/Makefile	2006-10-16 15:05:06.000000000 +1000
@@ -60,6 +60,7 @@ obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_PPC_UDBG_16550)	+= legacy_serial.o udbg_16550.o
+
 module-$(CONFIG_PPC64)		+= module_64.o
 obj-$(CONFIG_MODULES)		+= $(module-y)
 
Index: linux-cell/arch/powerpc/sysdev/Makefile
===================================================================
--- linux-cell.orig/arch/powerpc/sysdev/Makefile	2006-10-16 15:05:04.000000000 +1000
+++ linux-cell/arch/powerpc/sysdev/Makefile	2006-10-16 15:05:06.000000000 +1000
@@ -5,8 +5,7 @@ endif
 obj-$(CONFIG_MPIC)		+= mpic.o
 obj-$(CONFIG_PPC_INDIRECT_PCI)	+= indirect_pci.o
 obj-$(CONFIG_PPC_MPC106)	+= grackle.o
-obj-$(CONFIG_BOOKE)		+= dcr.o
-obj-$(CONFIG_40x)		+= dcr.o
+obj-$(CONFIG_PPC_DCR)		+= dcr.o dcr-low.o
 obj-$(CONFIG_U3_DART)		+= dart_iommu.o
 obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
 obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
Index: linux-cell/arch/powerpc/sysdev/dcr-low.S
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/arch/powerpc/sysdev/dcr-low.S	2006-10-16 15:05:06.000000000 +1000
@@ -0,0 +1,39 @@
+/*
+ * "Indirect" DCR access
+ *
+ * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
+ *
+ * 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 <asm/ppc_asm.h>
+#include <asm/processor.h>
+
+#define DCR_ACCESS_PROLOG(table) \
+	rlwinm  r3,r3,4,18,27;   \
+	lis     r5,table@h;      \
+	ori     r5,r5,table@l;   \
+	add     r3,r3,r5;        \
+	mtctr   r3;              \
+	bctr
+
+_GLOBAL(__mfdcr)
+	DCR_ACCESS_PROLOG(__mfdcr_table)
+
+_GLOBAL(__mtdcr)
+	DCR_ACCESS_PROLOG(__mtdcr_table)
+
+__mfdcr_table:
+	mfdcr  r3,0; blr
+__mtdcr_table:
+	mtdcr  0,r4; blr
+
+dcr     = 1
+        .rept   1023
+	mfdcr   r3,dcr; blr
+	mtdcr   dcr,r4; blr
+	dcr     = dcr + 1
+	.endr
Index: linux-cell/arch/powerpc/sysdev/dcr.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/arch/powerpc/sysdev/dcr.c	2006-10-16 17:21:01.000000000 +1000
@@ -0,0 +1,134 @@
+/*
+ * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
+ *                    <benh@kernel.crashing.org>
+ *
+ *   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.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#undef DEBUG
+
+#include <linux/kernel.h>
+#include <asm/prom.h>
+#include <asm/dcr.h>
+
+unsigned int dcr_resource_start(struct device_node *np, unsigned int index)
+{
+	unsigned int ds;
+	const u32 *dr = get_property(np, "dcr-reg", &ds);
+
+	if (dr == NULL || ds & 1 || index >= (ds / 8))
+		return -EINVAL;
+
+	return dr[index * 2];
+}
+
+unsigned int dcr_resource_len(struct device_node *np, unsigned int index)
+{
+	unsigned int ds;
+	const u32 *dr = get_property(np, "dcr-reg", &ds);
+
+	if (dr == NULL || ds & 1 || index >= (ds / 8))
+		return -EINVAL;
+
+	return dr[index * 2 + 1];
+}
+
+#ifndef CONFIG_PPC_DCR_NATIVE
+
+static struct device_node * find_dcr_parent(struct device_node * node)
+{
+	struct device_node *par, *tmp;
+	const u32 *p;
+
+	for (par = of_node_get(node); par;) {
+		if (get_property(par, "dcr-controller", NULL))
+		    break;
+		p = get_property(par, "dcr-parent", NULL);
+		tmp = par;
+		if (p == NULL)
+			par = of_get_parent(par);
+		else
+			par = of_find_node_by_phandle(*p);
+		of_node_put(tmp);
+	}
+	return par;
+}
+
+u64 of_translate_dcr_address(struct device_node *dev,
+			     unsigned int dcr_n,
+			     unsigned int *stride)
+{
+	struct device_node *dp;
+	const u32 *p;
+	u64 ret;
+
+	dp = find_dcr_parent(dev);
+	if (dp == NULL)
+		return OF_BAD_ADDR;
+
+	/* Stride is not properly defined yet, default to 0x10 for Axon */
+	p = get_property(dp, "dcr-mmio-stride", NULL);
+	*stride = (p == NULL) ? 0x10 : *p;
+
+	/* XXX FIXME: Which property name is to use of the 2 following ? */
+	p = get_property(dp, "dcr-mmio-range", NULL);
+	if (p == NULL)
+		p = get_property(dp, "dcr-mmio-space", NULL);
+	if (p == NULL)
+		return OF_BAD_ADDR;
+
+	/* Maybe could do some better range checking here */
+	ret = of_translate_address(dp, p);
+	if (ret != OF_BAD_ADDR)
+		ret += (u64)(*stride) * (u64)dcr_n;
+	return ret;
+}
+
+dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
+		   unsigned int dcr_c)
+{
+	dcr_host_t ret = { .token = NULL, .stride = 0 };
+	u64 addr;
+
+	pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",
+		 dev->full_name, dcr_n, dcr_c);
+
+	addr = of_translate_dcr_address(dev, dcr_n, &ret.stride);
+	pr_debug("translates to addr: 0x%lx, stride: 0x%x\n",
+		 addr, ret.stride);
+	if (addr == OF_BAD_ADDR)
+		return ret;
+	pr_debug("mapping 0x%x bytes\n", dcr_c * ret.stride);
+	ret.token = ioremap(addr, dcr_c * ret.stride);
+	if (ret.token == NULL)
+		return ret;
+	pr_debug("mapped at 0x%p -> base is 0x%p\n",
+		 ret.token, ret.token - dcr_n * ret.stride);
+	ret.token -= dcr_n * ret.stride;
+	return ret;
+}
+
+void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c)
+{
+	dcr_host_t h = host;
+
+	if (h.token == NULL)
+		return;
+	h.token -= dcr_n * h.stride;
+	iounmap(h.token);
+	h.token = NULL;
+}
+
+#endif /* !defined(CONFIG_PPC_DCR_NATIVE) */

^ permalink raw reply

* [PATCH] powerpc: adapt EMAC/MAL to new DCR access methods
From: Benjamin Herrenschmidt @ 2006-10-16  7:45 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: cbe-oss-dev@ozlabs.org

This patch makes the EMAC driver use the new DCR access methods

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


Index: linux-cell/drivers/net/ibm_emac/ibm_emac_mal.h
===================================================================
--- linux-cell.orig/drivers/net/ibm_emac/ibm_emac_mal.h	2006-10-11 13:01:59.000000000 +1000
+++ linux-cell/drivers/net/ibm_emac/ibm_emac_mal.h	2006-10-11 14:35:28.000000000 +1000
@@ -24,6 +24,7 @@
 #include <linux/netdevice.h>
 
 #include <asm/io.h>
+#include <asm/dcr.h>
 
 /*
  * These MAL "versions" probably aren't the real versions IBM uses for these 
@@ -191,6 +192,7 @@ struct mal_commac {
 
 struct ibm_ocp_mal {
 	int			dcrbase;
+	dcr_host_t		dcrhost;
 
 	struct list_head	poll_list;
 	struct net_device	poll_dev;
@@ -207,12 +209,12 @@ struct ibm_ocp_mal {
 
 static inline u32 get_mal_dcrn(struct ibm_ocp_mal *mal, int reg)
 {
-	return mfdcr(mal->dcrbase + reg);
+	return dcr_read(mal->dcrhost, mal->dcrbase + reg);
 }
 
 static inline void set_mal_dcrn(struct ibm_ocp_mal *mal, int reg, u32 val)
 {
-	mtdcr(mal->dcrbase + reg, val);
+	dcr_write(mal->dcrhost, mal->dcrbase + reg, val);
 }
 
 /* Register MAL devices */

^ permalink raw reply

* [PATCH] powerpc: Support for DCR based MPIC
From: Benjamin Herrenschmidt @ 2006-10-16  7:45 UTC (permalink / raw)
  To: linuxppc-dev list; +Cc: cbe-oss-dev@ozlabs.org

This patch implements support for DCR based MPIC implementations. Such
implementations have the MPIC_USES_DCR flag set and don't use the phys_addr
argument of mpic_alloc (they require a valid dcr mapping in the device node)

This version of the patch can use a little bif of cleanup still (I can
probably consolidate rb->dbase/doff, at least once I'm sure on how the
hardware is actually supposed to work vs. possible simulator issues) and
it should be possible to build a DCR-only version of the driver. I need
to cleanup a bit the CONFIG_* handling for that and probably introduce
CONFIG_MPIC_MMIO and CONFIG_MPIC_DCR.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


Index: linux-cell/arch/powerpc/sysdev/mpic.c
===================================================================
--- linux-cell.orig/arch/powerpc/sysdev/mpic.c	2006-10-16 17:20:39.000000000 +1000
+++ linux-cell/arch/powerpc/sysdev/mpic.c	2006-10-16 17:29:50.000000000 +1000
@@ -147,33 +147,51 @@ static u32 mpic_infos[][MPIC_IDX_END] = 
  */
 
 
-static inline u32 _mpic_read(unsigned int be, volatile u32 __iomem *base,
-			    unsigned int reg)
-{
-	if (be)
-		return in_be32(base + (reg >> 2));
-	else
-		return in_le32(base + (reg >> 2));
+static inline u32 _mpic_read(enum mpic_reg_type type,
+			     struct mpic_reg_bank *rb,
+			     unsigned int reg)
+{
+	switch(type) {
+#ifdef CONFIG_PPC_DCR
+	case mpic_access_dcr:
+		return dcr_read(rb->dhost,
+				rb->dbase + reg + rb->doff);
+#endif
+	case mpic_access_mmio_be:
+		return in_be32(rb->base + (reg >> 2));
+	case mpic_access_mmio_le:
+	default:
+		return in_le32(rb->base + (reg >> 2));
+	}
 }
 
-static inline void _mpic_write(unsigned int be, volatile u32 __iomem *base,
-			      unsigned int reg, u32 value)
+static inline void _mpic_write(enum mpic_reg_type type,
+			       struct mpic_reg_bank *rb,
+ 			       unsigned int reg, u32 value)
 {
-	if (be)
-		out_be32(base + (reg >> 2), value);
-	else
-		out_le32(base + (reg >> 2), value);
+	switch(type) {
+#ifdef CONFIG_PPC_DCR
+	case mpic_access_dcr:
+		return dcr_write(rb->dhost,
+				 rb->dbase + reg + rb->doff, value);
+#endif
+	case mpic_access_mmio_be:
+		return out_be32(rb->base + (reg >> 2), value);
+	case mpic_access_mmio_le:
+	default:
+		return out_le32(rb->base + (reg >> 2), value);
+	}
 }
 
 static inline u32 _mpic_ipi_read(struct mpic *mpic, unsigned int ipi)
 {
-	unsigned int be = (mpic->flags & MPIC_BIG_ENDIAN) != 0;
+	enum mpic_reg_type type = mpic->reg_type;
 	unsigned int offset = MPIC_INFO(GREG_IPI_VECTOR_PRI_0) +
 			      (ipi * MPIC_INFO(GREG_IPI_STRIDE));
 
-	if (mpic->flags & MPIC_BROKEN_IPI)
-		be = !be;
-	return _mpic_read(be, mpic->gregs, offset);
+	if ((mpic->flags & MPIC_BROKEN_IPI) && type == mpic_access_mmio_le)
+		type = mpic_access_mmio_be;
+	return _mpic_read(type, &mpic->gregs, offset);
 }
 
 static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 value)
@@ -181,7 +199,7 @@ static inline void _mpic_ipi_write(struc
 	unsigned int offset = MPIC_INFO(GREG_IPI_VECTOR_PRI_0) +
 			      (ipi * MPIC_INFO(GREG_IPI_STRIDE));
 
-	_mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->gregs, offset, value);
+	_mpic_write(mpic->reg_type, &mpic->gregs, offset, value);
 }
 
 static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
@@ -190,8 +208,7 @@ static inline u32 _mpic_cpu_read(struct 
 
 	if (mpic->flags & MPIC_PRIMARY)
 		cpu = hard_smp_processor_id();
-	return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN,
-			  mpic->cpuregs[cpu], reg);
+	return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg);
 }
 
 static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value)
@@ -201,7 +218,7 @@ static inline void _mpic_cpu_write(struc
 	if (mpic->flags & MPIC_PRIMARY)
 		cpu = hard_smp_processor_id();
 
-	_mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], reg, value);
+	_mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value);
 }
 
 static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, unsigned int reg)
@@ -209,7 +226,7 @@ static inline u32 _mpic_irq_read(struct 
 	unsigned int	isu = src_no >> mpic->isu_shift;
 	unsigned int	idx = src_no & mpic->isu_mask;
 
-	return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
+	return _mpic_read(mpic->reg_type, &mpic->isus[isu],
 			  reg + (idx * MPIC_INFO(IRQ_STRIDE)));
 }
 
@@ -219,12 +236,12 @@ static inline void _mpic_irq_write(struc
 	unsigned int	isu = src_no >> mpic->isu_shift;
 	unsigned int	idx = src_no & mpic->isu_mask;
 
-	_mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
+	_mpic_write(mpic->reg_type, &mpic->isus[isu],
 		    reg + (idx * MPIC_INFO(IRQ_STRIDE)), value);
 }
 
-#define mpic_read(b,r)		_mpic_read(mpic->flags & MPIC_BIG_ENDIAN,(b),(r))
-#define mpic_write(b,r,v)	_mpic_write(mpic->flags & MPIC_BIG_ENDIAN,(b),(r),(v))
+#define mpic_read(b,r)		_mpic_read(mpic->reg_type,&(b),(r))
+#define mpic_write(b,r,v)	_mpic_write(mpic->reg_type,&(b),(r),(v))
 #define mpic_ipi_read(i)	_mpic_ipi_read(mpic,(i))
 #define mpic_ipi_write(i,v)	_mpic_ipi_write(mpic,(i),(v))
 #define mpic_cpu_read(i)	_mpic_cpu_read(mpic,(i))
@@ -238,6 +255,38 @@ static inline void _mpic_irq_write(struc
  */
 
 
+static void _mpic_map_mmio(struct mpic *mpic, unsigned long phys_addr,
+			   struct mpic_reg_bank *rb, unsigned int offset,
+			   unsigned int size)
+{
+	rb->base = ioremap(phys_addr + offset, size);
+	BUG_ON(rb->base == NULL);
+}
+
+#ifdef CONFIG_PPC_DCR
+static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
+			  unsigned int offset, unsigned int size)
+{
+	rb->dbase = mpic->dcr_base;
+	rb->doff = offset;
+	rb->dhost = dcr_map(mpic->of_node, rb->dbase + rb->doff, size);
+	BUG_ON(!DCR_MAP_OK(rb->dhost));
+}
+
+static inline void mpic_map(struct mpic *mpic, unsigned long phys_addr,
+			    struct mpic_reg_bank *rb, unsigned int offset,
+			    unsigned int size)
+{
+	if (mpic->flags & MPIC_USES_DCR)
+		_mpic_map_dcr(mpic, rb, offset, size);
+	else
+		_mpic_map_mmio(mpic, phys_addr, rb, offset, size);
+}
+#else /* CONFIG_PPC_DCR */
+#define mpic_map(m,p,b,o,s)	_mpic_map_mmio(m,p,b,o,s)
+#endif /* !CONFIG_PPC_DCR */
+
+
 
 /* Check if we have one of those nice broken MPICs with a flipped endian on
  * reads from IPI registers
@@ -883,6 +932,7 @@ struct mpic * __init mpic_alloc(struct d
 	if (flags & MPIC_PRIMARY)
 		mpic->hc_ht_irq.set_affinity = mpic_set_affinity;
 #endif /* CONFIG_MPIC_BROKEN_U3 */
+
 #ifdef CONFIG_SMP
 	mpic->hc_ipi = mpic_ipi_chip;
 	mpic->hc_ipi.typename = name;
@@ -897,11 +947,26 @@ struct mpic * __init mpic_alloc(struct d
 	mpic->hw_set = mpic_infos[MPIC_GET_REGSET(flags)];
 #endif
 
+	/* default register type */
+	mpic->reg_type = (flags & MPIC_BIG_ENDIAN) ?
+		mpic_access_mmio_be : mpic_access_mmio_le;
+
+#ifdef CONFIG_PPC_DCR
+	if (mpic->flags & MPIC_USES_DCR) {
+		const u32 *dbasep;
+		BUG_ON(mpic->of_node == NULL);
+		dbasep = get_property(mpic->of_node, "dcr-reg", NULL);
+		BUG_ON(dbasep == NULL);
+		mpic->dcr_base = *dbasep;
+		mpic->reg_type = mpic_access_dcr;
+	}
+#else
+	BUG_ON (mpic->flags & MPIC_USES_DCR);
+#endif /* CONFIG_PPC_DCR */
+
 	/* Map the global registers */
-	mpic->gregs = ioremap(phys_addr + MPIC_INFO(GREG_BASE), 0x1000);
-	mpic->tmregs = mpic->gregs +
-		       ((MPIC_INFO(TIMER_BASE) - MPIC_INFO(GREG_BASE)) >> 2);
-	BUG_ON(mpic->gregs == NULL);
+	mpic_map(mpic, phys_addr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
+	mpic_map(mpic, phys_addr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
 
 	/* Reset */
 	if (flags & MPIC_WANTS_RESET) {
@@ -926,17 +991,16 @@ struct mpic * __init mpic_alloc(struct d
 
 	/* Map the per-CPU registers */
 	for (i = 0; i < mpic->num_cpus; i++) {
-		mpic->cpuregs[i] = ioremap(phys_addr + MPIC_INFO(CPU_BASE) +
-					   i * MPIC_INFO(CPU_STRIDE), 0x1000);
-		BUG_ON(mpic->cpuregs[i] == NULL);
+		mpic_map(mpic, phys_addr, &mpic->cpuregs[i],
+			 MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE),
+			 0x1000);
 	}
 
 	/* Initialize main ISU if none provided */
 	if (mpic->isu_size == 0) {
 		mpic->isu_size = mpic->num_sources;
-		mpic->isus[0] = ioremap(phys_addr + MPIC_INFO(IRQ_BASE),
-					MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
-		BUG_ON(mpic->isus[0] == NULL);
+		mpic_map(mpic, phys_addr, &mpic->isus[0],
+			 MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
 	}
 	mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
 	mpic->isu_mask = (1 << mpic->isu_shift) - 1;
@@ -979,8 +1043,8 @@ void __init mpic_assign_isu(struct mpic 
 
 	BUG_ON(isu_num >= MPIC_MAX_ISU);
 
-	mpic->isus[isu_num] = ioremap(phys_addr,
-				      MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
+	mpic_map(mpic, phys_addr, &mpic->isus[isu_num], 0,
+		 MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
 	if ((isu_first + mpic->isu_size) > mpic->num_sources)
 		mpic->num_sources = isu_first + mpic->isu_size;
 }
Index: linux-cell/include/asm-powerpc/mpic.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/mpic.h	2006-10-16 17:20:39.000000000 +1000
+++ linux-cell/include/asm-powerpc/mpic.h	2006-10-16 17:26:46.000000000 +1000
@@ -3,6 +3,7 @@
 #ifdef __KERNEL__
 
 #include <linux/irq.h>
+#include <asm/dcr.h>
 
 /*
  * Global registers
@@ -225,6 +226,23 @@ struct mpic_irq_fixup
 #endif /* CONFIG_MPIC_BROKEN_U3 */
 
 
+enum mpic_reg_type {
+	mpic_access_mmio_le,
+	mpic_access_mmio_be,
+#ifdef CONFIG_PPC_DCR
+	mpic_access_dcr
+#endif
+};
+
+struct mpic_reg_bank {
+	u32 __iomem	*base;
+#ifdef CONFIG_PPC_DCR
+	dcr_host_t	dhost;
+	unsigned int	dbase;
+	unsigned int	doff;
+#endif /* CONFIG_PPC_DCR */
+};
+
 /* The instance data of a given MPIC */
 struct mpic
 {
@@ -264,11 +282,18 @@ struct mpic
 	spinlock_t		fixup_lock;
 #endif
 
+	/* Register access method */
+	enum mpic_reg_type	reg_type;
+
 	/* The various ioremap'ed bases */
-	volatile u32 __iomem	*gregs;
-	volatile u32 __iomem	*tmregs;
-	volatile u32 __iomem	*cpuregs[MPIC_MAX_CPUS];
-	volatile u32 __iomem	*isus[MPIC_MAX_ISU];
+	struct mpic_reg_bank	gregs;
+	struct mpic_reg_bank	tmregs;
+	struct mpic_reg_bank	cpuregs[MPIC_MAX_CPUS];
+	struct mpic_reg_bank	isus[MPIC_MAX_ISU];
+
+#ifdef CONFIG_PPC_DCR
+	unsigned int		dcr_base;
+#endif
 
 #ifdef CONFIG_MPIC_WEIRD
 	/* Pointer to HW info array */
@@ -305,6 +330,8 @@ struct mpic
 #define MPIC_SPV_EOI			0x00000020
 /* No passthrough disable */
 #define MPIC_NO_PTHROU_DIS		0x00000040
+/* DCR based MPIC */
+#define MPIC_USES_DCR			0x00000080
 
 /* MPIC HW modification ID */
 #define MPIC_REGSET_MASK		0xf0000000

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox