NetBSD Problem Report #23428

Received: (qmail 1140 invoked by uid 605); 14 Nov 2003 01:42:49 -0000
Message-Id: <200311140142.hAE1gf504091@ariel.plethora.net>
Date: Thu, 13 Nov 2003 19:42:41 -0600 (CST)
From: tmp@ariel.plethora.net
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: tmp+pr@plethora.net
To: gnats-bugs@gnats.netbsd.org
Subject: driver support for NDC NCP130A2 (Prism-II PCI)
X-Send-Pr-Version: 3.95

>Number:         23428
>Category:       kern
>Synopsis:       device chipset supported, but attach lacks support for board
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dyoung
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 14 01:43:00 +0000 2003
>Closed-Date:    Mon Mar 22 17:43:00 +0000 2004
>Last-Modified:  Fri Mar 26 14:59:01 +0000 2004
>Originator:     T. M. Pederson
>Release:        NetBSD 1.6ZE (2003-11-13)
>Organization:
Plethora . Net
>Environment:


System: NetBSD thule.mirage 1.6ZE NetBSD 1.6ZE (SNAFU) #13: Wed Nov 13 11:58:50 CST 2003 tmp@thule.mirage:/usr/src/sys/arch/i386/compile/SNAFU i386
Architecture: i386
Machine: i386
>Description:
	While the Prism-II chipset on board the Nat'l Datacomm Corp. NCP130
	rev. A2 appears to be supported, the PCI<->Prism bridge lacks a
	function to initialize it.
>How-To-Repeat:
	Install the NDC NCP130A2 board in a NetBSD system and provide
	electricity.
>Fix:
	Apply the following two diffs, The cover two critical addresses for
	wireg.h and a preliminary function for initializing the board. I've
	done some initial tests with a board I have, and it looks good so
	far. A note on the function rewrite: I tried sticking with
	if/then/else, and PLX gets its own variables, but that got cumbersome.

--- sys/dev/ic/wireg.h.orig	2003-11-03 15:18:06.000000000 -0600
+++ sys/dev/ic/wireg.h	2003-11-05 10:40:11.000000000 -0600
@@ -228,6 +228,9 @@
 #define WI_HCR_HOLD		0x000f
 #define WI_HCR_EEHOLD		0x00ce

+#define WI_TMD_COR		0x14	/* Prism COR (TMD) */
+#define WI_TMD_IO		0x18	/* Prism I/O space (TMD) */
+
 /*
  * PCI Host Interface Registers (HFA3842 Specific)
  * The value of all Register's Offset, such as WI_INFO_FID and WI_PARAM0,


--- sys/dev/pci/if_wi_pci.c.orig	2003-10-24 15:49:49.000000000 -0500
+++ sys/dev/pci/if_wi_pci.c	2003-11-05 12:35:00.000000000 -0600
@@ -79,6 +79,7 @@

 #define CHIP_PLX_OTHER		0x01
 #define CHIP_PLX_9052		0x02
+#define CHIP_TMD_7160		0x03

 #define WI_PLX_COR_OFFSET       0x3E0
 #define WI_PLX_COR_VALUE        0x41
@@ -110,7 +111,7 @@
 	pci_vendor_id_t		wpp_vendor;	/* vendor ID */
 	pci_product_id_t	wpp_product;	/* product ID */
 	const char		*wpp_name;	/* product name */
-	int			wpp_plx;	/* uses PLX chip */
+	int			wpp_chip;	/* uses other chip */
 } wi_pci_products[] = {
 	{ PCI_VENDOR_GLOBALSUN,		PCI_PRODUCT_GLOBALSUN_GL24110P,
 	  NULL, CHIP_PLX_OTHER },
@@ -128,6 +129,8 @@
 	  NULL, CHIP_PLX_9052 },
 	{ PCI_VENDOR_USR2,		PCI_PRODUCT_USR2_2415,
 	  NULL, CHIP_PLX_OTHER },
+	{ PCI_VENDOR_NDC,		PCI_PRODUCT_NDC_NCP130A2,
+	  NULL, CHIP_TMD_7160 },
 	{ 0,				0,
 	  NULL, 0},
 };
@@ -235,8 +238,8 @@
 	const char *intrstr;
 	const struct wi_pci_product *wpp;
 	pci_intr_handle_t ih;
-	bus_space_tag_t memt, iot, plxt;
-	bus_space_handle_t memh, ioh, plxh;
+	bus_space_tag_t memt, iot, plxt, tmdt;
+	bus_space_handle_t memh, ioh, plxh, tmdh;

 	psc->psc_pc = pc;

@@ -248,7 +251,9 @@
 	}
 #endif

-	if (wpp->wpp_plx) {
+	switch (wpp->wpp_chip) {
+	case CHIP_PLX_OTHER:
+	case CHIP_PLX_9052:
 		/* Map memory and I/O registers. */
 		if (pci_mapreg_map(pa, WI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
 		    &memt, &memh, NULL, NULL) != 0) {
@@ -261,7 +266,7 @@
 			return;
 		}

-		if (wpp->wpp_plx == CHIP_PLX_OTHER) {
+		if (wpp->wpp_chip == CHIP_PLX_OTHER) {
 			/* The PLX 9052 doesn't have IO at 0x14.  Perhaps
 			   other chips have, so we'll make this conditional. */
 			if (pci_mapreg_map(pa, WI_PCI_PLX_LOIO,
@@ -271,7 +276,25 @@
 					return;
 				}
 		}
-	} else {
+		break;
+	case CHIP_TMD_7160:
+		/* Used instead of PLX on at least one revision of the
+		 * Nat'l Datacomm Corp. NCP130. Value for registers
+		 * acquired from OpenBSD, which in turn got them from
+		 * a linux driver. */
+		/* Map COR and I/O registers. */
+		if (pci_mapreg_map(pa, WI_TMD_COR, PCI_MAPREG_TYPE_IO, 0,
+		    &tmdt, &tmdh, NULL, NULL) != 0) {
+			printf(": can't map TMD I/O space\n");
+			return;
+		}
+		if (pci_mapreg_map(pa, WI_TMD_IO, PCI_MAPREG_TYPE_IO, 0,
+		    &iot, &ioh, NULL, NULL) != 0) {
+			printf(": can't map I/O space\n");
+			return;
+		}
+		break;
+	default:
 		if (pci_mapreg_map(pa, WI_PCI_CBMA,
 		    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
 		    0, &iot, &ioh, NULL, NULL) != 0) {
@@ -282,6 +305,7 @@
 		memt = iot;
 		memh = ioh;
 		sc->sc_pci = 1;
+		break;
 	}

 	if (wpp->wpp_name != NULL) {
@@ -304,7 +328,7 @@
 	CSR_WRITE_2(sc, WI_INT_EN, 0);
 	CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);

-	if (wpp->wpp_plx == CHIP_PLX_OTHER) {
+	if (wpp->wpp_chip == CHIP_PLX_OTHER) {
 		uint32_t command;
 #define	WI_LOCAL_INTCSR		0x4c
 #define	WI_LOCAL_INTEN		0x40	/* poke this into INTCSR */
@@ -334,16 +358,27 @@

 	printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);

-	if (wpp->wpp_plx) {
+	switch (wpp->wpp_chip) {
+	case CHIP_PLX_OTHER:
+	case CHIP_PLX_9052:
 		/*
 		 * Setup the PLX chip for level interrupts and config index 1
 		 * XXX - should really reset the PLX chip too.
 		 */
 		bus_space_write_1(memt, memh,
 		    WI_PLX_COR_OFFSET, WI_PLX_COR_VALUE);
-	} else {
+		break;
+	case CHIP_TMD_7160:
+		/*
+		 * Enable I/O mode and level interrupts on the embedded
+		 * card. The card's COR is the first byte of BAR 0.
+		 */
+		bus_space_write_1(tmdt, tmdh, 0, WI_COR_IOMODE);
+		break;
+	default:
 		/* reset HFA3842 MAC core */
 		wi_pci_reset(sc);
+		break;
 	}

 	printf("%s:", sc->sc_dev.dv_xname);
>Release-Note:
>Audit-Trail:

From: tmp@ariel.plethora.net
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: kern/23428
Date: Mon, 17 Nov 2003 11:10:15 -0600 (CST)

 >Release:	NetBSD 1.6ZF (2003-11-17)
 >Environment:
 System: NetBSD thule.mirage 1.6ZF NetBSD 1.6ZF (SNAFU) #15: Mon Nov 17 10:25:20 CST 2003 tmp@thule.mirage:/usr/src/sys/arch/i386/compile/SNAFU i386
 Architecture: i386
 Machine: i386
 >Description:
 	Device driver for Prism-II PCI boards does not have an attach function
 	for the Nat'l Datacomm Corp. NCP130 rev A2. Previous patch needs to
 	be updated.
 >Fix:
 	I've used the patch below to successfully connect to a nearby base
 	station. (Still needs the wireg.h patch as in previous message.)


 --- sys/dev/pci/if_wi_pci.c.orig	2003-11-17 09:42:22.000000000 -0600
 +++ sys/dev/pci/if_wi_pci.c	2003-11-17 10:20:22.000000000 -0600
 @@ -80,6 +80,7 @@

  #define CHIP_PLX_OTHER		0x01
  #define CHIP_PLX_9052		0x02
 +#define CHIP_TMD_7160		0x03

  #define WI_PLX_COR_OFFSET       0x3E0
  #define WI_PLX_COR_VALUE        0x41
 @@ -111,7 +112,7 @@
  	pci_vendor_id_t		wpp_vendor;	/* vendor ID */
  	pci_product_id_t	wpp_product;	/* product ID */
  	const char		*wpp_name;	/* product name */
 -	int			wpp_plx;	/* uses PLX chip */
 +	int			wpp_chip;	/* uses other chip */
  } wi_pci_products[] = {
  	{ PCI_VENDOR_GLOBALSUN,		PCI_PRODUCT_GLOBALSUN_GL24110P,
  	  NULL, CHIP_PLX_OTHER },
 @@ -129,6 +130,8 @@
  	  NULL, CHIP_PLX_9052 },
  	{ PCI_VENDOR_USR2,		PCI_PRODUCT_USR2_2415,
  	  NULL, CHIP_PLX_OTHER },
 +	{ PCI_VENDOR_NDC,		PCI_PRODUCT_NDC_NCP130A2,
 +	  NULL, CHIP_TMD_7160 },
  	{ 0,				0,
  	  NULL, 0},
  };
 @@ -236,8 +239,8 @@
  	const char *intrstr;
  	const struct wi_pci_product *wpp;
  	pci_intr_handle_t ih;
 -	bus_space_tag_t memt, iot, plxt;
 -	bus_space_handle_t memh, ioh, plxh;
 +	bus_space_tag_t memt, iot, plxt, tmdt;
 +	bus_space_handle_t memh, ioh, plxh, tmdh;

  	psc->psc_pc = pc;

 @@ -249,7 +252,9 @@
  	}
  #endif

 -	if (wpp->wpp_plx) {
 +	switch (wpp->wpp_chip) {
 +	case CHIP_PLX_OTHER:
 +	case CHIP_PLX_9052:
  		/* Map memory and I/O registers. */
  		if (pci_mapreg_map(pa, WI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0,
  		    &memt, &memh, NULL, NULL) != 0) {
 @@ -262,7 +267,7 @@
  			return;
  		}

 -		if (wpp->wpp_plx == CHIP_PLX_OTHER) {
 +		if (wpp->wpp_chip == CHIP_PLX_OTHER) {
  			/* The PLX 9052 doesn't have IO at 0x14.  Perhaps
  			   other chips have, so we'll make this conditional. */
  			if (pci_mapreg_map(pa, WI_PCI_PLX_LOIO,
 @@ -272,7 +277,25 @@
  					return;
  				}
  		}
 -	} else {
 +		break;
 +	case CHIP_TMD_7160:
 +		/* Used instead of PLX on at least one revision of the
 +		 * Nat'l Datacomm Corp. NCP130. Value for registers
 +		 * acquired from OpenBSD, which in turn got them from
 +		 * a linux driver. */
 +		/* Map COR and I/O registers. */
 +		if (pci_mapreg_map(pa, WI_TMD_COR, PCI_MAPREG_TYPE_IO, 0,
 +		    &tmdt, &tmdh, NULL, NULL) != 0) {
 +			printf(": can't map TMD I/O space\n");
 +			return;
 +		}
 +		if (pci_mapreg_map(pa, WI_TMD_IO, PCI_MAPREG_TYPE_IO, 0,
 +		    &iot, &ioh, NULL, NULL) != 0) {
 +			printf(": can't map I/O space\n");
 +			return;
 +		}
 +		break;
 +	default:
  		if (pci_mapreg_map(pa, WI_PCI_CBMA,
  		    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
  		    0, &iot, &ioh, NULL, NULL) != 0) {
 @@ -283,6 +306,7 @@
  		memt = iot;
  		memh = ioh;
  		sc->sc_pci = 1;
 +		break;
  	}

  	if (wpp->wpp_name != NULL) {
 @@ -305,7 +329,7 @@
  	CSR_WRITE_2(sc, WI_INT_EN, 0);
  	CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);

 -	if (wpp->wpp_plx == CHIP_PLX_OTHER) {
 +	if (wpp->wpp_chip == CHIP_PLX_OTHER) {
  		uint32_t command;
  #define	WI_LOCAL_INTCSR		0x4c
  #define	WI_LOCAL_INTEN		0x40	/* poke this into INTCSR */
 @@ -335,16 +359,27 @@

  	printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);

 -	if (wpp->wpp_plx) {
 +	switch (wpp->wpp_chip) {
 +	case CHIP_PLX_OTHER:
 +	case CHIP_PLX_9052:
  		/*
  		 * Setup the PLX chip for level interrupts and config index 1
  		 * XXX - should really reset the PLX chip too.
  		 */
  		bus_space_write_1(memt, memh,
  		    WI_PLX_COR_OFFSET, WI_PLX_COR_VALUE);
 -	} else {
 +		break;
 +	case CHIP_TMD_7160:
 +		/*
 +		 * Enable I/O mode and level interrupts on the embedded
 +		 * card. The card's COR is the first byte of BAR 0.
 +		 */
 +		bus_space_write_1(tmdt, tmdh, 0, WI_COR_IOMODE);
 +		break;
 +	default:
  		/* reset HFA3842 MAC core */
  		wi_pci_reset(sc);
 +		break;
  	}

  	printf("%s:", sc->sc_dev.dv_xname);
Responsible-Changed-From-To: kern-bug-people->dsl 
Responsible-Changed-By: fair 
Responsible-Changed-When: Thu Dec 4 08:29:05 UTC 2003 
Responsible-Changed-Why:  
David, can you have a look at this patch? 

Responsible-Changed-From-To: dsl->fair 
Responsible-Changed-By: dsl 
Responsible-Changed-When: Thu Dec 4 20:11:35 UTC 2003 
Responsible-Changed-Why:  
I don't know anything about this code. 
Responsible-Changed-From-To: fair->kern-bug-people 
Responsible-Changed-By: fair 
Responsible-Changed-When: Thu Dec 4 23:51:55 UTC 2003 
Responsible-Changed-Why:  
OK, some other person with familiarity with the 802.11 stuff 
should look at this. 
Responsible-Changed-From-To: kern-bug-people->dyoung 
Responsible-Changed-By: fair 
Responsible-Changed-When: Sat Dec 6 20:05:03 UTC 2003 
Responsible-Changed-Why:  
David Young is our 802.11b expert 

From: David Young <dyoung@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/23428 CVS commit: src/sys/dev
Date: Sun, 14 Dec 2003 10:04:33 +0000 (UTC)

 Module Name:	src
 Committed By:	dyoung
 Date:		Sun Dec 14 10:04:33 UTC 2003

 Modified Files:
 	src/sys/dev/ic: wireg.h
 	src/sys/dev/pci: if_wi_pci.c

 Log Message:
 PR 23428: support National Datacomm Corporation NCP130A2 board.
 Thanks T. M. Pederson for sending the patches.


 To generate a diff of this commit:
 cvs rdiff -r1.49 -r1.50 src/sys/dev/ic/wireg.h
 cvs rdiff -r1.29 -r1.30 src/sys/dev/pci/if_wi_pci.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


From: David Young <dyoung@pobox.com>
To: gnats-bugs@gnats.netbsd.org
Cc: tmp@ariel.plethora.net
Subject: Re: kern/23428
Date: Sun, 14 Dec 2003 04:08:02 -0600

 I've just applied T. M. Pederson's patch for NCP130A2 support. Please
 verify that the -current sources work for you, T.M., so that I can close
 this PR.

 Dave

 -- 
 David Young             OJC Technologies
 dyoung@ojctech.com      Urbana, IL * (217) 278-3933

From: "T. M. Pederson" <tmp@ariel.plethora.net>
To: dyoung@pobox.com, gnats-bugs@gnats.netbsd.org
Cc: tmp@ariel.plethora.net
Subject: Re: kern/23428
Date: Mon, 29 Dec 2003 09:07:31 -0600 (CST)

 I've had success with the NCP130A2 patch applied to mid-November -current
 (Nov. 13, IIRC). I'll be setting up another box that could use it today, and
 I'll update that to the latest stable -current. Unless there's been significant
 change to wi(4) in the last month, I don't expect any problems.

 Thanks.
State-Changed-From-To: open->feedback 
State-Changed-By: fair 
State-Changed-When: Mon Mar 22 09:25:36 UTC 2004 
State-Changed-Why:  

As I read the audit trail of this problem report, 
it has been resolved. Is my impression correct, and 
can we then close this PR? 
State-Changed-From-To: feedback->closed 
State-Changed-By: dyoung 
State-Changed-When: Mon Mar 22 17:37:51 UTC 2004 
State-Changed-Why:  
T.M. did not expect any problems. Apparently he did not have any. 
The PR is resolved. 

From: David Young <dyoung@pobox.com>
To: gnats-bugs@gnats.netbsd.org
Cc: tmp+pr@plethora.net, fair@netbsd.org, dyoung@netbsd.org
Subject: Re: kern/23428
Date: Mon, 22 Mar 2004 11:41:50 -0600

 On Mon, Mar 22, 2004 at 09:26:18AM -0000, fair@netbsd.org wrote:
 > Synopsis: device chipset supported, but attach lacks support for board
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: fair
 > State-Changed-When: Mon Mar 22 09:25:36 UTC 2004
 > State-Changed-Why: 
 > 
 > As I read the audit trail of this problem report,
 > it has been resolved. Is my impression correct, and
 > can we then close this PR?

 Thanks, Erik. I realize now that T.M. was going to give me feedback if
 it *didn't* work.  I will close the PR.

 Dave

 -- 
 David Young             OJC Technologies
 dyoung@ojctech.com      Urbana, IL * (217) 278-3933

From: "T. M. Pederson" <tmp@herd.plethora.net>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: kern/23428 
Date: Fri, 26 Mar 2004 08:58:09 -0600

 On Mon Mar 22 11:43:02 2004 dyoung@netbsd.org wrote:
 >Synopsis: device chipset supported, but attach lacks support for board
 >
 >State-Changed-From-To: feedback->closed
 >State-Changed-By: dyoung
 >State-Changed-When: Mon Mar 22 17:37:51 UTC 2004
 >State-Changed-Why: 
 >T.M. did not expect any problems. Apparently he did not have any.
 >The PR is resolved.

 Sorry for the delay in responding; the target motherboard fried. The
 board is now acceptably running in another box (still need to update
 the firmware though).

 One thing to note is that the source changes from this PR also take
 care of kern/20063.
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.