* [U-Boot-Users] Zilog Z85230 serial communication controller
@ 2005-02-09 14:28 "Häpe, Sebastian, HRD/AB"
2005-02-09 14:44 ` Jerry Van Baren
2005-02-09 15:14 ` Wolfgang Denk
0 siblings, 2 replies; 3+ messages in thread
From: "Häpe, Sebastian, HRD/AB" @ 2005-02-09 14:28 UTC (permalink / raw)
To: u-boot
Hi again!
Currently I try to integrate a Zilog Z85230 serial communication controller
on a 603e-based board to work with U-Boot.
For testing reasons I wrote a little inline assembler program looking like
that:
#include <common.h>
#ifdef CFG_Z85230
#if CONFIG_CONS_INDEX == 1
#else
#error no valid console defined
#endif
int serial_init (void)
{
/* First we load the _physical_ address of the chip's cntrol
register to R3 */
__asm__ __volatile__ ("addis 3, 0, 0x0000");
__asm__ __volatile__ ("addis 3,0,0xF500");
__asm__ __volatile__ ("ori 3,3,0x00D0");
/* Load the address of the chip's data rgister to R2 */
__asm__ __volatile__ ("addis 2, 0, 0x0000");
__asm__ __volatile__ ("addis 2,0,0xF500");
__asm__ __volatile__ ("ori 2,2,0x00D8");
/* Here some configuration for the serial controller is done, use R4
*/
__asm__ __volatile__ ("li 4, 0x04");
__asm__ __volatile__ ("stb 4, 0(3)");
__asm__ __volatile__ ("li 4, 0x44");
__asm__ __volatile__ ("stb 4, 0(3)");
.
.
.
.
/* Write one character ('I') */
__asm__ __volatile__ ("addis 4, 0, 0x0000");
__asm__ __volatile__ ("li 4, 0x49");
__asm__ __volatile__ ("stb 4, 0(2)");
return(0);
}
.
.
.
When I compile this, load it into RAM and execute it, everything is fine,
MiniCom shows an 'I'.
Now I put this litte function into the file serial.c from U-Boot and compile
it.
Then I load U-Boot to Flash and run it. I'm tested before, wheather the
function is always called and it is.
When I run it, I get an error, caused by the MMU, because it cannot
translate the demanded address (it's a physical one).
Now I tried to disable the data-address-translation on the beginning of the
function and re-enable it at the end, always surrounded by an
'isync'-command. It this case, the program runs, but without any output via
the serial port.
Is it legal to disable the MMU in this context and how should I configure
U-Boot for my memory map?
I have the following memory map on my board:
0x00000000 - 0x007FEFFF SRAM
0xF5000000 - Serial Interface #1 Channel B Control
0xF5000008 - Serial Interface #1 Channel B Data
.
.
.
0xF50000D0 - Serial Interface #3 Channel A Control
0xF50000D8 - Serial Interface #3 Channel A Data
0xFF800000 - 0xFFFFFFFF Flash
Thanks for ideas or advices why this doesn't work?
Sebastian H?pe
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot-Users] Zilog Z85230 serial communication controller
2005-02-09 14:28 [U-Boot-Users] Zilog Z85230 serial communication controller "Häpe, Sebastian, HRD/AB"
@ 2005-02-09 14:44 ` Jerry Van Baren
2005-02-09 15:14 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Jerry Van Baren @ 2005-02-09 14:44 UTC (permalink / raw)
To: u-boot
H?pe, Sebastian, HRD/AB wrote:
> Hi again!
>
> Currently I try to integrate a Zilog Z85230 serial communication controller
> on a 603e-based board to work with U-Boot.
[snip]
> When I compile this, load it into RAM and execute it, everything is fine,
> MiniCom shows an 'I'.
I assume you are putting a stand-alone snippet of code in RAM -- in this
case, your MMU and caches are disabled.
> Now I put this litte function into the file serial.c from U-Boot and compile
> it.
> Then I load U-Boot to Flash and run it. I'm tested before, wheather the
> function is always called and it is.
>
> When I run it, I get an error, caused by the MMU, because it cannot
> translate the demanded address (it's a physical one).
> Now I tried to disable the data-address-translation on the beginning of the
> function and re-enable it at the end, always surrounded by an
> 'isync'-command. It this case, the program runs, but without any output via
> the serial port.
>
> Is it legal to disable the MMU in this context and how should I configure
> U-Boot for my memory map?
>
> I have the following memory map on my board:
>
> 0x00000000 - 0x007FEFFF SRAM
>
> 0xF5000000 - Serial Interface #1 Channel B Control
> 0xF5000008 - Serial Interface #1 Channel B Data
> .
> .
> .
> 0xF50000D0 - Serial Interface #3 Channel A Control
> 0xF50000D8 - Serial Interface #3 Channel A Data
>
> 0xFF800000 - 0xFFFFFFFF Flash
>
> Thanks for ideas or advices why this doesn't work?
>
> Sebastian H?pe
It doesn't run from u-boot because you have not mapped the physical
memory space using a BAT (or other MMU method). You need to map the
memory area _and mark it uncached_.
By disabling the MMU around the call, you got around the memory
protection issue, but now you have a caching issue: u-boot will be
running with data caching enabled (and instruction caching, but that
shouldn't be a problem). When you do your write to the control
registers you are only writing to cache, not to the registers
themselves. There is no reason for the CPU to write your register-bound
data to the registers, so you never see anything coming out.
The only way to make this work is to understand and use the MMU and
cache control or disable them altogether (hint: disabling is not a good
choice other than proof-of-concept testing :-).
* Do some User Manual reading on your processor, concentrating on the
sections covering MMU (DBATs) and cache.
* Figure out which DBAT(s) are available for use and use one of them to
map your peripheral space.
gvb
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] Zilog Z85230 serial communication controller
2005-02-09 14:28 [U-Boot-Users] Zilog Z85230 serial communication controller "Häpe, Sebastian, HRD/AB"
2005-02-09 14:44 ` Jerry Van Baren
@ 2005-02-09 15:14 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2005-02-09 15:14 UTC (permalink / raw)
To: u-boot
In message <2D9AB865A49FD511914700105A0EF67901C6F198@morse.smart.lfk.eads.net> you wrote:
>
> Currently I try to integrate a Zilog Z85230 serial communication
> controller
> on a 603e-based board to work with U-Boot.
Jerry van Baren already explained you the core problem (memory
mapping) of your approach.
> For testing reasons I wrote a little inline assembler program looking
> like that:
My question is: why do you write this in assembler? There is no
reason to do this. Please write your code in C if you hope to see it
added to U-Boot one day.
Viele Gr??e,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wenn das dann in die Hose geht, nehme ich es auf meine Kappe.
-- Rudi V?ller, 15. Nov 2003
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-02-09 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-09 14:28 [U-Boot-Users] Zilog Z85230 serial communication controller "Häpe, Sebastian, HRD/AB"
2005-02-09 14:44 ` Jerry Van Baren
2005-02-09 15:14 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.