diff options
-rw-r--r-- | drivers/char/synclink_gt.c | 46 | ||||
-rw-r--r-- | include/linux/synclink.h | 4 |
2 files changed, 36 insertions, 14 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index b4f1a5a435aa..6f93a0149fbf 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -2515,7 +2515,8 @@ static int set_txidle(struct slgt_info *info, int idle_mode) | |||
2515 | DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); | 2515 | DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); |
2516 | spin_lock_irqsave(&info->lock,flags); | 2516 | spin_lock_irqsave(&info->lock,flags); |
2517 | info->idle_mode = idle_mode; | 2517 | info->idle_mode = idle_mode; |
2518 | tx_set_idle(info); | 2518 | if (info->params.mode != MGSL_MODE_ASYNC) |
2519 | tx_set_idle(info); | ||
2519 | spin_unlock_irqrestore(&info->lock,flags); | 2520 | spin_unlock_irqrestore(&info->lock,flags); |
2520 | return 0; | 2521 | return 0; |
2521 | } | 2522 | } |
@@ -3940,8 +3941,6 @@ static void async_mode(struct slgt_info *info) | |||
3940 | 3941 | ||
3941 | msc_set_vcr(info); | 3942 | msc_set_vcr(info); |
3942 | 3943 | ||
3943 | tx_set_idle(info); | ||
3944 | |||
3945 | /* SCR (serial control) | 3944 | /* SCR (serial control) |
3946 | * | 3945 | * |
3947 | * 15 1=tx req on FIFO half empty | 3946 | * 15 1=tx req on FIFO half empty |
@@ -4175,17 +4174,38 @@ static void hdlc_mode(struct slgt_info *info) | |||
4175 | */ | 4174 | */ |
4176 | static void tx_set_idle(struct slgt_info *info) | 4175 | static void tx_set_idle(struct slgt_info *info) |
4177 | { | 4176 | { |
4178 | unsigned char val = 0xff; | 4177 | unsigned char val; |
4178 | unsigned short tcr; | ||
4179 | 4179 | ||
4180 | switch(info->idle_mode) | 4180 | /* if preamble enabled (tcr[6] == 1) then tx idle size = 8 bits |
4181 | { | 4181 | * else tcr[5:4] = tx idle size: 00 = 8 bits, 01 = 16 bits |
4182 | case HDLC_TXIDLE_FLAGS: val = 0x7e; break; | 4182 | */ |
4183 | case HDLC_TXIDLE_ALT_ZEROS_ONES: val = 0xaa; break; | 4183 | tcr = rd_reg16(info, TCR); |
4184 | case HDLC_TXIDLE_ZEROS: val = 0x00; break; | 4184 | if (info->idle_mode & HDLC_TXIDLE_CUSTOM_16) { |
4185 | case HDLC_TXIDLE_ONES: val = 0xff; break; | 4185 | /* disable preamble, set idle size to 16 bits */ |
4186 | case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break; | 4186 | tcr = (tcr & ~(BIT6 + BIT5)) | BIT4; |
4187 | case HDLC_TXIDLE_SPACE: val = 0x00; break; | 4187 | /* MSB of 16 bit idle specified in tx preamble register (TPR) */ |
4188 | case HDLC_TXIDLE_MARK: val = 0xff; break; | 4188 | wr_reg8(info, TPR, (unsigned char)((info->idle_mode >> 8) & 0xff)); |
4189 | } else if (!(tcr & BIT6)) { | ||
4190 | /* preamble is disabled, set idle size to 8 bits */ | ||
4191 | tcr &= ~(BIT5 + BIT4); | ||
4192 | } | ||
4193 | wr_reg16(info, TCR, tcr); | ||
4194 | |||
4195 | if (info->idle_mode & (HDLC_TXIDLE_CUSTOM_8 | HDLC_TXIDLE_CUSTOM_16)) { | ||
4196 | /* LSB of custom tx idle specified in tx idle register */ | ||
4197 | val = (unsigned char)(info->idle_mode & 0xff); | ||
4198 | } else { | ||
4199 | /* standard 8 bit idle patterns */ | ||
4200 | switch(info->idle_mode) | ||
4201 | { | ||
4202 | case HDLC_TXIDLE_FLAGS: val = 0x7e; break; | ||
4203 | case HDLC_TXIDLE_ALT_ZEROS_ONES: | ||
4204 | case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break; | ||
4205 | case HDLC_TXIDLE_ZEROS: | ||
4206 | case HDLC_TXIDLE_SPACE: val = 0x00; break; | ||
4207 | default: val = 0xff; | ||
4208 | } | ||
4189 | } | 4209 | } |
4190 | 4210 | ||
4191 | wr_reg8(info, TIR, val); | 4211 | wr_reg8(info, TIR, val); |
diff --git a/include/linux/synclink.h b/include/linux/synclink.h index 2993302f7923..b0e3535c38bf 100644 --- a/include/linux/synclink.h +++ b/include/linux/synclink.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SyncLink Multiprotocol Serial Adapter Driver | 2 | * SyncLink Multiprotocol Serial Adapter Driver |
3 | * | 3 | * |
4 | * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $ | 4 | * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $ |
5 | * | 5 | * |
6 | * Copyright (C) 1998-2000 by Microgate Corporation | 6 | * Copyright (C) 1998-2000 by Microgate Corporation |
7 | * | 7 | * |
@@ -97,6 +97,8 @@ | |||
97 | #define HDLC_TXIDLE_ALT_MARK_SPACE 4 | 97 | #define HDLC_TXIDLE_ALT_MARK_SPACE 4 |
98 | #define HDLC_TXIDLE_SPACE 5 | 98 | #define HDLC_TXIDLE_SPACE 5 |
99 | #define HDLC_TXIDLE_MARK 6 | 99 | #define HDLC_TXIDLE_MARK 6 |
100 | #define HDLC_TXIDLE_CUSTOM_8 0x10000000 | ||
101 | #define HDLC_TXIDLE_CUSTOM_16 0x20000000 | ||
100 | 102 | ||
101 | #define HDLC_ENCODING_NRZ 0 | 103 | #define HDLC_ENCODING_NRZ 0 |
102 | #define HDLC_ENCODING_NRZB 1 | 104 | #define HDLC_ENCODING_NRZB 1 |