diff options
-rw-r--r-- | drivers/char/moxa.c | 245 |
1 files changed, 0 insertions, 245 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index ef2558f5a3fc..3c8858cbe102 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -11,15 +11,6 @@ | |||
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | */ | 14 | */ |
24 | 15 | ||
25 | /* | 16 | /* |
@@ -1684,9 +1675,7 @@ int MoxaPortsOfCard(int cardno) | |||
1684 | * 2. MoxaPortEnable(int port); * | 1675 | * 2. MoxaPortEnable(int port); * |
1685 | * 3. MoxaPortDisable(int port); * | 1676 | * 3. MoxaPortDisable(int port); * |
1686 | * 4. MoxaPortGetMaxBaud(int port); * | 1677 | * 4. MoxaPortGetMaxBaud(int port); * |
1687 | * 5. MoxaPortGetCurBaud(int port); * | ||
1688 | * 6. MoxaPortSetBaud(int port, long baud); * | 1678 | * 6. MoxaPortSetBaud(int port, long baud); * |
1689 | * 7. MoxaPortSetMode(int port, int databit, int stopbit, int parity); * | ||
1690 | * 8. MoxaPortSetTermio(int port, unsigned char *termio); * | 1679 | * 8. MoxaPortSetTermio(int port, unsigned char *termio); * |
1691 | * 9. MoxaPortGetLineOut(int port, int *dtrState, int *rtsState); * | 1680 | * 9. MoxaPortGetLineOut(int port, int *dtrState, int *rtsState); * |
1692 | * 10. MoxaPortLineCtrl(int port, int dtrState, int rtsState); * | 1681 | * 10. MoxaPortLineCtrl(int port, int dtrState, int rtsState); * |
@@ -1697,18 +1686,12 @@ int MoxaPortsOfCard(int cardno) | |||
1697 | * 15. MoxaPortFlushData(int port, int mode); * | 1686 | * 15. MoxaPortFlushData(int port, int mode); * |
1698 | * 16. MoxaPortWriteData(int port, unsigned char * buffer, int length); * | 1687 | * 16. MoxaPortWriteData(int port, unsigned char * buffer, int length); * |
1699 | * 17. MoxaPortReadData(int port, struct tty_struct *tty); * | 1688 | * 17. MoxaPortReadData(int port, struct tty_struct *tty); * |
1700 | * 18. MoxaPortTxBufSize(int port); * | ||
1701 | * 19. MoxaPortRxBufSize(int port); * | ||
1702 | * 20. MoxaPortTxQueue(int port); * | 1689 | * 20. MoxaPortTxQueue(int port); * |
1703 | * 21. MoxaPortTxFree(int port); * | 1690 | * 21. MoxaPortTxFree(int port); * |
1704 | * 22. MoxaPortRxQueue(int port); * | 1691 | * 22. MoxaPortRxQueue(int port); * |
1705 | * 23. MoxaPortRxFree(int port); * | ||
1706 | * 24. MoxaPortTxDisable(int port); * | 1692 | * 24. MoxaPortTxDisable(int port); * |
1707 | * 25. MoxaPortTxEnable(int port); * | 1693 | * 25. MoxaPortTxEnable(int port); * |
1708 | * 26. MoxaPortGetBrkCnt(int port); * | ||
1709 | * 27. MoxaPortResetBrkCnt(int port); * | 1694 | * 27. MoxaPortResetBrkCnt(int port); * |
1710 | * 28. MoxaPortSetXonXoff(int port, int xonValue, int xoffValue); * | ||
1711 | * 29. MoxaPortIsTxHold(int port); * | ||
1712 | * 30. MoxaPortSendBreak(int port, int ticks); * | 1695 | * 30. MoxaPortSendBreak(int port, int ticks); * |
1713 | *****************************************************************************/ | 1696 | *****************************************************************************/ |
1714 | /* | 1697 | /* |
@@ -1795,15 +1778,6 @@ int MoxaPortsOfCard(int cardno) | |||
1795 | * 38400/57600/115200 bps | 1778 | * 38400/57600/115200 bps |
1796 | * | 1779 | * |
1797 | * | 1780 | * |
1798 | * Function 9: Get the current baud rate of this port. | ||
1799 | * Syntax: | ||
1800 | * long MoxaPortGetCurBaud(int port); | ||
1801 | * int port : port number (0 - 127) | ||
1802 | * | ||
1803 | * return: 0 : this port is invalid | ||
1804 | * 50 - 115200 bps | ||
1805 | * | ||
1806 | * | ||
1807 | * Function 10: Setting baud rate of this port. | 1781 | * Function 10: Setting baud rate of this port. |
1808 | * Syntax: | 1782 | * Syntax: |
1809 | * long MoxaPortSetBaud(int port, long baud); | 1783 | * long MoxaPortSetBaud(int port, long baud); |
@@ -1817,18 +1791,6 @@ int MoxaPortsOfCard(int cardno) | |||
1817 | * baud rate will be the maximun baud rate. | 1791 | * baud rate will be the maximun baud rate. |
1818 | * | 1792 | * |
1819 | * | 1793 | * |
1820 | * Function 11: Setting the data-bits/stop-bits/parity of this port | ||
1821 | * Syntax: | ||
1822 | * int MoxaPortSetMode(int port, int databits, int stopbits, int parity); | ||
1823 | * int port : port number (0 - 127) | ||
1824 | * int databits : data bits (8/7/6/5) | ||
1825 | * int stopbits : stop bits (2/1/0, 0 show 1.5 stop bits) | ||
1826 | int parity : parity (0:None,1:Odd,2:Even,3:Mark,4:Space) | ||
1827 | * | ||
1828 | * return: -1 : invalid parameter | ||
1829 | * 0 : setting O.K. | ||
1830 | * | ||
1831 | * | ||
1832 | * Function 12: Configure the port. | 1794 | * Function 12: Configure the port. |
1833 | * Syntax: | 1795 | * Syntax: |
1834 | * int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud); | 1796 | * int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud); |
@@ -1933,22 +1895,6 @@ int MoxaPortsOfCard(int cardno) | |||
1933 | * return: 0 - length : real read data length | 1895 | * return: 0 - length : real read data length |
1934 | * | 1896 | * |
1935 | * | 1897 | * |
1936 | * Function 22: Get the Tx buffer size of this port | ||
1937 | * Syntax: | ||
1938 | * int MoxaPortTxBufSize(int port); | ||
1939 | * int port : port number (0 - 127) | ||
1940 | * | ||
1941 | * return: .. : Tx buffer size | ||
1942 | * | ||
1943 | * | ||
1944 | * Function 23: Get the Rx buffer size of this port | ||
1945 | * Syntax: | ||
1946 | * int MoxaPortRxBufSize(int port); | ||
1947 | * int port : port number (0 - 127) | ||
1948 | * | ||
1949 | * return: .. : Rx buffer size | ||
1950 | * | ||
1951 | * | ||
1952 | * Function 24: Get the Tx buffer current queued data bytes | 1898 | * Function 24: Get the Tx buffer current queued data bytes |
1953 | * Syntax: | 1899 | * Syntax: |
1954 | * int MoxaPortTxQueue(int port); | 1900 | * int MoxaPortTxQueue(int port); |
@@ -1973,14 +1919,6 @@ int MoxaPortsOfCard(int cardno) | |||
1973 | * return: .. : Rx buffer current queued data bytes | 1919 | * return: .. : Rx buffer current queued data bytes |
1974 | * | 1920 | * |
1975 | * | 1921 | * |
1976 | * Function 27: Get the Rx buffer current free space | ||
1977 | * Syntax: | ||
1978 | * int MoxaPortRxFree(int port); | ||
1979 | * int port : port number (0 - 127) | ||
1980 | * | ||
1981 | * return: .. : Rx buffer current free space | ||
1982 | * | ||
1983 | * | ||
1984 | * Function 28: Disable port data transmission. | 1922 | * Function 28: Disable port data transmission. |
1985 | * Syntax: | 1923 | * Syntax: |
1986 | * void MoxaPortTxDisable(int port); | 1924 | * void MoxaPortTxDisable(int port); |
@@ -1993,14 +1931,6 @@ int MoxaPortsOfCard(int cardno) | |||
1993 | * int port : port number (0 - 127) | 1931 | * int port : port number (0 - 127) |
1994 | * | 1932 | * |
1995 | * | 1933 | * |
1996 | * Function 30: Get the received BREAK signal count. | ||
1997 | * Syntax: | ||
1998 | * int MoxaPortGetBrkCnt(int port); | ||
1999 | * int port : port number (0 - 127) | ||
2000 | * | ||
2001 | * return: 0 - .. : BREAK signal count | ||
2002 | * | ||
2003 | * | ||
2004 | * Function 31: Get the received BREAK signal count and reset it. | 1934 | * Function 31: Get the received BREAK signal count and reset it. |
2005 | * Syntax: | 1935 | * Syntax: |
2006 | * int MoxaPortResetBrkCnt(int port); | 1936 | * int MoxaPortResetBrkCnt(int port); |
@@ -2009,25 +1939,6 @@ int MoxaPortsOfCard(int cardno) | |||
2009 | * return: 0 - .. : BREAK signal count | 1939 | * return: 0 - .. : BREAK signal count |
2010 | * | 1940 | * |
2011 | * | 1941 | * |
2012 | * Function 32: Set the S/W flow control new XON/XOFF value, default | ||
2013 | * XON is 0x11 & XOFF is 0x13. | ||
2014 | * Syntax: | ||
2015 | * void MoxaPortSetXonXoff(int port, int xonValue, int xoffValue); | ||
2016 | * int port : port number (0 - 127) | ||
2017 | * int xonValue : new XON value (0 - 255) | ||
2018 | * int xoffValue : new XOFF value (0 - 255) | ||
2019 | * | ||
2020 | * | ||
2021 | * Function 33: Check this port's transmission is hold by remote site | ||
2022 | * because the flow control. | ||
2023 | * Syntax: | ||
2024 | * int MoxaPortIsTxHold(int port); | ||
2025 | * int port : port number (0 - 127) | ||
2026 | * | ||
2027 | * return: 0 : normal | ||
2028 | * 1 : hold by remote site | ||
2029 | * | ||
2030 | * | ||
2031 | * Function 34: Send out a BREAK signal. | 1942 | * Function 34: Send out a BREAK signal. |
2032 | * Syntax: | 1943 | * Syntax: |
2033 | * void MoxaPortSendBreak(int port, int ms100); | 1944 | * void MoxaPortSendBreak(int port, int ms100); |
@@ -2276,23 +2187,6 @@ int MoxaPortDCDON(int port) | |||
2276 | return (n); | 2187 | return (n); |
2277 | } | 2188 | } |
2278 | 2189 | ||
2279 | |||
2280 | /* | ||
2281 | int MoxaDumpMem(int port, unsigned char * buffer, int len) | ||
2282 | { | ||
2283 | int i; | ||
2284 | unsigned long baseAddr,ofsAddr,ofs; | ||
2285 | |||
2286 | baseAddr = moxaBaseAddr[port / MAX_PORTS_PER_BOARD]; | ||
2287 | ofs = baseAddr + DynPage_addr + pageofs; | ||
2288 | if (len > 0x2000L) | ||
2289 | len = 0x2000L; | ||
2290 | for (i = 0; i < len; i++) | ||
2291 | buffer[i] = readb(ofs+i); | ||
2292 | } | ||
2293 | */ | ||
2294 | |||
2295 | |||
2296 | int MoxaPortWriteData(int port, unsigned char * buffer, int len) | 2190 | int MoxaPortWriteData(int port, unsigned char * buffer, int len) |
2297 | { | 2191 | { |
2298 | int c, total, i; | 2192 | int c, total, i; |
@@ -2944,16 +2838,6 @@ static int moxaloadc320(int cardno, void __iomem *baseAddr, int len, int *numPor | |||
2944 | return (0); | 2838 | return (0); |
2945 | } | 2839 | } |
2946 | 2840 | ||
2947 | #if 0 | ||
2948 | long MoxaPortGetCurBaud(int port) | ||
2949 | { | ||
2950 | |||
2951 | if (moxaChkPort[port] == 0) | ||
2952 | return (0); | ||
2953 | return (moxaCurBaud[port]); | ||
2954 | } | ||
2955 | #endif /* 0 */ | ||
2956 | |||
2957 | static void MoxaSetFifo(int port, int enable) | 2841 | static void MoxaSetFifo(int port, int enable) |
2958 | { | 2842 | { |
2959 | void __iomem *ofsAddr = moxaTableAddr[port]; | 2843 | void __iomem *ofsAddr = moxaTableAddr[port]; |
@@ -2966,132 +2850,3 @@ static void MoxaSetFifo(int port, int enable) | |||
2966 | moxafunc(ofsAddr, FC_SetTxFIFOCnt, 16); | 2850 | moxafunc(ofsAddr, FC_SetTxFIFOCnt, 16); |
2967 | } | 2851 | } |
2968 | } | 2852 | } |
2969 | |||
2970 | #if 0 | ||
2971 | int MoxaPortSetMode(int port, int databits, int stopbits, int parity) | ||
2972 | { | ||
2973 | void __iomem *ofsAddr; | ||
2974 | int val; | ||
2975 | |||
2976 | val = 0; | ||
2977 | switch (databits) { | ||
2978 | case 5: | ||
2979 | val |= 0; | ||
2980 | break; | ||
2981 | case 6: | ||
2982 | val |= 1; | ||
2983 | break; | ||
2984 | case 7: | ||
2985 | val |= 2; | ||
2986 | break; | ||
2987 | case 8: | ||
2988 | val |= 3; | ||
2989 | break; | ||
2990 | default: | ||
2991 | return (-1); | ||
2992 | } | ||
2993 | switch (stopbits) { | ||
2994 | case 0: | ||
2995 | val |= 0; | ||
2996 | break; /* stop bits 1.5 */ | ||
2997 | case 1: | ||
2998 | val |= 0; | ||
2999 | break; | ||
3000 | case 2: | ||
3001 | val |= 4; | ||
3002 | break; | ||
3003 | default: | ||
3004 | return (-1); | ||
3005 | } | ||
3006 | switch (parity) { | ||
3007 | case 0: | ||
3008 | val |= 0x00; | ||
3009 | break; /* None */ | ||
3010 | case 1: | ||
3011 | val |= 0x08; | ||
3012 | break; /* Odd */ | ||
3013 | case 2: | ||
3014 | val |= 0x18; | ||
3015 | break; /* Even */ | ||
3016 | case 3: | ||
3017 | val |= 0x28; | ||
3018 | break; /* Mark */ | ||
3019 | case 4: | ||
3020 | val |= 0x38; | ||
3021 | break; /* Space */ | ||
3022 | default: | ||
3023 | return (-1); | ||
3024 | } | ||
3025 | ofsAddr = moxaTableAddr[port]; | ||
3026 | moxafunc(ofsAddr, FC_SetMode, val); | ||
3027 | return (0); | ||
3028 | } | ||
3029 | |||
3030 | int MoxaPortTxBufSize(int port) | ||
3031 | { | ||
3032 | void __iomem *ofsAddr; | ||
3033 | int size; | ||
3034 | |||
3035 | ofsAddr = moxaTableAddr[port]; | ||
3036 | size = readw(ofsAddr + TX_mask); | ||
3037 | return (size); | ||
3038 | } | ||
3039 | |||
3040 | int MoxaPortRxBufSize(int port) | ||
3041 | { | ||
3042 | void __iomem *ofsAddr; | ||
3043 | int size; | ||
3044 | |||
3045 | ofsAddr = moxaTableAddr[port]; | ||
3046 | size = readw(ofsAddr + RX_mask); | ||
3047 | return (size); | ||
3048 | } | ||
3049 | |||
3050 | int MoxaPortRxFree(int port) | ||
3051 | { | ||
3052 | void __iomem *ofsAddr; | ||
3053 | ushort rptr, wptr, mask; | ||
3054 | int len; | ||
3055 | |||
3056 | ofsAddr = moxaTableAddr[port]; | ||
3057 | rptr = readw(ofsAddr + RXrptr); | ||
3058 | wptr = readw(ofsAddr + RXwptr); | ||
3059 | mask = readw(ofsAddr + RX_mask); | ||
3060 | len = mask - ((wptr - rptr) & mask); | ||
3061 | return (len); | ||
3062 | } | ||
3063 | int MoxaPortGetBrkCnt(int port) | ||
3064 | { | ||
3065 | return (moxaBreakCnt[port]); | ||
3066 | } | ||
3067 | |||
3068 | void MoxaPortSetXonXoff(int port, int xonValue, int xoffValue) | ||
3069 | { | ||
3070 | void __iomem *ofsAddr; | ||
3071 | |||
3072 | ofsAddr = moxaTableAddr[port]; | ||
3073 | writew(xonValue, ofsAddr + FuncArg); | ||
3074 | writew(xoffValue, ofsAddr + FuncArg1); | ||
3075 | writew(FC_SetXonXoff, ofsAddr + FuncCode); | ||
3076 | wait_finish(ofsAddr); | ||
3077 | } | ||
3078 | |||
3079 | int MoxaPortIsTxHold(int port) | ||
3080 | { | ||
3081 | void __iomem *ofsAddr; | ||
3082 | int val; | ||
3083 | |||
3084 | ofsAddr = moxaTableAddr[port]; | ||
3085 | if ((moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_ISA) || | ||
3086 | (moxa_boards[port / MAX_PORTS_PER_BOARD].boardType == MOXA_BOARD_C320_PCI)) { | ||
3087 | moxafunc(ofsAddr, FC_GetCCSR, 0); | ||
3088 | val = readw(ofsAddr + FuncArg); | ||
3089 | if (val & 0x04) | ||
3090 | return (1); | ||
3091 | } else { | ||
3092 | if (readw(ofsAddr + FlagStat) & Tx_flowOff) | ||
3093 | return (1); | ||
3094 | } | ||
3095 | return (0); | ||
3096 | } | ||
3097 | #endif | ||