Coding style fixes (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2577 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
1a9c892d58
commit
195237f2e1
|
@ -21,7 +21,8 @@ extern __inline__ void toggle_ready_82802ab(volatile uint8_t *dst)
|
|||
}
|
||||
}
|
||||
|
||||
extern __inline__ void data_polling_82802ab(volatile uint8_t *dst, uint8_t data)
|
||||
extern __inline__ void data_polling_82802ab(volatile uint8_t *dst,
|
||||
uint8_t data)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
uint8_t tmp;
|
||||
|
@ -38,9 +39,9 @@ extern __inline__ void data_polling_82802ab(volatile uint8_t *dst, uint8_t data)
|
|||
|
||||
extern __inline__ void protect_82802ab(volatile uint8_t *bios)
|
||||
{
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xA0;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xA0;
|
||||
|
||||
usleep(200);
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
|
|||
int i;
|
||||
|
||||
for (i = 0; i < page_size; i++) {
|
||||
if( (i & 0xfff) == 0xfff )
|
||||
printf("0x%08lx", (unsigned long) dst -
|
||||
(unsigned long) bios);
|
||||
if ((i & 0xfff) == 0xfff)
|
||||
printf("0x%08lx", (unsigned long)dst -
|
||||
(unsigned long)bios);
|
||||
|
||||
*(bios + 0x555) = 0xAA;
|
||||
*(bios + 0x2AA) = 0x55;
|
||||
|
@ -66,7 +66,7 @@ static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
|
|||
/* wait for Toggle bit ready */
|
||||
toggle_ready_jedec(bios);
|
||||
|
||||
if( (i & 0xfff) == 0xfff )
|
||||
if ((i & 0xfff) == 0xfff)
|
||||
printf("\b\b\b\b\b\b\b\b\b\b");
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,8 @@ int erase_29f040b(struct flashchip *flash)
|
|||
int write_29f040b(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024, page_size =
|
||||
flash->page_size;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
printf("Programming page ");
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __FLASH_H__
|
||||
#define __FLASH_H__ 1
|
||||
|
||||
|
@ -41,10 +40,10 @@ struct flashchip {
|
|||
int total_size;
|
||||
int page_size;
|
||||
|
||||
int (*probe) (struct flashchip * flash);
|
||||
int (*erase) (struct flashchip * flash);
|
||||
int (*write) (struct flashchip * flash, uint8_t *buf);
|
||||
int (*read) (struct flashchip * flash, uint8_t *buf);
|
||||
int (*probe) (struct flashchip *flash);
|
||||
int (*erase) (struct flashchip *flash);
|
||||
int (*write) (struct flashchip *flash, uint8_t *buf);
|
||||
int (*read) (struct flashchip *flash, uint8_t *buf);
|
||||
|
||||
int fd_mem;
|
||||
volatile uint8_t *virt_addr_2;
|
||||
|
@ -52,73 +51,73 @@ struct flashchip {
|
|||
|
||||
extern struct flashchip flashchips[];
|
||||
|
||||
#define AMD_ID 0x01
|
||||
#define AM_29F040B 0xA4
|
||||
#define AM_29F016D 0xAD
|
||||
#define AMD_ID 0x01
|
||||
#define AM_29F040B 0xA4
|
||||
#define AM_29F016D 0xAD
|
||||
|
||||
#define ASD_ID 0x25
|
||||
#define ASD_AE49F2008 0x52
|
||||
#define ASD_ID 0x25
|
||||
#define ASD_AE49F2008 0x52
|
||||
|
||||
#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */
|
||||
#define AT_29C040A 0xA4 /* Winbond w29c020c device code */
|
||||
#define ATMEL_ID 0x1F /* Winbond Manufacture ID code */
|
||||
#define AT_29C040A 0xA4 /* Winbond w29c020c device code */
|
||||
|
||||
#define MX_ID 0xC2
|
||||
#define MX_29F002 0xB0
|
||||
#define MX_ID 0xC2
|
||||
#define MX_29F002 0xB0
|
||||
|
||||
#define SHARP_ID 0xB0
|
||||
#define SHARP_LHF00L04 0xCF
|
||||
#define SHARP_ID 0xB0
|
||||
#define SHARP_LHF00L04 0xCF
|
||||
|
||||
#define SST_ID 0xBF /* SST Manufacturer ID code */
|
||||
#define SST_29EE020A 0x10 /* SST 29EE020 device */
|
||||
#define SST_28SF040 0x04 /* SST 29EE040 device */
|
||||
#define SST_39SF010 0xB5 /* SST 39SF010A device */
|
||||
#define SST_39SF020 0xB6 /* SST 39SF020A device */
|
||||
#define SST_39SF040 0xB7 /* SST 39SF040 device */
|
||||
#define SST_39VF020 0xD6 /* SST 39VF020 device */
|
||||
#define SST_49LF040B 0x50 /* SST 49LF040B device */
|
||||
#define SST_49LF040 0x51 /* SST 49LF040 device */
|
||||
#define SST_49LF020A 0x52 /* SST 49LF020A device */
|
||||
#define SST_49LF080A 0x5B /* SST 48LF080A device */
|
||||
#define SST_49LF002A 0x57 /* SST 49LF002A device */
|
||||
#define SST_49LF003A 0x1B /* SST 49LF003A device */
|
||||
#define SST_49LF004A 0x60 /* SST 49LF004A device */
|
||||
#define SST_49LF008A 0x5A /* SST 49LF008A device */
|
||||
#define SST_49LF004C 0x54 /* SST 49LF004C device */
|
||||
#define SST_49LF008C 0x59 /* SST 49LF008C device */
|
||||
#define SST_49LF016C 0x5C /* SST 49LF016C device */
|
||||
#define SST_49LF160C 0x4C /* SST 49LF160C device */
|
||||
#define SST_ID 0xBF /* SST Manufacturer ID code */
|
||||
#define SST_29EE020A 0x10 /* SST 29EE020 device */
|
||||
#define SST_28SF040 0x04 /* SST 29EE040 device */
|
||||
#define SST_39SF010 0xB5 /* SST 39SF010A device */
|
||||
#define SST_39SF020 0xB6 /* SST 39SF020A device */
|
||||
#define SST_39SF040 0xB7 /* SST 39SF040 device */
|
||||
#define SST_39VF020 0xD6 /* SST 39VF020 device */
|
||||
#define SST_49LF040B 0x50 /* SST 49LF040B device */
|
||||
#define SST_49LF040 0x51 /* SST 49LF040 device */
|
||||
#define SST_49LF020A 0x52 /* SST 49LF020A device */
|
||||
#define SST_49LF080A 0x5B /* SST 48LF080A device */
|
||||
#define SST_49LF002A 0x57 /* SST 49LF002A device */
|
||||
#define SST_49LF003A 0x1B /* SST 49LF003A device */
|
||||
#define SST_49LF004A 0x60 /* SST 49LF004A device */
|
||||
#define SST_49LF008A 0x5A /* SST 49LF008A device */
|
||||
#define SST_49LF004C 0x54 /* SST 49LF004C device */
|
||||
#define SST_49LF008C 0x59 /* SST 49LF008C device */
|
||||
#define SST_49LF016C 0x5C /* SST 49LF016C device */
|
||||
#define SST_49LF160C 0x4C /* SST 49LF160C device */
|
||||
|
||||
#define PMC_ID 0x9D /* PMC Manufacturer ID code */
|
||||
#define PMC_49FL002 0x6D /* PMC 49FL002 device code */
|
||||
#define PMC_49FL004 0x6E /* PMC 49FL004 device code */
|
||||
#define PMC_ID 0x9D /* PMC Manufacturer ID code */
|
||||
#define PMC_49FL002 0x6D /* PMC 49FL002 device code */
|
||||
#define PMC_49FL004 0x6E /* PMC 49FL004 device code */
|
||||
|
||||
#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */
|
||||
#define W_29C011 0xC1 /* Winbond w29c011 device code */
|
||||
#define W_29C020C 0x45 /* Winbond w29c020c device code */
|
||||
#define W_39V040A 0x3D /* Winbond w39v040a device code */
|
||||
#define W_39V040B 0x54 /* Winbond w39v040b device code */
|
||||
#define W_39V080A 0xD0 /* Winbond w39v080a device code */
|
||||
#define W_49F002U 0x0B /* Winbond w49F002u device code */
|
||||
#define W_49V002A 0xB0 /* Winbond W49V002A device code */
|
||||
#define W_49V002FA 0x32 /* Winbond W49V002FA device code */
|
||||
#define WINBOND_ID 0xDA /* Winbond Manufacture ID code */
|
||||
#define W_29C011 0xC1 /* Winbond w29c011 device code */
|
||||
#define W_29C020C 0x45 /* Winbond w29c020c device code */
|
||||
#define W_39V040A 0x3D /* Winbond w39v040a device code */
|
||||
#define W_39V040B 0x54 /* Winbond w39v040b device code */
|
||||
#define W_39V080A 0xD0 /* Winbond w39v080a device code */
|
||||
#define W_49F002U 0x0B /* Winbond w49F002u device code */
|
||||
#define W_49V002A 0xB0 /* Winbond W49V002A device code */
|
||||
#define W_49V002FA 0x32 /* Winbond W49V002FA device code */
|
||||
|
||||
#define ST_ID 0x20
|
||||
#define ST_M29F040B 0xE2
|
||||
#define ST_M29F400BT 0xD5
|
||||
#define ST_ID 0x20
|
||||
#define ST_M29F040B 0xE2
|
||||
#define ST_M29F400BT 0xD5
|
||||
|
||||
#define EMST_ID 0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */
|
||||
#define EMST_F49B002UA 0x00 /* EMST F49B002UA device code */
|
||||
#define EMST_ID 0x8c /* EMST - Elite Flash Storage Inc. Manufacturer ID code */
|
||||
#define EMST_F49B002UA 0x00 /* EMST F49B002UA device code */
|
||||
|
||||
#define MSYSTEMS_ID 0x156f
|
||||
#define MSYSTEMS_MD2200 0xdb /* ? */
|
||||
#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */
|
||||
#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
|
||||
#define MSYSTEMS_ID 0x156f
|
||||
#define MSYSTEMS_MD2200 0xdb /* ? */
|
||||
#define MSYSTEMS_MD2800 0x30 /* hmm -- both 0x30 */
|
||||
#define MSYSTEMS_MD2802 0x30 /* hmm -- both 0x30 */
|
||||
|
||||
#define SYNCMOS_ID 0x40 /* SyncMOS ID */
|
||||
#define S29C51001T 0x01 /* SyncMOS S29C51001T/B */
|
||||
#define S29C51002T 0x02 /* SyncMOS S29C51002T/B */
|
||||
#define S29C51004T 0x03 /* SyncMOS S29C51004T/B */
|
||||
#define S29C31004T 0x63 /* SyncMOS S29C31004T */
|
||||
#define SYNCMOS_ID 0x40 /* SyncMOS ID */
|
||||
#define S29C51001T 0x01 /* SyncMOS S29C51001T/B */
|
||||
#define S29C51002T 0x02 /* SyncMOS S29C51002T/B */
|
||||
#define S29C51004T 0x03 /* SyncMOS S29C51004T/B */
|
||||
#define S29C31004T 0x63 /* SyncMOS S29C31004T */
|
||||
|
||||
/* function prototypes from udelay.h */
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ extern int write_jedec(struct flashchip *flash, uint8_t *buf);
|
|||
extern int erase_sector_jedec(volatile uint8_t *bios, unsigned int page);
|
||||
extern int erase_block_jedec(volatile uint8_t *bios, unsigned int page);
|
||||
extern int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
|
||||
volatile uint8_t *dst,
|
||||
unsigned int page_size);
|
||||
volatile uint8_t *dst, unsigned int page_size);
|
||||
|
||||
extern __inline__ void toggle_ready_jedec(volatile uint8_t *dst)
|
||||
{
|
||||
|
@ -45,21 +44,21 @@ extern __inline__ void data_polling_jedec(volatile uint8_t *dst, uint8_t data)
|
|||
|
||||
extern __inline__ void unprotect_jedec(volatile uint8_t *bios)
|
||||
{
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0x80;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0x20;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0x80;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0x20;
|
||||
|
||||
usleep(200);
|
||||
}
|
||||
|
||||
extern __inline__ void protect_jedec(volatile uint8_t *bios)
|
||||
{
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xA0;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xA0;
|
||||
|
||||
usleep(200);
|
||||
}
|
||||
|
|
|
@ -6,5 +6,4 @@ int read_romlayout(char *name);
|
|||
int find_romentry(char *name);
|
||||
int handle_romentries(uint8_t *buffer, uint8_t *content);
|
||||
|
||||
|
||||
#endif /* !__LAYOUT_H__ */
|
||||
|
|
|
@ -19,13 +19,9 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __MSYS_DOC_H__
|
||||
#define __MSYS_DOC_H__ 1
|
||||
|
||||
|
||||
|
||||
/* idea from include/linux/mtd/doc2000.h */
|
||||
/* registers with __ should not be read/written directly */
|
||||
#define MSYSTEMS_DOC_R__ChipID 0x1000
|
||||
|
@ -66,8 +62,6 @@
|
|||
#define MSYSTEMS_DOC_R_CDSNIO_BASE 0x0800
|
||||
#define MSYSTEMS_DOC_W_CDSNIO_BASE 0x0800
|
||||
|
||||
|
||||
|
||||
#define doc_read(base,reg) \
|
||||
(*(volatile uint8_t *)(base + MSYSTEMS_DOC_R_##reg))
|
||||
|
||||
|
@ -98,13 +92,9 @@
|
|||
#define doc_toggle(base) /* 0, 1, 0, 1, 0, 1, ... if a doc is present */ \
|
||||
( (doc_read(base, ECCConfiguration) & 0x04) >> 2 )
|
||||
|
||||
|
||||
|
||||
extern int probe_md2802(struct flashchip *flash);
|
||||
extern int read_md2802(struct flashchip *flash, uint8_t *buf);
|
||||
extern int erase_md2802(struct flashchip *flash);
|
||||
extern int write_md2802(struct flashchip *flash, uint8_t *buf);
|
||||
|
||||
|
||||
|
||||
#endif /* !__MSYS_DOC_H__ */
|
||||
|
|
|
@ -40,8 +40,8 @@ int probe_29f002(struct flashchip *flash)
|
|||
*(bios + 0x2AAA) = 0x55;
|
||||
*(bios + 0x5555) = 0x90;
|
||||
|
||||
id1 = *(volatile uint8_t *) bios;
|
||||
id2 = *(volatile uint8_t *) (bios + 0x01);
|
||||
id1 = *(volatile uint8_t *)bios;
|
||||
id2 = *(volatile uint8_t *)(bios + 0x01);
|
||||
|
||||
*bios = 0xF0;
|
||||
|
||||
|
@ -101,7 +101,7 @@ int write_29f002(struct flashchip *flash, uint8_t *buf)
|
|||
for (i = 0; i < total_size; i++) {
|
||||
/* write to the sector */
|
||||
if ((i & 0xfff) == 0)
|
||||
printf("address: 0x%08lx", (unsigned long) i);
|
||||
printf("address: 0x%08lx", (unsigned long)i);
|
||||
*(bios + 0x5555) = 0xAA;
|
||||
*(bios + 0x2AAA) = 0x55;
|
||||
*(bios + 0x5555) = 0xA0;
|
||||
|
|
|
@ -32,13 +32,13 @@ extern int exclude_start_page, exclude_end_page;
|
|||
int write_49fl004(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024, page_size =
|
||||
flash->page_size;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
printf("Programming Page: ");
|
||||
for (i = 0; i < total_size / page_size; i++) {
|
||||
if( (i>=exclude_start_page) && (i<exclude_end_page))
|
||||
if ((i >= exclude_start_page) && (i < exclude_end_page))
|
||||
continue;
|
||||
|
||||
/* erase the page before programming */
|
||||
|
|
|
@ -20,7 +20,8 @@ extern __inline__ void toggle_ready_lhf00l04(volatile uint8_t *dst)
|
|||
}
|
||||
}
|
||||
|
||||
extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data)
|
||||
extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst,
|
||||
uint8_t data)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
uint8_t tmp;
|
||||
|
@ -37,9 +38,9 @@ extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data
|
|||
|
||||
extern __inline__ void protect_lhf00l04(volatile uint8_t *bios)
|
||||
{
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *) (bios + 0x5555) = 0xA0;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||
*(volatile uint8_t *)(bios + 0x5555) = 0xA0;
|
||||
|
||||
usleep(200);
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ static __inline__ int erase_sector_39sf020(volatile uint8_t *bios,
|
|||
int write_39sf020(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024, page_size =
|
||||
flash->page_size;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
erase_chip_jedec(flash);
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
|
||||
int erase_49lf040(struct flashchip *flash)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
for (i = 0; i < total_size / page_size; i++) {
|
||||
for (i = 0; i < total_size / page_size; i++) {
|
||||
/* Chip erase only works in parallel programming mode
|
||||
* for the 49lf040. Use sector-erase instead */
|
||||
erase_sector_jedec(bios, i * page_size);
|
||||
|
|
|
@ -90,15 +90,15 @@ int erase_sst_fwhub(struct flashchip *flash)
|
|||
int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024, page_size =
|
||||
flash->page_size;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
// FIXME: We want block wide erase instead of ironing the whole chip
|
||||
erase_sst_fwhub(flash);
|
||||
|
||||
// dumb check if erase was successful.
|
||||
for (i=0; i < total_size; i++) {
|
||||
for (i = 0; i < total_size; i++) {
|
||||
if (bios[i] != 0xff) {
|
||||
printf("ERASE FAILED\n");
|
||||
return -1;
|
||||
|
|
|
@ -8,7 +8,7 @@ unsigned long micro = 1;
|
|||
void myusec_delay(int time)
|
||||
{
|
||||
volatile unsigned long i;
|
||||
for (i = 0; i < time * micro; i++);
|
||||
for (i = 0; i < time * micro; i++) ;
|
||||
}
|
||||
|
||||
void myusec_calibrate_delay()
|
||||
|
@ -34,5 +34,5 @@ void myusec_calibrate_delay()
|
|||
// compute one microsecond. That will be count / time
|
||||
micro = count / timeusec;
|
||||
|
||||
printf_debug("%ldM loops per second\n", (unsigned long) micro);
|
||||
printf_debug("%ldM loops per second\n", (unsigned long)micro);
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
int write_49f002(struct flashchip *flash, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
int total_size = flash->total_size * 1024, page_size =
|
||||
flash->page_size;
|
||||
int total_size = flash->total_size * 1024;
|
||||
int page_size = flash->page_size;
|
||||
volatile uint8_t *bios = flash->virt_addr;
|
||||
|
||||
erase_chip_jedec(flash);
|
||||
|
|
Loading…
Reference in New Issue