Ronald G. Minnich | 1f4d653 | 2004-09-30 16:37:01 +0000 | [diff] [blame] | 1 | #ifndef __SST_FWHUB_H__ |
| 2 | #define __SST_FWHUB_H__ 1 |
| 3 | |
| 4 | extern int probe_sst_fwhub(struct flashchip *flash); |
| 5 | extern int erase_sst_fwhub(struct flashchip *flash); |
| 6 | extern int write_sst_fwhub(struct flashchip *flash, unsigned char *buf); |
| 7 | |
| 8 | extern __inline__ void toggle_ready_sst_fwhub(volatile char *dst) |
| 9 | { |
| 10 | unsigned int i = 0; |
| 11 | char tmp1, tmp2; |
| 12 | |
| 13 | tmp1 = *dst & 0x40; |
| 14 | |
| 15 | while (i++ < 0xFFFFFF) { |
| 16 | tmp2 = *dst & 0x40; |
| 17 | if (tmp1 == tmp2) { |
| 18 | break; |
| 19 | } |
| 20 | tmp1 = tmp2; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | extern __inline__ void data_polling_sst_fwhub(volatile char *dst, char data) |
| 25 | { |
| 26 | unsigned int i = 0; |
| 27 | char tmp; |
| 28 | |
| 29 | data &= 0x80; |
| 30 | |
| 31 | while (i++ < 0xFFFFFF) { |
| 32 | tmp = *dst & 0x80; |
| 33 | if (tmp == data) { |
| 34 | break; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | extern __inline__ void protect_sst_fwhub(volatile char *bios) |
| 40 | { |
| 41 | *(volatile char *) (bios + 0x5555) = 0xAA; |
| 42 | *(volatile char *) (bios + 0x2AAA) = 0x55; |
| 43 | *(volatile char *) (bios + 0x5555) = 0xA0; |
| 44 | |
| 45 | usleep(200); |
| 46 | } |
| 47 | |
| 48 | #endif /* !__SST_FWHUB_H__ */ |