LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Aaro Koskinen <aaro.koskinen@iki.fi>
To: Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>, Rob Herring <robh@kernel.org>,
	Paul Burton <paul.burton@mips.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [REGRESSION] OCTEON MMC driver failure with v4.19
Date: Tue, 6 Nov 2018 00:06:32 +0200	[thread overview]
Message-ID: <20181105220632.GA5083@darkstar.musicnaut.iki.fi> (raw)
In-Reply-To: <20181026205423.GD3792@darkstar.musicnaut.iki.fi>

Hi,

On Fri, Oct 26, 2018 at 11:54:23PM +0300, Aaro Koskinen wrote:
> OCTEON (MIPS64) MMC driver probe fails with v4.19, because with
> 
> commit 6c2fb2ea76361da9b420a8e23a2a19e7842cbdda
> Author: Robin Murphy <robin.murphy@arm.com>
> Date:   Mon Jul 23 23:16:09 2018 +0100
> 
>     of/device: Set bus DMA mask as appropriate
> 
> we now get a default 32-bit bus DMA mask, and the device itself has
> 64-bit mask, so it gets rejected.
> 
> With the current mainline, the driver is again working (probably
> because of b4ebe6063204 ("dma-direct: implement complete bus_dma_mask
> handling")). But I think this is just because I happen to have < 4 GB RAM,
> and it probably could still fail on bigger systems..?

With the below change, the MMC card probe seems to with v4.19. But it
feels a bit hackish, don't you think... Is there some obvious simple
fix that I'm missing? Any comments?

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 807cadaf554e..31fab09fadcc 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -1067,8 +1067,29 @@ int __init octeon_prune_device_tree(void)
 	return 0;
 }
 
+static int octeon_device_notifier_call(struct notifier_block *nb,
+				       unsigned long event, void *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	if (event != BUS_NOTIFY_ADD_DEVICE ||
+	    !pdev || !pdev->dev.dma_mask || !pdev->dev.of_node)
+		return NOTIFY_DONE;
+
+	if (of_device_is_compatible(pdev->dev.of_node,
+				     "cavium,octeon-6130-mmc"))
+		*pdev->dev.dma_mask = DMA_BIT_MASK(64);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block platform_nb = {
+	.notifier_call = octeon_device_notifier_call,
+};
+
 static int __init octeon_publish_devices(void)
 {
+	bus_register_notifier(&platform_bus_type, &platform_nb);
 	return of_platform_populate(NULL, octeon_ids, NULL, NULL);
 }
 arch_initcall(octeon_publish_devices);

A.

  reply	other threads:[~2018-11-05 22:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 20:54 Aaro Koskinen
2018-11-05 22:06 ` Aaro Koskinen [this message]
2018-11-06  6:27   ` Christoph Hellwig
2018-11-06  9:05     ` Aaro Koskinen
2018-11-06 21:51       ` Aaro Koskinen

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=20181105220632.GA5083@darkstar.musicnaut.iki.fi \
    --to=aaro.koskinen@iki.fi \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@mips.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --subject='Re: [REGRESSION] OCTEON MMC driver failure with v4.19' \
    /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

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).