Linux PARISC architecture development
 help / color / mirror / Atom feed
From: lamont@b180.mmjgroup.com (LaMont Jones)
To: parisc-linux@parisc-linux.org
Subject: [parisc-linux] airo.c patch for hppa
Date: Tue, 3 Dec 2002 22:06:40 -0700	[thread overview]
Message-ID: <20021204050640.GA22117@b180.mmjgroup.com> (raw)

The patch below gets airo.c working on hppa.  Diff is vs 2.4.20 source.

The first part (chage to init_airo_card and it's callers) allows us to call
pci_enable_device like we need to.

The other part (the stuff inside #ifdef __hppa__) is a gross hack that works
around some issues between dino and the card during initialization where the
card fails to ack reads of several 2-byte aligned addresses.  With these
changes, I have a working PCI4800 in my B180.

It would, of course, be nice if at least part of this made it into the CVS
tree...

thoughts?
lamont

--- ../x/airo.c	2002-12-03 18:55:31.000000000 -0700
+++ drivers/net/wireless/airo.c	2002-12-03 21:20:32.000000000 -0700
@@ -1649,7 +1649,7 @@
 	return dev;
 }
 
-struct net_device *init_airo_card( unsigned short irq, int port, int is_pcmcia )
+struct net_device *init_airo_card( unsigned short irq, int port, int is_pcmcia , struct pci_dev *pdev )
 {
 	struct net_device *dev;
 	struct airo_info *ai;
@@ -1696,6 +1696,12 @@
 	dev->irq = irq;
 	dev->base_addr = port;
 
+	if ( !is_pcmcia && pdev ) {
+		if (pci_enable_device(pdev))
+			goto err_out_free;
+		pci_set_master(pdev);
+	}
+
 	rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev );
 	if (rc) {
 		printk(KERN_ERR "airo: register interrupt %d failed, rc %d\n", irq, rc );
@@ -2163,12 +2169,22 @@
 static u16 IN4500( struct airo_info *ai, u16 reg ) {
 	unsigned short rc;
 
+#ifdef __hppa__
+	if ((reg&3) && reg!=DATA0) {
+		unsigned int ri;
+		ri=inl(ai->dev->base_addr + (reg&~3));
+		rc=(ri>>(8*(reg&3)))&0xffff;
+	} else {
+		rc = inw( ai->dev->base_addr + reg );
+	}
+#else
 	if ( !do8bitIO )
 		rc = inw( ai->dev->base_addr + reg );
 	else {
 		rc = inb( ai->dev->base_addr + reg );
 		rc += ((int)inb( ai->dev->base_addr + reg + 1 )) << 8;
 	}
+#endif
 	return rc;
 }
 
@@ -2266,6 +2282,7 @@
 		printk(KERN_ERR "airo: Error checking for AUX port\n");
 		return ERROR;
 	}
+	
 	if (!aux_bap || rsp.status & 0xff00) {
 		ai->bap_read = fast_bap_read;
 		printk(KERN_DEBUG "airo: Doing fast bap_reads\n");
@@ -4008,7 +4025,7 @@
 {
 	struct net_device *dev;
 
-	dev = init_airo_card(pdev->irq,	pdev->resource[2].start, 0);
+	dev = init_airo_card(pdev->irq,	pdev->resource[2].start, 0, pdev);
 	if (!dev)
 		return -ENODEV;
 
@@ -4036,7 +4053,7 @@
 		printk( KERN_INFO
 			"airo:  Trying to configure ISA adapter at irq=%d io=0x%x\n",
 			irq[i], io[i] );
-		if (init_airo_card( irq[i], io[i], 0 ))
+		if (init_airo_card( irq[i], io[i], 0, 0 ))
 			have_isa_dev = 1;
 	}
 

             reply	other threads:[~2002-12-04  5:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04  5:06 LaMont Jones [this message]
2002-12-04 14:44 ` [parisc-linux] airo.c patch for hppa Matthew Wilcox
2002-12-04 17:12   ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021204050640.GA22117@b180.mmjgroup.com \
    --to=lamont@b180.mmjgroup.com \
    --cc=parisc-linux@parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox