ax88796.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * AX88796L(NE2000) support
  3. *
  4. * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. *
  21. */
  22. #ifndef __DRIVERS_AX88796L_H__
  23. #define __DRIVERS_AX88796L_H__
  24. #define DP_DATA (0x10 << 1)
  25. #define START_PG 0x40 /* First page of TX buffer */
  26. #define START_PG2 0x48
  27. #define STOP_PG 0x80 /* Last page +1 of RX ring */
  28. #define TX_PAGES 12
  29. #define RX_START (START_PG+TX_PAGES)
  30. #define RX_END STOP_PG
  31. #define AX88796L_BASE_ADDRESS CONFIG_DRIVER_NE2000_BASE
  32. #define AX88796L_BYTE_ACCESS 0x00001000
  33. #define AX88796L_OFFSET 0x00000400
  34. #define AX88796L_ADDRESS_BYTE AX88796L_BASE_ADDRESS + \
  35. AX88796L_BYTE_ACCESS + AX88796L_OFFSET
  36. #define AX88796L_REG_MEMR AX88796L_ADDRESS_BYTE + (0x14<<1)
  37. #define AX88796L_REG_CR AX88796L_ADDRESS_BYTE + (0x00<<1)
  38. #define AX88796L_CR (*(vu_short *)(AX88796L_REG_CR))
  39. #define AX88796L_MEMR (*(vu_short *)(AX88796L_REG_MEMR))
  40. #define EECS_HIGH (AX88796L_MEMR |= 0x10)
  41. #define EECS_LOW (AX88796L_MEMR &= 0xef)
  42. #define EECLK_HIGH (AX88796L_MEMR |= 0x80)
  43. #define EECLK_LOW (AX88796L_MEMR &= 0x7f)
  44. #define EEDI_HIGH (AX88796L_MEMR |= 0x20)
  45. #define EEDI_LOW (AX88796L_MEMR &= 0xdf)
  46. #define EEDO ((AX88796L_MEMR & 0x40)>>6)
  47. #define PAGE0_SET (AX88796L_CR &= 0x3f)
  48. #define PAGE1_SET (AX88796L_CR = (AX88796L_CR & 0x3f) | 0x40)
  49. #define BIT_DUMMY 0
  50. #define MAC_EEP_READ 1
  51. #define MAC_EEP_WRITE 2
  52. #define MAC_EEP_ERACE 3
  53. #define MAC_EEP_EWEN 4
  54. #define MAC_EEP_EWDS 5
  55. /* R7780MP Specific code */
  56. #if defined(CONFIG_R7780MP)
  57. #define ISA_OFFSET 0x1400
  58. #define DP_IN(_b_, _o_, _d_) (_d_) = \
  59. *( (vu_short *) ((_b_) + ((_o_) * 2) + ISA_OFFSET))
  60. #define DP_OUT(_b_, _o_, _d_) \
  61. *((vu_short *)((_b_) + ((_o_) * 2) + ISA_OFFSET)) = (_d_)
  62. #define DP_IN_DATA(_b_, _d_) (_d_) = *( (vu_short *) ((_b_) + ISA_OFFSET))
  63. #define DP_OUT_DATA(_b_, _d_) *( (vu_short *) ((_b_)+ISA_OFFSET)) = (_d_)
  64. #else
  65. /* Please change for your target boards */
  66. #define ISA_OFFSET 0x0000
  67. #define DP_IN(_b_, _o_, _d_) (_d_) = *( (vu_short *)((_b_)+(_o_ )+ISA_OFFSET))
  68. #define DP_OUT(_b_, _o_, _d_) *((vu_short *)((_b_)+(_o_)+ISA_OFFSET)) = (_d_)
  69. #define DP_IN_DATA(_b_, _d_) (_d_) = *( (vu_short *) ((_b_)+ISA_OFFSET))
  70. #define DP_OUT_DATA(_b_, _d_) *( (vu_short *) ((_b_)+ISA_OFFSET)) = (_d_)
  71. #endif
  72. #endif /* __DRIVERS_AX88796L_H__ */