netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
To: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	John Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
	Bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
Subject: Re: [PATCH] bcm43xx: Fix failure to deliver PCI-E interrupts
Date: Fri, 12 Jan 2007 15:17:40 +0100	[thread overview]
Message-ID: <200701121517.40539.mb@bu3sch.de> (raw)
In-Reply-To: <45a713f4.CVklfeegOYfmrIW+%Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>

On Friday 12 January 2007 05:52, Larry Finger wrote:
> The PCI-E modifications to bcm43xx do not set up the interrupt vector
> correctly.
> 
> Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
> ---
> 
> John,
> 
> This fix should be applied to wireless-2.6 _AND_ pushed upstream to
> 2.6.20-rcX. Without this patch, none of the PCI-E interfaces will work.
> 
> Larry
> 
> 
> Index: linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> +++ linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
> @@ -2704,7 +2704,7 @@ static int bcm43xx_probe_cores(struct bc
>  		sb_id_hi = bcm43xx_read32(bcm, BCM43xx_CIR_SB_ID_HI);
>  
>  		/* extract core_id, core_rev, core_vendor */
> -		core_id = (sb_id_hi & 0xFFF0) >> 4;
> +		core_id = (sb_id_hi & 0x8FF0) >> 4;

ACK. That one fixes a bug.

>  		core_rev = (sb_id_hi & 0xF);

This is also buggy. Should be something like:

	core_rev = ((sb_id_hi & 0xF) | ((sb_id_hi & 0x7000) >> 8));

>  		core_vendor = (sb_id_hi & 0xFFFF0000) >> 16;
>  
> @@ -2717,7 +2717,7 @@ static int bcm43xx_probe_cores(struct bc
>  		case BCM43xx_COREID_PCIE:
>  			core = &bcm->core_pci;
>  			if (core->available) {
> -				printk(KERN_WARNING PFX "Multiple PCI cores found.\n");
> +				printk(KERN_WARNING PFX "Multiple PCI/PCI-E cores found.\n");
>  				continue;
>  			}
>  			break;
> @@ -2872,11 +2872,14 @@ static int bcm43xx_wireless_core_init(st
>  	u32 sbimconfiglow;
>  	u8 limit;
>  
> -	if (bcm->core_pci.rev <= 5 && bcm->core_pci.id != BCM43xx_COREID_PCIE) {
> +	if (bcm->core_pci.rev <= 5 && bcm->core_pci.id == BCM43xx_COREID_PCI) {

That's semantically equal.

>  		sbimconfiglow = bcm43xx_read32(bcm, BCM43xx_CIR_SBIMCONFIGLOW);
>  		sbimconfiglow &= ~ BCM43xx_SBIMCONFIGLOW_REQUEST_TOUT_MASK;
>  		sbimconfiglow &= ~ BCM43xx_SBIMCONFIGLOW_SERVICE_TOUT_MASK;
> -		sbimconfiglow |= 0x32;
> +		if (bcm->bustype == BCM43xx_BUSTYPE_PCI)
> +			sbimconfiglow |= 0x32;
> +		else
> +			sbimconfiglow |= 0x53;

That used to be there until someone ripped it out (not me). Not sure why.

>  		bcm43xx_write32(bcm, BCM43xx_CIR_SBIMCONFIGLOW, sbimconfiglow);
>  	}
>  
> @@ -3070,6 +3073,7 @@ static int bcm43xx_setup_backplane_pci_c
>  	u32 backplane_flag_nr;
>  	u32 value;
>  	struct bcm43xx_coreinfo *old_core;
> +	struct bcm43xx_coreinfo *pci_core = &bcm->core_pci ;
>  	int err = 0;
>  
>  	value = bcm43xx_read32(bcm, BCM43xx_CIR_SBTPSFLAG);
> @@ -3080,26 +3084,22 @@ static int bcm43xx_setup_backplane_pci_c
>  	if (err)
>  		goto out;
>  
> -	if (bcm->current_core->rev < 6 ||
> -		bcm->current_core->id == BCM43xx_COREID_PCI) {
> -		value = bcm43xx_read32(bcm, BCM43xx_CIR_SBINTVEC);
> -		value |= (1 << backplane_flag_nr);
> -		bcm43xx_write32(bcm, BCM43xx_CIR_SBINTVEC, value);
> -	} else {
> +	if ((pci_core->rev >= 6) || (pci_core->id == BCM43xx_COREID_PCIE)) {
>  		err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCICFG_ICR, &value);
> -		if (err) {
> -			printk(KERN_ERR PFX "Error: ICR setup failure!\n");
> +		if (err)
>  			goto out_switch_back;
> -		}
>  		value |= core_mask << 8;
>  		err = bcm43xx_pci_write_config32(bcm, BCM43xx_PCICFG_ICR, value);
> -		if (err) {
> -			printk(KERN_ERR PFX "Error: ICR setup failure!\n");
> +		if (err)
>  			goto out_switch_back;
> -		}
> +	} else {
> +                err = -EINVAL;
> +                value = bcm43xx_read32(bcm, BCM43xx_CIR_SBINTVEC);
> +		value |= 1 << backplane_flag_nr;
> +                bcm43xx_write32(bcm, BCM43xx_CIR_SBINTVEC, value);
>  	}

The above doesn't change semantics. Or am I simply not seeing it? :)
Seems that it just shuffles the code.

>  
> -	if (bcm->current_core->id == BCM43xx_COREID_PCI) {
> +	if (pci_core->id == BCM43xx_COREID_PCI) {

That's semantically equal.

>  		value = bcm43xx_read32(bcm, BCM43xx_PCICORE_SBTOPCI2);
>  		value |= BCM43xx_SBTOPCI2_PREFETCH | BCM43xx_SBTOPCI2_BURST;
>  		bcm43xx_write32(bcm, BCM43xx_PCICORE_SBTOPCI2, value);
> @@ -3118,21 +3118,21 @@ static int bcm43xx_setup_backplane_pci_c
>  			value |= BCM43xx_SBTOPCI2_MEMREAD_MULTI;
>  			bcm43xx_write32(bcm, BCM43xx_PCICORE_SBTOPCI2, value);
>  		}
> -	} else {
> -		if (bcm->current_core->rev == 0 || bcm->current_core->rev == 1) {
> +	} else if (pci_core->id == BCM43xx_COREID_PCIE) {

That's redundant. If it's not a PCI core, it must be a PCIE core.

> +		if (pci_core->rev == 0 || pci_core->rev == 1) {

Semantically equal.

>  			value = bcm43xx_pcie_reg_read(bcm, BCM43xx_PCIE_TLP_WORKAROUND);
>  			value |= 0x8;
>  			bcm43xx_pcie_reg_write(bcm, BCM43xx_PCIE_TLP_WORKAROUND,
>  					       value);
>  		}
> -		if (bcm->current_core->rev == 0) {
> +		if (pci_core->rev == 0) {

dito

>  			bcm43xx_pcie_mdio_write(bcm, BCM43xx_MDIO_SERDES_RX,
>  						BCM43xx_SERDES_RXTIMER, 0x8128);
>  			bcm43xx_pcie_mdio_write(bcm, BCM43xx_MDIO_SERDES_RX,
>  						BCM43xx_SERDES_CDR, 0x0100);
>  			bcm43xx_pcie_mdio_write(bcm, BCM43xx_MDIO_SERDES_RX,
>  						BCM43xx_SERDES_CDR_BW, 0x1466);
> -		} else if (bcm->current_core->rev == 1) {
> +		} else if (pci_core->rev == 1) {

dito

>  			value = bcm43xx_pcie_reg_read(bcm, BCM43xx_PCIE_DLLP_LINKCTL);
>  			value |= 0x40;
>  			bcm43xx_pcie_reg_write(bcm, BCM43xx_PCIE_DLLP_LINKCTL,
> @@ -3141,6 +3141,7 @@ static int bcm43xx_setup_backplane_pci_c
>  	}
>  out_switch_back:
>  	err = bcm43xx_switch_core(bcm, old_core);
> +	printk(KERN_ERR PFX "Error: ICR setup failure!\n");
>  out:
>  	return err;
>  }
> 
> ---
> 
> 

-- 
Greetings Michael.

  parent reply	other threads:[~2007-01-12 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12  4:52 [PATCH] bcm43xx: Fix failure to deliver PCI-E interrupts Larry Finger
     [not found] ` <45a713f4.CVklfeegOYfmrIW+%Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2007-01-12 14:17   ` Michael Buesch [this message]
2007-01-12 16:36     ` Larry Finger
     [not found]       ` <45A7B914.4030804-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2007-01-12 16:53         ` Michael Buesch

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=200701121517.40539.mb@bu3sch.de \
    --to=mb-fseuscv1ubazqb+pc5nmwq@public.gmane.org \
    --cc=Bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
    --cc=Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org \
    --cc=linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).