mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 00:49:43 +00:00
Support passing of OF flat trees to the kernel.
Patch by Pantelis Antoniou, 04 Sep 2005
This commit is contained in:
parent
3df5bea0b0
commit
f57f70aab9
16 changed files with 310 additions and 216 deletions
|
@ -2,6 +2,9 @@
|
|||
Changes for U-Boot 1.1.4:
|
||||
======================================================================
|
||||
|
||||
* Support passing of OF flat trees to the kernel.
|
||||
Patch by Pantelis Antoniou, 04 Sep 2005
|
||||
|
||||
* Cleanup
|
||||
|
||||
* Add support for NetSilicon NS7520 processor.
|
||||
|
|
3
Makefile
3
Makefile
|
@ -1598,6 +1598,9 @@ lubbock_config : unconfig
|
|||
logodl_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa logodl
|
||||
|
||||
pxa255_idp_config: unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa pxa255_idp
|
||||
|
||||
wepep250_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa wepep250
|
||||
|
||||
|
|
14
README
14
README
|
@ -399,6 +399,20 @@ The following options need to be configured:
|
|||
expect it to be in bytes, others in MB.
|
||||
Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes.
|
||||
|
||||
CONFIG_OF_FLAT_TREE
|
||||
|
||||
New kernel versions are expecting firmware settings to be
|
||||
passed using flat open firmware trees.
|
||||
The environment variable "disable_of", when set, disables this
|
||||
functionality.
|
||||
|
||||
CONFIG_OF_FLAT_TREE_MAX_SIZE
|
||||
|
||||
The maximum size of the constructed OF tree.
|
||||
|
||||
OF_CPU - The proper name of the cpus node.
|
||||
OF_TBCLK - The timebase frequency.
|
||||
|
||||
- Serial Ports:
|
||||
CFG_PL010_SERIAL
|
||||
|
||||
|
|
|
@ -138,18 +138,14 @@ int write_flash(char *addr, char value)
|
|||
char *adr = (char *)0xFF800000;
|
||||
int cnt = 0;
|
||||
char status,oldstatus;
|
||||
*(adr+0x55) = 0xAA;
|
||||
|
||||
udelay(1);
|
||||
*(adr+0xAA) = 0x55;
|
||||
udelay(1);
|
||||
*(adr+0x55) = 0xA0;
|
||||
udelay(1);
|
||||
*(adr+0x55) = 0xAA; udelay (1);
|
||||
*(adr+0xAA) = 0x55; udelay (1);
|
||||
*(adr+0x55) = 0xA0; udelay (1);
|
||||
*addr = value;
|
||||
|
||||
status = *addr;
|
||||
do {
|
||||
|
||||
oldstatus = status;
|
||||
status = *addr;
|
||||
|
||||
|
@ -165,14 +161,16 @@ int write_flash(char *addr, char value)
|
|||
oldstatus = *addr;
|
||||
status = *addr;
|
||||
|
||||
if ((oldstatus & 0x40) == (status & 0x40)) return 0;
|
||||
else {
|
||||
if ((oldstatus & 0x40) == (status & 0x40)) {
|
||||
return 0;
|
||||
} else {
|
||||
*(adr+0x55) = 0xF0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned update_flash(unsigned char* buf){
|
||||
unsigned update_flash (unsigned char *buf)
|
||||
{
|
||||
switch ((*buf) & 0x3) {
|
||||
case TRY_WORKING:
|
||||
printf ("found 3 and converted it to 2\n");
|
||||
|
@ -180,6 +178,7 @@ unsigned update_flash(unsigned char* buf){
|
|||
*((unsigned char *)0xFF800000) = 0xF0;
|
||||
udelay (100);
|
||||
printf ("buf [%#010x] %#010x\n", buf, (*buf));
|
||||
/* XXX - fall through??? */
|
||||
case BOOT_WORKING :
|
||||
return BOOT_WORKING;
|
||||
}
|
||||
|
@ -189,7 +188,6 @@ unsigned update_flash(unsigned char* buf){
|
|||
unsigned scan_flash (void)
|
||||
{
|
||||
char section[] = "kernel";
|
||||
ulong sp;
|
||||
int cfgFileLen = (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1);
|
||||
int sectionPtr = 0;
|
||||
int foundItem = 0; /* 0: None, 1: section found, 2: "=" found */
|
||||
|
@ -202,19 +200,16 @@ unsigned scan_flash(void)
|
|||
if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) {
|
||||
return BOOT_DEFAULT;
|
||||
}
|
||||
switch(foundItem)
|
||||
{
|
||||
/* This is the scanning loop, we try to find a particular
|
||||
* quoted value
|
||||
*/
|
||||
switch (foundItem) {
|
||||
case 0:
|
||||
if ((section[sectionPtr] == 0)) {
|
||||
++foundItem;
|
||||
}
|
||||
else if(buf[bufPtr] == section[sectionPtr]){
|
||||
} else if (buf[bufPtr] == section[sectionPtr]) {
|
||||
++sectionPtr;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sectionPtr = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -226,7 +221,7 @@ unsigned scan_flash(void)
|
|||
break;
|
||||
case 3:
|
||||
default:
|
||||
return update_flash(buf[bufPtr - 1]);
|
||||
return update_flash (&buf[bufPtr - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,6 +257,7 @@ void barcobcd_boot(void)
|
|||
char *bootm_args[2];
|
||||
char *buf;
|
||||
int cnt;
|
||||
extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
|
||||
|
||||
buf = (char *)(0x00800000);
|
||||
/* make certain there are enough chars to print the command line here!
|
||||
|
@ -328,13 +324,40 @@ U_BOOT_CMD(
|
|||
/*
|
||||
* We are not using serial communication, so just provide empty functions
|
||||
*/
|
||||
int serial_init(void){return 0;}
|
||||
void serial_setbrg(void){}
|
||||
void serial_putc(const char c){}
|
||||
void serial_puts(const char *c){}
|
||||
void serial_addr(unsigned int i){}
|
||||
int serial_getc(void){return 0;}
|
||||
int serial_tstc(void){return 0;}
|
||||
int serial_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void serial_puts (const char *c)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void serial_addr (unsigned int i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int serial_getc (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long post_word_load(void){return 0l;};
|
||||
void post_word_store(unsigned long val){}
|
||||
unsigned long post_word_load (void)
|
||||
{
|
||||
return 0l;
|
||||
}
|
||||
void post_word_store (unsigned long val)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o \
|
|||
env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
|
||||
env_nvram.o env_nowhere.o \
|
||||
exports.o \
|
||||
flash.o fpga.o \
|
||||
flash.o fpga.o ft_build.o \
|
||||
hush.o kgdb.o lcd.o lists.o lynxkdi.o \
|
||||
memsize.o miiphybb.o miiphyutil.o \
|
||||
s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include <environment.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
#include <ft_build.h>
|
||||
#endif
|
||||
|
||||
/*cmd_boot.c*/
|
||||
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
||||
|
||||
|
@ -489,6 +493,11 @@ fixup_silent_linux ()
|
|||
}
|
||||
#endif /* CONFIG_SILENT_CONSOLE */
|
||||
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
extern const unsigned char oftree_dtb[];
|
||||
extern const unsigned int oftree_dtb_len;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC
|
||||
static void
|
||||
do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
|
@ -511,6 +520,9 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
|||
bd_t *kbd;
|
||||
void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
|
||||
image_header_t *hdr = &header;
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
char *of_flat_tree;
|
||||
#endif
|
||||
|
||||
if ((s = getenv ("initrd_high")) != NULL) {
|
||||
/* a value of "no" or a similar string will act like 0,
|
||||
|
@ -776,15 +788,26 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
|||
initrd_end = 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF_FLAT_TREE
|
||||
if (initrd_start == 0)
|
||||
of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE -
|
||||
sizeof(bd_t)) & ~0xF);
|
||||
else
|
||||
of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE -
|
||||
sizeof(bd_t)) & ~0xF);
|
||||
#endif
|
||||
|
||||
debug ("## Transferring control to Linux (at address %08lx) ...\n",
|
||||
(ulong)kernel);
|
||||
|
||||
SHOW_BOOT_PROGRESS (15);
|
||||
|
||||
#ifndef CONFIG_OF_FLAT_TREE
|
||||
|
||||
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
|
||||
unlock_ram_in_cache();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Linux Kernel Parameters:
|
||||
* r3: ptr to board info data
|
||||
|
@ -794,6 +817,25 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
|||
* r7: End of command line string
|
||||
*/
|
||||
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
|
||||
|
||||
#else
|
||||
ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd);
|
||||
/* ft_dump_blob(of_flat_tree); */
|
||||
|
||||
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
|
||||
unlock_ram_in_cache();
|
||||
#endif
|
||||
/*
|
||||
* Linux Kernel Parameters:
|
||||
* r3: ptr to OF flat tree, followed by the board info data
|
||||
* r4: initrd_start or 0 if no initrd
|
||||
* r5: initrd_end - unused if r4 is 0
|
||||
* r6: Start of command line string
|
||||
* r7: End of command line string
|
||||
*/
|
||||
(*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end, cmd_start, cmd_end);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_PPC */
|
||||
|
||||
|
|
|
@ -318,11 +318,20 @@ int
|
|||
do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
uint rcode = 0;
|
||||
iopin_t iopin;
|
||||
static uint port = 0;
|
||||
static uint pin = 0;
|
||||
static uint value = 0;
|
||||
static enum { DIR, PAR, SOR, ODR, DAT, INT } cmd = DAT;
|
||||
iopin_t iopin;
|
||||
static enum {
|
||||
DIR,
|
||||
PAR,
|
||||
SOR,
|
||||
ODR,
|
||||
DAT,
|
||||
#if defined(CONFIG_8xx)
|
||||
INT
|
||||
#endif
|
||||
} cmd = DAT;
|
||||
|
||||
if (argc != 5) {
|
||||
puts ("iopset PORT PIN CMD VALUE\n");
|
||||
|
|
|
@ -184,7 +184,7 @@ int eth_init (bd_t * bd)
|
|||
|
||||
/* Init Ehternet buffers */
|
||||
for (i = 0; i < RBF_FRAMEMAX; i++) {
|
||||
rbfdt[i].addr = rbf_framebuf[i];
|
||||
rbfdt[i].addr = (unsigned long)rbf_framebuf[i];
|
||||
rbfdt[i].size = 0;
|
||||
}
|
||||
rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
|
||||
|
|
|
@ -66,15 +66,14 @@
|
|||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
|
||||
|
||||
#define CONFIG_COMMANDS ( (CONFIG_CMD_DFL & \
|
||||
(~CFG_CMD_RTC) & ~(CFG_CMD_I2C)) | \
|
||||
CFG_CMD_IRQ | \
|
||||
CFG_CMD_PCI | \
|
||||
CFG_CMD_DHCP | \
|
||||
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
|
||||
CFG_CMD_ASKENV | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_ELF | \
|
||||
CFG_CMD_PING | \
|
||||
CFG_CMD_MVENV \
|
||||
CFG_CMD_IRQ | \
|
||||
CFG_CMD_MVENV | \
|
||||
CFG_CMD_PCI | \
|
||||
CFG_CMD_PING \
|
||||
)
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
|
@ -129,7 +128,7 @@
|
|||
#define CFG_BAUDRATE_TABLE \
|
||||
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
|
||||
|
||||
#define CFG_LOAD_ADDR 0x00100000 /* default load address */
|
||||
#define CFG_LOAD_ADDR 0x00200000 /* default load address */
|
||||
#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
|
|
@ -99,19 +99,17 @@
|
|||
#define SCL 0x1000 /* PA 3 */
|
||||
#define SDA 0x2000 /* PA 2 */
|
||||
|
||||
#define PAR immr->im_ioport.iop_papar
|
||||
#define DIR immr->im_ioport.iop_padir
|
||||
#define DAT immr->im_ioport.iop_padat
|
||||
|
||||
#define I2C_INIT {PAR &= ~(SCL | SDA); DIR |= SCL;}
|
||||
#define I2C_ACTIVE (DIR |= SDA)
|
||||
#define I2C_TRISTATE (DIR &= ~SDA)
|
||||
#define I2C_READ ((DAT & SDA) != 0)
|
||||
#define I2C_SDA(bit) if (bit) DAT |= SDA; \
|
||||
else DAT &= ~SDA
|
||||
#define I2C_SCL(bit) if (bit) DAT |= SCL; \
|
||||
else DAT &= ~SCL
|
||||
#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
|
||||
#define __I2C_DIR immr->im_ioport.iop_padir
|
||||
#define __I2C_DAT immr->im_ioport.iop_padat
|
||||
#define __I2C_PAR immr->im_ioport.iop_papar
|
||||
#define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
|
||||
__I2C_DIR |= (SDA|SCL); }
|
||||
#define I2C_READ ((__I2C_DAT & SDA) ? 1 : 0)
|
||||
#define I2C_SDA(x) { if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
|
||||
#define I2C_SCL(x) { if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
|
||||
#define I2C_DELAY { udelay(5); }
|
||||
#define I2C_ACTIVE { __I2C_DIR |= SDA; }
|
||||
#define I2C_TRISTATE { __I2C_DIR &= ~SDA; }
|
||||
|
||||
#define CONFIG_RTC_PCF8563
|
||||
#define CFG_I2C_RTC_ADDR 0x51
|
||||
|
|
|
@ -235,7 +235,7 @@
|
|||
#define CONFIG_NET_MULTI
|
||||
#define CONFIG_PCI_PNP /* do pci plug-and-play */
|
||||
|
||||
#define CONFIG_EEPRO100
|
||||
/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
|
||||
#define CONFIG_E1000
|
||||
#undef CONFIG_TULIP
|
||||
|
||||
|
|
|
@ -181,17 +181,20 @@
|
|||
#if defined (CONFIG_SOFT_I2C)
|
||||
#define SDA 0x00010
|
||||
#define SCL 0x00020
|
||||
#define DIR immr->im_cpm.cp_pbdir
|
||||
#define DAT immr->im_cpm.cp_pbdat
|
||||
#define PAR immr->im_cpm.cp_pbpar
|
||||
#define ODR immr->im_cpm.cp_pbodr
|
||||
#define I2C_INIT {PAR&=~(SDA|SCL);ODR&=~(SDA|SCL);DAT|=(SDA|SCL);DIR|=(SDA|SCL);}
|
||||
#define I2C_READ ((DAT&SDA)?1:0)
|
||||
#define I2C_SDA(x) {if(x)DAT|=SDA;else DAT&=~SDA;}
|
||||
#define I2C_SCL(x) {if(x)DAT|=SCL;else DAT&=~SCL;}
|
||||
#define __I2C_DIR immr->im_cpm.cp_pbdir
|
||||
#define __I2C_DAT immr->im_cpm.cp_pbdat
|
||||
#define __I2C_PAR immr->im_cpm.cp_pbpar
|
||||
#define __I2C_ODR immr->im_cpm.cp_pbodr
|
||||
#define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
|
||||
__I2C_ODR &= ~(SDA|SCL); \
|
||||
__I2C_DAT |= (SDA|SCL); \
|
||||
__I2C_DIR|=(SDA|SCL); }
|
||||
#define I2C_READ ((__I2C_DAT & SDA) ? 1 : 0)
|
||||
#define I2C_SDA(x) { if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
|
||||
#define I2C_SCL(x) { if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
|
||||
#define I2C_DELAY { udelay(5); }
|
||||
#define I2C_ACTIVE {DIR|=SDA;}
|
||||
#define I2C_TRISTATE {DIR&=~SDA;}
|
||||
#define I2C_ACTIVE { __I2C_DIR |= SDA; }
|
||||
#define I2C_TRISTATE { __I2C_DIR &= ~SDA; }
|
||||
#endif
|
||||
|
||||
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
#define CONFIG_PCI_IO_SIZE 0x01000000
|
||||
|
||||
#define CONFIG_NET_MULTI 1
|
||||
#define CONFIG_EEPRO100 1
|
||||
/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
|
||||
#define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */
|
||||
#define CONFIG_NS8382X 1
|
||||
#endif /* CONFIG_STK52XX */
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
#define CONFIG_NET_MULTI
|
||||
#define CONFIG_PCI_PNP /* do pci plug-and-play */
|
||||
|
||||
#define CONFIG_EEPRO100
|
||||
/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
|
||||
#undef CONFIG_TULIP
|
||||
|
||||
#if !defined(CONFIG_PCI_PNP)
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_OFFSET 0x000047A4 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_SIZE 0x00002000 /* Total Size of Environment Sector */
|
||||
#define ENV_CRC 0x8BF6F24B
|
||||
/* #define ENV_CRC 0x8BF6F24B XXX - FIXME: gets defined automatically */
|
||||
|
||||
#define CFG_MALLOC_LEN (512 << 10) /* Reserve 512 kB for malloc() */
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#define CFG_XLB_PIPELINING 1
|
||||
|
||||
#define CONFIG_NET_MULTI 1
|
||||
#define CONFIG_EEPRO100 1
|
||||
/* #define CONFIG_EEPRO100 XXX - FIXME: conflicts when CONFIG_MII is enabled */
|
||||
#define CFG_RX_ETH_BUFFER 8 /* use 8 rx buffer on eepro100 */
|
||||
#define CONFIG_NS8382X 1
|
||||
|
||||
|
|
Loading…
Reference in a new issue