ata_misc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __ATA_MISC_H
  2. #define __ATA_MISC_H
  3. #include <linux/types.h>
  4. #include <linux/kernel.h>
  5. #include <linux/err.h>
  6. #include <linux/slab.h>
  7. #include <linux/module.h>
  8. #include <linux/init.h>
  9. #include <linux/delay.h>
  10. #include <asm/arch/am_regs.h>
  11. #include <asm/cacheflush.h>
  12. #include <asm/delay.h>
  13. #define ata_get_timer_tick() READ_ISA_REG(IREG_TIMER_E_COUNT) //unit: 10us or 1/100ms, max: 0 ~ 0xFFFFFF
  14. #define ATA_MAX_TIMER_TICK 0xFFFFFF
  15. #define TIMER_1US 1
  16. #define TIMER_10US (10*TIMER_1US)
  17. #define TIMER_1MS (100*TIMER_10US)
  18. void ata_start_timer(unsigned long time_value);
  19. int ata_check_timer(void);
  20. int ata_check_timeout(void);
  21. #define ATA_DEBUG
  22. #define Debug_Printf printk
  23. //Definition to use block address 0x3400000
  24. //#define AMLOGIC_CHIP_SUPPORT
  25. #ifdef AMLOGIC_CHIP_SUPPORT
  26. #ifdef AVOS
  27. #define WRITE_BYTE_TO_FIFO(DATA) {WRITE_MPEG_REG(HFIFO_DATA,DATA);while((READ_MPEG_REG(BFIFO_LEVEL)>>8) >= 120){}}
  28. #else /* */
  29. #define WRITE_BYTE_TO_FIFO(DATA) {Wr(HFIFO_DATA,DATA);while((Rd(BFIFO_LEVEL)>>8) >= 120){}}
  30. #endif /* */
  31. #endif /* */
  32. //Definition for debug
  33. #define ata_malloc kmalloc
  34. #define ata_free kfree
  35. #define ATABASE 0xC1000000
  36. #define WRITE_ATA_REG(reg, val) { *(volatile unsigned *)(ATABASE + ((reg) << 2)) = (val); }
  37. #define READ_ATA_REG(reg) (IO_READ32(ATABASE + ((reg) << 2)))
  38. #define ata_delay_us udelay
  39. #define ata_delay_ms msleep
  40. #define ata_delay_100ns udelay
  41. unsigned char read_pio_8(unsigned reg);
  42. void write_pio_8(unsigned reg, unsigned char val);
  43. unsigned short read_pio_16(unsigned reg);
  44. void write_pio_16(unsigned reg, unsigned short val);
  45. //Delay time in 100 ns
  46. //void ata_delay_100ns(unsigned long num_100ns);
  47. #endif // __ATA_MISC_H