ifxmips_ptm_adsl.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /******************************************************************************
  2. **
  3. ** FILE NAME : ifxmips_ptm_adsl.h
  4. ** PROJECT : UEIP
  5. ** MODULES : PTM
  6. **
  7. ** DATE : 7 Jul 2009
  8. ** AUTHOR : Xu Liang
  9. ** DESCRIPTION : PTM driver header file (core functions for Danube/Amazon-SE/
  10. ** AR9)
  11. ** COPYRIGHT : Copyright (c) 2006
  12. ** Infineon Technologies AG
  13. ** Am Campeon 1-12, 85579 Neubiberg, Germany
  14. **
  15. ** This program is free software; you can redistribute it and/or modify
  16. ** it under the terms of the GNU General Public License as published by
  17. ** the Free Software Foundation; either version 2 of the License, or
  18. ** (at your option) any later version.
  19. **
  20. ** HISTORY
  21. ** $Date $Author $Comment
  22. ** 17 JUN 2009 Xu Liang Init Version
  23. *******************************************************************************/
  24. #ifndef IFXMIPS_PTM_ADSL_H
  25. #define IFXMIPS_PTM_ADSL_H
  26. #include <linux/version.h>
  27. #include <linux/netdevice.h>
  28. #include <lantiq_ptm.h>
  29. #include "ifxmips_ptm_common.h"
  30. #include "ifxmips_ptm_ppe_common.h"
  31. #include "ifxmips_ptm_fw_regs_adsl.h"
  32. #define CONFIG_IFXMIPS_DSL_CPE_MEI
  33. #define INT_NUM_IM2_IRL24 (INT_NUM_IM2_IRL0 + 24)
  34. #define IFX_REG_W32(_v, _r) __raw_writel((_v), (volatile unsigned int *)(_r))
  35. #define IFX_REG_R32(_r) __raw_readl((volatile unsigned int *)(_r))
  36. #define IFX_REG_W32_MASK(_clr, _set, _r) IFX_REG_W32((IFX_REG_R32((_r)) & ~(_clr)) | (_set), (_r))
  37. #define SET_BITS(x, msb, lsb, value) (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb)))
  38. /*
  39. * ####################################
  40. * Definition
  41. * ####################################
  42. */
  43. /*
  44. * Constant Definition
  45. */
  46. #define ETH_WATCHDOG_TIMEOUT (2 * HZ)
  47. /*
  48. * DMA RX/TX Channel Parameters
  49. */
  50. #define MAX_ITF_NUMBER 2
  51. #define MAX_RX_DMA_CHANNEL_NUMBER MAX_ITF_NUMBER
  52. #define MAX_TX_DMA_CHANNEL_NUMBER MAX_ITF_NUMBER
  53. #define DATA_BUFFER_ALIGNMENT EMA_ALIGNMENT
  54. #define DESC_ALIGNMENT 8
  55. /*
  56. * Ethernet Frame Definitions
  57. */
  58. #define ETH_MAC_HEADER_LENGTH 14
  59. #define ETH_CRC_LENGTH 4
  60. #define ETH_MIN_FRAME_LENGTH 64
  61. #define ETH_MAX_FRAME_LENGTH (1518 + 4 * 2)
  62. /*
  63. * RX Frame Definitions
  64. */
  65. #define RX_HEAD_MAC_ADDR_ALIGNMENT 2
  66. #define RX_TAIL_CRC_LENGTH 0 // PTM firmware does not have ethernet frame CRC
  67. // The len in descriptor doesn't include ETH_CRC
  68. // because ETH_CRC may not present in some configuration
  69. /*
  70. * ####################################
  71. * Data Type
  72. * ####################################
  73. */
  74. struct ptm_itf {
  75. volatile struct rx_descriptor *rx_desc;
  76. unsigned int rx_desc_pos;
  77. volatile struct tx_descriptor *tx_desc;
  78. unsigned int tx_desc_pos;
  79. struct sk_buff **tx_skb;
  80. struct net_device_stats stats;
  81. struct napi_struct napi;
  82. };
  83. struct ptm_priv_data {
  84. struct ptm_itf itf[MAX_ITF_NUMBER];
  85. void *rx_desc_base;
  86. void *tx_desc_base;
  87. void *tx_skb_base;
  88. };
  89. /*
  90. * ####################################
  91. * Declaration
  92. * ####################################
  93. */
  94. extern unsigned int ifx_ptm_dbg_enable;
  95. extern void ifx_ptm_get_fw_ver(unsigned int *major, unsigned int *minor);
  96. extern void ifx_ptm_init_chip(struct platform_device *pdev);
  97. extern void ifx_ptm_uninit_chip(void);
  98. extern int ifx_pp32_start(int pp32);
  99. extern void ifx_pp32_stop(int pp32);
  100. extern void ifx_reset_ppe(void);
  101. extern int ifx_ptm_proc_read_regs(char *page, char **start, off_t off, int count, int *eof, void *data);
  102. #endif // IFXMIPS_PTM_ADSL_H