|
| 1 | +/* |
| 2 | + * Copyright 2005-2008 Analog Devices Inc. |
| 3 | + * |
| 4 | + * Licensed under the GPL-2 or later |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef _MACH_FIO_FLAG_H |
| 8 | +#define _MACH_FIO_FLAG_H |
| 9 | + |
| 10 | +#include <asm/blackfin.h> |
| 11 | +#include <asm/irqflags.h> |
| 12 | + |
| 13 | +#if ANOMALY_05000311 |
| 14 | +#define BFIN_WRITE_FIO_FLAG(name) \ |
| 15 | +static inline void bfin_write_FIO_FLAG_##name(unsigned short val) \ |
| 16 | +{ \ |
| 17 | + unsigned long flags; \ |
| 18 | + local_irq_save_hw(flags); \ |
| 19 | + bfin_write16(FIO_FLAG_##name, val); \ |
| 20 | + bfin_read_CHIPID(); \ |
| 21 | + local_irq_restore_hw(flags); \ |
| 22 | +} |
| 23 | +BFIN_WRITE_FIO_FLAG(D) |
| 24 | +BFIN_WRITE_FIO_FLAG(C) |
| 25 | +BFIN_WRITE_FIO_FLAG(S) |
| 26 | +BFIN_WRITE_FIO_FLAG(T) |
| 27 | + |
| 28 | +#define BFIN_READ_FIO_FLAG(name) \ |
| 29 | +static inline u16 bfin_read_FIO_FLAG_##name(void) \ |
| 30 | +{ \ |
| 31 | + unsigned long flags; \ |
| 32 | + u16 ret; \ |
| 33 | + local_irq_save_hw(flags); \ |
| 34 | + ret = bfin_read16(FIO_FLAG_##name); \ |
| 35 | + bfin_read_CHIPID(); \ |
| 36 | + local_irq_restore_hw(flags); \ |
| 37 | + return ret; \ |
| 38 | +} |
| 39 | +BFIN_READ_FIO_FLAG(D) |
| 40 | +BFIN_READ_FIO_FLAG(C) |
| 41 | +BFIN_READ_FIO_FLAG(S) |
| 42 | +BFIN_READ_FIO_FLAG(T) |
| 43 | + |
| 44 | +#else |
| 45 | +#define bfin_write_FIO_FLAG_D(val) bfin_write16(FIO_FLAG_D, val) |
| 46 | +#define bfin_write_FIO_FLAG_C(val) bfin_write16(FIO_FLAG_C, val) |
| 47 | +#define bfin_write_FIO_FLAG_S(val) bfin_write16(FIO_FLAG_S, val) |
| 48 | +#define bfin_write_FIO_FLAG_T(val) bfin_write16(FIO_FLAG_T, val) |
| 49 | +#define bfin_read_FIO_FLAG_T() bfin_read16(FIO_FLAG_T) |
| 50 | +#define bfin_read_FIO_FLAG_C() bfin_read16(FIO_FLAG_C) |
| 51 | +#define bfin_read_FIO_FLAG_S() bfin_read16(FIO_FLAG_S) |
| 52 | +#define bfin_read_FIO_FLAG_D() bfin_read16(FIO_FLAG_D) |
| 53 | +#endif |
| 54 | + |
| 55 | +#endif /* _MACH_FIO_FLAG_H */ |
0 commit comments