All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: shankerd@codeaurora.org, Rob Herring <robh@kernel.org>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, sdharia@codeaurora.org,
	vikrams@codeaurora.org, cov@codeaurora.org,
	gavidov@codeaurora.org, andrew@lunn.ch,
	bjorn.andersson@linaro.org, mlangsdo@redhat.com, jcm@redhat.com,
	agross@codeaurora.org, davem@davemloft.net, f.fainelli@gmail.com
Subject: Re: [PATCH] [v5] net: emac: emac gigabit ethernet controller driver
Date: Mon, 20 Jun 2016 13:15:27 -0500	[thread overview]
Message-ID: <576832BF.7080805@codeaurora.org> (raw)
In-Reply-To: <57683029.1090601@codeaurora.org>

Shanker Donthineni wrote:
>          /* Set dma_mask and coherent_dma_mask to 64-bits,
>           * if xHC supports 64-bit addressing */
>          if (HCC_64BIT_ADDR(xhci->hcc_params) &&
>                          !dma_set_mask(dev, DMA_BIT_MASK(64))) {
>                  xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
>                  dma_set_coherent_mask(dev, DMA_BIT_MASK(64));
>          } else {
>                  /*
>                   * This is to avoid error in cases where a 32-bit USB
>                   * controller is used on a 64-bit capable system.
>                   */
>                  retval = dma_set_mask(dev, DMA_BIT_MASK(32));

I'm not sure this example is valid because HCC_64BIT_ADDR is part of the 
XCHI specification, so there's an architected way determine whether the 
platform is 64-bit capable or not.  The EMAC has nothing like that.

I can do this:

	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
	if (ret)
		dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32))

but this has always seemed wrong to me, because it doesn't make sense to 
me that DMA_BIT_MASK(64) could ever fail.  DMA_BIT_MASK(64) says that 
the device can handle any physical address, so the device does not 
impose any limitations.  How could that fail?  I have has this question 
multiple times, and I have never gotten a satisfactory answer.

Also, I don't know if I should be using dma_set_mask_and_coherent or 
dma_coerce_mask_and_coherent.  The comment for 
dma_coerce_mask_and_coherent says this:

/*
  * Similar to the above, except it deals with the case where the device
  * does not have dev->dma_mask appropriately setup.
  */

How can I know if the device has dev->dma_mask "appropriately setup"?

Remember, I need a solution that works for DT and ACPI.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.

  reply	other threads:[~2016-06-20 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 22:22 [PATCH] [v5] net: emac: emac gigabit ethernet controller driver Timur Tabi
2016-06-16  4:41 ` David Miller
2016-06-16  5:05   ` Timur Tabi
2016-06-19 14:17 ` Rob Herring
2016-06-20 17:41   ` Timur Tabi
2016-06-20 18:04     ` Shanker Donthineni
2016-06-20 18:15       ` Timur Tabi [this message]
2016-06-20 18:49   ` Timur Tabi

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=576832BF.7080805@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=agross@codeaurora.org \
    --cc=andrew@lunn.ch \
    --cc=bjorn.andersson@linaro.org \
    --cc=cov@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gavidov@codeaurora.org \
    --cc=jcm@redhat.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=mlangsdo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sdharia@codeaurora.org \
    --cc=shankerd@codeaurora.org \
    --cc=vikrams@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.