Commit ed407be5 authored by Pali Rohár's avatar Pali Rohár Committed by Tom Rini

New board support: Nokia RX-51 aka N900

Based on previous work by: Alistair Buxton <a.j.buxton@gmail.com>
Signed-off-by: default avatarPali Rohár <pali.rohar@gmail.com>
Cc: Ивайло Димитров <freemangordon@abv.bg>
parent 33a35bbb
......@@ -1013,6 +1013,10 @@ Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
armadillo-800eva R8A7740 (RMOBILE SoC)
Pali Rohár <pali.rohar@gmail.com>
nokia_rx51 ARM ARMV7 (OMAP34xx SoC)
-------------------------------------------------------------------------
Unknown / orphaned boards:
......
#
# (C) Copyright 2000, 2001, 2002
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# 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
#
include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).o
COBJS-y := $(BOARD).o
SOBJS-y := lowlevel_init.o
COBJS := $(sort $(COBJS-y))
SOBJS := $(sort $(SOBJS-y))
SRCS := $(COBJS:.o=.c) $(SOBJS:.o=.S)
OBJS := $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS))
$(LIB): $(obj).depend $(OBJS)
$(call cmd_link_o_target, $(OBJS))
#########################################################################
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
/*
* (C) Copyright 2011-2012
* Pali Rohár <pali.rohar@gmail.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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
*/
#include <config.h>
relocaddr: /* address of this relocaddr section after coping */
.word . /* address of section (calculated at compile time) */
startaddr: /* address of u-boot after copying */
.word CONFIG_SYS_TEXT_BASE
kernaddr: /* address of kernel after copying */
.word KERNEL_ADDRESS
kernsize: /* maximal size of kernel image */
.word KERNEL_MAXSIZE
kernoffs: /* offset of kernel image in loaded u-boot */
.word KERNEL_OFFSET
imagesize: /* maximal size of image */
.word IMAGE_MAXSIZE
ih_magic: /* IH_MAGIC in big endian from include/image.h */
.word 0x56190527
/*
* Routine: save_boot_params (called after reset from start.S)
* Description: Copy attached kernel to address KERNEL_ADDRESS
* Copy u-boot to address CONFIG_SYS_TEXT_BASE
* Return to copied u-boot address
*/
.global save_boot_params
save_boot_params:
/* Copy valid attached kernel to address KERNEL_ADDRESS */
copy_kernel_start:
adr r0, relocaddr /* r0 - address of section relocaddr */
ldr r1, relocaddr /* r1 - address of relocaddr after relocation */
cmp r0, r1
/* r4 - calculated offset */
subhi r4, r0, r1
sublo r4, r1, r0
/* r0 - start of kernel before */
ldr r0, startaddr
addhi r0, r0, r4
sublo r0, r0, r4
ldr r1, kernoffs
add r0, r0, r1
/* r3 - start of kernel after */
ldr r3, kernaddr
/* r2 - end of kernel after */
ldr r1, kernsize
add r2, r3, r1
/* r1 - end of kernel before */
add r1, r0, r1
/* remove header in target kernel */
mov r5, #0
str r5, [r3]
/* check for valid kernel uImage */
ldr r4, [r0] /* r4 - 4 bytes header of kernel */
ldr r5, ih_magic /* r5 - IH_MAGIC */
cmp r4, r5
bne copy_kernel_end /* skip if invalid image */
copy_kernel_loop:
ldmdb r1!, {r3 - r10}
stmdb r2!, {r3 - r10}
cmp r1, r0
bhi copy_kernel_loop
copy_kernel_end:
mov r5, #0
str r5, [r0] /* remove 4 bytes header of kernel */
/* Fix u-boot code */
fix_start:
adr r0, relocaddr /* r0 - address of section relocaddr */
ldr r1, relocaddr /* r1 - address of relocaddr after relocation */
cmp r0, r1
beq copy_uboot_end /* skip if u-boot is on correct address */
/* r5 - calculated offset */
subhi r5, r0, r1
sublo r5, r1, r0
/* r6 - maximal u-boot size */
ldr r6, imagesize
/* fix return address */
subhi lr, lr, r5
addlo lr, lr, r5
/* r1 - start of u-boot after */
ldr r1, startaddr
/* r0 - start of u-boot before */
addhi r0, r1, r5
sublo r0, r1, r5
/* check if we need to move uboot copy code before calling it */
cmp r5, r6
bhi copy_uboot_start /* now coping u-boot code directly is safe */
copy_code_start:
/* r0 - start of u-boot before */
/* r1 - start of u-boot after */
/* r6 - maximal u-boot size */
/* r7 - maximal kernel size */
ldr r7, kernsize
/* r4 - end of kernel before */
add r4, r0, r6
add r4, r4, r7
/* r5 - end of u-boot after */
ldr r5, startaddr
add r5, r5, r6
/* r2 - start of loop code after */
cmp r4, r5 /* higher address (r4 or r5) */
movhs r2, r4
movlo r2, r5
/* r3 - end of loop code before */
adr r3, end
/* r4 - end of loop code after */
adr r4, copy_uboot_start
sub r4, r3, r4
add r4, r2, r4
copy_code_loop:
ldmdb r3!, {r7 - r10}
stmdb r4!, {r7 - r10}
cmp r4, r2
bhi copy_code_loop
copy_code_end:
mov pc, r2
/* Copy u-boot to address CONFIG_SYS_TEXT_BASE */
copy_uboot_start:
/* r0 - start of u-boot before */
/* r1 - start of u-boot after */
/* r6 - maximal u-boot size */
/* r2 - end of u-boot after */
add r2, r1, r6
/* condition for copying from left to right */
cmp r0, r1
addlo r1, r0, r6 /* r1 - end of u-boot before */
blo copy_uboot_loop_right
copy_uboot_loop_left:
ldmia r0!, {r3 - r10}
stmia r1!, {r3 - r10}
cmp r1, r2
blo copy_uboot_loop_left
b copy_uboot_end
copy_uboot_loop_right:
ldmdb r1!, {r3 - r10}
stmdb r2!, {r3 - r10}
cmp r1, r0
bhi copy_uboot_loop_right
copy_uboot_end:
bx lr
end:
This diff is collapsed.
This diff is collapsed.
/*
* (C) Copyright 2011-2012
* Pali Rohár <pali.rohar@gmail.com>
*
* (C) Copyright 2011
* marcel@mesa.nl, Mesa Consulting B.V.
*
* (C) Copyright 2004-2005
* Nokia Corporation
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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
*/
/*
* Code copied from maemo kernel 2.6.28 file
* arch/arm/plat-omap/include/mach/board.h
*
* Information structures for board-specific data
*
* Copyright (C) 2004 Nokia Corporation
* Written by Juha Yrjölä <juha.yrjola@nokia.com>
*/
/* Different peripheral ids */
#define OMAP_TAG_CLOCK 0x4f01
#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
#define OMAP_TAG_USB 0x4f04
#define OMAP_TAG_LCD 0x4f05
#define OMAP_TAG_GPIO_SWITCH 0x4f06
#define OMAP_TAG_UART 0x4f07
#define OMAP_TAG_FBMEM 0x4f08
#define OMAP_TAG_STI_CONSOLE 0x4f09
#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
#define OMAP_TAG_PARTITION 0x4f0b
#define OMAP_TAG_TEA5761 0x4f10
#define OMAP_TAG_TMP105 0x4f11
#define OMAP_TAG_BOOT_REASON 0x4f80
#define OMAP_TAG_FLASH_PART_STR 0x4f81
#define OMAP_TAG_VERSION_STR 0x4f82
#define OMAP_TAG_NOKIA_BT 0x4e01
#define OMAP_TAG_WLAN_CX3110X 0x4e02
#define OMAP_TAG_CBUS 0x4e03
#define OMAP_TAG_EM_ASIC_BB5 0x4e04
struct omap_clock_config {
/* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */
u8 system_clock_type;
};
struct omap_serial_console_config {
u8 console_uart;
u32 console_speed;
};
struct omap_sti_console_config {
unsigned enable:1;
u8 channel;
};
struct omap_usb_config {
/* Configure drivers according to the connectors on your board:
* - "A" connector (rectagular)
* ... for host/OHCI use, set "register_host".
* - "B" connector (squarish) or "Mini-B"
* ... for device/gadget use, set "register_dev".
* - "Mini-AB" connector (very similar to Mini-B)
* ... for OTG use as device OR host, initialize "otg"
*/
unsigned register_host:1;
unsigned register_dev:1;
u8 otg; /* port number, 1-based: usb1 == 2 */
u8 hmc_mode;
/* implicitly true if otg: host supports remote wakeup? */
u8 rwc;
/* signaling pins used to talk to transceiver on usbN:
* 0 == usbN unused
* 2 == usb0-only, using internal transceiver
* 3 == 3 wire bidirectional
* 4 == 4 wire bidirectional
* 6 == 6 wire unidirectional (or TLL)
*/
u8 pins[3];
};
struct omap_lcd_config {
char panel_name[16];
char ctrl_name[16];
s16 nreset_gpio;
u8 data_lines;
};
struct omap_fbmem_config {
u32 start;
u32 size;
};
struct omap_gpio_switch_config {
char name[12];
u16 gpio;
u8 flags:4;
u8 type:4;
unsigned int key_code:24; /* Linux key code */
};
struct omap_uart_config {
/* Bit field of UARTs present; bit 0 --> UART1 */
unsigned int enabled_uarts;
};
struct omap_tea5761_config {
u16 enable_gpio;
};
struct omap_partition_config {
char name[16];
unsigned int size;
unsigned int offset;
/* same as in include/linux/mtd/partitions.h */
unsigned int mask_flags;
};
struct omap_flash_part_str_config {
char part_table[0];
};
struct omap_boot_reason_config {
char reason_str[12];
};
struct omap_version_config {
char component[12];
char version[12];
};
/*
* Code copied from maemo kernel 2.6.28 file
* arch/arm/plat-omap/include/mach/board-nokia.h
*
* Information structures for Nokia-specific board config data
*
* Copyright (C) 2005 Nokia Corporation
*/
struct omap_bluetooth_config {
u8 chip_type;
u8 bt_wakeup_gpio;
u8 host_wakeup_gpio;
u8 reset_gpio;
u8 bt_uart;
u8 bd_addr[6];
u8 bt_sysclk;
};
struct omap_wlan_cx3110x_config {
u8 chip_type;
u8 reserverd;
s16 power_gpio;
s16 irq_gpio;
s16 spi_cs_gpio;
};
struct omap_cbus_config {
s16 clk_gpio;
s16 dat_gpio;
s16 sel_gpio;
};
struct omap_em_asic_bb5_config {
s16 retu_irq_gpio;
s16 tahvo_irq_gpio;
};
/*
* omap_tag handling
*
* processing omap tag structures
*
* Copyright (C) 2011 marcel@mesa.nl, Mesa Consulting B.V.
* Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com>
*/
/* TI OMAP specific information */
#define ATAG_BOARD 0x414f4d50
struct tag_omap_header {
u16 tag;
u16 size;
};
struct tag_omap {
struct tag_omap_header hdr;
union {
struct omap_clock_config clock;
struct omap_serial_console_config serial_console;
struct omap_sti_console_config sti_console;
struct omap_usb_config usb;
struct omap_lcd_config lcd;
struct omap_fbmem_config fbmem;
struct omap_gpio_switch_config gpio_switch;
struct omap_uart_config uart;
struct omap_tea5761_config tea5761;
struct omap_partition_config partition;
struct omap_flash_part_str_config flash_part_str;
struct omap_boot_reason_config boot_reason;
struct omap_version_config version;
struct omap_bluetooth_config bluetooth;
struct omap_wlan_cx3110x_config wlan_cx3110x;
struct omap_cbus_config cbus;
struct omap_em_asic_bb5_config em_asic_bb5;
} u;
};
#define tag_omap_next(t) ((struct tag_omap *)((u8 *)(t) + \
(t)->hdr.size + sizeof(struct tag_omap_header)))
#define OMAP_TAG_HEADER_CONFIG(config, type) \
.hdr.tag = config, \
.hdr.size = sizeof(struct type)
#define OMAP_TAG_UART_CONFIG(p1) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_UART, omap_uart_config), \
.u.uart.enabled_uarts = p1, \
}
#define OMAP_TAG_SERIAL_CONSOLE_CONFIG(p1, p2) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_SERIAL_CONSOLE, \
omap_serial_console_config), \
.u.serial_console.console_uart = p1, \
.u.serial_console.console_speed = p2, \
}
#define OMAP_TAG_LCD_CONFIG(p1, p2, p3, p4) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_LCD, omap_lcd_config), \
.u.lcd.panel_name = p1, \
.u.lcd.ctrl_name = p2, \
.u.lcd.nreset_gpio = p3, \
.u.lcd.data_lines = p4, \
}
#define OMAP_TAG_GPIO_SWITCH_CONFIG(p1, p2, p3, p4, p5) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_GPIO_SWITCH, \
omap_gpio_switch_config), \
.u.gpio_switch.name = p1, \
.u.gpio_switch.gpio = p2, \
.u.gpio_switch.flags = p3, \
.u.gpio_switch.type = p4, \
.u.gpio_switch.key_code = p5, \
}
#define OMAP_TAG_WLAN_CX3110X_CONFIG(p1, p2, p3, p4, p5) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_WLAN_CX3110X, \
omap_wlan_cx3110x_config), \
.u.wlan_cx3110x.chip_type = p1, \
.u.wlan_cx3110x.reserverd = p2, \
.u.wlan_cx3110x.power_gpio = p3, \
.u.wlan_cx3110x.irq_gpio = p4, \
.u.wlan_cx3110x.spi_cs_gpio = p5, \
}
#define OMAP_TAG_PARTITION_CONFIG(p1, p2, p3, p4) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_PARTITION, \
omap_partition_config), \
.u.partition.name = p1, \
.u.partition.size = p2, \
.u.partition.offset = p3, \
.u.partition.mask_flags = p4, \
}
#define OMAP_TAG_BOOT_REASON_CONFIG(p1) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_BOOT_REASON, \
omap_boot_reason_config), \
.u.boot_reason.reason_str = p1, \
}
#define OMAP_TAG_VERSION_STR_CONFIG(p1, p2) \
{ \
OMAP_TAG_HEADER_CONFIG(OMAP_TAG_VERSION_STR, \
omap_version_config), \
.u.version.component = p1, \
.u.version.version = p2, \
}
......@@ -269,6 +269,7 @@ devkit8000 arm armv7 devkit8000 timll
mcx arm armv7 mcx htkw omap3
tricorder arm armv7 tricorder corscience omap3
twister arm armv7 twister technexion omap3
nokia_rx51 arm armv7 rx51 nokia omap3
omap4_panda arm armv7 panda ti omap4
omap4_sdp4430 arm armv7 sdp4430 ti omap4
omap5_evm arm armv7 omap5_evm ti omap5
......
Board: Nokia RX-51 aka N900
This board definition results in a u-boot.bin which can be chainloaded
from NOLO in qemu or on a real N900. It does very little hardware config
because NOLO has already configured the board. Only needed is enabling
internal eMMC memory via twl4030 regulator which is not enabled by NOLO.
NOLO is expecting a kernel image and will treat any image it finds in
onenand as such. This u-boot is intended to be flashed to the N900 like
a kernel. In order to transparently boot the original kernel, it will be
appended to u-boot.bin at 0x40000. NOLO will load the entire image into
(random) memory and execute u-boot, which saves hw revision, boot reason
and boot mode ATAGs set by NOLO. Then the bootscripts will attempt to load
uImage or boot.scr from a fat, ext2/ext3 or ext4 filesystem in external
SD card or internal eMMC memory. If this fails or keyboard is closed then
the appended kernel image will be booted using some generated and some
stored ATAGs (see boot order).
There is support for hardware watchdog. Hardware watchdog is started by
NOLO so u-boot must kick watchdog to prevent reboot device (but not very
often, max every 2 seconds). There is also support for framebuffer display
output with ANSI espace codes and the N900 HW keyboard input. USB tty works
but is disabled because it prevents the current Maemo kernel from booting.
When U-Boot is starting it enable IBE bit in Auxiliary Control Register,
which is needed for Thumb-2 ISA support. It is workaround for errata 430973.
Default boot order:
* 0. if keyboard is closed boot automatically attached kernel image
* 1. try boot from external SD card
* 2. try boot from internal eMMC memory
* 3. try boot from attached kernel image
Boot from SD or eMMC in this order:
* 1.
* 1.1 find boot.scr on first fat partition
* 1.2 find uImage on first fat parition
* 1.3 same order for 2. - 4. fat partition
* 2. same as 1. but for ext2/3 partition
* 3. same as 1. but for ext4 partition
Available additional commands/variables:
* run sercon - Use serial port for control
* run usbcon - Use usbtty for control
* run vgacon - Use framebuffer and HW keyboard for control (default)
* run sdboot - Boot from external SD card (see boot order)
* run emmcboot - Boot from internal eMMC memory (see boot order)
* run attachboot - Boot attached kernel image (attached to U-Boot binary)
* run scriptload - Load boot script ${mmcscriptfile}
* run scriptboot - Run loaded boot script
* run kernload - Load kernel image ${mmckernfile}
* run initrdload - Load initrd image ${mmcinitrdfile}
* run kernboot - Boot loaded kernel image
* run kerninitrdboot - Boot loaded kernel image with loaded initrd image
* run trymmcscriptboot - Try to load and boot script ${mmcscriptfile}
* run trymmckernboot - Try to load and boot kernel image ${mmckernfile}
* run trymmckerninitrdboot - Try to load and boot kernel image ${mmckernfile}
with initrd image ${mmcinitrdfile}
Additional variables for loading files from mmc:
* mmc ${mmcnum} (0 - external, 1 - internal)
* partition number ${mmcpart} (1 - 4)
* parition type ${mmctype} (fat, ext2)
Additional varuables for booting kernel:
* setup_omap_atag - Add OMAP table into atags structure (needs maemo kernel)
* setup_console_atag - Enable serial console in OMAP table
* setup_boot_reason_atag - Change boot reason in OMAP table
* setup_boot_mode_atag - Change boot mode in OMAP table
USB TTY:
Maemo kernel 2.6.28 will crash if u-boot enable usb tty. So USB TTY is disabled.
For enabling USB TTY just add this line to file include/configs/nokia_rx51.h
#define CONFIG_USB_TTY
ONENAND support:
ONENAND support is disabled because not working yet and cause linux kernel to
crash or no access to mtd. For enabling ONENAND support add this line at begin
of file include/configs/nokia_rx51.h
#define ONENAND_SUPPORT
UBIFS support:
UBIFS support is disabled, because U-Boot image is too big and cannot be
flashed with attached zImage to RX-51 kernel nand area. For enabling UBIFS
support first enable ONENAND support and then add this line at begin of file
include/configs/nokia_rx51.h
#define UBIFS_SUPPORT
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment