* PCI confusion
@ 2001-02-15 17:54 Dag Nygren
0 siblings, 0 replies; 4+ messages in thread
From: Dag Nygren @ 2001-02-15 17:54 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I just got a 2.2.17 port working OK and started
with the 2.4.1 (from www.kernel.org).
I used the same BAT mapping and replaced my
old PCI mapping code with the one in arch/ppc/kernel/pci.c.
Now I am confused.....
The BAT maps PCI MEM space from 0xc0000000 to 0xe0000000 in
mm/init.c.
The PCI devices can bee seen fine when printing ie. the first one
in pci.c, after the fixup of the addresses. (with address 0xexxxxxxx).
But later when the driver tries to access the PCI devices memory space
the kernel oops:es with a memory access error (11).
What could I have overlooked?
What changed from 2.2.17 to 2.4.1 on the PCI side ?
BRGDS
--
Dag Nygren email: dag@newtech•fi
Oy NewTech Ab phone: +358 9 8024910
Trasktorpet 3 fax: +358 9 8024916
02360 ESBO GSM: 0400-426312
FINLAND
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* PCI confusion
@ 2001-03-08 15:54 Dag Nygren
2001-03-08 13:01 ` Matt Porter
0 siblings, 1 reply; 4+ messages in thread
From: Dag Nygren @ 2001-03-08 15:54 UTC (permalink / raw)
To: linuxppc-dev
Hi,
just spent some hours going through all
postings in the mailing list about PCI-setup,
but now i am even more confused....
The setup is:
Nonsupported (sofar) VME board with
a PreP address map and MPC107.
I have the board booting but the PCI-drivers
are all working through the I/O space and cannot see
the memoryspace of the PCI devices.
The questions I have are:
1. The I/O BAT:s are setup as follows:
BAT 0: 0x10000000@0x80000000 to virtual 0x80000000
BAT 1: 0x10000000@0xc0000000 to virtual 0xe0000000
ioremap_base = 0xe0000000
Are these OK ?
2. What is the right value for hose->pci_mem_offset ?
The physical 0xc0000000 or the address the processor sees
0xe0000000.
3. the driver I am using for testing (for the Tundra Universe) uses
the following construction:
baseaddr = ioremap(pci_resource_start(uni_pci_dev,0),
pci_resource_len (uni_pci_dev, 0));
Then request_mem_region() for the same resources.
Then pci_enable_device()
Then pci_set_master()
After this a access: temp = readl(baseaddr) will generate
an Oops with illegal access....
What am I doing wrong ?
My kernel is a stock 2.4.2 from ftp.kernel.org.
Many thanks for reading this
BRGDS
--
Dag Nygren email: dag@newtech•fi
Oy NewTech Ab phone: +358 9 8024910
Trasktorpet 3 fax: +358 9 8024916
02360 ESBO GSM: 0400-426312
FINLAND
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: PCI confusion
2001-03-08 15:54 Dag Nygren
@ 2001-03-08 13:01 ` Matt Porter
2001-03-08 14:54 ` Matt Porter
0 siblings, 1 reply; 4+ messages in thread
From: Matt Porter @ 2001-03-08 13:01 UTC (permalink / raw)
To: Dag Nygren; +Cc: linuxppc-dev
On Thu, Mar 08, 2001 at 05:54:28PM +0200, Dag Nygren wrote:
>
> Hi,
>
> just spent some hours going through all
> postings in the mailing list about PCI-setup,
> but now i am even more confused....
We can fix that...
> The setup is:
>
> Nonsupported (sofar) VME board with
> a PreP address map and MPC107.
>
> I have the board booting but the PCI-drivers
> are all working through the I/O space and cannot see
> the memoryspace of the PCI devices.
>
> The questions I have are:
>
> 1. The I/O BAT:s are setup as follows:
> BAT 0: 0x10000000@0x80000000 to virtual 0x80000000
> BAT 1: 0x10000000@0xc0000000 to virtual 0xe0000000
> ioremap_base = 0xe0000000
> Are these OK ?
That's fine. Hopefully, your PCI allocator locates PCI memory base
addresses at 0x00000000-0x10000000 so the BAT translation is used.
If you really want the low latency BAT translation, you'd better
be sure of placement or an ioremap is going to generate PTEs.
> 2. What is the right value for hose->pci_mem_offset ?
> The physical 0xc0000000 or the address the processor sees
> 0xe0000000.
In this case it's 0xc0000000. It is used to "fixup" the PCI mem
resources since those are defined to be an ioremmapable "token". As
you know in PReP (MPC10x map A) CPU and PCI memory space addresses
are not 1:1.
> 3. the driver I am using for testing (for the Tundra Universe) uses
> the following construction:
> baseaddr = ioremap(pci_resource_start(uni_pci_dev,0),
> pci_resource_len (uni_pci_dev, 0));
> Then request_mem_region() for the same resources.
> Then pci_enable_device()
> Then pci_set_master()
> After this a access: temp = readl(baseaddr) will generate
> an Oops with illegal access....
> What am I doing wrong ?
Also be sure that pci_mem_offset is 0x80000000 in the case of your
memory map. Otherwise, virt_to_bus() and the pci DMA API will not
generate appropriate PCI mem master addresses for your devices to
use.
> My kernel is a stock 2.4.2 from ftp.kernel.org.
Ports to board like these are much easier off of the linuxppc_2_5 tree
http://www.fsmlabs.com/linuxppcbk.html (port 5005). There are many
examples of similar boards (there's really nothing new out there
anyway).
--
Matt Porter
MontaVista Software, Inc.
mporter@home•com
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PCI confusion
2001-03-08 13:01 ` Matt Porter
@ 2001-03-08 14:54 ` Matt Porter
0 siblings, 0 replies; 4+ messages in thread
From: Matt Porter @ 2001-03-08 14:54 UTC (permalink / raw)
To: linuxppc-dev
On Thu, Mar 08, 2001 at 06:01:29AM -0700, Matt Porter wrote:
> > 3. the driver I am using for testing (for the Tundra Universe) uses
> > the following construction:
> > baseaddr = ioremap(pci_resource_start(uni_pci_dev,0),
> > pci_resource_len (uni_pci_dev, 0));
> > Then request_mem_region() for the same resources.
> > Then pci_enable_device()
> > Then pci_set_master()
> > After this a access: temp = readl(baseaddr) will generate
> > an Oops with illegal access....
> > What am I doing wrong ?
>
> Also be sure that pci_mem_offset is 0x80000000 in the case of your
> memory map. Otherwise, virt_to_bus() and the pci DMA API will not
> generate appropriate PCI mem master addresses for your devices to
> use.
Arg...that should be pci_dram_offset, of course.
--
Matt Porter
MontaVista Software, Inc.
mporter@mvista•com
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-03-08 15:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-15 17:54 PCI confusion Dag Nygren
-- strict thread matches above, loose matches on Subject: below --
2001-03-08 15:54 Dag Nygren
2001-03-08 13:01 ` Matt Porter
2001-03-08 14:54 ` Matt Porter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox