lkml.org 
[lkml]   [2001]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectIRDA support for NSC8739x LPC Super I/O chipsets
Hello,

I've attached a patch for NSC8739x LPC Super I/O chipsets to
enable and configure the IRDA port. It works perfectly with my notebook
over a half of year but the FIR transfers has not been tested yet. It
would be nice to include this code to the official linux kernel tree.
Thank you.

Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org
--- linux-2.4.10/drivers/net/irda/nsc-ircc.c Tue Sep 25 13:01:49 2001
+++ linux/drivers/net/irda/nsc-ircc.c Mon Sep 24 10:43:55 2001
@@ -2,7 +2,7 @@
*
* Filename: nsc-ircc.c
* Version: 1.0
- * Description: Driver for the NSC PC'108 and PC'338 IrDA chipsets
+ * Description: Driver for the NSC PC'108, PC'338 and PC'39x IrDA chipsets
* Status: Stable.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Nov 7 21:43:15 1998
@@ -13,6 +13,9 @@
* Copyright (c) 1998 Lichen Wang, <lwang@actisys.com>
* Copyright (c) 1998 Actisys Corp., www.actisys.com
* All Rights Reserved
+ *
+ * 03/03/2001 Jaroslav Kysela <perex@suse.cz>
+ * Added PC8739x initialization code.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -83,8 +86,10 @@

static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info);
static int nsc_ircc_probe_338(nsc_chip_t *chip, chipio_t *info);
+static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info);
static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info);
static int nsc_ircc_init_338(nsc_chip_t *chip, chipio_t *info);
+static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info);

/* These are the known NSC chips */
static nsc_chip_t chips[] = {
@@ -92,6 +97,8 @@
nsc_ircc_probe_108, nsc_ircc_init_108 },
{ "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf8,
nsc_ircc_probe_338, nsc_ircc_init_338 },
+ { "PC8739x", { 0x2e, 0x4e }, 0x20, 0xea, 0xff,
+ nsc_ircc_probe_39x, nsc_ircc_init_39x },
{ NULL }
};

@@ -156,7 +163,7 @@
int ret = -ENODEV;
int cfg_base;
int cfg, id;
- int reg;
+ int reg, res;
int i = 0;

/* Probe for all the NSC chipsets we know about */
@@ -197,11 +204,11 @@
* set by the BIOS
*/
if (io[i] < 0x2000) {
- chip->init(chip, &info);
+ res = chip->init(chip, &info);
} else
- chip->probe(chip, &info);
+ res = chip->probe(chip, &info);

- if (nsc_ircc_open(i, &info) == 0)
+ if (res == 0 && nsc_ircc_open(i, &info) == 0)
ret = 0;
i++;
} else {
@@ -680,6 +687,67 @@
reg = inb(cfg_base+1);

info->suspended = reg & 0x01;
+
+ return 0;
+}
+
+/*
+ * Function nsc_ircc_init_39x (chip, info)
+ *
+ * Initialize the NSC '39x chip.
+ */
+static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info)
+{
+ /* No init yet */
+
+ return 0;
+}
+
+/*
+ * Function nsc_ircc_probe_39x (chip, info)
+ *
+ *
+ *
+ */
+static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info)
+{
+ int cfg_base = info->cfg_base;
+ int reg;
+
+ /* Select the SP2 logical device */
+ outb(CFG_LOGDEV, cfg_base);
+ outb(2, cfg_base + 1);
+
+ /* Read logical device activate bit */
+ outb(CFG_ACTIVATE, cfg_base);
+ if (((reg = inb(cfg_base+1)) & 1) == 0) {
+ MESSAGE("%s, the 2nd serial IR port is disabled in BIOS [0x%x]\n", driver_name, reg);
+ return -EIO;
+ }
+
+ info->enabled = reg & 0x01;
+
+ outb(CFG_BASE_LSB, cfg_base);
+ reg = inb(cfg_base + 1);
+ outb(CFG_BASE_MSB, cfg_base);
+ reg |= inb(cfg_base + 1) << 8;
+ info->fir_base = reg;
+
+ outb(CFG_IRQ, cfg_base);
+ info->irq = inb(cfg_base + 1) & 15;
+
+ outb(CFG_DMA_RX, cfg_base);
+ info->dma = inb(cfg_base + 1) & 7;
+
+ outb(CFG_DMA_TX, cfg_base);
+
+ /* Read power and bank enable register */
+ outb(CFG_SP2_CFG, cfg_base);
+ reg = inb(cfg_base+1);
+ reg |= SP2_ENBNKSEL;
+ outb(reg, cfg_base+1);
+
+ info->suspended = !((reg & 0x02) >> 1);

return 0;
}
--- linux-2.4.10/include/net/irda/nsc-ircc.h Mon Dec 11 21:59:39 2000
+++ linux/include/net/irda/nsc-ircc.h Mon Sep 24 12:20:50 2001
@@ -51,9 +51,26 @@
#define CFG_PNP1 0x1c
#define CFG_PNP3 0x4f

+/* Config register for the '39x */
+#define CFG_LOGDEV 0x07 /* select logical device, 2 = IR 2nd Serial Port */
+#define CFG_ACTIVATE 0x30
+#define CFG_BASE_MSB 0x60
+#define CFG_BASE_LSB 0x61
+#define CFG_IRQ 0x70
+#define CFG_IRQ_TYPE 0x71
+#define CFG_DMA_RX 0x74
+#define CFG_DMA_TX 0x75
+#define CFG_SP2_CFG 0xf0 /* 2nd Serial port configuration */
+
/* Flags for configuration register CRF0 */
#define APEDCRC 0x02
#define ENBNKSEL 0x01
+
+/* Flags for configuration register SP2_CFG */
+#define SP2_ENBNKSEL 0x80
+#define SP2_BUSYINDIC 0x04
+#define SP2_PMC 0x02
+#define SP2_TRISTATE 0x01

/* Set 0 */
#define TXD 0x00 /* Transmit data port */
--- linux-2.4.10/drivers/net/irda/Config.in Sun Aug 12 19:51:42 2001
+++ linux/drivers/net/irda/Config.in Mon Sep 24 12:23:18 2001
@@ -18,7 +18,7 @@

comment 'FIR device drivers'
dep_tristate 'IrDA USB dongles (Experimental)' CONFIG_USB_IRDA $CONFIG_IRDA $CONFIG_USB $CONFIG_EXPERIMENTAL
-dep_tristate 'NSC PC87108/PC87338' CONFIG_NSC_FIR $CONFIG_IRDA
+dep_tristate 'NSC PC87108/PC87338/PC8739x' CONFIG_NSC_FIR $CONFIG_IRDA
dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA
dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA
if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.087 / U:7.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site