Some code cleanup for GCC 4.x
This commit is contained in:
parent
4367a01036
commit
d52fb7e3d1
|
@ -2,6 +2,8 @@
|
||||||
Changes since U-Boot 1.1.4:
|
Changes since U-Boot 1.1.4:
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
|
* Some code cleanup for GCC 4.x
|
||||||
|
|
||||||
* Fixes to support environment in NAND flash;
|
* Fixes to support environment in NAND flash;
|
||||||
enable NAND flash based environment for delta board.
|
enable NAND flash based environment for delta board.
|
||||||
|
|
||||||
|
|
|
@ -593,7 +593,7 @@ int AT91F_DataFlashRead(
|
||||||
if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY) != DATAFLASH_OK)
|
if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY) != DATAFLASH_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (AT91F_DataFlashContinuousRead (pDataFlash, addr, buffer, SizeToRead) != DATAFLASH_OK)
|
if (AT91F_DataFlashContinuousRead (pDataFlash, addr, (uchar *)buffer, SizeToRead) != DATAFLASH_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
size -= SizeToRead;
|
size -= SizeToRead;
|
||||||
|
|
|
@ -393,8 +393,7 @@ outahere:
|
||||||
* Copy memory to flash
|
* Copy memory to flash
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile static int write_word (flash_info_t * info, ulong dest,
|
static int write_word (flash_info_t * info, ulong dest, ulong data)
|
||||||
ulong data)
|
|
||||||
{
|
{
|
||||||
volatile u16 *addr = (volatile u16 *) dest;
|
volatile u16 *addr = (volatile u16 *) dest;
|
||||||
ulong result;
|
ulong result;
|
||||||
|
@ -409,7 +408,6 @@ volatile static int write_word (flash_info_t * info, ulong dest,
|
||||||
if ((result & data) != data)
|
if ((result & data) != data)
|
||||||
return ERR_NOT_ERASED;
|
return ERR_NOT_ERASED;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable interrupts which might cause a timeout
|
* Disable interrupts which might cause a timeout
|
||||||
* here. Remember that our exception vectors are
|
* here. Remember that our exception vectors are
|
||||||
|
|
|
@ -69,8 +69,8 @@ int i2c_read (unsigned char chip, unsigned int addr, int alen,
|
||||||
void load_sernum_ethaddr (void)
|
void load_sernum_ethaddr (void)
|
||||||
{
|
{
|
||||||
struct manufacturer_data data;
|
struct manufacturer_data data;
|
||||||
unsigned char serial [9];
|
char ethaddr[18];
|
||||||
unsigned char ethaddr[18];
|
char serial [9];
|
||||||
unsigned short chksum;
|
unsigned short chksum;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned short i, is, id;
|
unsigned short i, is, id;
|
||||||
|
|
|
@ -229,7 +229,7 @@ static void wait_us(unsigned long us)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dfc_clear_nddb()
|
static void dfc_clear_nddb(void)
|
||||||
{
|
{
|
||||||
NDCR &= ~NDCR_ND_RUN;
|
NDCR &= ~NDCR_ND_RUN;
|
||||||
wait_us(CFG_NAND_OTHER_TO);
|
wait_us(CFG_NAND_OTHER_TO);
|
||||||
|
@ -263,7 +263,7 @@ static unsigned long dfc_wait_event(unsigned long event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we don't always wan't to do this */
|
/* we don't always wan't to do this */
|
||||||
static void dfc_new_cmd()
|
static void dfc_new_cmd(void)
|
||||||
{
|
{
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
unsigned long status;
|
unsigned long status;
|
||||||
|
@ -398,7 +398,7 @@ static void dfc_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dfc_gpio_init()
|
static void dfc_gpio_init(void)
|
||||||
{
|
{
|
||||||
DFC_DEBUG2("Setting up DFC GPIO's.\n");
|
DFC_DEBUG2("Setting up DFC GPIO's.\n");
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,7 @@ outahere:
|
||||||
* Copy memory to flash
|
* Copy memory to flash
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile static int write_word (flash_info_t *info, ulong dest, ulong data)
|
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||||
{
|
{
|
||||||
vu_long *addr = (vu_long *)dest;
|
vu_long *addr = (vu_long *)dest;
|
||||||
ulong result;
|
ulong result;
|
||||||
|
|
|
@ -351,8 +351,7 @@ outahere:
|
||||||
* Copy memory to flash
|
* Copy memory to flash
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile static int write_word (flash_info_t * info, ulong dest,
|
static int write_word (flash_info_t * info, ulong dest, ulong data)
|
||||||
ulong data)
|
|
||||||
{
|
{
|
||||||
vu_long *addr = (vu_long *) dest;
|
vu_long *addr = (vu_long *) dest;
|
||||||
ulong result;
|
ulong result;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -230,7 +230,7 @@ out:
|
||||||
* Copy memory to flash
|
* Copy memory to flash
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile static int write_hword(flash_info_t *info, ulong dest, ushort data)
|
static int write_hword(flash_info_t *info, ulong dest, ushort data)
|
||||||
{
|
{
|
||||||
vu_short *addr = (vu_short *) dest;
|
vu_short *addr = (vu_short *) dest;
|
||||||
ushort result;
|
ushort result;
|
||||||
|
|
|
@ -48,10 +48,12 @@ static void netstar_nand_hwcontrol(struct mtd_info *mtd, int cmd)
|
||||||
/*
|
/*
|
||||||
* chip R/B detection
|
* chip R/B detection
|
||||||
*/
|
*/
|
||||||
|
/***
|
||||||
static int netstar_nand_ready(struct mtd_info *mtd)
|
static int netstar_nand_ready(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
return (*(volatile ushort *)GPIO_DATA_INPUT_REG) & 0x02;
|
return (*(volatile ushort *)GPIO_DATA_INPUT_REG) & 0x02;
|
||||||
}
|
}
|
||||||
|
***/
|
||||||
|
|
||||||
void board_nand_init(struct nand_chip *nand)
|
void board_nand_init(struct nand_chip *nand)
|
||||||
{
|
{
|
||||||
|
|
|
@ -315,7 +315,7 @@ outahere:
|
||||||
* Copy memory to flash
|
* Copy memory to flash
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile static int write_word (flash_info_t *info, ulong dest, ulong data)
|
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||||
{
|
{
|
||||||
vu_long *addr = (vu_long *)dest;
|
vu_long *addr = (vu_long *)dest;
|
||||||
ulong result;
|
ulong result;
|
||||||
|
|
|
@ -112,7 +112,8 @@ int env_init(void)
|
||||||
*/
|
*/
|
||||||
int saveenv(void)
|
int saveenv(void)
|
||||||
{
|
{
|
||||||
int total, ret = 0;
|
ulong total;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
puts ("Erasing Nand...");
|
puts ("Erasing Nand...");
|
||||||
if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))
|
if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))
|
||||||
|
@ -120,8 +121,7 @@ int saveenv(void)
|
||||||
|
|
||||||
puts ("Writing to Nand... ");
|
puts ("Writing to Nand... ");
|
||||||
total = CFG_ENV_SIZE;
|
total = CFG_ENV_SIZE;
|
||||||
ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total,
|
ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
|
||||||
(u_char*) env_ptr);
|
|
||||||
if (ret || total != CFG_ENV_SIZE)
|
if (ret || total != CFG_ENV_SIZE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -138,11 +138,11 @@ int saveenv(void)
|
||||||
void env_relocate_spec (void)
|
void env_relocate_spec (void)
|
||||||
{
|
{
|
||||||
#if !defined(ENV_IS_EMBEDDED)
|
#if !defined(ENV_IS_EMBEDDED)
|
||||||
int ret, total;
|
ulong total;
|
||||||
|
int ret;
|
||||||
|
|
||||||
total = CFG_ENV_SIZE;
|
total = CFG_ENV_SIZE;
|
||||||
ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total,
|
ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
|
||||||
(u_char*) env_ptr);
|
|
||||||
if (ret || total != CFG_ENV_SIZE)
|
if (ret || total != CFG_ENV_SIZE)
|
||||||
return use_default();
|
return use_default();
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ at91_xfer(unsigned char chip, unsigned int addr, int alen,
|
||||||
int
|
int
|
||||||
i2c_probe(unsigned char chip)
|
i2c_probe(unsigned char chip)
|
||||||
{
|
{
|
||||||
char buffer[1];
|
unsigned char buffer[1];
|
||||||
|
|
||||||
return at91_xfer(chip, 0, 0, buffer, 1, 1);
|
return at91_xfer(chip, 0, 0, buffer, 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ i2c_init(int speed, int slaveaddr)
|
||||||
|
|
||||||
uchar i2c_reg_read(uchar i2c_addr, uchar reg)
|
uchar i2c_reg_read(uchar i2c_addr, uchar reg)
|
||||||
{
|
{
|
||||||
char buf;
|
unsigned char buf;
|
||||||
|
|
||||||
i2c_read(i2c_addr, reg, 1, &buf, 1);
|
i2c_read(i2c_addr, reg, 1, &buf, 1);
|
||||||
|
|
||||||
|
|
|
@ -174,8 +174,7 @@ void dataflash_print_info (void)
|
||||||
/* Function Name : AT91F_DataflashSelect */
|
/* Function Name : AT91F_DataflashSelect */
|
||||||
/* Object : Select the correct device */
|
/* Object : Select the correct device */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash,
|
AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash, unsigned long *addr)
|
||||||
unsigned int *addr)
|
|
||||||
{
|
{
|
||||||
char addr_valid = 0;
|
char addr_valid = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -291,7 +290,7 @@ int i,j, area1, area2, addr_valid = 0;
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
int read_dataflash (unsigned long addr, unsigned long size, char *result)
|
int read_dataflash (unsigned long addr, unsigned long size, char *result)
|
||||||
{
|
{
|
||||||
int AddrToRead = addr;
|
unsigned long AddrToRead = addr;
|
||||||
AT91PS_DataFlash pFlash = &DataFlashInst;
|
AT91PS_DataFlash pFlash = &DataFlashInst;
|
||||||
|
|
||||||
pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead);
|
pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead);
|
||||||
|
@ -313,7 +312,7 @@ int read_dataflash (unsigned long addr, unsigned long size, char *result)
|
||||||
int write_dataflash (unsigned long addr_dest, unsigned long addr_src,
|
int write_dataflash (unsigned long addr_dest, unsigned long addr_src,
|
||||||
unsigned long size)
|
unsigned long size)
|
||||||
{
|
{
|
||||||
int AddrToWrite = addr_dest;
|
unsigned long AddrToWrite = addr_dest;
|
||||||
AT91PS_DataFlash pFlash = &DataFlashInst;
|
AT91PS_DataFlash pFlash = &DataFlashInst;
|
||||||
|
|
||||||
pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite);
|
pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite);
|
||||||
|
@ -330,7 +329,7 @@ int write_dataflash (unsigned long addr_dest, unsigned long addr_src,
|
||||||
if (AddrToWrite == -1)
|
if (AddrToWrite == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return AT91F_DataFlashWrite (pFlash, (char *) addr_src, AddrToWrite, size);
|
return AT91F_DataFlashWrite (pFlash, (uchar *)addr_src, AddrToWrite, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -185,21 +185,21 @@ static int smc_rcv (void);
|
||||||
. If an EEPROM is present it really should be consulted.
|
. If an EEPROM is present it really should be consulted.
|
||||||
*/
|
*/
|
||||||
int smc_get_ethaddr(bd_t *bd);
|
int smc_get_ethaddr(bd_t *bd);
|
||||||
int get_rom_mac(char *v_rom_mac);
|
int get_rom_mac(unsigned char *v_rom_mac);
|
||||||
|
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* Internal routines
|
* Internal routines
|
||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c };
|
static unsigned char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function must be called before smc_open() if you want to override
|
* This function must be called before smc_open() if you want to override
|
||||||
* the default mac address.
|
* the default mac address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void smc_set_mac_addr (const char *addr)
|
void smc_set_mac_addr (const unsigned char *addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -883,7 +883,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
char *e = NULL;
|
char *e = NULL;
|
||||||
char *v_mac, es[] = "11:22:33:44:55:66";
|
char *v_mac, es[] = "11:22:33:44:55:66";
|
||||||
uchar s_env_mac[64];
|
char s_env_mac[64];
|
||||||
uchar v_env_mac[6];
|
uchar v_env_mac[6];
|
||||||
uchar v_rom_mac[6];
|
uchar v_rom_mac[6];
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
|
|
||||||
if (!env_present) { /* if NO env */
|
if (!env_present) { /* if NO env */
|
||||||
if (rom_valid) { /* but ROM is valid */
|
if (rom_valid) { /* but ROM is valid */
|
||||||
v_mac = v_rom_mac;
|
v_mac = (char *)v_rom_mac;
|
||||||
sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
|
sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
v_mac[0], v_mac[1], v_mac[2], v_mac[3],
|
v_mac[0], v_mac[1], v_mac[2], v_mac[3],
|
||||||
v_mac[4], v_mac[5]);
|
v_mac[4], v_mac[5]);
|
||||||
|
@ -915,7 +915,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else { /* good env, don't care ROM */
|
} else { /* good env, don't care ROM */
|
||||||
v_mac = v_env_mac; /* always use a good env over a ROM */
|
v_mac = (char *)v_env_mac; /* always use a good env over a ROM */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env_present && rom_valid) { /* if both env and ROM are good */
|
if (env_present && rom_valid) { /* if both env and ROM are good */
|
||||||
|
@ -935,7 +935,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
|
memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
|
||||||
smc_set_mac_addr (v_mac); /* use old function to update smc default */
|
smc_set_mac_addr ((unsigned char *)v_mac); /* use old function to update smc default */
|
||||||
PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
|
PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
|
||||||
v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
|
v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -946,7 +946,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
* Note, this has omly been tested for the OMAP730 P2.
|
* Note, this has omly been tested for the OMAP730 P2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int get_rom_mac (char *v_rom_mac)
|
int get_rom_mac (unsigned char *v_rom_mac)
|
||||||
{
|
{
|
||||||
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
|
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
|
||||||
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
|
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
* in order to override the default mac address.
|
* in order to override the default mac address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void smc_set_mac_addr(const char *addr);
|
void smc_set_mac_addr(const unsigned char *addr);
|
||||||
|
|
||||||
|
|
||||||
/* I want some simple types */
|
/* I want some simple types */
|
||||||
|
|
|
@ -897,7 +897,7 @@ static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int pa
|
||||||
int i, status;
|
int i, status;
|
||||||
u_char ecc_code[32];
|
u_char ecc_code[32];
|
||||||
int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;
|
int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;
|
||||||
int *oob_config = oobsel->eccpos;
|
uint *oob_config = oobsel->eccpos;
|
||||||
int datidx = 0, eccidx = 0, eccsteps = this->eccsteps;
|
int datidx = 0, eccidx = 0, eccsteps = this->eccsteps;
|
||||||
int eccbytes = 0;
|
int eccbytes = 0;
|
||||||
|
|
||||||
|
@ -1119,7 +1119,8 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
|
||||||
u_char ecc_calc[32];
|
u_char ecc_calc[32];
|
||||||
u_char ecc_code[32];
|
u_char ecc_code[32];
|
||||||
int eccmode, eccsteps;
|
int eccmode, eccsteps;
|
||||||
int *oob_config, datidx;
|
unsigned *oob_config;
|
||||||
|
int datidx;
|
||||||
int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
|
int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
|
||||||
int eccbytes;
|
int eccbytes;
|
||||||
int compareecc = 1;
|
int compareecc = 1;
|
||||||
|
|
|
@ -210,7 +210,7 @@ static int smc_rcv(void);
|
||||||
. If an EEPROM is present it really should be consulted.
|
. If an EEPROM is present it really should be consulted.
|
||||||
*/
|
*/
|
||||||
int smc_get_ethaddr(bd_t *bd);
|
int smc_get_ethaddr(bd_t *bd);
|
||||||
int get_rom_mac(char *v_rom_mac);
|
int get_rom_mac(uchar *v_rom_mac);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
@ -276,17 +276,23 @@ static inline void SMC_outb(byte value, dword offset)
|
||||||
|
|
||||||
static inline void SMC_insw(dword offset, volatile uchar* buf, dword len)
|
static inline void SMC_insw(dword offset, volatile uchar* buf, dword len)
|
||||||
{
|
{
|
||||||
|
volatile word *p = (volatile word *)buf;
|
||||||
|
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
*((word*)buf)++ = SMC_inw(offset);
|
*p++ = SMC_inw(offset);
|
||||||
barrier(); *((volatile u32*)(0xc0000000));
|
barrier();
|
||||||
|
*((volatile u32*)(0xc0000000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SMC_outsw(dword offset, uchar* buf, dword len)
|
static inline void SMC_outsw(dword offset, uchar* buf, dword len)
|
||||||
{
|
{
|
||||||
|
volatile word *p = (volatile word *)buf;
|
||||||
|
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
SMC_outw(*((word*)buf)++, offset);
|
SMC_outw(*p++, offset);
|
||||||
barrier(); *(volatile u32*)(0xc0000000);
|
barrier();
|
||||||
|
*(volatile u32*)(0xc0000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SMC_USE_IOFUNCS */
|
#endif /* CONFIG_SMC_USE_IOFUNCS */
|
||||||
|
@ -298,7 +304,7 @@ static char unsigned smc_mac_addr[6] = {0x02, 0x80, 0xad, 0x20, 0x31, 0xb8};
|
||||||
* the default mac address.
|
* the default mac address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void smc_set_mac_addr(const char *addr) {
|
void smc_set_mac_addr(const unsigned char *addr) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < sizeof(smc_mac_addr); i++){
|
for (i=0; i < sizeof(smc_mac_addr); i++){
|
||||||
|
@ -1524,7 +1530,8 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
{
|
{
|
||||||
int env_size, rom_valid, env_present = 0, reg;
|
int env_size, rom_valid, env_present = 0, reg;
|
||||||
char *s = NULL, *e, *v_mac, es[] = "11:22:33:44:55:66";
|
char *s = NULL, *e, *v_mac, es[] = "11:22:33:44:55:66";
|
||||||
uchar s_env_mac[64], v_env_mac[6], v_rom_mac[6];
|
char s_env_mac[64];
|
||||||
|
uchar v_env_mac[6], v_rom_mac[6];
|
||||||
|
|
||||||
env_size = getenv_r ("ethaddr", s_env_mac, sizeof (s_env_mac));
|
env_size = getenv_r ("ethaddr", s_env_mac, sizeof (s_env_mac));
|
||||||
if ((env_size > 0) && (env_size < sizeof (es))) { /* exit if env is bad */
|
if ((env_size > 0) && (env_size < sizeof (es))) { /* exit if env is bad */
|
||||||
|
@ -1547,7 +1554,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
|
|
||||||
if (!env_present) { /* if NO env */
|
if (!env_present) { /* if NO env */
|
||||||
if (rom_valid) { /* but ROM is valid */
|
if (rom_valid) { /* but ROM is valid */
|
||||||
v_mac = v_rom_mac;
|
v_mac = (char *)v_rom_mac;
|
||||||
sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
|
sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
v_mac[0], v_mac[1], v_mac[2], v_mac[3],
|
v_mac[0], v_mac[1], v_mac[2], v_mac[3],
|
||||||
v_mac[4], v_mac[5]);
|
v_mac[4], v_mac[5]);
|
||||||
|
@ -1557,7 +1564,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} else { /* good env, don't care ROM */
|
} else { /* good env, don't care ROM */
|
||||||
v_mac = v_env_mac; /* always use a good env over a ROM */
|
v_mac = (char *)v_env_mac; /* always use a good env over a ROM */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env_present && rom_valid) { /* if both env and ROM are good */
|
if (env_present && rom_valid) { /* if both env and ROM are good */
|
||||||
|
@ -1577,13 +1584,13 @@ int smc_get_ethaddr (bd_t * bd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
|
memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
|
||||||
smc_set_mac_addr (v_mac); /* use old function to update smc default */
|
smc_set_mac_addr ((uchar *)v_mac); /* use old function to update smc default */
|
||||||
PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
|
PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
|
||||||
v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
|
v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_rom_mac (char *v_rom_mac)
|
int get_rom_mac (uchar *v_rom_mac)
|
||||||
{
|
{
|
||||||
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
|
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
|
||||||
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
|
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
* in order to override the default mac address.
|
* in order to override the default mac address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void smc_set_mac_addr(const char *addr);
|
void smc_set_mac_addr (const unsigned char *addr);
|
||||||
|
|
||||||
|
|
||||||
/* I want some simple types */
|
/* I want some simple types */
|
||||||
|
|
|
@ -267,8 +267,6 @@ struct _irq_handler {
|
||||||
void (*m_func)( void *data);
|
void (*m_func)( void *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct _irq_handler IRQ_HANDLER[];
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __S3C4510_h */
|
#endif /* __S3C4510_h */
|
||||||
|
|
|
@ -124,7 +124,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
|
||||||
checksum = ntohl (hdr->ih_hcrc);
|
checksum = ntohl (hdr->ih_hcrc);
|
||||||
hdr->ih_hcrc = 0;
|
hdr->ih_hcrc = 0;
|
||||||
|
|
||||||
if (crc32 (0, (char *) data, len) != checksum) {
|
if (crc32 (0, (unsigned char *) data, len) != checksum) {
|
||||||
printf ("Bad Header Checksum\n");
|
printf ("Bad Header Checksum\n");
|
||||||
SHOW_BOOT_PROGRESS (-11);
|
SHOW_BOOT_PROGRESS (-11);
|
||||||
do_reset (cmdtp, flag, argc, argv);
|
do_reset (cmdtp, flag, argc, argv);
|
||||||
|
@ -148,7 +148,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
|
||||||
ulong csum = 0;
|
ulong csum = 0;
|
||||||
|
|
||||||
printf (" Verifying Checksum ... ");
|
printf (" Verifying Checksum ... ");
|
||||||
csum = crc32 (0, (char *) data, len);
|
csum = crc32 (0, (unsigned char *) data, len);
|
||||||
if (csum != ntohl (hdr->ih_dcrc)) {
|
if (csum != ntohl (hdr->ih_dcrc)) {
|
||||||
printf ("Bad Data CRC\n");
|
printf ("Bad Data CRC\n");
|
||||||
SHOW_BOOT_PROGRESS (-12);
|
SHOW_BOOT_PROGRESS (-12);
|
||||||
|
|
|
@ -121,7 +121,7 @@ void *sbrk (ptrdiff_t increment)
|
||||||
|
|
||||||
static int init_baudrate (void)
|
static int init_baudrate (void)
|
||||||
{
|
{
|
||||||
uchar tmp[64]; /* long enough for environment variables */
|
char tmp[64]; /* long enough for environment variables */
|
||||||
int i = getenv_r ("baudrate", tmp, sizeof (tmp));
|
int i = getenv_r ("baudrate", tmp, sizeof (tmp));
|
||||||
gd->bd->bi_baudrate = gd->baudrate = (i > 0)
|
gd->bd->bi_baudrate = gd->baudrate = (i > 0)
|
||||||
? (int) simple_strtoul (tmp, NULL, 10)
|
? (int) simple_strtoul (tmp, NULL, 10)
|
||||||
|
@ -235,9 +235,11 @@ init_fnc_t *init_sequence[] = {
|
||||||
|
|
||||||
void start_armboot (void)
|
void start_armboot (void)
|
||||||
{
|
{
|
||||||
ulong size;
|
|
||||||
init_fnc_t **init_fnc_ptr;
|
init_fnc_t **init_fnc_ptr;
|
||||||
char *s;
|
char *s;
|
||||||
|
#ifndef CFG_NO_FLASH
|
||||||
|
ulong size;
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_VFD) || defined(CONFIG_LCD)
|
#if defined(CONFIG_VFD) || defined(CONFIG_LCD)
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -320,7 +322,7 @@ void start_armboot (void)
|
||||||
int i;
|
int i;
|
||||||
ulong reg;
|
ulong reg;
|
||||||
char *s, *e;
|
char *s, *e;
|
||||||
uchar tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
i = getenv_r ("ethaddr", tmp, sizeof (tmp));
|
i = getenv_r ("ethaddr", tmp, sizeof (tmp));
|
||||||
s = (i > 0) ? tmp : NULL;
|
s = (i > 0) ? tmp : NULL;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static unsigned bcd2bin (uchar c);
|
||||||
static int setup_done = 0;
|
static int setup_done = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rs5c372_readram(char *buf, int len)
|
rs5c372_readram(unsigned char *buf, int len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ rs5c372_enable(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rs5c372_convert_to_time(struct rtc_time *dt, char *buf)
|
rs5c372_convert_to_time(struct rtc_time *dt, unsigned char *buf)
|
||||||
{
|
{
|
||||||
/* buf[0] is register 15 */
|
/* buf[0] is register 15 */
|
||||||
dt->tm_sec = bcd2bin(buf[1]);
|
dt->tm_sec = bcd2bin(buf[1]);
|
||||||
|
|
Loading…
Reference in New Issue