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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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