blob: e2352a0a09075d1e7260b941375a729c4c39ecc8 [file] [log] [blame]
Ronald G. Minnich5b582f22006-02-23 17:16:44 +00001#ifndef __SHARPLHF00L04_H__
2#define __SHARPLHF00L04_H__ 1
3
4extern int probe_lhf00l04(struct flashchip *flash);
5extern int erase_lhf00l04(struct flashchip *flash);
6extern int write_lhf00l04(struct flashchip *flash, uint8_t *buf);
Ronald G. Minnich5eaed682006-03-14 19:58:14 +00007extern __inline__ void toggle_ready_lhf00l04(volatile uint8_t *dst)
8{
9 unsigned int i = 0;
10 uint8_t tmp1, tmp2;
11
12 tmp1 = *dst & 0x40;
13
14 while (i++ < 0xFFFFFF) {
15 tmp2 = *dst & 0x40;
16 if (tmp1 == tmp2) {
17 break;
18 }
19 tmp1 = tmp2;
20 }
21}
22
Uwe Hermann0b7afe62007-04-01 19:44:21 +000023extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst,
24 uint8_t data)
Ronald G. Minnich5eaed682006-03-14 19:58:14 +000025{
26 unsigned int i = 0;
27 uint8_t tmp;
28
29 data &= 0x80;
30
31 while (i++ < 0xFFFFFF) {
32 tmp = *dst & 0x80;
33 if (tmp == data) {
34 break;
35 }
36 }
37}
38
39extern __inline__ void protect_lhf00l04(volatile uint8_t *bios)
40{
Uwe Hermann0b7afe62007-04-01 19:44:21 +000041 *(volatile uint8_t *)(bios + 0x5555) = 0xAA;
42 *(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
43 *(volatile uint8_t *)(bios + 0x5555) = 0xA0;
Ronald G. Minnich5eaed682006-03-14 19:58:14 +000044
45 usleep(200);
46}
Ronald G. Minnich5b582f22006-02-23 17:16:44 +000047
48#endif /* !__SHARPLHF00L04_H__ */