summaryrefslogtreecommitdiffstats
path: root/sharplhf00l04.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2007-05-09 10:17:44 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2007-05-09 10:17:44 +0000
commita7e0548cea45ec60616936c536efbb2a34605093 (patch)
tree8d31e1c7e3343980b1c0724103f39dbb5baae77a /sharplhf00l04.c
parent7977f4ef2ea478a5460e6730aa2adc23e9685be1 (diff)
downloadast2050-flashrom-a7e0548cea45ec60616936c536efbb2a34605093.zip
ast2050-flashrom-a7e0548cea45ec60616936c536efbb2a34605093.tar.gz
Fix coding style of flashrom by running indent on all files
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs *.[ch] Some minor fixups were required, and maybe a few more cosmetic changes are needed. Corresponding to flashrom svn r108 and coreboot v2 svn r2643. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'sharplhf00l04.c')
-rw-r--r--sharplhf00l04.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/sharplhf00l04.c b/sharplhf00l04.c
index fc41fbf..5be1cbc 100644
--- a/sharplhf00l04.c
+++ b/sharplhf00l04.c
@@ -51,9 +51,9 @@ int probe_lhf00l04(struct flashchip *flash)
uint8_t id1, id2;
#if 0
- *(volatile uint8_t *) (bios + 0x5555) = 0xAA;
- *(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
- *(volatile uint8_t *) (bios + 0x5555) = 0x90;
+ *(volatile uint8_t *)(bios + 0x5555) = 0xAA;
+ *(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
+ *(volatile uint8_t *)(bios + 0x5555) = 0x90;
#endif
*bios = 0xff;
@@ -61,13 +61,13 @@ int probe_lhf00l04(struct flashchip *flash)
*bios = 0x90;
myusec_delay(10);
- id1 = *(volatile uint8_t *) bios;
- id2 = *(volatile uint8_t *) (bios + 0x01);
+ id1 = *(volatile uint8_t *)bios;
+ id2 = *(volatile uint8_t *)(bios + 0x01);
#if 1
- *(volatile uint8_t *) (bios + 0x5555) = 0xAA;
- *(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
- *(volatile uint8_t *) (bios + 0x5555) = 0xF0;
+ *(volatile uint8_t *)(bios + 0x5555) = 0xAA;
+ *(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
+ *(volatile uint8_t *)(bios + 0x5555) = 0xF0;
#endif
myusec_delay(10);
@@ -86,7 +86,8 @@ int probe_lhf00l04(struct flashchip *flash)
}
flash->virt_addr_2 = bios;
- printf("bios %p, *bios 0x%x, bios[1] 0x%x\n", bios, *bios, bios[1]);
+ printf("bios %p, *bios 0x%x, bios[1] 0x%x\n", bios, *bios,
+ bios[1]);
return 1;
}
@@ -101,7 +102,7 @@ uint8_t wait_lhf00l04(volatile uint8_t *bios)
*bios = 0x70;
if ((*bios & 0x80) == 0) { // it's busy
- while ((*bios & 0x80) == 0);
+ while ((*bios & 0x80) == 0) ;
}
status = *bios;
@@ -111,21 +112,20 @@ uint8_t wait_lhf00l04(volatile uint8_t *bios)
*bios = 0x90;
myusec_delay(10);
- id1 = *(volatile uint8_t *) bios;
- id2 = *(volatile uint8_t *) (bios + 0x01);
+ id1 = *(volatile uint8_t *)bios;
+ id2 = *(volatile uint8_t *)(bios + 0x01);
// this is needed to jam it out of "read id" mode
- *(volatile uint8_t *) (bios + 0x5555) = 0xAA;
- *(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
- *(volatile uint8_t *) (bios + 0x5555) = 0xF0;
+ *(volatile uint8_t *)(bios + 0x5555) = 0xAA;
+ *(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
+ *(volatile uint8_t *)(bios + 0x5555) = 0xF0;
return status;
}
int erase_lhf00l04_block(struct flashchip *flash, int offset)
{
volatile uint8_t *bios = flash->virt_addr + offset;
- volatile uint8_t *wrprotect =
- flash->virt_addr_2 + offset + 2;
+ volatile uint8_t *wrprotect = flash->virt_addr_2 + offset + 2;
uint8_t status;
// clear status register
@@ -140,8 +140,8 @@ int erase_lhf00l04_block(struct flashchip *flash, int offset)
printf("write protect is 0x%x\n", *(wrprotect));
// now start it
- *(volatile uint8_t *) (bios) = 0x20;
- *(volatile uint8_t *) (bios) = 0xd0;
+ *(volatile uint8_t *)(bios) = 0x20;
+ *(volatile uint8_t *)(bios) = 0xd0;
myusec_delay(10);
// now let's see what the register is
status = wait_lhf00l04(flash->virt_addr);
@@ -162,8 +162,8 @@ int erase_lhf00l04(struct flashchip *flash)
return (0);
}
-void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src, volatile uint8_t *dst,
- int page_size)
+void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
+ volatile uint8_t *dst, int page_size)
{
int i;
@@ -179,8 +179,8 @@ void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src, volatile uint8_t
int write_lhf00l04(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_lhf00l04(flash);
@@ -192,9 +192,8 @@ int write_lhf00l04(struct flashchip *flash, uint8_t *buf)
for (i = 0; i < total_size / page_size; i++) {
printf("%04d at address: 0x%08x", i, i * page_size);
write_page_lhf00l04(bios, buf + i * page_size,
- bios + i * page_size, page_size);
- printf
- ("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ bios + i * page_size, page_size);
+ printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
printf("\n");
protect_lhf00l04(bios);
OpenPOWER on IntegriCloud