patch-2.3.13 linux/include/asm-sparc64/parport.h
Next file: linux/include/asm-sparc64/pgtable.h
Previous file: linux/include/asm-sparc64/page.h
Back to the patch index
Back to the overall index
- Lines: 121
- Date:
Mon Aug 9 11:29:37 1999
- Orig file:
v2.3.12/linux/include/asm-sparc64/parport.h
- Orig date:
Wed Jul 28 14:47:42 1999
diff -u --recursive --new-file v2.3.12/linux/include/asm-sparc64/parport.h linux/include/asm-sparc64/parport.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: parport.h,v 1.4 1999/08/08 01:38:18 davem Exp $
* parport.h: sparc64 specific parport initialization and dma.
*
* Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
@@ -7,21 +7,33 @@
#ifndef _ASM_SPARC64_PARPORT_H
#define _ASM_SPARC64_PARPORT_H 1
+#include <linux/config.h>
#include <asm/ebus.h>
#include <asm/ns87303.h>
-static struct linux_ebus_dma *sparc_ebus_dmas[PARPORT_MAX];
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_init
+#define __maybe_initdata
+#else
+#define __maybe_init __init
+#define __maybe_initdata __initdata
+#endif
+
+#undef HAVE_SLOW_DEVICES
+
+#define PARPORT_PC_MAX_PORTS PARPORT_MAX
+
+static struct linux_ebus_dma *sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
static __inline__ void
reset_dma(unsigned int dmanr)
{
unsigned int dcsr;
- dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr) & EBUS_DCSR_INT_EN;
writel(EBUS_DCSR_RESET, &sparc_ebus_dmas[dmanr]->dcsr);
-
- dcsr |= EBUS_DCSR_BURST_SZ_16 | EBUS_DCSR_TCI_DIS |
- EBUS_DCSR_EN_CNT;
+ udelay(1);
+ dcsr = EBUS_DCSR_BURST_SZ_16 | EBUS_DCSR_TCI_DIS |
+ EBUS_DCSR_EN_CNT;
writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
}
@@ -41,14 +53,21 @@
unsigned int dcsr;
dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
- while (dcsr & EBUS_DCSR_DRAIN)
+ if (dcsr & EBUS_DCSR_EN_DMA) {
+ while (dcsr & EBUS_DCSR_DRAIN) {
+ udelay(1);
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ }
+ dcsr &= ~(EBUS_DCSR_EN_DMA);
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+
dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
- dcsr &= ~(EBUS_DCSR_EN_DMA);
- if (dcsr & EBUS_DCSR_ERR_PEND) {
- reset_dma(dmanr);
- dcsr &= ~(EBUS_DCSR_ERR_PEND);
+ if (dcsr & EBUS_DCSR_ERR_PEND) {
+ reset_dma(dmanr);
+ dcsr &= ~(EBUS_DCSR_ERR_PEND);
+ }
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
}
- writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
}
static __inline__ void
@@ -86,13 +105,21 @@
static __inline__ int
get_dma_residue(unsigned int dmanr)
{
- return readl(&sparc_ebus_dmas[dmanr]->dbcr);
+ unsigned int dcsr;
+ int res;
+
+ res = readl(&sparc_ebus_dmas[dmanr]->dbcr);
+ if (res != 0) {
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ reset_dma(dmanr);
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+ }
+ return res;
}
-static int __init probe_one_port(unsigned long int base,
- unsigned long int base_hi,
- int irq, int dma);
-static int __init parport_pc_init_pci(int irq, int dma);
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __initdata = 0;
int __init
parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
@@ -114,6 +141,7 @@
sparc_ebus_dmas[count] =
(struct linux_ebus_dma *)
edev->base_address[2];
+ reset_dma(count);
/* Enable ECP, set bit 2 of the CTR first */
outb(0x04, base + 0x02);
@@ -139,8 +167,10 @@
ns87303_writeb(config, FCR, cfg);
#endif
- count += probe_one_port(base, base + 0x400,
- edev->irqs[0], count);
+ if (parport_pc_probe_port(base, base + 0x400,
+ edev->irqs[0],
+ count))
+ count++;
}
}
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)