blob: 3b8852a8288893c25e22a9086b955061ddae4ddd [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
23extern __inline__ void data_polling_lhf00l04(volatile uint8_t *dst, uint8_t data)
24{
25 unsigned int i = 0;
26 uint8_t tmp;
27
28 data &= 0x80;
29
30 while (i++ < 0xFFFFFF) {
31 tmp = *dst & 0x80;
32 if (tmp == data) {
33 break;
34 }
35 }
36}
37
38extern __inline__ void protect_lhf00l04(volatile uint8_t *bios)
39{
40 *(volatile uint8_t *) (bios + 0x5555) = 0xAA;
41 *(volatile uint8_t *) (bios + 0x2AAA) = 0x55;
42 *(volatile uint8_t *) (bios + 0x5555) = 0xA0;
43
44 usleep(200);
45}
Ronald G. Minnich5b582f22006-02-23 17:16:44 +000046
47#endif /* !__SHARPLHF00L04_H__ */