* MPC5200B - FEC Error
From: Ram Prasad H L @ 2006-09-05 6:30 UTC (permalink / raw)
To: linuxppc-embedded
hi all,
this is Ramprasad, and we are using freescale's Lite5200B
using MPC5200B as core, for one of our applications.
The board is booted with u-boot-1.2.2 and linux kernel 2.4.25.
I'm finding a very peculiar problem with the board when I
run my application which extensively uses the FEC for receiving
video and audio streams from network. The application runs fine for
some time say 2-3 hrs and suddenly i'm getting the following error
and the OS starts rebooting.
The error log looks somewhat like this:
NIP: C0124ECC XER: 00000000 LR: C0125028 SP: C01B6270 REGS: c01b61c0 TRAP:
0300 Not tainted
MSR: 00001032 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 000000F0, DSISR: 20000000
TASK = c01b4470[0] 'swapper' Last syscall: 120
last math c228a000 last altivec 00000000
GPR00: 000000F0 C01B6270 C01B4470 00001032 00001032 00000006 C0C11034
C3C61CC0
GPR08: 0000003F 00000000 C01CE9F8 C01CEAD0 00000002 1012A714 03FBA000
00000000
GPR16: 00000001 00000001 FFFFFFFF 007FFF00 00001032 C3F93000 C0210000
00000000
GPR24: C3C06012 00000045 C01E0000 C0BE1320 0000054E C01CE9E0 C01CEA08
C3CA9A20
Call backtrace:
C0125528 C011AF0C C0006CD8 C0006D98 C0005C40 C00072C8 C00072E4
C0003918 C01CF5B8 000035F0
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
<0>Rebooting in 180 seconds..<4>MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
Can anyone tell me what is the reason to face such
an error? and how can we avoid this error? any pointers
for overcoming it will be really helpfull as I'm stuck with
this problem since long time.
thanks and regards,
Ramprasad H L
^ permalink raw reply
* Re: MAC driver issues
From: Alex Zeffertt @ 2006-09-05 8:33 UTC (permalink / raw)
To: David H. Lynch Jr.; +Cc: linuxppc-embedded
In-Reply-To: <44FCA93E.1000009@dlasys.net>
Hi David,
I think in order to get any help from this list you need to be more specific
about how this problem relates to PowerPCs.
You also need to say exactly what "never gets handed off to the ARP protocol"
means.
FWIW, in my experience the hardware independent parts of the networking stack are
very stable and the problem is almost always with the drivers, or with the IP
configuration (e.g. two interfaces on the same subnet).
Alex
David H. Lynch Jr. wrote:
> I am trying to get a network driver working.
>
> It sends - I can capture the output with Etherreal and it looks good.
> It receives - I can dump the received packets when the come in and they
> look ok to me.
>
>
> BUT,
> If I try to ping another host, first Linux sends and ARP broadcast,
> the appropriate client sends an ARP response.
> Etherreal is happy with both.
> My driver gets the response - The driver says the packet lenght is
> 64 bytes, which includes something like 14 bytes of padding at the end.
> But the actual packet looks perfect exactly like what etherreal says
> it should (and what I get when I capture a received ARP packet in
> another driver).
> At the end of the recive interrupt the skb is passed to Linux with
> the netif_rc(ndev) function. This returns SUCCESS.
>
> However, the paket never gets handed of to the ARP protocol - I put
> some debugging in there and I never see it, while if I switch to a
> different NIC
> driver nearly the identical ARP packet gets processed by arp inside
> Linux.
>
> I have tried to chase this down, but I can't follow what is going
> on inside of all the /net/core/dev.c etc.
>
> Has anyone seen something similar to this ?
>
> Does anyone have a clue where I can find some info on trying to
> follow something through netif_rx to see where things are going off the
> rails ?
>
>
>
^ permalink raw reply
* Re: MPC5200B - FEC Error
From: Parav Pandit @ 2006-09-05 12:53 UTC (permalink / raw)
To: Ram Prasad H L, linuxppc-embedded
In-Reply-To: <000201c6d0b4$b6d08f50$4129320a@telxsi.com>
[-- Attachment #1: Type: text/plain, Size: 3263 bytes --]
Hi Ram Prasad,
Are you using the BEST COMM APIs in your driver?
I believe FEC driver needs some rework. Driver tries reinit the device in the interrupt handler itself from where your mpx5xxx_fec_reinit is called.
fec_reinit() calls fec_open() in the interrupt halder!
Also,
We did somewhat but is not complete yet.
If we closely look, I think, typical sequence is init() followed by open().
In case of reinit(), we missed something or miss to reconfigure something (Mostly the Tx, Rx queue) before we make call to open() similar to init().
Welll, on top of this, I am refering to 2.6.13 code base.
Regards,
Parav Pandit
Ram Prasad H L <hlrprasad@tataelxsi.co.in> wrote:
hi all,
this is Ramprasad, and we are using freescale's Lite5200B
using MPC5200B as core, for one of our applications.
The board is booted with u-boot-1.2.2 and linux kernel 2.4.25.
I'm finding a very peculiar problem with the board when I
run my application which extensively uses the FEC for receiving
video and audio streams from network. The application runs fine for
some time say 2-3 hrs and suddenly i'm getting the following error
and the OS starts rebooting.
The error log looks somewhat like this:
NIP: C0124ECC XER: 00000000 LR: C0125028 SP: C01B6270 REGS: c01b61c0 TRAP:
0300 Not tainted
MSR: 00001032 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 000000F0, DSISR: 20000000
TASK = c01b4470[0] 'swapper' Last syscall: 120
last math c228a000 last altivec 00000000
GPR00: 000000F0 C01B6270 C01B4470 00001032 00001032 00000006 C0C11034
C3C61CC0
GPR08: 0000003F 00000000 C01CE9F8 C01CEAD0 00000002 1012A714 03FBA000
00000000
GPR16: 00000001 00000001 FFFFFFFF 007FFF00 00001032 C3F93000 C0210000
00000000
GPR24: C3C06012 00000045 C01E0000 C0BE1320 0000054E C01CE9E0 C01CEA08
C3CA9A20
Call backtrace:
C0125528 C011AF0C C0006CD8 C0006D98 C0005C40 C00072C8 C00072E4
C0003918 C01CF5B8 000035F0
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
<0>Rebooting in 180 seconds..<4>MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
MPC5xxx_FEC_IEVENT_RFIFO_ERROR
mpc5xxx_fec_reinit
Can anyone tell me what is the reason to face such
an error? and how can we avoid this error? any pointers
for overcoming it will be really helpfull as I'm stuck with
this problem since long time.
thanks and regards,
Ramprasad H L
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
[-- Attachment #2: Type: text/html, Size: 3976 bytes --]
^ permalink raw reply
* OT: Re: [U-Boot-Users] Status of OF in TQM8540 and linux-2.6.17.11
From: Clemens Koller @ 2006-09-05 13:28 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: u-boot-users, ppcembed Mailing List
In-Reply-To: <20060905121957.CF13F353A15@atlas.denx.de>
Hello, Wolfgang!
-> moving from u-boot-users to linuxppc-embedded
Wolfgang Denk wrote:
> In message <44FD5BD4.9090406@anagramm.de> you wrote:
>
>>Now I try to boot a current linux kernel - the vanilla 2.6.17.11
>>with the default tqm8540 config but it doesn't show any sign of life
>
> Please use the kernel from our repo instead; see
> http://www.denx.de/cgi-bin/gitweb.cgi?p=linux-2.6-denx.git
Okay, the compilation after a make TQM8540_defconfig fails:
clemens@ecam:~/git/linux-2.6-denx$ make uImage
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-ppc
CHK include/linux/compile.h
CC arch/ppc/syslib/mpc85xx_devices.o
In file included from arch/ppc/syslib/mpc85xx_devices.c:23:
include/asm/cpm2.h:1193:1: warning: "FCC2_MEM_OFFSET" redefined
include/asm/cpm2.h:1192:1: warning: this is the location of the previous definition
arch/ppc/syslib/mpc85xx_devices.c:99: error: `F1_RXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:99: error: `F1_TXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:99: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:99: error: (near initialization for `mpc85xx_fcc1_pdata.clk_route')
arch/ppc/syslib/mpc85xx_devices.c:100: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:100: error: (near initialization for `mpc85xx_fcc1_pdata.clk_trx')
arch/ppc/syslib/mpc85xx_devices.c:117: error: `F2_RXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:117: error: `F2_TXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:117: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:117: error: (near initialization for `mpc85xx_fcc2_pdata.clk_route')
arch/ppc/syslib/mpc85xx_devices.c:118: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:118: error: (near initialization for `mpc85xx_fcc2_pdata.clk_trx')
arch/ppc/syslib/mpc85xx_devices.c:135: error: `F3_RXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:135: error: `F3_TXCLK' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:135: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:135: error: (near initialization for `mpc85xx_fcc3_pdata.clk_route')
arch/ppc/syslib/mpc85xx_devices.c:136: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:136: error: (near initialization for `mpc85xx_fcc3_pdata.clk_trx')
arch/ppc/syslib/mpc85xx_devices.c:138: error: `FCC3_MEM_OFFSET' undeclared here (not in a function)
arch/ppc/syslib/mpc85xx_devices.c:138: error: initializer element is not constant
arch/ppc/syslib/mpc85xx_devices.c:138: error: (near initialization for `mpc85xx_fcc3_pdata.mem_offset')
make[1]: *** [arch/ppc/syslib/mpc85xx_devices.o] Error 1
make: *** [arch/ppc/syslib] Error 2
>>Are there any tips&tricks to consider regarding that point?
>
> Yes, use a working kernel. Not all our patches have been accepted
> upstream, and we have some lag with re-submissions.
According to TQC, the latest "working" kernel was a 2.6.15-git from your
(denx) tree. I get the details from Mr. Becher@TQC and see how far I can get.
Okay, let's move over to linux-ppc-embedded. (xposting)
Best greets,
Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany
http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19
^ permalink raw reply
* Re: OT: Re: [U-Boot-Users] Status of OF in TQM8540 and linux-2.6.17.11
From: Vitaly Bordug @ 2006-09-05 15:06 UTC (permalink / raw)
To: Clemens Koller; +Cc: u-boot-users, ppcembed, Mailing List
In-Reply-To: <44FD7B96.80405@anagramm.de>
On Tue, 05 Sep 2006 15:28:54 +0200
Clemens Koller <clemens.koller@anagramm.de> wrote:
> Hello, Wolfgang!
>
> -> moving from u-boot-users to linuxppc-embedded
>
> Wolfgang Denk wrote:
> > In message <44FD5BD4.9090406@anagramm.de> you wrote:
> >
> >>Now I try to boot a current linux kernel - the vanilla 2.6.17.11
> >>with the default tqm8540 config but it doesn't show any sign of life
> >
> > Please use the kernel from our repo instead; see
> > http://www.denx.de/cgi-bin/gitweb.cgi?p=linux-2.6-denx.git
>
> Okay, the compilation after a make TQM8540_defconfig fails:
>
> clemens@ecam:~/git/linux-2.6-denx$ make uImage
> CHK include/linux/version.h
> CHK include/linux/utsrelease.h
> SYMLINK include/asm -> include/asm-ppc
> CHK include/linux/compile.h
> CC arch/ppc/syslib/mpc85xx_devices.o
> In file included from arch/ppc/syslib/mpc85xx_devices.c:23:
> include/asm/cpm2.h:1193:1: warning: "FCC2_MEM_OFFSET" redefined
> include/asm/cpm2.h:1192:1: warning: this is the location of the previous definition
> arch/ppc/syslib/mpc85xx_devices.c:99: error: `F1_RXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:99: error: `F1_TXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:99: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:99: error: (near initialization for `mpc85xx_fcc1_pdata.clk_route')
> arch/ppc/syslib/mpc85xx_devices.c:100: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:100: error: (near initialization for `mpc85xx_fcc1_pdata.clk_trx')
> arch/ppc/syslib/mpc85xx_devices.c:117: error: `F2_RXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:117: error: `F2_TXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:117: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:117: error: (near initialization for `mpc85xx_fcc2_pdata.clk_route')
> arch/ppc/syslib/mpc85xx_devices.c:118: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:118: error: (near initialization for `mpc85xx_fcc2_pdata.clk_trx')
> arch/ppc/syslib/mpc85xx_devices.c:135: error: `F3_RXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:135: error: `F3_TXCLK' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:135: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:135: error: (near initialization for `mpc85xx_fcc3_pdata.clk_route')
> arch/ppc/syslib/mpc85xx_devices.c:136: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:136: error: (near initialization for `mpc85xx_fcc3_pdata.clk_trx')
> arch/ppc/syslib/mpc85xx_devices.c:138: error: `FCC3_MEM_OFFSET' undeclared here (not in a function)
> arch/ppc/syslib/mpc85xx_devices.c:138: error: initializer element is not constant
> arch/ppc/syslib/mpc85xx_devices.c:138: error: (near initialization for `mpc85xx_fcc3_pdata.mem_offset')
> make[1]: *** [arch/ppc/syslib/mpc85xx_devices.o] Error 1
> make: *** [arch/ppc/syslib] Error 2
>
> >>Are there any tips&tricks to consider regarding that point?
> >
> > Yes, use a working kernel. Not all our patches have been accepted
> > upstream, and we have some lag with re-submissions.
>
> According to TQC, the latest "working" kernel was a 2.6.15-git from your
> (denx) tree. I get the details from Mr. Becher@TQC and see how far I can get.
>
> Okay, let's move over to linux-ppc-embedded. (xposting)
The upper defines need to reside in the board-specific code for tqm as well as for other boards
utilizing such scheme (see platforms/85xx/mpc85xx_ads_common.h for instance).
Fix for FCC3_MEM_OFFSET was part of my patch series (as a typo fix), I'll submit it separately since
it's a notable bugfix should be in the mainstream.
--
Sincerely,
Vitaly
^ permalink raw reply
* On the transfer of data from the uart.c driver to the tty layer...
From: Alejandro C @ 2006-09-05 14:56 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
I'm working on a the uart.c driver to add support for SCCs in HDLC mode. The
application I'm going to run on top will be sending Ethernet packets
encapsulated in the data field of an HDLC frame. The idea was to make the
buffer big enough so that a whole Eth. packet (max 1518 octects) could fit
in just one buffer. I let the CPM interrupt on a frame basis and the problem
I've come across is that the receive buffer in the struct tty_struct, where
the tty layer collects the data from the driver
(tty_struct.tty_flip_buffer.char_buf), is only 1024 bytes
(2*TTY_FLIPBUF_SIZE). The easiest at this stage would be to make those
buffers larger, but I don't know what sort of impact this might have... Any
tips?
Any ideas on how to solve it in another fashion?
Help will be highly appreciated.
Regards,
Alejandro
_________________________________________________________________
Acepta el reto MSN Premium: Correos más divertidos con fotos y textos
increíbles en MSN Premium. Descárgalo y pruébalo 2 meses gratis.
http://join.msn.com?XAPID=1697&DI=1055&HL=Footer_mailsenviados_correosmasdivertidos
^ permalink raw reply
* Re: [2.6.19 PATCH 1/7] ehea: interface to network stack
From: Thomas Klein @ 2006-09-05 15:09 UTC (permalink / raw)
To: Francois Romieu
Cc: Thomas Klein, Jan-Bernd Themann, netdev, linux-kernel,
Christoph Raisch, linux-ppc, Marcus Eder
In-Reply-To: <20060904201606.GA24386@electric-eye.fr.zoreil.com>
Hi Francois,
thanks for your review and your comments. See below our answers.
Regards
Thomas
Francois Romieu wrote:
>> + cb2 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
>> + if (!cb2) {
>> + ehea_error("no mem for cb2");
>> + goto kzalloc_failed;
>
> It's better when the label tell what it does than where it comes from.
> If it's numbered too, one can check them without going back and forth.
>> + stats->tx_packets = cb2->txucp + cb2->txmcp + cb2->txbcp;
>> + stats->multicast = cb2->rxmcp;
>> + stats->rx_errors = cb2->rxuerr;
>> + stats->rx_bytes = cb2->rxo;
>> + stats->tx_bytes = cb2->txo;
>> + stats->rx_packets = rx_packets;
>> +
>> +hcall_failed:
>> + kfree(cb2);
>
> Tab was turned into spaces.
Fixed.
>> +static inline int ehea_refill_rq1(struct ehea_port_res *pr, int index,
>
> Avoid inline ?
Inline declaration was removed from this one and several other functions.
>> + for (i = 0; i < nr_of_wqes; i++) {
>> + if (!skb_arr_rq1[index]) {
>> + skb_arr_rq1[index] = dev_alloc_skb(EHEA_LL_PKT_SIZE);
>
> netdev_alloc_skb ?
Agreed & done.
>
>> +
>> + if (!skb_arr_rq1[index]) {
>> + ehea_error("no mem for skb/%d wqes filled", i);
>> + ret = -ENOMEM;
>
> The caller does not check the returned value.
Agreed. fn returns void now.
>> + if (!skb_arr_rq1[i]) {
>> + ehea_error("no mem for skb/%d skbs filled.", i);
>> + ret = -ENOMEM;
>> + goto exit0;
>
> s/exit0/out/
Goto target naming was reworked throughout the whole driver and basically
uses the style used by Dave M. and Jeff G. in the Tigon3 driver.
>> +static inline int ehea_check_cqe(struct ehea_cqe *cqe, int *rq_num)
>> +{
>> + *rq_num = (cqe->type & EHEA_CQE_TYPE_RQ) >> 5;
>> + if ((cqe->status & EHEA_CQE_STAT_ERR_MASK) == 0)
>> + return 0;
>> + if (((cqe->status & EHEA_CQE_STAT_ERR_TCP) != 0)
>> + && (cqe->header_length == 0))
>
> && on the previous line please.
Changed at all occurences.
>> +static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
>> + int arr_len,
>> + struct ehea_cqe *cqe)
>> +{
>> + int skb_index = EHEA_BMASK_GET(EHEA_WR_ID_INDEX, cqe->wr_id);
>> + struct sk_buff *skb;
>> + void *pref;
>> + int x;
>> +
>> + x = skb_index + 1;
>> + x &= (arr_len - 1);
>> +
>> + pref = (void*)skb_array[x];
>
> Useless cast.
Agreed -> removed.
>> + if (unlikely(!skb)) {
>> + if (netif_msg_rx_err(port))
>> + ehea_error("LL rq1: skb=NULL");
>> + skb = dev_alloc_skb(EHEA_LL_PKT_SIZE);
>
> Tab/space
Fixed.
>> +irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param, struct pt_regs * regs)
>
> static ?
Agreed.
>> +int ehea_sense_port_attr(struct ehea_port *port)
>
> static ?
No -> used in ehea_ethtool.c
>> + } else {
>> + if (hret == H_AUTHORITY)
>> + {
>
> Misplaced curly brace.
Fixed.
>
>> + ehea_info("Hypervisor denied setting port speed. Either"
>> + " this partition is not authorized to set "
>> + "port speed or another partition has modified"
>> + " port speed first.");
>> + ret = -EPERM;
>> + } else
>> + {
>
> Misplaced curly brace.
Fixed.
>
>> + ret = -EIO;
>> + ehea_error("Failed setting port speed");
>> + }
>> + }
>> + netif_carrier_on(port->netdev);
>> +exit0:
>> + kfree(cb4);
>
> cb4 is NULL. Not wrong per se but I'd rather move the label one line down.
Agreed.
>> +void ehea_neq_tasklet(unsigned long data)
>
> static ?
Agreed.
>> +irqreturn_t ehea_interrupt_neq(int irq, void *param, struct pt_regs *regs)
>
> static ?
Agreed.
>> +{
>> + struct ehea_adapter *adapter = (struct ehea_adapter*)param;
>
> Useless cast.
Fixed.
>> +static int ehea_fill_port_res(struct ehea_port_res *pr)
>> +{
>> + int ret;
>> + struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr;
>> +
>> + /* RQ 1 */
>> + ret = ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1
>> + - init_attr->act_nr_rwqes_rq2
>> + - init_attr->act_nr_rwqes_rq3 - 1);
>> + /* RQ 2 */
>
> Useless comment.
Removed.
>> + for (k = 0; k < i; k++) {
>> + u32 ist = port->port_res[k].recv_eq->attr.ist1;
>> + ibmebus_free_irq(NULL, ist, &port->port_res[k]);
>> + }
>> + goto failure;
>
> Poor label (and bloaty release practice too: remove k, reuse "i" below
> and more importantly release the things in allocation-reversed order).
Somehow I don't get your point concerning the usage of 'k'. We need another
iterator as the for loops using 'k' use 'i' as their terminating condition.
>
>> + }
>> + if (netif_msg_ifup(port))
>> + ehea_info("irq_handle 0x%X for funct ehea_recv_int %d "
>> + "registered", pr->recv_eq->attr.ist1, i);
>> + }
>> +
>> + snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1,
>> + "%s-aff", dev->name);
>> + ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
>> + ehea_qp_aff_irq_handler,
>> + SA_INTERRUPT, port->int_aff_name, port);
>> + if (ret) {
>> + ehea_error("failed registering irq for qp_aff_irq_handler:"
>> + " ist=%X", port->qp_eq->attr.ist1);
>> + goto failure2;
>> + }
>> + if (netif_msg_ifup(port))
>> + ehea_info("irq_handle 0x%X for function qp_aff_irq_handler "
>> + "registered", port->qp_eq->attr.ist1);
>> +
>> + for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
>> + pr = &port->port_res[i];
>> + snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
>> + "%s-send%d", dev->name, i);
>> + ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1,
>> + ehea_send_irq_handler,
>> + SA_INTERRUPT, pr->int_send_name,
>> + pr);
>> + if (ret) {
>> + ehea_error("failed registering irq for ehea_send"
>> + " port_res_nr:%d, ist=%X", i,
>> + pr->send_eq->attr.ist1);
>> + for (k = 0; k < i; k++) {
>> + u32 ist = port->port_res[k].send_eq->attr.ist1;
>> + ibmebus_free_irq(NULL, ist, &port->port_res[i]);
>> + }
>> + goto failure3;
>> + }
>> + if (netif_msg_ifup(port))
>> + ehea_info("irq_handle 0x%X for function ehea_send_int "
>> + "%d registered", pr->send_eq->attr.ist1, i);
>> + }
>> + return ret;
>> +failure3:
>> + for (i = 0; i < port->num_def_qps; i++)
>> + ibmebus_free_irq(NULL, port->port_res[i].recv_eq->attr.ist1,
>> + &port->port_res[i]);
>
> Compare with:
> u32 ist = port->port_res[k].recv_eq->attr.ist1;
> ibmebus_free_irq(NULL, ist, &port->port_res[k]);
>
> It was the first loop above. :o/
Agreed, that's slightly prettier.
>> + /* send */
>> + for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
>> + ibmebus_free_irq(NULL, port->port_res[i].send_eq->attr.ist1,
>> + &port->port_res[i]);
>
> Please add a local 'struct shnortz *foo = port->port_res + i;'
Agreed & done.
>> + cb0->port_rc = EHEA_BMASK_SET(PXLY_RC_VALID, 1)
>> + | EHEA_BMASK_SET(PXLY_RC_IP_CHKSUM, 1)
>> + | EHEA_BMASK_SET(PXLY_RC_TCP_UDP_CHKSUM, 1)
>> + | EHEA_BMASK_SET(PXLY_RC_VLAN_XTRACT, 1)
>
> Tab/space
Fixed.
>> +static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
>> + struct port_res_cfg *pr_cfg, int queue_token)
>> +{
>> + struct ehea_adapter *adapter = port->adapter;
>> + struct ehea_qp_init_attr *init_attr = NULL;
>
> Useless initialization.
init_attr must be initialized as there are goto statements which may
pass the init_attr = kzalloc() statement and jump to ehea_init_port_res_err
where we want to kfree() init_attr without having to care for its state.
>> + pr->send_eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0);
>> + if (!pr->send_eq) {
>> + ehea_error("create_eq failed (send_eq)");
>> + ret = -EIO;
>> + goto ehea_init_port_res_err;
>
> Should factor 'ret = -EIO' before the sequence.
Ok, done.
>> + if (!ret) {
>> + ehea_destroy_cq(pr->send_cq);
>> + ehea_destroy_cq(pr->recv_cq);
>> + ehea_destroy_eq(pr->send_eq);
>> + ehea_destroy_eq(pr->recv_eq);
>> +
>> + for (i = 0; i < pr->rq1_skba.len; i++)
>> + if (pr->rq1_skba.arr[i])
>> + dev_kfree_skb(pr->rq1_skba.arr[i]);
>> +
>> + for (i = 0; i < pr->rq2_skba.len; i++)
>> + if (pr->rq2_skba.arr[i])
>> + dev_kfree_skb(pr->rq2_skba.arr[i]);
>> +
>> + for (i = 0; i < pr->rq3_skba.len; i++)
>> + if (pr->rq3_skba.arr[i])
>> + dev_kfree_skb(pr->rq3_skba.arr[i]);
>> +
>> + for (i = 0; i < pr->sq_skba.len; i++)
>> + if (pr->sq_skba.arr[i])
>> + dev_kfree_skb(pr->sq_skba.arr[i]);
>
> Feels like a 0..4 loop is missing above.
The send queue and the receive queues are not related to eachother
in any way. Thus using a joint array for them isn't appropriate.
>> +static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
>> +{
>> + struct ehea_port *port = netdev_priv(dev);
>> + struct ehea_port_res *pr;
>> + struct ehea_swqe *swqe;
>> + unsigned long flags;
>> + u32 lkey;
>> + int swqe_index;
>> +
>> + pr = &port->port_res[0];
>
> Initialization and declaration can happen at the same time.
Agreed.
>> + if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
>> + spin_lock_irqsave(&pr->netif_queue, flags);
>> + if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
>> + netif_stop_queue(dev);
>> + pr->queue_stopped = 1;
>> + spin_unlock_irqrestore(&pr->netif_queue, flags);
>> + return NETDEV_TX_BUSY;
>
> 1 - this is considered a severe bug. You should stop queueing before it
> happens.
> 2 - don't mix spinlocked sections and stealth return.
Fixed.
>> +port_res_setup_failed:
>> + for(k = 0; k < i; k++) {
>> + ehea_clean_port_res(port, &port->port_res[k]);
>
> Useless k ?
No, i is used as terminating condition and may not be reused as iterator
in this loop.
>> +int ehea_up(struct net_device *dev)
>> +int ehea_open(struct net_device *dev)
>
> static
Agreed.
>> +{
>> + int ret;
>> + struct ehea_port *port = netdev_priv(dev);
>> +
>> + down(&port->port_lock);
>> +
>> + if (netif_msg_ifup(port))
>> + ehea_info("enabling port %s", dev->name);
>> + ret = ehea_up(dev);
>
> Broken indent.
Fixed.
>> + dev->open = ehea_open;
>> + dev->poll = ehea_poll;
>> + dev->weight = 64;
>> + dev->stop = ehea_stop;
>> + dev->hard_start_xmit = ehea_start_xmit;
>> + dev->get_stats = ehea_get_stats;
>> + dev->set_multicast_list = ehea_set_multicast_list;
>> + dev->set_mac_address = ehea_set_mac_addr;
>> + dev->change_mtu = ehea_change_mtu;
>> + dev->vlan_rx_register = ehea_vlan_rx_register;
>> + dev->vlan_rx_add_vid = ehea_vlan_rx_add_vid;
>> + dev->vlan_rx_kill_vid = ehea_vlan_rx_kill_vid;
>> + dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
>> + | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX
>> + | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
>> + | NETIF_F_LLTX;
>> + dev->tx_timeout = &ehea_tx_watchdog;
>> + dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
>> +
>> + INIT_WORK(&port->reset_task,
>> + (void (*)(void *)) ehea_reset_port, dev);
>
> Why not modify ehea_reset_port ?
Done.
>> + ehea_set_ethtool_ops(dev);
>
> This function does not appear in the current patch.
It appears in [2.6.19 PATCH 4/7] ehea: ethtool interface
>> +int check_module_parm(void)
>
> static
Agreed.
>> + if ((rq1_entries < EHEA_MIN_ENTRIES_QP)
>> + || (rq1_entries > EHEA_MAX_ENTRIES_RQ1)) {
>
> || is misplaced.
Changed at all occurences.
>> +static struct of_device_id ehea_device_table[] = {
>> + {
>> + .name = "lhea",
>> + .compatible = "IBM,lhea",
>> + },
>
> Indent seems strange.
Fixed.
>> + printk("IBM eHEA ethernet device driver (Release %s)\n", DRV_VERSION);
>
> Missing KERN_XYZ
KERN_INFO set.
^ permalink raw reply
* Re: [U-Boot-Users] OT: Re: Status of OF in TQM8540 and linux-2.6.17.11
From: Wolfgang Denk @ 2006-09-05 15:39 UTC (permalink / raw)
To: Vitaly Bordug; +Cc: linuxppc-embedded
In-Reply-To: <20060905190608.082331bc@vitb.ru.mvista.com>
In message <20060905190608.082331bc@vitb.ru.mvista.com> you wrote:
>
> Clemens Koller <clemens.koller@anagramm.de> wrote:
...
> > According to TQC, the latest "working" kernel was a 2.6.15-git from your
> > (denx) tree. I get the details from Mr. Becher@TQC and see how far I can get.
[TQ provides obsolete information.]
> The upper defines need to reside in the board-specific code for tqm as well as for other boards
> utilizing such scheme (see platforms/85xx/mpc85xx_ads_common.h for instance).
Thanks for pointing out.
Clemens, plese try again (commit id cd4ebbc9b95434977e5f182b9a22d7d1de0748ce)
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"Where shall I begin, please your Majesty?" he asked. "Begin at the
beginning," the King said, gravely, "and go on till you come to the
end: then stop." - Alice's Adventures in Wonderland, Lewis Carroll
^ permalink raw reply
* Yosemite board w/ppc440ep NETDEV WATCHDOG: eth0: transmit timed out
From: Michael Alievsky @ 2006-09-05 16:14 UTC (permalink / raw)
To: linuxppc-embedded
Hi Rocky,
We have experienced absolutely the same problem with the Yosemite board.
The problem is releated to the simultanious recieve on both Ethernet ports.
Did you get more information about the problem?
Regards,
Michael Alievsky
^ permalink raw reply
* Re: [POWERPC] merge iSeries i/o operations with the rest
From: Linas Vepstas @ 2006-09-05 16:41 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: ppc-dev, paulus
In-Reply-To: <20060905120817.e52857ee.sfr@canb.auug.org.au>
On Tue, Sep 05, 2006 at 12:08:17PM +1000, Stephen Rothwell wrote:
> @@ -273,25 +234,30 @@ #define iobarrier_w() eieio()
> * These routines do not perform EEH-related I/O address translation,
> * and should not be used directly by device drivers. Use inb/readb
> * instead.
> + *
> + * For some of these, we force the target/source register to be
> + * r0 to ease decoding on iSeries.
???
Why?
> static inline int in_8(const volatile unsigned char __iomem *addr)
> {
> - int ret;
> + register unsigned int ret __asm__("r0");
Such as here .. why is this being forced ??
> - __asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync"
> - : "=r" (ret) : "m" (*addr));
> + __asm__ __volatile__("lbzx %0,0,%1; twi 0,%0,0; isync"
> + : "=r" (ret) : "r" (addr));
Why make this change? The old code allows the compiler to optimize
better than the new code. One might argue that, in the grand scheme of
things, i/o is very slow, so a few cycles here doesn't matter much.
But still, I don't understand why this change is needed.
> +static inline void memset_io(volatile void __iomem *addr, int c,
> + unsigned long n)
> +{
> + if (firmware_has_feature(FW_FEATURE_ISERIES))
> + iSeries_memset_io(addr, c, n);
> + else
> + eeh_memset_io(addr, c, n);
> +}
!! I think it would be much better to have this be a compile-time
check rather than a run-time check. No only does it save cycles,
but it makes the iSeries kernel smaller (by not needing eeh code
in it) and the p-series code smaller (by not compiling iseries
code into it.
--linas
^ permalink raw reply
* [0/5] powerpc: PA Semi PWRficient patches
From: Olof Johansson @ 2006-09-05 17:26 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
Hi,
The following series of patches introduces basic support for PA Semi's
PA6T core, and the base platform support for PWRficient PA6T-1682M.
It is split up in 5 separate patches:
1. Reduce default cacheline size to 64 bytes
2. Divorce CPU_FTR_CTRL from CPU_FTR_PPCAS_ARCH_V2_BASE
3. Cpu table entry, PVR value
4. Basic arch/powerpc/platforms/pasemi contents
5. MAINTAINER entry
-Olof
^ permalink raw reply
* [1/5] powerpc: Reduce default cacheline size to 64 bytes
From: Olof Johansson @ 2006-09-05 17:26 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
Reduce default cacheline size on 64-bit powerpc from 128 bytes to 64.
This is the architected minimum. In most cases we'll still end up using
cache line information from the device tree, but defaults are used during
early boot and doing a few dcbst/icbi's too many there won't do any harm.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/arch/powerpc/kernel/setup_64.c
===================================================================
--- merge.orig/arch/powerpc/kernel/setup_64.c
+++ merge/arch/powerpc/kernel/setup_64.c
@@ -78,10 +78,10 @@ u64 ppc64_pft_size;
* before we've read this from the device tree.
*/
struct ppc64_caches ppc64_caches = {
- .dline_size = 0x80,
- .log_dline_size = 7,
- .iline_size = 0x80,
- .log_iline_size = 7
+ .dline_size = 0x40,
+ .log_dline_size = 6,
+ .iline_size = 0x40,
+ .log_iline_size = 6
};
EXPORT_SYMBOL_GPL(ppc64_caches);
Index: merge/arch/powerpc/kernel/head_64.S
===================================================================
--- merge.orig/arch/powerpc/kernel/head_64.S
+++ merge/arch/powerpc/kernel/head_64.S
@@ -1748,7 +1748,7 @@ _STATIC(__after_prom_start)
_GLOBAL(copy_and_flush)
addi r5,r5,-8
addi r6,r6,-8
-4: li r0,16 /* Use the least common */
+4: li r0,8 /* Use the smallest common */
/* denominator cache line */
/* size. This results in */
/* extra cache line flushes */
^ permalink raw reply
* [2/5] powerpc: Divorce CPU_FTR_CTRL from CPU_FTR_PPCAS_ARCH_V2_BASE
From: Olof Johansson @ 2006-09-05 17:27 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
The performance monitor implementation (including CTRL register behaviour)
is just included in PPC v2 as an example, it's not truly part of the base.
It's actually a somewhat misleading feature, but I'll leave that be for
now: The precense of the register is not what the feature bit is used
for, but instead it's used to determine if it contains the runlatch
bit for idle reporting of the performance monitor. For alternative
implementations, the register might still exist but the bit might have
different meaning (or no meaning at all).
For now, split it off and don't include it in CPU_FTR_PPCAS_ARCH_V2_BASE.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/include/asm-powerpc/cputable.h
===================================================================
--- merge.orig/include/asm-powerpc/cputable.h
+++ merge/include/asm-powerpc/cputable.h
@@ -148,7 +148,7 @@ extern void do_cpu_ftr_fixups(unsigned l
#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
- CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL)
+ CPU_FTR_NODSISRALIGN)
/* iSeries doesn't support large pages */
#ifdef CONFIG_PPC_ISERIES
@@ -313,24 +313,25 @@ extern void do_cpu_ftr_fixups(unsigned l
CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
CPU_FTR_MMCRA | CPU_FTR_CTRL)
#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
- CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA)
+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
+ CPU_FTR_MMCRA)
#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
- CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
- CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
CPU_FTR_MMCRA | CPU_FTR_SMT | \
CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
CPU_FTR_PURR)
#define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
- CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
CPU_FTR_MMCRA | CPU_FTR_SMT | \
CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE)
#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
- CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
- CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
+ CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
#endif
^ permalink raw reply
* [3/5] powerpc: PA6T cputable entry, PVR value
From: Olof Johansson @ 2006-09-05 17:28 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
Introduce PWRficient PA6T cputable entry and feature bits.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/arch/powerpc/kernel/cputable.c
===================================================================
--- merge.orig/arch/powerpc/kernel/cputable.c
+++ merge/arch/powerpc/kernel/cputable.c
@@ -58,6 +58,9 @@ extern void __restore_cpu_ppc970(void);
#define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
PPC_FEATURE_TRUE_LE)
+#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
+ PPC_FEATURE_TRUE_LE | \
+ PPC_FEATURE_HAS_ALTIVEC_COMP)
#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
PPC_FEATURE_BOOKE)
@@ -286,6 +289,17 @@ struct cpu_spec cpu_specs[] = {
.dcache_bsize = 128,
.platform = "ppc-cell-be",
},
+ { /* PA Semi PA6T */
+ .pvr_mask = 0x7fff0000,
+ .pvr_value = 0x00900000,
+ .cpu_name = "PA6T",
+ .cpu_features = CPU_FTRS_PA6T,
+ .cpu_user_features = COMMON_USER_PA6T,
+ .icache_bsize = 64,
+ .dcache_bsize = 64,
+ .num_pmcs = 6,
+ .platform = "pa6t",
+ },
{ /* default match */
.pvr_mask = 0x00000000,
.pvr_value = 0x00000000,
Index: merge/include/asm-powerpc/reg.h
===================================================================
--- merge.orig/include/asm-powerpc/reg.h
+++ merge/include/asm-powerpc/reg.h
@@ -592,6 +592,8 @@
#define PV_630p 0x0041
#define PV_970MP 0x0044
#define PV_BE 0x0070
+#define PV_PA6T 0x0090
+
/*
* Number of entries in the SLB. If this ever changes we should handle
Index: merge/include/asm-powerpc/cputable.h
===================================================================
--- merge.orig/include/asm-powerpc/cputable.h
+++ merge/include/asm-powerpc/cputable.h
@@ -23,6 +23,7 @@
#define PPC_FEATURE_SMT 0x00004000
#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
#define PPC_FEATURE_ARCH_2_05 0x00001000
+#define PPC_FEATURE_PA6T 0x00000800
#define PPC_FEATURE_TRUE_LE 0x00000002
#define PPC_FEATURE_PPC_LE 0x00000001
@@ -332,6 +333,10 @@ extern void do_cpu_ftr_fixups(unsigned l
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)
+#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 | \
+ CPU_FTR_PURR | CPU_FTR_REAL_LE)
#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
#endif
@@ -340,7 +345,7 @@ extern void do_cpu_ftr_fixups(unsigned l
#define CPU_FTRS_POSSIBLE \
(CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
- CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE)
+ CPU_FTRS_CELL | CPU_FTRS_PA6T)
#else
enum {
CPU_FTRS_POSSIBLE =
@@ -379,7 +384,7 @@ enum {
#define CPU_FTRS_ALWAYS \
(CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \
- CPU_FTRS_CELL & CPU_FTRS_POSSIBLE)
+ CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
#else
enum {
CPU_FTRS_ALWAYS =
^ permalink raw reply
* [4/5] powerpc: PA Semi PWRficient platform support
From: Olof Johansson @ 2006-09-05 17:28 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
Base patch for PA6T and PA6T-1682M. This introduces the
arch/powerpc/platform/pasemi directory, together with basic
implementations for various setup.
Much of this was based on other platform code, i.e. Maple, etc.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/arch/powerpc/Kconfig
===================================================================
--- merge.orig/arch/powerpc/Kconfig
+++ merge/arch/powerpc/Kconfig
@@ -413,6 +409,17 @@ config PPC_MAPLE
This option enables support for the Maple 970FX Evaluation Board.
For more informations, refer to <http://www.970eval.com>
+config PPC_PASEMI
+ depends on PPC_MULTIPLATFORM && PPC64
+ bool "PA Semi SoC-based platforms"
+ default n
+ select MPIC
+ select PPC_UDBG_16550
+ select GENERIC_TBSYNC
+ help
+ This option enables support for PA Semi's PWRficient line
+ of SoC processors, including PA6T-1682M
+
config PPC_CELL
bool
default n
Index: merge/arch/powerpc/platforms/Makefile
===================================================================
--- merge.orig/arch/powerpc/platforms/Makefile
+++ merge/arch/powerpc/platforms/Makefile
@@ -13,5 +13,6 @@ obj-$(CONFIG_PPC_86xx) += 86xx/
obj-$(CONFIG_PPC_PSERIES) += pseries/
obj-$(CONFIG_PPC_ISERIES) += iseries/
obj-$(CONFIG_PPC_MAPLE) += maple/
+obj-$(CONFIG_PPC_PASEMI) += pasemi/
obj-$(CONFIG_PPC_CELL) += cell/
obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
Index: merge/arch/powerpc/platforms/pasemi/Makefile
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/Makefile
@@ -0,0 +1 @@
+obj-y += setup.o pci.o time.o
Index: merge/arch/powerpc/platforms/pasemi/pci.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/pci.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Authors: Kip Walker, PA Semi
+ * Olof Johansson, PA Semi
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on arch/powerpc/platforms/maple/pci.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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 <linux/pci.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+
+#include <asm/sections.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+#include <asm/machdep.h>
+#include <asm/iommu.h>
+
+#include <asm/ppc-pci.h>
+#include <asm/udbg.h>
+
+#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
+
+static unsigned long pa_pxp_cfg_addr(struct pci_controller* hose,
+ u8 bus, u8 devfn, int offset)
+{
+ return ((unsigned long)hose->cfg_data) + PA_PXP_CFA(bus, devfn, offset);
+}
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val)
+{
+ struct pci_controller *hose;
+ unsigned long addr;
+
+ hose = pci_bus_to_host(bus);
+ if (!hose)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
+
+ /*
+ * Note: the caller has already checked that offset is
+ * suitably aligned and that len is 1, 2 or 4.
+ */
+ switch (len) {
+ case 1:
+ *val = in_8((u8 *)addr);
+ break;
+ case 2:
+ *val = in_le16((u16 *)addr);
+ break;
+ default:
+ *val = in_le32((u32 *)addr);
+ break;
+ }
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
+static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 val)
+{
+ struct pci_controller *hose;
+ unsigned long addr;
+
+ hose = pci_bus_to_host(bus);
+ if (!hose)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
+
+ /*
+ * Note: the caller has already checked that offset is
+ * suitably aligned and that len is 1, 2 or 4.
+ */
+ switch (len) {
+ case 1:
+ out_8((u8 *)addr, val);
+ (void) in_8((u8 *)addr);
+ break;
+ case 2:
+ out_le16((u16 *)addr, val);
+ (void) in_le16((u16 *)addr);
+ break;
+ default:
+ out_le32((u32 *)addr, val);
+ (void) in_le32((u32 *)addr);
+ break;
+ }
+ return PCIBIOS_SUCCESSFUL;
+}
+
+static struct pci_ops pa_pxp_ops =
+{
+ pa_pxp_read_config,
+ pa_pxp_write_config
+};
+
+static void __init setup_pa_pxp(struct pci_controller* hose)
+{
+ hose->ops = &pa_pxp_ops;
+ hose->cfg_data = ioremap(0xe0000000, 0x1000000);
+}
+
+static int __init add_bridge(struct device_node *dev)
+{
+ int len;
+ struct pci_controller *hose;
+ int *bus_range;
+ struct property *of_prop;
+
+ pr_debug("Adding PCI host bridge %s\n", dev->full_name);
+
+ bus_range = (int *) get_property(dev, "bus-range", &len);
+ if (bus_range == NULL || len < 2 * sizeof(int)) {
+ printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
+ dev->full_name);
+ }
+
+ hose = pcibios_alloc_controller(dev);
+ if (hose == NULL)
+ return -ENOMEM;
+
+ hose->first_busno = bus_range ? bus_range[0] : 0;
+ hose->last_busno = bus_range ? bus_range[1] : 0xff;
+
+ of_prop = alloc_bootmem(sizeof(struct property) +
+ sizeof(hose->global_number));
+ if (of_prop) {
+ memset(of_prop, 0, sizeof(struct property));
+ of_prop->name = "linux,pci-domain";
+ of_prop->length = sizeof(hose->global_number);
+ of_prop->value = (unsigned char *)&of_prop[1];
+ memcpy(of_prop->value, &hose->global_number, sizeof(hose->global_number));
+ prom_add_property(dev, of_prop);
+ }
+
+ if (device_is_compatible(dev, "pa-pxp"))
+ setup_pa_pxp(hose);
+
+ printk(KERN_INFO "Found PA-PXP PCI host bridge. Firmware bus number: %d->%d\n",
+ hose->first_busno, hose->last_busno);
+
+ /* Interpret the "ranges" property */
+ /* This also maps the I/O region and sets isa_io/mem_base */
+ pci_process_bridge_OF_ranges(hose, dev, 1);
+ pci_setup_phb_io(hose, 1);
+
+ return 0;
+}
+
+
+void __init pas_pcibios_fixup(void)
+{
+ struct pci_dev *dev = NULL;
+
+ for_each_pci_dev(dev)
+ pci_read_irq_line(dev);
+}
+
+static void __init pas_fixup_phb_resources(void)
+{
+ struct pci_controller *hose, *tmp;
+
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
+ unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
+ hose->io_resource.start += offset;
+ hose->io_resource.end += offset;
+ printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n",
+ hose->global_number,
+ hose->io_resource.start, hose->io_resource.end);
+ }
+}
+
+
+void __init pas_pci_init(void)
+{
+ struct device_node *np, *root;
+
+ root = of_find_node_by_path("/");
+ if (root == NULL) {
+ printk(KERN_CRIT "pas_pci_init: can't find root "
+ "of device tree\n");
+ return;
+ }
+
+ for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
+ if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np))
+ of_node_get(np);
+
+ of_node_put(root);
+
+ pas_fixup_phb_resources();
+
+ /* Setup the linkage between OF nodes and PHBs */
+ pci_devs_phb_init();
+
+ /* Use the common resource allocation mechanism */
+ pci_probe_only = 1;
+}
Index: merge/arch/powerpc/platforms/pasemi/setup.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/setup.c
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Authors: Kip Walker, PA Semi
+ * Olof Johansson, PA Semi
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on arch/powerpc/platforms/maple/setup.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/config.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+#include <linux/ptrace.h>
+#include <linux/slab.h>
+#include <linux/user.h>
+#include <linux/a.out.h>
+#include <linux/tty.h>
+#include <linux/string.h>
+#include <linux/delay.h>
+#include <linux/ioport.h>
+#include <linux/major.h>
+#include <linux/initrd.h>
+#include <linux/vt_kern.h>
+#include <linux/console.h>
+#include <linux/ide.h>
+#include <linux/pci.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
+#include <linux/pmu.h>
+#include <linux/irq.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/serial.h>
+#include <linux/smp.h>
+
+#include <asm/processor.h>
+#include <asm/sections.h>
+#include <asm/prom.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/pci-bridge.h>
+#include <asm/iommu.h>
+#include <asm/machdep.h>
+#include <asm/dma.h>
+#include <asm/cputable.h>
+#include <asm/time.h>
+#include <asm/of_device.h>
+#include <asm/lmb.h>
+#include <asm/mpic.h>
+#include <asm/smp.h>
+#include <asm/udbg.h>
+#include <asm/serial.h>
+
+extern int pas_set_rtc_time(struct rtc_time *tm);
+extern void pas_get_rtc_time(struct rtc_time *tm);
+extern unsigned long pas_get_boot_time(void);
+extern void pas_pci_init(void);
+extern void pas_pcibios_fixup(void);
+
+static void pas_restart(char *cmd)
+{
+ printk("restart unimplemented, looping...\n");
+ for (;;) ;
+}
+
+static void pas_power_off(void)
+{
+ printk("power off unimplemented, looping...\n");
+ for (;;) ;
+}
+
+static void pas_halt(void)
+{
+ pas_power_off();
+}
+
+#ifdef CONFIG_SMP
+struct smp_ops_t pas_smp_ops = {
+ .probe = smp_mpic_probe,
+ .message_pass = smp_mpic_message_pass,
+ .kick_cpu = smp_generic_kick_cpu,
+ .setup_cpu = smp_mpic_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
+};
+#endif /* CONFIG_SMP */
+
+void __init pas_setup_arch(void)
+{
+ /* init to some ~sane value until calibrate_delay() runs */
+ loops_per_jiffy = 50000000;
+
+ /* Setup SMP callback */
+#ifdef CONFIG_SMP
+ smp_ops = &pas_smp_ops;
+#endif
+ /* Lookup PCI hosts */
+ pas_pci_init();
+
+#ifdef CONFIG_DUMMY_CONSOLE
+ conswitchp = &dummy_con;
+#endif
+
+ printk(KERN_DEBUG "Using default idle loop\n");
+}
+
+static void iommu_dev_setup_null(struct pci_dev *dev) { }
+static void iommu_bus_setup_null(struct pci_bus *bus) { }
+
+static void __init pas_init_early(void)
+{
+ /* No iommu code yet */
+ ppc_md.iommu_dev_setup = iommu_dev_setup_null;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_null;
+ pci_direct_iommu_init();
+}
+
+/* No legacy IO on our parts */
+static int pas_check_legacy_ioport(unsigned int baseport)
+{
+ return -ENODEV;
+}
+
+static __init void pas_init_IRQ(void)
+{
+ struct device_node *np = NULL;
+ struct device_node *root, *mpic_node = NULL;
+ unsigned long openpic_addr = 0;
+ const unsigned int *opprop;
+ int naddr, opplen;
+ struct mpic *mpic;
+
+ np = of_find_node_by_type(np, "open-pic");
+ if (!np) {
+ printk(KERN_ERR "No interrupt controller in device tree.\n");
+ return;
+ }
+ mpic_node = of_node_get(np);
+
+ /* Find address list in /platform-open-pic */
+ root = of_find_node_by_path("/");
+ naddr = prom_n_addr_cells(root);
+ opprop = get_property(root, "platform-open-pic", &opplen);
+ if (opprop != 0) {
+ openpic_addr = of_read_number(opprop, naddr);
+ printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
+ }
+ of_node_put(root);
+
+ mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0,
+ " PAS-OPIC ");
+ BUG_ON(mpic == NULL);
+
+ mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
+ mpic_init(mpic);
+ of_node_put(mpic_node);
+ of_node_put(root);
+}
+
+static void __init pas_progress(char *s, unsigned short hex)
+{
+ printk("[%04x] : %s\n", hex, s ? s : "");
+}
+
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init pas_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
+ return 0;
+
+ hpte_init_native();
+
+ return 1;
+}
+
+define_machine(pas) {
+ .name = "PA Semi PA6T-1682M",
+ .probe = pas_probe,
+ .setup_arch = pas_setup_arch,
+ .init_early = pas_init_early,
+ .init_IRQ = pas_init_IRQ,
+ .get_irq = mpic_get_irq,
+ .pcibios_fixup = pas_pcibios_fixup,
+ .restart = pas_restart,
+ .power_off = pas_power_off,
+ .halt = pas_halt,
+ .get_boot_time = pas_get_boot_time,
+ .set_rtc_time = pas_set_rtc_time,
+ .get_rtc_time = pas_get_rtc_time,
+ .calibrate_decr = generic_calibrate_decr,
+ .check_legacy_ioport = pas_check_legacy_ioport,
+ .progress = pas_progress,
+};
Index: merge/arch/powerpc/platforms/pasemi/time.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/time.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/config.h>
+#include <linux/sched.h>
+#include <linux/bcd.h>
+
+#include <asm/time.h>
+
+void pas_get_rtc_time(struct rtc_time *tm)
+{
+}
+
+int pas_set_rtc_time(struct rtc_time *tm)
+{
+ return -ENODEV;
+}
+
+unsigned long __init pas_get_boot_time(void)
+{
+#if 0
+ struct rtc_time tm;
+
+ pas_get_rtc_time(&tm);
+
+ return mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+#else
+ /* Let's just return a fake date right now */
+ return mktime(2006, 1, 1, 12, 0, 0);
+#endif
+}
^ permalink raw reply
* [4/5] powerpc: PA Semi PWRficient platform support
From: Olof Johansson @ 2006-09-05 17:29 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
Base patch for PA6T and PA6T-1682M. This introduces the
arch/powerpc/platform/pasemi directory, together with basic
implementations for various setup.
Much of this was based on other platform code, i.e. Maple, etc.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/arch/powerpc/Kconfig
===================================================================
--- merge.orig/arch/powerpc/Kconfig
+++ merge/arch/powerpc/Kconfig
@@ -413,6 +409,17 @@ config PPC_MAPLE
This option enables support for the Maple 970FX Evaluation Board.
For more informations, refer to <http://www.970eval.com>
+config PPC_PASEMI
+ depends on PPC_MULTIPLATFORM && PPC64
+ bool "PA Semi SoC-based platforms"
+ default n
+ select MPIC
+ select PPC_UDBG_16550
+ select GENERIC_TBSYNC
+ help
+ This option enables support for PA Semi's PWRficient line
+ of SoC processors, including PA6T-1682M
+
config PPC_CELL
bool
default n
Index: merge/arch/powerpc/platforms/Makefile
===================================================================
--- merge.orig/arch/powerpc/platforms/Makefile
+++ merge/arch/powerpc/platforms/Makefile
@@ -13,5 +13,6 @@ obj-$(CONFIG_PPC_86xx) += 86xx/
obj-$(CONFIG_PPC_PSERIES) += pseries/
obj-$(CONFIG_PPC_ISERIES) += iseries/
obj-$(CONFIG_PPC_MAPLE) += maple/
+obj-$(CONFIG_PPC_PASEMI) += pasemi/
obj-$(CONFIG_PPC_CELL) += cell/
obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
Index: merge/arch/powerpc/platforms/pasemi/Makefile
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/Makefile
@@ -0,0 +1 @@
+obj-y += setup.o pci.o time.o
Index: merge/arch/powerpc/platforms/pasemi/pci.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/pci.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Authors: Kip Walker, PA Semi
+ * Olof Johansson, PA Semi
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on arch/powerpc/platforms/maple/pci.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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 <linux/pci.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+
+#include <asm/sections.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+#include <asm/machdep.h>
+#include <asm/iommu.h>
+
+#include <asm/ppc-pci.h>
+#include <asm/udbg.h>
+
+#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
+
+static unsigned long pa_pxp_cfg_addr(struct pci_controller* hose,
+ u8 bus, u8 devfn, int offset)
+{
+ return ((unsigned long)hose->cfg_data) + PA_PXP_CFA(bus, devfn, offset);
+}
+
+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val)
+{
+ struct pci_controller *hose;
+ unsigned long addr;
+
+ hose = pci_bus_to_host(bus);
+ if (!hose)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
+
+ /*
+ * Note: the caller has already checked that offset is
+ * suitably aligned and that len is 1, 2 or 4.
+ */
+ switch (len) {
+ case 1:
+ *val = in_8((u8 *)addr);
+ break;
+ case 2:
+ *val = in_le16((u16 *)addr);
+ break;
+ default:
+ *val = in_le32((u32 *)addr);
+ break;
+ }
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
+static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 val)
+{
+ struct pci_controller *hose;
+ unsigned long addr;
+
+ hose = pci_bus_to_host(bus);
+ if (!hose)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
+
+ /*
+ * Note: the caller has already checked that offset is
+ * suitably aligned and that len is 1, 2 or 4.
+ */
+ switch (len) {
+ case 1:
+ out_8((u8 *)addr, val);
+ (void) in_8((u8 *)addr);
+ break;
+ case 2:
+ out_le16((u16 *)addr, val);
+ (void) in_le16((u16 *)addr);
+ break;
+ default:
+ out_le32((u32 *)addr, val);
+ (void) in_le32((u32 *)addr);
+ break;
+ }
+ return PCIBIOS_SUCCESSFUL;
+}
+
+static struct pci_ops pa_pxp_ops =
+{
+ pa_pxp_read_config,
+ pa_pxp_write_config
+};
+
+static void __init setup_pa_pxp(struct pci_controller* hose)
+{
+ hose->ops = &pa_pxp_ops;
+ hose->cfg_data = ioremap(0xe0000000, 0x1000000);
+}
+
+static int __init add_bridge(struct device_node *dev)
+{
+ int len;
+ struct pci_controller *hose;
+ int *bus_range;
+ struct property *of_prop;
+
+ pr_debug("Adding PCI host bridge %s\n", dev->full_name);
+
+ bus_range = (int *) get_property(dev, "bus-range", &len);
+ if (bus_range == NULL || len < 2 * sizeof(int)) {
+ printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
+ dev->full_name);
+ }
+
+ hose = pcibios_alloc_controller(dev);
+ if (hose == NULL)
+ return -ENOMEM;
+
+ hose->first_busno = bus_range ? bus_range[0] : 0;
+ hose->last_busno = bus_range ? bus_range[1] : 0xff;
+
+ of_prop = alloc_bootmem(sizeof(struct property) +
+ sizeof(hose->global_number));
+ if (of_prop) {
+ memset(of_prop, 0, sizeof(struct property));
+ of_prop->name = "linux,pci-domain";
+ of_prop->length = sizeof(hose->global_number);
+ of_prop->value = (unsigned char *)&of_prop[1];
+ memcpy(of_prop->value, &hose->global_number, sizeof(hose->global_number));
+ prom_add_property(dev, of_prop);
+ }
+
+ if (device_is_compatible(dev, "pa-pxp"))
+ setup_pa_pxp(hose);
+
+ printk(KERN_INFO "Found PA-PXP PCI host bridge. Firmware bus number: %d->%d\n",
+ hose->first_busno, hose->last_busno);
+
+ /* Interpret the "ranges" property */
+ /* This also maps the I/O region and sets isa_io/mem_base */
+ pci_process_bridge_OF_ranges(hose, dev, 1);
+ pci_setup_phb_io(hose, 1);
+
+ return 0;
+}
+
+
+void __init pas_pcibios_fixup(void)
+{
+ struct pci_dev *dev = NULL;
+
+ for_each_pci_dev(dev)
+ pci_read_irq_line(dev);
+}
+
+static void __init pas_fixup_phb_resources(void)
+{
+ struct pci_controller *hose, *tmp;
+
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
+ unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
+ hose->io_resource.start += offset;
+ hose->io_resource.end += offset;
+ printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n",
+ hose->global_number,
+ hose->io_resource.start, hose->io_resource.end);
+ }
+}
+
+
+void __init pas_pci_init(void)
+{
+ struct device_node *np, *root;
+
+ root = of_find_node_by_path("/");
+ if (root == NULL) {
+ printk(KERN_CRIT "pas_pci_init: can't find root "
+ "of device tree\n");
+ return;
+ }
+
+ for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
+ if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np))
+ of_node_get(np);
+
+ of_node_put(root);
+
+ pas_fixup_phb_resources();
+
+ /* Setup the linkage between OF nodes and PHBs */
+ pci_devs_phb_init();
+
+ /* Use the common resource allocation mechanism */
+ pci_probe_only = 1;
+}
Index: merge/arch/powerpc/platforms/pasemi/setup.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/setup.c
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Authors: Kip Walker, PA Semi
+ * Olof Johansson, PA Semi
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on arch/powerpc/platforms/maple/setup.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/config.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+#include <linux/ptrace.h>
+#include <linux/slab.h>
+#include <linux/user.h>
+#include <linux/a.out.h>
+#include <linux/tty.h>
+#include <linux/string.h>
+#include <linux/delay.h>
+#include <linux/ioport.h>
+#include <linux/major.h>
+#include <linux/initrd.h>
+#include <linux/vt_kern.h>
+#include <linux/console.h>
+#include <linux/ide.h>
+#include <linux/pci.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
+#include <linux/pmu.h>
+#include <linux/irq.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/serial.h>
+#include <linux/smp.h>
+
+#include <asm/processor.h>
+#include <asm/sections.h>
+#include <asm/prom.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/pci-bridge.h>
+#include <asm/iommu.h>
+#include <asm/machdep.h>
+#include <asm/dma.h>
+#include <asm/cputable.h>
+#include <asm/time.h>
+#include <asm/of_device.h>
+#include <asm/lmb.h>
+#include <asm/mpic.h>
+#include <asm/smp.h>
+#include <asm/udbg.h>
+#include <asm/serial.h>
+
+extern int pas_set_rtc_time(struct rtc_time *tm);
+extern void pas_get_rtc_time(struct rtc_time *tm);
+extern unsigned long pas_get_boot_time(void);
+extern void pas_pci_init(void);
+extern void pas_pcibios_fixup(void);
+
+static void pas_restart(char *cmd)
+{
+ printk("restart unimplemented, looping...\n");
+ for (;;) ;
+}
+
+static void pas_power_off(void)
+{
+ printk("power off unimplemented, looping...\n");
+ for (;;) ;
+}
+
+static void pas_halt(void)
+{
+ pas_power_off();
+}
+
+#ifdef CONFIG_SMP
+struct smp_ops_t pas_smp_ops = {
+ .probe = smp_mpic_probe,
+ .message_pass = smp_mpic_message_pass,
+ .kick_cpu = smp_generic_kick_cpu,
+ .setup_cpu = smp_mpic_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
+};
+#endif /* CONFIG_SMP */
+
+void __init pas_setup_arch(void)
+{
+ /* init to some ~sane value until calibrate_delay() runs */
+ loops_per_jiffy = 50000000;
+
+ /* Setup SMP callback */
+#ifdef CONFIG_SMP
+ smp_ops = &pas_smp_ops;
+#endif
+ /* Lookup PCI hosts */
+ pas_pci_init();
+
+#ifdef CONFIG_DUMMY_CONSOLE
+ conswitchp = &dummy_con;
+#endif
+
+ printk(KERN_DEBUG "Using default idle loop\n");
+}
+
+static void iommu_dev_setup_null(struct pci_dev *dev) { }
+static void iommu_bus_setup_null(struct pci_bus *bus) { }
+
+static void __init pas_init_early(void)
+{
+ /* No iommu code yet */
+ ppc_md.iommu_dev_setup = iommu_dev_setup_null;
+ ppc_md.iommu_bus_setup = iommu_bus_setup_null;
+ pci_direct_iommu_init();
+}
+
+/* No legacy IO on our parts */
+static int pas_check_legacy_ioport(unsigned int baseport)
+{
+ return -ENODEV;
+}
+
+static __init void pas_init_IRQ(void)
+{
+ struct device_node *np = NULL;
+ struct device_node *root, *mpic_node = NULL;
+ unsigned long openpic_addr = 0;
+ const unsigned int *opprop;
+ int naddr, opplen;
+ struct mpic *mpic;
+
+ np = of_find_node_by_type(np, "open-pic");
+ if (!np) {
+ printk(KERN_ERR "No interrupt controller in device tree.\n");
+ return;
+ }
+ mpic_node = of_node_get(np);
+
+ /* Find address list in /platform-open-pic */
+ root = of_find_node_by_path("/");
+ naddr = prom_n_addr_cells(root);
+ opprop = get_property(root, "platform-open-pic", &opplen);
+ if (opprop != 0) {
+ openpic_addr = of_read_number(opprop, naddr);
+ printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
+ }
+ of_node_put(root);
+
+ mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0,
+ " PAS-OPIC ");
+ BUG_ON(mpic == NULL);
+
+ mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
+ mpic_init(mpic);
+ of_node_put(mpic_node);
+ of_node_put(root);
+}
+
+static void __init pas_progress(char *s, unsigned short hex)
+{
+ printk("[%04x] : %s\n", hex, s ? s : "");
+}
+
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init pas_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
+ return 0;
+
+ hpte_init_native();
+
+ return 1;
+}
+
+define_machine(pas) {
+ .name = "PA Semi PA6T-1682M",
+ .probe = pas_probe,
+ .setup_arch = pas_setup_arch,
+ .init_early = pas_init_early,
+ .init_IRQ = pas_init_IRQ,
+ .get_irq = mpic_get_irq,
+ .pcibios_fixup = pas_pcibios_fixup,
+ .restart = pas_restart,
+ .power_off = pas_power_off,
+ .halt = pas_halt,
+ .get_boot_time = pas_get_boot_time,
+ .set_rtc_time = pas_set_rtc_time,
+ .get_rtc_time = pas_get_rtc_time,
+ .calibrate_decr = generic_calibrate_decr,
+ .check_legacy_ioport = pas_check_legacy_ioport,
+ .progress = pas_progress,
+};
Index: merge/arch/powerpc/platforms/pasemi/time.c
===================================================================
--- /dev/null
+++ merge/arch/powerpc/platforms/pasemi/time.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006 PA Semi, Inc
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/config.h>
+#include <linux/sched.h>
+#include <linux/bcd.h>
+
+#include <asm/time.h>
+
+void pas_get_rtc_time(struct rtc_time *tm)
+{
+}
+
+int pas_set_rtc_time(struct rtc_time *tm)
+{
+ return -ENODEV;
+}
+
+unsigned long __init pas_get_boot_time(void)
+{
+#if 0
+ struct rtc_time tm;
+
+ pas_get_rtc_time(&tm);
+
+ return mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+#else
+ /* Let's just return a fake date right now */
+ return mktime(2006, 1, 1, 12, 0, 0);
+#endif
+}
^ permalink raw reply
* [5/5] powerpc: PA Semi PWRficient MAINTAINER entry
From: Olof Johansson @ 2006-09-05 17:30 UTC (permalink / raw)
To: paulus, anton; +Cc: linuxppc-dev
In-Reply-To: <20060904175742.5472a6fa@localhost.localdomain>
Maintainer entry for PWRficient
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: merge/MAINTAINERS
===================================================================
--- merge.orig/MAINTAINERS
+++ merge/MAINTAINERS
@@ -1777,6 +1777,13 @@ W: http://www.penguinppc.org/
L: linuxppc-embedded@ozlabs.org
S: Maintained
+LINUX FOR POWERPC PA SEMI PWRFICIENT
+P: Olof Johansson
+M: olof@lixom.net
+W: http://www.pasemi.com/
+L: linuxppc-dev@ozlabs.org
+S: Supported
+
LLC (802.2)
P: Arnaldo Carvalho de Melo
M: acme@conectiva.com.
^ permalink raw reply
* Re: [U-Boot-Users] OT: Re: Status of OF in TQM8540 and linux-2.6.17.11
From: Clemens Koller @ 2006-09-05 18:06 UTC (permalink / raw)
Cc: linuxppc-embedded
In-Reply-To: <20060905153925.F1384353A15@atlas.denx.de>
Hi, Wolfgang!
Success!
>> The upper defines need to reside in the board-specific code for tqm as well as for other boards
>> utilizing such scheme (see platforms/85xx/mpc85xx_ads_common.h for instance).
>
>
> Thanks for pointing out.
>
> Clemens, plese try again (commit id cd4ebbc9b95434977e5f182b9a22d7d1de0748ce)
Jup, that works!
Just for the records: As of Sept 05 2006,
U-Boot 1.1.4-gf60ba0d3 and linux-2.6-denx-cd4ebbc9b (aka: 2.6.18-rc5-git)
is known to boot on the TQM8540 + STK85XX in the default configurations.
Thank you!
Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany
http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19
^ permalink raw reply
* Compile Error
From: wei.li4 @ 2006-09-05 18:20 UTC (permalink / raw)
To: linuxppc-embedded
Hi All,
I am working on linux-2.6.18-rc2-g73a589b5.tar.bz2 for MPC875, the
cross-tools are from ELDK 4.0. After configuration and do 'make
zImage', I got these error:
CC arch/ppc/boot/simple/m8xx_tty.o
arch/ppc/boot/simple/m8xx_tty.c:32: error: static declaration of 'cpmp'
follows non-static declaration
include/asm/commproc.h:74: error: previous declaration of 'cpmp' was here
make[2]: *** [arch/ppc/boot/simple/m8xx_tty.o] Error 1
I also got these errors if I used these tools on Linux 2.6.13, but
there is no error if I use tools from ELDK 3.1.1, can anyone help me
figure it out? Thanks.
^ permalink raw reply
* Re: [3/5] powerpc: PA6T cputable entry, PVR value
From: Michael Neuling @ 2006-09-05 18:43 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus, anton
In-Reply-To: <20060905122808.36c0c88d@localhost.localdomain>
> #define PV_630p 0x0041
> #define PV_970MP 0x0044
> #define PV_BE 0x0070
> +#define PV_PA6T 0x0090
> +
>
> /*
> * Number of entries in the SLB. If this ever changes we should handle
Should be a space not a tab after the #define. Also extra new line is
not required.
Mikey "White space king" Neuling
^ permalink raw reply
* Re: Serial problem with MPC8241-based board
From: Mark A. Greer @ 2006-09-05 18:49 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linuxppc-embedded
In-Reply-To: <Pine.LNX.4.60.0609032112260.3944@poirot.grange>
On Sun, Sep 03, 2006 at 09:58:25PM +0200, Guennadi Liakhovetski wrote:
Hi Guennadi,
> Mark, may I use this opportunity to ask you for your current consistent
> snapshot of both powerpc/boot and powerpc/platforms and whatever others? I
> can compile a kernel with ARCH=powerpc for linkstation, now I have to find
> a way to boot it. My choices are kexec or u-boot. Neither will run
> out-of-the-box, so...
I'm in the middle of making a bunch of changes to the bootwrapper
patches so I don't have a good set of patches for you.
Hopefully in a day or two at which time I'll be happy to share them with you.
> BTW, I would be greatful for any help with setting up kexec.
I can't help you there. You could try asking Milton Miller.
Mark
^ permalink raw reply
* Re: MPC8245 reset register
From: Reeve Yang @ 2006-09-05 18:49 UTC (permalink / raw)
To: Jon Scully; +Cc: linuxppc-embedded
In-Reply-To: <53107f6e0609021647l1f1cd84du496e3cd7219b603@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
Hi Jon,
Could you elaborate it a bit? I wrote 0x1 to PI register, but CPU hangs
without resetting. I'm kind of curious what's the proper way to reset the
8245 CPU? For anyone who doesn't know MPC8245, which is 603e core.
Thanks a lot.
- Reeve
On 9/2/06, Jon Scully <jonscully@gmail.com> wrote:
>
> On 9/2/06, Reeve Yang <yang.reeve@gmail.com> wrote:
> > Can anyone tell me which register should I use to do soft reset on
> MPC8241/5
> > CPU? I searched its manuall but only find EPIC to send SRESET exception
> on
> > offset 0x41090.
> >
> > Thanks.
> >
> > - Reeve
> >
>
> Use the reset instruction (RST in assembly).
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
[-- Attachment #2: Type: text/html, Size: 1319 bytes --]
^ permalink raw reply
* Re: pci error recovery procedure
From: Linas Vepstas @ 2006-09-05 18:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Zhang, Yanmin, Yanmin Zhang, LKML, Rajesh Shah, linuxppc-dev,
linux-pci maillist
In-Reply-To: <1157360592.22705.46.camel@localhost.localdomain>
On Mon, Sep 04, 2006 at 07:03:12PM +1000, Benjamin Herrenschmidt wrote:
>
> > As you know, all functions of a device share the same bus number and 5 bit dev number.
> > They just have different 3 bit function number. We could deduce if functions are in the same
> > device (slot).
>
> Until you have a P2P bridge ...
And this is not theoretical: for example, the matrox graphics cards:
0000:c8:01.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 13)
0000:c9:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G400 AGP (rev 85)
Now, I could have sworn there was another device behind this bridge,
some serial or joystick controller or something, although this
particular card doesn't seem to have it.
------
It's not clear to me what hardware may show up in the future.
For example, someone may build a 32x PCI-E card that will act
as a bridge to a drawer with half-a-dozen ordinary PCI-X slots
in it. This is perhaps a bit hypothetical, but changing the API
will make it harder to implement eror recovery for such a system.
FWIW, there is at least one pSeries system in the lab which has
several hundred PCI slots attached to it, although I've never
done testing on it. Hmm. Maybe its time I did ...
--linas
^ permalink raw reply
* Re: [2.6.19 PATCH 1/7] ehea: interface to network stack
From: Francois Romieu @ 2006-09-05 18:58 UTC (permalink / raw)
To: Thomas Klein
Cc: Jan-Bernd Themann, netdev, linux-kernel, Christoph Raisch,
linux-ppc, Marcus Eder
In-Reply-To: <44FD931A.3080107@de.ibm.com>
Thomas Klein <osstklei@de.ibm.com> :
[...]
> Somehow I don't get your point concerning the usage of 'k'. We need another
> iterator as the for loops using 'k' use 'i' as their terminating condition.
Something like the code below perhaps (with more local variables maybe):
static int ehea_reg_interrupts(struct net_device *dev)
{
struct ehea_port *port = netdev_priv(dev);
struct ehea_port_res *pr;
int i, ret;
for (i = 0; i < port->num_def_qps; i++) {
pr = &port->port_res[i];
snprintf(pr->int_recv_name, EHEA_IRQ_NAME_SIZE - 1
, "%s-recv%d", dev->name, i);
ret = ibmebus_request_irq(NULL, pr->recv_eq->attr.ist1,
ehea_recv_irq_handler, SA_INTERRUPT,
pr->int_recv_name, pr);
if (ret) {
ehea_error("failed registering irq for ehea_recv_int:"
"port_res_nr:%d, ist=%X", i,
pr->recv_eq->attr.ist1);
goto err_free_irq_recv_eq_0;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for funct ehea_recv_int %d "
"registered", pr->recv_eq->attr.ist1, i);
}
snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-aff", dev->name);
ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
ehea_qp_aff_irq_handler,
SA_INTERRUPT, port->int_aff_name, port);
if (ret) {
ehea_error("failed registering irq for qp_aff_irq_handler:"
" ist=%X", port->qp_eq->attr.ist1);
goto err_free_irq_recv_eq_0;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for function qp_aff_irq_handler "
"registered", port->qp_eq->attr.ist1);
for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
pr = &port->port_res[i];
snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-send%d", dev->name, i);
ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1,
ehea_send_irq_handler, SA_INTERRUPT,
pr->int_send_name, pr);
if (ret) {
ehea_error("failed registering irq for ehea_send"
" port_res_nr:%d, ist=%X", i,
pr->send_eq->attr.ist1);
goto err_free_irq_send_eq_1;
}
if (netif_msg_ifup(port))
ehea_info("irq_handle 0x%X for function ehea_send_int "
"%d registered", pr->send_eq->attr.ist1, i);
}
out:
return ret;
err_free_irq_send_eq_1:
// Post-dec works with unsigned int too.
while (i-- > 0) {
u32 ist = port->port_res[i].send_eq->attr.ist1;
ibmebus_free_irq(NULL, ist, &port->port_res[i]);
}
ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port);
i = port->num_def_qps;
err_free_irq_recv_eq_0:
while (i-- > 0) {
u32 ist = port->port_res[i].recv_eq->attr.ist1;
ibmebus_free_irq(NULL, ist, &port->port_res[k]);
}
goto out;
}
^ permalink raw reply
* Re: pci error recovery procedure
From: Linas Vepstas @ 2006-09-05 19:01 UTC (permalink / raw)
To: Zhang, Yanmin
Cc: Yanmin Zhang, LKML, Rajesh Shah, linuxppc-dev, linux-pci maillist
In-Reply-To: <1157423528.20092.365.camel@ymzhang-perf.sh.intel.com>
On Tue, Sep 05, 2006 at 10:32:08AM +0800, Zhang, Yanmin wrote:
> Is it the exclusive reason to have multi-steps?
I don't understand the question. A previous email explained the reason
to have mutiple steps.
> 1) Here link reset and hard reset are hardware operations, not the
> link_reset and slot_reset callback in pci_error_handlers.
I don't understand the comment.
> 2) Callback error_detected will notify drivers there is PCI errors. Drivers
> shouldn't do any I/O in error_detected.
It shouldn't matter. If it is truly important for a particular platform
to make sure that there is no i/o, then the low-level i/o routines
could be modified to drop any accidentally issued i/o on the floor.
This doesn't require a change to either the API or the policy.
> 3) If both the link and slot are reset after all error_detected are called,
> the device should go back to initial status and all DMA should be stopped
> automatically. Why does the driver still need a chance to stop DMA?
As explained previously, not all drivers may want to have a full
electrical device reset.
> The
> error_detected of the drivers in the latest kernel who support err handlers
> always returns PCI_ERS_RESULT_NEED_RESET. They are typical examples.
Just because the current drivers do it this way does not mean that this is
the best way to do things. A full reset is time-consuming. Some drivers
may want to implement a faster and quicker reset.
--linas
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox