From: Matt Porter <hidden> Date: 2002-05-28 13:23:51
On Tue, May 28, 2002 at 07:38:19PM +0900, Sangmoon Kim wrote:
Hi,
quoted
No, that's rubbish. Use one or the other. ioremap() takes a physical
address and returns the virtual address at which it mapped it.
Sometimes it is needed to use io_block_mapping and ioremap.
io_block_mapping maps a phiscal address to a virtual address.
And ioremap returns the virtual address.
When I ported linux on an MPC755 based custom board.
My hardware didn't running because it had a serial port at 0x78000000.
Linux uses 0 to 0x7fffffff as a virtual memory for applications.
And the address of 0x78000000 overlaped the serial port.
I had to use io_block_mapping to map it at different location on system initialization,
and ioremap to get the mapped address on serial port driver.
I'm sorry, if it's another rubbish.
You don't need io_block_mapping. Follow one of the many examples to
use early_serial_init with an ioremap call for your UART.
The only reason your method works is that the io_block_mapping is
actually using a BAT on our classic PPC platform. ioremap will
look for an existent BAT mapping and just return the translated
virtual address in this case. Relying on this is bad practice
since it will not work on other PPC systems.
As David correctly pointed out, only use io_block_mapping when
you absolutely must control the placement of the virtual address.
There are cases when this is necessary since the hardware engineers
always send us garbage to support. Mapping a UART at init time is
not one of these.
BTW, your UART at physical 0x78000000 has zero bearing on the default
PPC Linux task size virtual addresses from 0-0x7fffffff.
Regards,
--
Matt Porter
porter@cox.net
This is Linux Country. On a quiet night, you can hear Windows reboot.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Sangmoon Kim <hidden> Date: 2002-05-29 04:57:34
Hi,
You don't need io_block_mapping. Follow one of the many examples to
use early_serial_init with an ioremap call for your UART.
The only reason your method works is that the io_block_mapping is
actually using a BAT on our classic PPC platform. ioremap will
look for an existent BAT mapping and just return the translated
virtual address in this case. Relying on this is bad practice
since it will not work on other PPC systems.
Right, I exactly wanted to do that.
I called io_block_mapping() on initialization code.
More precisly on <board name>_map_io(),
which is in arch/ppc/platforms/<board_name>_setup().
It has nothing to do with competibility.
And... Is there any ppc without BAT?
I didn't know that.
As David correctly pointed out, only use io_block_mapping when
you absolutely must control the placement of the virtual address.
Than, if the system initialization code is changed,
the driver code should be changed too.
There are cases when this is necessary since the hardware engineers
always send us garbage to support. Mapping a UART at init time is
not one of these.
Actually, I'm a hardware guy.
In most cases, mapping UART is not needed,
but on the hardware I designed, it is needed.
Because its physical addres is 0x78000000.
Don't blame us too much.
It takes much money to change hardware.
- Sangmoon Kim -
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Roland Dreier <hidden> Date: 2002-05-29 05:47:21
quoted
quoted
quoted
quoted
"Sangmoon" == Sangmoon Kim [off-list ref] writes:
Sangmoon> Actually, I'm a hardware guy. In most cases, mapping
Sangmoon> UART is not needed, but on the hardware I designed, it
Sangmoon> is needed. Because its physical addres is 0x78000000.
You do not need to remap the UART. It doesn't matter that 0x78000000
is its address. Linux will not get confused between physical address
of the UART and any virtual address space it may be using. Just call
ioremap() and give it the address 0x78000000. It will give you a
virtual address you can use to access the UART.
Best,
Roland
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Sangmoon Kim <hidden> Date: 2002-05-29 06:01:36
Thank you.
I'll try that.
quoted
quoted
quoted
quoted
quoted
"Sangmoon" == Sangmoon Kim [off-list ref] writes:
Sangmoon> Actually, I'm a hardware guy. In most cases, mapping
Sangmoon> UART is not needed, but on the hardware I designed, it
Sangmoon> is needed. Because its physical addres is 0x78000000.
You do not need to remap the UART. It doesn't matter that 0x78000000
is its address. Linux will not get confused between physical address
of the UART and any virtual address space it may be using. Just call
ioremap() and give it the address 0x78000000. It will give you a
virtual address you can use to access the UART.
Best,
Roland
From: David Gibson <hidden> Date: 2002-05-29 05:47:37
On Wed, May 29, 2002 at 01:57:34PM +0900, Sangmoon Kim wrote:
Hi,
quoted
You don't need io_block_mapping. Follow one of the many examples to
use early_serial_init with an ioremap call for your UART.
The only reason your method works is that the io_block_mapping is
actually using a BAT on our classic PPC platform. ioremap will
look for an existent BAT mapping and just return the translated
virtual address in this case. Relying on this is bad practice
since it will not work on other PPC systems.
Right, I exactly wanted to do that.
I called io_block_mapping() on initialization code.
More precisly on <board name>_map_io(),
which is in arch/ppc/platforms/<board_name>_setup().
It has nothing to do with competibility.
And... Is there any ppc without BAT?
I didn't know that.
Yes there are PPCs without BATs. e.g. 4xx.
quoted
As David correctly pointed out, only use io_block_mapping when
you absolutely must control the placement of the virtual address.
Than, if the system initialization code is changed,
the driver code should be changed too.
That's exactly why ioremap() is preferred - then the initialization
code doesn't need to touch it at all.
quoted
There are cases when this is necessary since the hardware engineers
always send us garbage to support. Mapping a UART at init time is
not one of these.
Actually, I'm a hardware guy.
In most cases, mapping UART is not needed,
but on the hardware I designed, it is needed.
Because its physical addres is 0x78000000.
Don't blame us too much.
It takes much money to change hardware.
Rubbish. Having a *physical* address of 0x78000000 is no problem at
all, ioremap() will map that (like any other physical address) into a
sensible virtual address.
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Sangmoon Kim <hidden> Date: 2002-05-29 06:14:24
OK,
I understand.
Thank you.
----- Original Message -----
From: "David Gibson" <redacted>
To: <redacted>
Sent: Wednesday, May 29, 2002 2:47 PM
Subject: Re: map iomem in linux_2_4_dev
On Wed, May 29, 2002 at 01:57:34PM +0900, Sangmoon Kim wrote:
quoted
Hi,
quoted
You don't need io_block_mapping. Follow one of the many examples to
use early_serial_init with an ioremap call for your UART.
The only reason your method works is that the io_block_mapping is
actually using a BAT on our classic PPC platform. ioremap will
look for an existent BAT mapping and just return the translated
virtual address in this case. Relying on this is bad practice
since it will not work on other PPC systems.
Right, I exactly wanted to do that.
I called io_block_mapping() on initialization code.
More precisly on <board name>_map_io(),
which is in arch/ppc/platforms/<board_name>_setup().
It has nothing to do with competibility.
And... Is there any ppc without BAT?
I didn't know that.
Yes there are PPCs without BATs. e.g. 4xx.
quoted
quoted
As David correctly pointed out, only use io_block_mapping when
you absolutely must control the placement of the virtual address.
Than, if the system initialization code is changed,
the driver code should be changed too.
That's exactly why ioremap() is preferred - then the initialization
code doesn't need to touch it at all.
quoted
quoted
There are cases when this is necessary since the hardware engineers
always send us garbage to support. Mapping a UART at init time is
not one of these.
Actually, I'm a hardware guy.
In most cases, mapping UART is not needed,
but on the hardware I designed, it is needed.
Because its physical addres is 0x78000000.
Don't blame us too much.
It takes much money to change hardware.
Rubbish. Having a *physical* address of 0x78000000 is no problem at
all, ioremap() will map that (like any other physical address) into a
sensible virtual address.
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
From: shaowei dai <hidden> Date: 2002-05-29 12:48:52
Hi, David, Sangmoon and all:
Thanks for all the input.
Now i understand why m8xx_pcmcia.c needs to use io_block_mapping. If we can
use ioremap in the driver, then
we don't need to map the io mem in kernel init. Maybe we can do some
improvement later on this driver.
regards
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/