Commit f57f70aa authored by Wolfgang Denk's avatar Wolfgang Denk

Support passing of OF flat trees to the kernel.

Patch by Pantelis Antoniou, 04 Sep 2005
parent 3df5bea0
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
Changes for U-Boot 1.1.4: Changes for U-Boot 1.1.4:
====================================================================== ======================================================================
* Support passing of OF flat trees to the kernel.
Patch by Pantelis Antoniou, 04 Sep 2005
* Cleanup * Cleanup
* Add support for NetSilicon NS7520 processor. * Add support for NetSilicon NS7520 processor.
......
...@@ -1598,6 +1598,9 @@ lubbock_config : unconfig ...@@ -1598,6 +1598,9 @@ lubbock_config : unconfig
logodl_config : unconfig logodl_config : unconfig
@./mkconfig $(@:_config=) arm pxa logodl @./mkconfig $(@:_config=) arm pxa logodl
pxa255_idp_config: unconfig
@./mkconfig $(@:_config=) arm pxa pxa255_idp
wepep250_config : unconfig wepep250_config : unconfig
@./mkconfig $(@:_config=) arm pxa wepep250 @./mkconfig $(@:_config=) arm pxa wepep250
......
...@@ -399,6 +399,20 @@ The following options need to be configured: ...@@ -399,6 +399,20 @@ The following options need to be configured:
expect it to be in bytes, others in MB. expect it to be in bytes, others in MB.
Define CONFIG_MEMSIZE_IN_BYTES to make it in bytes. 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: - Serial Ports:
CFG_PL010_SERIAL CFG_PL010_SERIAL
......
...@@ -90,17 +90,17 @@ long int initdram (int board_type) ...@@ -90,17 +90,17 @@ long int initdram (int board_type)
long mear1; long mear1;
long emear1; long emear1;
size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE); size = get_ram_size (CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
new_bank0_end = size - 1; new_bank0_end = size - 1;
mear1 = mpc824x_mpc107_getreg(MEAR1); mear1 = mpc824x_mpc107_getreg (MEAR1);
emear1 = mpc824x_mpc107_getreg(EMEAR1); emear1 = mpc824x_mpc107_getreg (EMEAR1);
mear1 = (mear1 & 0xFFFFFF00) | mear1 = (mear1 & 0xFFFFFF00) |
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT); ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
emear1 = (emear1 & 0xFFFFFF00) | emear1 = (emear1 & 0xFFFFFF00) |
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT); ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
mpc824x_mpc107_setreg(MEAR1, mear1); mpc824x_mpc107_setreg (MEAR1, mear1);
mpc824x_mpc107_setreg(EMEAR1, emear1); mpc824x_mpc107_setreg (EMEAR1, emear1);
return (size); return (size);
} }
...@@ -113,11 +113,11 @@ static struct pci_config_table pci_barcohydra_config_table[] = { ...@@ -113,11 +113,11 @@ static struct pci_config_table pci_barcohydra_config_table[] = {
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID, { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
PCI_ENET0_MEMADDR, PCI_ENET0_MEMADDR,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID, { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR, pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
PCI_ENET1_MEMADDR, PCI_ENET1_MEMADDR,
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER } },
{ } { }
}; };
#endif #endif
...@@ -128,68 +128,66 @@ struct pci_controller hose = { ...@@ -128,68 +128,66 @@ struct pci_controller hose = {
#endif #endif
}; };
void pci_init_board(void) void pci_init_board (void)
{ {
pci_mpc824x_init(&hose); pci_mpc824x_init (&hose);
} }
int write_flash(char *addr, char value) int write_flash (char *addr, char value)
{ {
char *adr = (char *)0xFF800000; char *adr = (char *)0xFF800000;
int cnt = 0; int cnt = 0;
char status,oldstatus; char status,oldstatus;
*(adr+0x55) = 0xAA;
udelay(1); *(adr+0x55) = 0xAA; udelay (1);
*(adr+0xAA) = 0x55; *(adr+0xAA) = 0x55; udelay (1);
udelay(1); *(adr+0x55) = 0xA0; udelay (1);
*(adr+0x55) = 0xA0;
udelay(1);
*addr = value; *addr = value;
status = *addr; status = *addr;
do{ do {
oldstatus = status; oldstatus = status;
status = *addr; status = *addr;
if ((oldstatus & 0x40) == (status & 0x40)){ if ((oldstatus & 0x40) == (status & 0x40)) {
return 4; return 4;
} }
cnt++; cnt++;
if (cnt > 10000){ if (cnt > 10000) {
return 2; return 2;
} }
}while( (status & 0x20) == 0 ); } while ( (status & 0x20) == 0 );
oldstatus = *addr; oldstatus = *addr;
status = *addr; status = *addr;
if ((oldstatus & 0x40) == (status & 0x40)) return 0; if ((oldstatus & 0x40) == (status & 0x40)) {
else { return 0;
} else {
*(adr+0x55) = 0xF0; *(adr+0x55) = 0xF0;
return 1; return 1;
} }
} }
unsigned update_flash(unsigned char* buf){ unsigned update_flash (unsigned char *buf)
switch((*buf) & 0x3){ {
case TRY_WORKING: switch ((*buf) & 0x3) {
printf("found 3 and converted it to 2\n"); case TRY_WORKING:
write_flash(buf, (*buf) & 0xFE); printf ("found 3 and converted it to 2\n");
*((unsigned char *)0xFF800000) = 0xF0; write_flash (buf, (*buf) & 0xFE);
udelay(100); *((unsigned char *)0xFF800000) = 0xF0;
printf("buf [%#010x] %#010x\n",buf,(*buf)); udelay (100);
case BOOT_WORKING : printf ("buf [%#010x] %#010x\n", buf, (*buf));
return BOOT_WORKING; /* XXX - fall through??? */
case BOOT_WORKING :
return BOOT_WORKING;
} }
return BOOT_DEFAULT; return BOOT_DEFAULT;
} }
unsigned scan_flash(void) unsigned scan_flash (void)
{ {
char section[] = "kernel"; char section[] = "kernel";
ulong sp;
int cfgFileLen = (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1); int cfgFileLen = (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1);
int sectionPtr = 0; int sectionPtr = 0;
int foundItem = 0; /* 0: None, 1: section found, 2: "=" found */ int foundItem = 0; /* 0: None, 1: section found, 2: "=" found */
...@@ -198,57 +196,54 @@ unsigned scan_flash(void) ...@@ -198,57 +196,54 @@ unsigned scan_flash(void)
buf = (unsigned char*)(CFG_FLASH_RANGE_BASE + CFG_FLASH_RANGE_SIZE \ buf = (unsigned char*)(CFG_FLASH_RANGE_BASE + CFG_FLASH_RANGE_SIZE \
- CFG_FLASH_ERASE_SECTOR_LENGTH); - CFG_FLASH_ERASE_SECTOR_LENGTH);
for(bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr){ for (bufPtr = 0; bufPtr < cfgFileLen; ++bufPtr) {
if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) { if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) {
return BOOT_DEFAULT; return BOOT_DEFAULT;
} }
switch(foundItem) /* This is the scanning loop, we try to find a particular
{ * quoted value
/* This is the scanning loop, we try to find a particular */
* quoted value switch (foundItem) {
*/ case 0:
case 0: if ((section[sectionPtr] == 0)) {
if((section[sectionPtr] == 0)){
++foundItem;
}
else if(buf[bufPtr] == section[sectionPtr]){
++sectionPtr;
}
else {
sectionPtr = 0;
}
break;
case 1:
++foundItem; ++foundItem;
break; } else if (buf[bufPtr] == section[sectionPtr]) {
case 2: ++sectionPtr;
++foundItem; } else {
break; sectionPtr = 0;
case 3: }
default: break;
return update_flash(buf[bufPtr - 1]); case 1:
++foundItem;
break;
case 2:
++foundItem;
break;
case 3:
default:
return update_flash (&buf[bufPtr - 1]);
} }
} }
printf("Failed to read %s\n",section); printf ("Failed to read %s\n",section);
return BOOT_DEFAULT; return BOOT_DEFAULT;
} }
TSBootInfo* find_boot_info(void) TSBootInfo* find_boot_info (void)
{ {
unsigned bootimage = scan_flash(); unsigned bootimage = scan_flash ();
TSBootInfo* info = (TSBootInfo*)malloc(sizeof(TSBootInfo)); TSBootInfo* info = (TSBootInfo*)malloc (sizeof(TSBootInfo));
switch(bootimage){ switch (bootimage) {
case TRY_WORKING: case TRY_WORKING:
info->address = CFG_WORKING_KERNEL_ADDRESS; info->address = CFG_WORKING_KERNEL_ADDRESS;
break; break;
case BOOT_WORKING : case BOOT_WORKING :
info->address = CFG_WORKING_KERNEL_ADDRESS; info->address = CFG_WORKING_KERNEL_ADDRESS;
break; break;
case BOOT_DEFAULT: case BOOT_DEFAULT:
default: default:
info->address= CFG_DEFAULT_KERNEL_ADDRESS; info->address= CFG_DEFAULT_KERNEL_ADDRESS;
} }
info->size = *((unsigned int *)(info->address )); info->size = *((unsigned int *)(info->address ));
...@@ -256,43 +251,44 @@ TSBootInfo* find_boot_info(void) ...@@ -256,43 +251,44 @@ TSBootInfo* find_boot_info(void)
return info; return info;
} }
void barcobcd_boot(void) void barcobcd_boot (void)
{ {
TSBootInfo* start; TSBootInfo* start;
char *bootm_args[2]; char *bootm_args[2];
char *buf; char *buf;
int cnt; int cnt;
extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
buf = (char *)(0x00800000); buf = (char *)(0x00800000);
/* make certain there are enough chars to print the command line here! /* make certain there are enough chars to print the command line here!
*/ */
bootm_args[0]=(char *)malloc(16*sizeof(char)); bootm_args[0] = (char *)malloc (16*sizeof(char));
bootm_args[1]=(char *)malloc(16*sizeof(char)); bootm_args[1] = (char *)malloc (16*sizeof(char));
start = find_boot_info(); start = find_boot_info ();
printf("Booting kernel at address %#10x with size %#10x\n", printf ("Booting kernel at address %#10x with size %#10x\n",
start->address, start->size); start->address, start->size);
/* give length of the kernel image to bootm */ /* give length of the kernel image to bootm */
sprintf(bootm_args[0],"%x",start->size); sprintf (bootm_args[0],"%x",start->size);
/* give address of the kernel image to bootm */ /* give address of the kernel image to bootm */
sprintf(bootm_args[1],"%x",buf); sprintf (bootm_args[1],"%x",buf);
printf("flash address: %#10x\n",start->address+8); printf ("flash address: %#10x\n",start->address+8);
printf("buf address: %#10x\n",buf); printf ("buf address: %#10x\n",buf);
/* aha, we reserve 8 bytes here... */ /* aha, we reserve 8 bytes here... */
for (cnt = 0; cnt < start->size ; cnt++){ for (cnt = 0; cnt < start->size ; cnt++) {
buf[cnt] = ((char *)start->address)[cnt+8]; buf[cnt] = ((char *)start->address)[cnt+8];
} }
/* initialise RAM memory */ /* initialise RAM memory */
*((unsigned int *)0xFEC00000) = 0x00141A98; *((unsigned int *)0xFEC00000) = 0x00141A98;
do_bootm(NULL,0,2,bootm_args); do_bootm (NULL,0,2,bootm_args);
} }
int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int barcobcd_boot_image (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ {
#if 0 #if 0
if (argc > 1) { if (argc > 1) {
...@@ -300,7 +296,7 @@ int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ...@@ -300,7 +296,7 @@ int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1; return 1;
} }
#endif #endif
barcobcd_boot(); barcobcd_boot ();
return 0; return 0;
} }
...@@ -308,19 +304,19 @@ int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ...@@ -308,19 +304,19 @@ int barcobcd_boot_image(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Currently, boot_working and boot_default are the same command. This is /* Currently, boot_working and boot_default are the same command. This is
* left in here to see what we'll do in the future */ * left in here to see what we'll do in the future */
U_BOOT_CMD( U_BOOT_CMD (
try_working, 1, 1, barcobcd_boot_image, try_working, 1, 1, barcobcd_boot_image,
" try_working - check flash value and boot the appropriate image\n", " try_working - check flash value and boot the appropriate image\n",
"\n" "\n"
); );
U_BOOT_CMD( U_BOOT_CMD (
boot_working, 1, 1, barcobcd_boot_image, boot_working, 1, 1, barcobcd_boot_image,
" boot_working - check flash value and boot the appropriate image\n", " boot_working - check flash value and boot the appropriate image\n",
"\n" "\n"
); );
U_BOOT_CMD( U_BOOT_CMD (
boot_default, 1, 1, barcobcd_boot_image, boot_default, 1, 1, barcobcd_boot_image,
" boot_default - check flash value and boot the appropriate image\n", " boot_default - check flash value and boot the appropriate image\n",
"\n" "\n"
...@@ -328,13 +324,40 @@ U_BOOT_CMD( ...@@ -328,13 +324,40 @@ U_BOOT_CMD(
/* /*
* We are not using serial communication, so just provide empty functions * We are not using serial communication, so just provide empty functions
*/ */
int serial_init(void){return 0;} int serial_init (void)
void serial_setbrg(void){} {
void serial_putc(const char c){} return 0;
void serial_puts(const char *c){} }
void serial_addr(unsigned int i){} void serial_setbrg (void)
int serial_getc(void){return 0;} {
int serial_tstc(void){return 0;} return;
}
unsigned long post_word_load(void){return 0l;}; void serial_putc (const char c)
void post_word_store(unsigned long val){} {
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)
{
return;
}
...@@ -46,7 +46,7 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o \ ...@@ -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_nand.o env_dataflash.o env_flash.o env_eeprom.o \
env_nvram.o env_nowhere.o \ env_nvram.o env_nowhere.o \
exports.o \ exports.o \
flash.o fpga.o \ flash.o fpga.o ft_build.o \
hush.o kgdb.o lcd.o lists.o lynxkdi.o \ hush.o kgdb.o lcd.o lists.o lynxkdi.o \
memsize.o miiphybb.o miiphyutil.o \ memsize.o miiphybb.o miiphyutil.o \
s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \ s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
......
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include <environment.h> #include <environment.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#ifdef CONFIG_OF_FLAT_TREE
#include <ft_build.h>
#endif
/*cmd_boot.c*/ /*cmd_boot.c*/
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
...@@ -489,6 +493,11 @@ fixup_silent_linux () ...@@ -489,6 +493,11 @@ fixup_silent_linux ()
} }
#endif /* CONFIG_SILENT_CONSOLE */ #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 #ifdef CONFIG_PPC
static void static void
do_bootm_linux (cmd_tbl_t *cmdtp, int flag, do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
...@@ -511,6 +520,9 @@ 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; bd_t *kbd;
void (*kernel)(bd_t *, ulong, ulong, ulong, ulong); void (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
image_header_t *hdr = &header; image_header_t *hdr = &header;
#ifdef CONFIG_OF_FLAT_TREE
char *of_flat_tree;
#endif
if ((s = getenv ("initrd_high")) != NULL) { if ((s = getenv ("initrd_high")) != NULL) {
/* a value of "no" or a similar string will act like 0, /* 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, ...@@ -776,15 +788,26 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
initrd_end = 0; 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", debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong)kernel); (ulong)kernel);
SHOW_BOOT_PROGRESS (15); SHOW_BOOT_PROGRESS (15);
#ifndef CONFIG_OF_FLAT_TREE
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
unlock_ram_in_cache(); unlock_ram_in_cache();
#endif #endif
/* /*
* Linux Kernel Parameters: * Linux Kernel Parameters:
* r3: ptr to board info data * r3: ptr to board info data
...@@ -794,6 +817,25 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, ...@@ -794,6 +817,25 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
* r7: End of command line string * r7: End of command line string
*/ */
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); (*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 */ #endif /* CONFIG_PPC */
......
...@@ -318,11 +318,20 @@ int ...@@ -318,11 +318,20 @@ int
do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ {
uint rcode = 0; uint rcode = 0;
iopin_t iopin;
static uint port = 0; static uint port = 0;
static uint pin = 0; static uint pin = 0;
static uint value = 0; static uint value = 0;
static enum { DIR, PAR, SOR, ODR, DAT, INT } cmd = DAT; static enum {
iopin_t iopin; DIR,
PAR,
SOR,
ODR,
DAT,
#if defined(CONFIG_8xx)
INT
#endif
} cmd = DAT;
if (argc != 5) { if (argc != 5) {
puts ("iopset PORT PIN CMD VALUE\n"); puts ("iopset PORT PIN CMD VALUE\n");
......
...@@ -184,7 +184,7 @@ int eth_init (bd_t * bd) ...@@ -184,7 +184,7 @@ int eth_init (bd_t * bd)
/* Init Ehternet buffers */ /* Init Ehternet buffers */
for (i = 0; i < RBF_FRAMEMAX; i++) { 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[i].size = 0;
} }
rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP; rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
......
This diff is collapsed.
...@@ -99,19 +99,17 @@ ...@@ -99,19 +99,17 @@
#define SCL 0x1000 /* PA 3 */ #define SCL 0x1000 /* PA 3 */
#define SDA 0x2000 /* PA 2 */ #define SDA 0x2000 /* PA 2 */
#define PAR immr->im_ioport.iop_papar #define __I2C_DIR immr->im_ioport.iop_padir
#define DIR immr->im_ioport.iop_padir #define __I2C_DAT immr->im_ioport.iop_padat
#define DAT immr->im_ioport.iop_padat #define __I2C_PAR immr->im_ioport.iop_papar
#define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
#define I2C_INIT {PAR &= ~(SCL | SDA); DIR |= SCL;} __I2C_DIR |= (SDA|SCL); }
#define I2C_ACTIVE (DIR |= SDA) #define I2C_READ ((__I2C_DAT & SDA) ? 1 : 0)
#define I2C_TRISTATE (DIR &= ~SDA) #define I2C_SDA(x) { if (x) __I2C_DAT |= SDA; else __I2C_DAT &= ~SDA; }
#define I2C_READ ((DAT & SDA) != 0) #define I2C_SCL(x) { if (x) __I2C_DAT |= SCL; else __I2C_DAT &= ~SCL; }
#define I2C_SDA(bit) if (bit) DAT |= SDA; \ #define I2C_DELAY { udelay(5); }
else DAT &= ~SDA #define I2C_ACTIVE { __I2C_DIR |= SDA; }
#define I2C_SCL(bit) if (bit) DAT |= SCL; \ #define I2C_TRISTATE { __I2C_DIR &= ~SDA; }
else DAT &= ~SCL
#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
#define CONFIG_RTC_PCF8563 #define CONFIG_RTC_PCF8563
#define CFG_I2C_RTC_ADDR 0x51 #define CFG_I2C_RTC_ADDR 0x51
......
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
#define CONFIG_NET_MULTI #define CONFIG_NET_MULTI
#define CONFIG_PCI_PNP /* do pci plug-and-play */ #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 #define CONFIG_E1000
#undef CONFIG_TULIP #undef CONFIG_TULIP
......
...@@ -181,17 +181,20 @@ ...@@ -181,17 +181,20 @@
#if defined (CONFIG_SOFT_I2C) #if defined (CONFIG_SOFT_I2C)
#define SDA 0x00010 #define SDA 0x00010
#define SCL 0x00020 #define SCL 0x00020
#define DIR immr->im_cpm.cp_pbdir #define __I2C_DIR immr->im_cpm.cp_pbdir
#define DAT immr->im_cpm.cp_pbdat #define __I2C_DAT immr->im_cpm.cp_pbdat
#define PAR immr->im_cpm.cp_pbpar #define __I2C_PAR immr->im_cpm.cp_pbpar
#define ODR immr->im_cpm.cp_pbodr #define __I2C_ODR immr->im_cpm.cp_pbodr
#define I2C_INIT {PAR&=~(SDA|SCL);ODR&=~(SDA|SCL);DAT|=(SDA|SCL);DIR|=(SDA|SCL);} #define I2C_INIT { __I2C_PAR &= ~(SDA|SCL); \
#define I2C_READ ((DAT&SDA)?1:0) __I2C_ODR &= ~(SDA|SCL); \
#define I2C_SDA(x) {if(x)DAT|=SDA;else DAT&=~SDA;}