linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add synclink_gt custom hdlc idle
@ 2006-06-21 14:27 Paul Fulghum
  2006-06-22  2:20 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Fulghum @ 2006-06-21 14:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel Mailing List

Add custom HDLC idle pattern feature.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>

--- a/drivers/char/synclink_gt.c	2006-06-21 09:04:11.000000000 -0500
+++ b/drivers/char/synclink_gt.c	2006-06-21 09:10:31.000000000 -0500
@@ -2515,7 +2515,8 @@ static int set_txidle(struct slgt_info *
 	DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode));
 	spin_lock_irqsave(&info->lock,flags);
 	info->idle_mode = idle_mode;
-	tx_set_idle(info);
+	if (info->params.mode != MGSL_MODE_ASYNC)
+		tx_set_idle(info);
 	spin_unlock_irqrestore(&info->lock,flags);
 	return 0;
 }
@@ -3940,8 +3941,6 @@ static void async_mode(struct slgt_info 
 
 	msc_set_vcr(info);
 
-	tx_set_idle(info);
-
 	/* SCR (serial control)
 	 *
 	 * 15  1=tx req on FIFO half empty
@@ -4175,17 +4174,38 @@ static void hdlc_mode(struct slgt_info *
  */
 static void tx_set_idle(struct slgt_info *info)
 {
-	unsigned char val = 0xff;
+	unsigned char val;
+	unsigned short tcr;
 
-	switch(info->idle_mode)
-	{
-	case HDLC_TXIDLE_FLAGS:          val = 0x7e; break;
-	case HDLC_TXIDLE_ALT_ZEROS_ONES: val = 0xaa; break;
-	case HDLC_TXIDLE_ZEROS:          val = 0x00; break;
-	case HDLC_TXIDLE_ONES:           val = 0xff; break;
-	case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break;
-	case HDLC_TXIDLE_SPACE:          val = 0x00; break;
-	case HDLC_TXIDLE_MARK:           val = 0xff; break;
+	/* if preamble enabled (tcr[6] == 1) then tx idle size = 8 bits
+	 * else tcr[5:4] = tx idle size: 00 = 8 bits, 01 = 16 bits
+	 */
+	tcr = rd_reg16(info, TCR);
+	if (info->idle_mode & HDLC_TXIDLE_CUSTOM_16) {
+		/* disable preamble, set idle size to 16 bits */
+		tcr = (tcr & ~(BIT6 + BIT5)) | BIT4;
+		/* MSB of 16 bit idle specified in tx preamble register (TPR) */
+		wr_reg8(info, TPR, (unsigned char)((info->idle_mode >> 8) & 0xff));
+	} else if (!(tcr & BIT6)) {
+		/* preamble is disabled, set idle size to 8 bits */
+		tcr &= ~(BIT5 + BIT4);
+	}
+	wr_reg16(info, TCR, tcr);
+
+	if (info->idle_mode & (HDLC_TXIDLE_CUSTOM_8 | HDLC_TXIDLE_CUSTOM_16)) {
+		/* LSB of custom tx idle specified in tx idle register */
+		val = (unsigned char)(info->idle_mode & 0xff);
+	} else {
+		/* standard 8 bit idle patterns */
+		switch(info->idle_mode)
+		{
+		case HDLC_TXIDLE_FLAGS:          val = 0x7e; break;
+		case HDLC_TXIDLE_ALT_ZEROS_ONES:
+		case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break;
+		case HDLC_TXIDLE_ZEROS:
+		case HDLC_TXIDLE_SPACE:          val = 0x00; break;
+		default:                         val = 0xff;
+		}
 	}
 
 	wr_reg8(info, TIR, val);
--- a/include/linux/synclink.h	2006-06-21 09:04:26.000000000 -0500
+++ b/include/linux/synclink.h	2006-06-21 09:10:44.000000000 -0500
@@ -1,7 +1,7 @@
 /*
  * SyncLink Multiprotocol Serial Adapter Driver
  *
- * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $
+ * $Id: synclink.h,v 3.13 2006/05/23 18:25:06 paulkf Exp $
  *
  * Copyright (C) 1998-2000 by Microgate Corporation
  *
@@ -97,6 +97,8 @@
 #define HDLC_TXIDLE_ALT_MARK_SPACE	4
 #define HDLC_TXIDLE_SPACE		5
 #define HDLC_TXIDLE_MARK		6
+#define HDLC_TXIDLE_CUSTOM_8            0x10000000
+#define HDLC_TXIDLE_CUSTOM_16           0x20000000
 
 #define HDLC_ENCODING_NRZ			0
 #define HDLC_ENCODING_NRZB			1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] add synclink_gt custom hdlc idle
  2006-06-21 14:27 [PATCH] add synclink_gt custom hdlc idle Paul Fulghum
@ 2006-06-22  2:20 ` Andrew Morton
  2006-06-22  2:53   ` Paul Fulghum
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-06-22  2:20 UTC (permalink / raw)
  To: Paul Fulghum; +Cc: linux-kernel

On Wed, 21 Jun 2006 09:27:56 -0500
Paul Fulghum <paulkf@microgate.com> wrote:

> Add custom HDLC idle pattern feature.

What's a custom HDLC idle pattern feature?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] add synclink_gt custom hdlc idle
  2006-06-22  2:20 ` Andrew Morton
@ 2006-06-22  2:53   ` Paul Fulghum
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Fulghum @ 2006-06-22  2:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Andrew Morton wrote:
> What's a custom HDLC idle pattern feature?

It allows the user to specify an arbitrary 8 or
16 bit repeating pattern on the transmit data pin between
HDLC frames.

In most cases the idle pattern is continuous
ones or flags as supported by off the shelf
synchronous controllers and defined in the ISO3309 standard.
Some applications (radio/satellite modems, connections to
legacy military hardware) require non-standard patterns.

--
Paul

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-22  2:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21 14:27 [PATCH] add synclink_gt custom hdlc idle Paul Fulghum
2006-06-22  2:20 ` Andrew Morton
2006-06-22  2:53   ` Paul Fulghum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).