linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	b43-dev@lists.infradead.org
Subject: Re: [RFC][RFT][PATCH V2 2/2] b43: fix DMA on some bugged hardware
Date: Sat, 13 Aug 2011 17:26:41 -0500	[thread overview]
Message-ID: <4E46FA21.9060207@lwfinger.net> (raw)
In-Reply-To: <1313001339-11211-2-git-send-email-zajec5@gmail.com>

On 08/10/2011 01:35 PM, Rafał Miłecki wrote:
> Some hardware with 64-bit DMA uses lower address word for setting
> routing (translation) bit. Add workaround for such boards.
>
> Signed-off-by: Rafał Miłecki<zajec5@gmail.com>
> ---
> This requires testing on at least 1 normal 64-bit DMA card and 1 32-bit
> DMA card. So far it was tested only on my 14e4:4329 where it fixed DMA.
> ---
>   drivers/net/wireless/b43/b43.h |    1 +
>   drivers/net/wireless/b43/dma.c |  113 +++++++++++++++++++++++++++-------------
>   drivers/net/wireless/b43/dma.h |    6 ++
>   3 files changed, 84 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
> index c818b0b..3aee322 100644
> --- a/drivers/net/wireless/b43/b43.h
> +++ b/drivers/net/wireless/b43/b43.h
> @@ -594,6 +594,7 @@ struct b43_dma {
>   	struct b43_dmaring *rx_ring;
>
>   	u32 translation; /* Routing bits */
> +	bool translation_in_low; /* Should translation bit go into low addr? */
>   	bool parity; /* Check for parity */
>   };
>
> diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
> index 0953ce1..547851c 100644
> --- a/drivers/net/wireless/b43/dma.c
> +++ b/drivers/net/wireless/b43/dma.c
> @@ -47,6 +47,38 @@
>    * into separate slots. */
>   #define TX_SLOTS_PER_FRAME	2
>
> +static u32 b43_dma_address(struct b43_dma *dma, dma_addr_t dmaaddr,
> +			   enum b43_addrtype addrtype)
> +{
> +	u32 uninitialized_var(addr);
> +
> +	switch (addrtype) {
> +	case B43_DMA_ADDR_LOW:
> +		addr = dmaaddr&  0xFFFFFFFF;
> +		if (dma->translation_in_low) {
> +			addr&= ~SSB_DMA_TRANSLATION_MASK;
> +			addr |= dma->translation;
> +		}
> +		break;
> +	case B43_DMA_ADDR_HIGH:
> +		addr = dmaaddr>>  32;
> +		if (!dma->translation_in_low) {
> +			addr&= ~SSB_DMA_TRANSLATION_MASK;
> +			addr |= dma->translation;
> +		}
> +		break;
> +	case B43_DMA_ADDR_EXT:
> +		if (dma->translation_in_low)
> +			addr = dmaaddr&  0xFFFFFFFF;
> +		else
> +			addr = dmaaddr>>  32;
> +		addr&= SSB_DMA_TRANSLATION_MASK;
> +		addr>>= SSB_DMA_TRANSLATION_SHIFT;
> +		break;

Sorry I missed this earlier, but when this code is compiled on a 32-bit system, 
the compiler spits out

   CC [M]  drivers/net/wireless/b43/dma.o
drivers/net/wireless/b43/dma.c: In function ‘b43_dma_address’:
drivers/net/wireless/b43/dma.c:64: warning: right shift count >= width of type
drivers/net/wireless/b43/dma.c:74: warning: right shift count >= width of type

This is reasonable as dma_addr_t is 32 bits.

Larry

      parent reply	other threads:[~2011-08-13 22:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 18:35 [RFC][RFT][PATCH V2 1/2] ssb: fix DMA translation for some specific boards Rafał Miłecki
2011-08-10 18:35 ` [RFC][RFT][PATCH V2 2/2] b43: fix DMA on some bugged hardware Rafał Miłecki
2011-08-10 19:11   ` Michael Büsch
2011-08-11  0:14   ` Rafał Miłecki
2011-08-11  4:39     ` Larry Finger
2011-08-11  8:05       ` Rafał Miłecki
2011-08-11 16:04         ` John W. Linville
2011-08-11 16:21           ` Rafał Miłecki
2011-08-11 16:22             ` Rafał Miłecki
2011-08-13 22:26   ` Larry Finger [this message]

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=4E46FA21.9060207@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=zajec5@gmail.com \
    /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).