summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/hyperbus/hbmc-am654.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2020-01-29 23:37:37 +0300
committerVignesh Raghavendra <vigneshr@ti.com>2020-03-03 10:13:11 +0530
commitb6fe8bc67d2d33a9eff1b0785482bccd14979115 (patch)
tree35d507d4c738c9349bea28220087754124c5b478 /drivers/mtd/hyperbus/hbmc-am654.c
parentcb6176ef25cef7a54ac1e8701f9dde822fce5cee (diff)
downloadlinux-b6fe8bc67d2d33a9eff1b0785482bccd14979115.tar.bz2
mtd: hyperbus: move direct mapping setup to AM654 HBMC driver
The Hyperbus core expects that HyperFlash is always directly mapped for both read and write, but in reality this may not always be the case, e.g. Renesas RPC-IF has read only direct mapping. Move the code setting up the direct mapping from the Hyperbus core to thh TI AM554 HBMC driver. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Diffstat (limited to 'drivers/mtd/hyperbus/hbmc-am654.c')
-rw-r--r--drivers/mtd/hyperbus/hbmc-am654.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c
index 08d543b124cd..f350a0809f88 100644
--- a/drivers/mtd/hyperbus/hbmc-am654.c
+++ b/drivers/mtd/hyperbus/hbmc-am654.c
@@ -11,6 +11,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mux/consumer.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/types.h>
@@ -57,8 +58,10 @@ static const struct hyperbus_ops am654_hbmc_ops = {
static int am654_hbmc_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct am654_hbmc_priv *priv;
+ struct resource res;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -67,6 +70,10 @@ static int am654_hbmc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
+ ret = of_address_to_resource(np, 0, &res);
+ if (ret)
+ return ret;
+
if (of_property_read_bool(dev->of_node, "mux-controls")) {
struct mux_control *control = devm_mux_control_get(dev, NULL);
@@ -88,6 +95,11 @@ static int am654_hbmc_probe(struct platform_device *pdev)
goto disable_pm;
}
+ priv->hbdev.map.size = resource_size(&res);
+ priv->hbdev.map.virt = devm_ioremap_resource(dev, &res);
+ if (IS_ERR(priv->hbdev.map.virt))
+ return PTR_ERR(priv->hbdev.map.virt);
+
priv->ctlr.dev = dev;
priv->ctlr.ops = &am654_hbmc_ops;
priv->hbdev.ctlr = &priv->ctlr;