Documente Academic
Documente Profesional
Documente Cultură
2 00 5
INCA-IP
L
I n f i n e on L A N P h on e S o f t w a r e S o l ut i o n
IA
( L i n ux / S IP ) I n t e g r a t i o n G u i d e
R e l e a s e 1 .1
T
A
ND
N
th
E
wi
ID
n
io
ut
F
rib
st
N
Di
O
C
W i r e l i n e C om m u n i c at i o n s
N e v e r s t o p t h i n k i n g .
INCA-IP LAN Phone
Software Integration Guide
CONFIDENTIAL
PSB 21553 Infineon LAN Phone Software Solution (Linux/SIP) Integration Guide
CONFIDENTIAL
Revision History: 2005-03-18, Rev. 1
Previous Version:
Page Subjects (major changes since last revision)
Trademarks
ABM®, ACE®, AOP®, ARCOFI®, ASM®, ASP®, DigiTape®, DuSLIC®, EPIC®, ELIC®, FALC®, GEMINAX®, IDEC®,
INCA®, IOM®, IPAT®-2, ISAC®, ITAC®, IWE®, IWORX®, MUSAC®, MuSLIC®, OCTAT®, OptiPort®, POTSWIRE®,
QUAT®, QuadFALC®, SCOUT®, SICAT®, SICOFI®, SIDEC®, SLICOFI®, SMINT®, SOCRATES®, VINETIC®,
10BaseV®, 10BaseVX® are registered trademarks of Infineon Technologies AG. 10BaseS™, EasyPort™,
VDSLite™ are trademarks of Infineon Technologies AG. Microsoft® is a registered trademark of Microsoft
Corporation, Linux® of Linus Torvalds, Visio® of Visio Corporation, and FrameMaker® of Adobe Systems
Incorporated.
CONFIDENTIAL
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 The Bootloader U-Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 cpu/mips/start.S:_start() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 board/incaip/memsetup.S:memsetup() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 lib_mips/board.c:board_init_r() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 board/incaip/flash.c:flash_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 board/incaip/flash.c:jffs2_part_info() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6 include/flash.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 The Linux Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 arch/mips/kernel/head.S:kernel_entry() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 arch/mips/infineon/incaip/basic/prom.c:prom_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 init/main.c:start_kernel() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 drivers/mtd/maps/incaip.c:init_incaip_mtd() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.5 arch/mips/defconfig-incaip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CONFIDENTIAL
List of Tables
CONFIDENTIAL
List of Figures
CONFIDENTIAL Introduction
1 Introduction
This document is intended to help developers to integrate the existing Infineon LAN Phone software solution into
their own designs. Each chapter focuses on a specific part of the software (boot loader or Linux kernel). For U-Boot
it gives an overview of what happens during boot.
Each file is described separately and the main function is specified in the chapter title. If it might be necessary to
apply some changes in order to port the software to a new design it will be mentioned.
Notes:
1. This guide assumes the usage of an INCA-IP as CPU. It is not intended to be a porting guide for any other
MIPS based CPU.
2. For changes regarding HAPI please refer to “LAN Phone - User’s Manual Software Descrition” chapter 6
“Customization Examples”.
cpu/mips/start.S:_start()
yyy
board/incaip/memsetup.S:memsetup()
ebu_setup()
cgu_setup()
sdram_setup()
yyy
Relocate code from flash to RAM
lib_mips/board.c:board_init_r()
yyy
board/incaip/flash.c:flash_init()
Networking initialization
Console setup
yyy
Start command line from common/main.c:main_loop()
U-BOOT-STARTUP-SEQUENCE
2.1 cpu/mips/start.S:_start()
This file contains the first executed code after a power-up or reset. The _start label marks the beginning of the
exception vector table, where the first entry is a jump to the U-Boot entry point (reset:) and the second entry is the
software reboot vector. All other exception vectors are set to a default handler, which just consists of an endless
loop.
In case of the INCA-IP the first two entries are followed by a 32bit word which is the configuration word for the
EBU. When using external memory as source for boot code, this dataword is fetched by the EBU “blindly” after
reset and it is used to configure the EBU before fetching the first code. If the external memory cannot be accessed
with the default value for BUSCON0 the correct value needs to be set here (see chapter 13.2.4 in “User’s Manual
Hardware Description” for details). For 100MHz the default value for the EBU config word is 0x000020C4, which
enables write accesses to the memory at chip select 0, with 3 read wait states and 1 recovery cycle.
_start:
RVECENT(reset,0)/* U-boot entry point */
RVECENT(reset,1)/* software reboot */
#if defined(CONFIG_INCA_IP)
.word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
.word 0x00000000 /* phase of the flash */
#else
RVECENT(romReserved,2)
#endif
RVECENT(romReserved,3)
RVECENT(romReserved,4)
RVECENT(romReserved,5)
...
/* Exception handlers. */
romReserved:
b romReserved
The reset routine will initialize internal CPU registers and check whether an NMI occurred. Then memory (function
memsetup()) and caches (function mips_cache_reset()) will be initialized before the code is relocated from flash
to RAM (function board_init_f() in file lib_mips/board.c). After relocation the bootloader will continue with function
board_init_r() in file lib_mips/board.c.
2.2 board/incaip/memsetup.S:memsetup()
In an early stage of the boot phase it is necessary to set up EBU, CPU frequency and SDRAM. Function
memsetup() calls a separate function for each item.
ebu_init() initializes all BUSCON and ADDSEL registers. If any other device is connected to the INCA-IP via EBU
the corresponding BUSCON and ADDSEL values need also to be configured here (for example the buswidth often
needs to be set to the correct value).
During compilation the default clock rate is defined (100 MHz or 150 MHz). cgu_init() configures the internal PLL
to use this clock rate. Normally there are no changes needed here.
sdram_init() configures the SDRAM memory controller. Depending on the type of SDRAM it might be necessary
to adjust settings (for example size, number of columns/rows, timing etc.). Check SDRAM datasheet for details
about these settings and User’s Manual Hardware Description for information on how to correctly configure the
SDRAM controller.
2.3 lib_mips/board.c:board_init_r()
Function board_init_r() is called after the code was relocated to RAM. Memory management, networking and other
devices are initialized now. If there is an external device that should be supported by U-Boot, it can be configured
here. Flash memory is initialized by calling flash_init() in file board/incaip/flash.c.
If the MAC address for the Ethernet device is not stored as an U-Boot environment variable it should be read from
the appropriate location before eth_initialize() is called.
2.4 board/incaip/flash.c:flash_init()
flash_init() will set up the flash and return the flash size. During compilation the number of flash banks and memory
location is defined. With these values U-Boot probes for known flash chips by checking the manufacturer code of
the flash (function flash_get_size()). If some unknown flash is used flash_get_size() needs to be adapted to
support the new flash type.
...
Note: Due to the implementation of the external device access of the INCA-IP, it is necessary to switch the
addresses for flash probing. The code example takes this into account, by reading first addr[1] and then
addr[0].
2.5 board/incaip/flash.c:jffs2_part_info()
In the current version the JFFS2 root partition, which can be accessed by U-Boot starts at 0xB0400000. If the
partition should be located elsewhere the offset and size needs to be modified in jffs2_part_info().
2.6 include/flash.h
If a new flash type should be supported by U-Boot, the manufacturer ID and the flash ID should be defined here.
3.1 arch/mips/kernel/head.S:kernel_entry()
The kernel is started by calling kernel_entry(). This function will set up the stackpointer, clear the bss segment and
then call init_arch() to proceed with the booting process. The kernel needs some registers set up before starting
(see Table 2). U-Boot will do this correctly. If another bootloader is used, it needs to be checked whether these
registers are supported.
As an example of how to set up the register, the following script for the Lauterbach JTAG debugger can be used:
Register.RESet
Register.Set PC kernel_entry
Register.Set R4 2 ; argc
Register.Set R5 0x800c0000 ; argv
Register.Set R6 0x800c0100 ; envp
Register.Set R7 0x04000000 ; memsize
Data.Set 0x800c0000 %l 0x800c0010 0x800c0020 ; argv
Data.Set 0x800c0010 "go" 0 ; first argument
Data.Set 0x800c0020 "root=/dev/ram rootfstype=romfs" 0 ; boot cmd
Data.Set 0x800c0100 %l 0x800c0110 0x800c0120 0x800c0140 0x00000000; envp
Data.Set 0x800c0110 "memsize=16" 0 ; memory size
Data.Set 0x800c0120 "flash_start=0xb0000000" 0 ; flash start address
Data.Set 0x800c0140 "flash_size=16777216" 0 ; flash size
3.2 arch/mips/infineon/incaip/basic/prom.c:prom_init()
prom_init() checks the provided environment array for values like memsize and flash location. Depending on the
type of bootloader used, the format of this data might be different. If the bootloader does not provide such an
environment at all it should be changed here accordingly.
3.3 init/main.c:start_kernel()
start_kernel() is the first architecture independent function, that is called. After initializing basic functions like
interrupt handling and caches, the init() task is created and the main task will enter the idle loop. init() will set up
system busses and call all init functions, which were registered with the __init macro during compilation. Then
/sbin/init is started as first user space program. If anything special (like setting some GPIO pins) needs to be done
to initialize devices on the board it should be done as part of an __init function. If this is not possible since a special
calling order needs to be obeyed, such a function can be called from init() directly.
3.4 drivers/mtd/maps/incaip.c:init_incaip_mtd()
Linux uses Memory Technology Devices (MTD) for flash support. There are some access functions that might
need adaptation if the type of flash memory is different from the INCA-IP Demo board (for example 8bit instead of
16bit bus width).
For each flash chip a partition layout needs to be defined (structures incaip_partitions and incaip_fs_partitions).
This layout needs to be changed to support the actual amount of flash memory on a specific board. For example
if only 8MB flash is available then the incaip_fs_partitions structure could be removed.
3.5 arch/mips/defconfig-incaip
Due to the flexibility of the INCA-IP multiplexing system it is possible that for a new design the number of supported
LEDs, keys and GPIO pins is different than for the Infineon demo board. To be able to support all kinds of designs,
the multiplex settings can be defined for each pin during compilation of the Linux kernel.
By running “make menuconfig”, it is possible to create a custom setting for an unsupported board, which can be
converted later to a new default setting for that board. There are already some boards defined, which can be used
as an example on how to add a new board setup.