HyperBus changes

* Print err msg when compatible is wrong or missing
 * Move mapping of direct access window from core to individual drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCAAuFiEEyRC2zAhGcGjrhiNExEYeRXyRFuMFAl55sjcQHHZpZ25lc2hy
 QHRpLmNvbQAKCRDERh5FfJEW40DsB/0YDbvoih+UZyGhb9nWmdbCjvo3y4QPqwpu
 tiV/KSoL10W6kGsQpWus4hIKf8tVhbTiHbTDPAkA8t6lx1G+h1s4rB9MfbgKx4Jh
 SLS42tiHnQorbIAOZv66CnWMUhdJkugavoUD3jf9F+2FFSoeejGJelyAQZXNArvH
 m/z1mX0pgNnbNCCzyi/oVjBktnNwQ3fVSv3qVpeSkNr9FliFu8m1SZmIqnOEUyyh
 A0H0kD9BPB9Bc7x3oo4RJivABQhn3KTf73NYDWJHniHLW9w6/GpVQFDG7vqJZM9u
 pVSE8a8bmETTlwzll9RwBJ2tibTCgzmCiE55nXlfzHAcaK9AmvWz
 =Wb0p
 -----END PGP SIGNATURE-----

Merge tag 'cfi/for-5.7' into mtd/next

HyperBus changes

* Print err msg when compatible is wrong or missing
* Move mapping of direct access window from core to individual drivers
This commit is contained in:
Miquel Raynal 2020-03-25 22:10:39 +01:00
commit 176538d9a4
2 changed files with 15 additions and 12 deletions

View File

@ -11,6 +11,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mux/consumer.h> #include <linux/mux/consumer.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/types.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) static int am654_hbmc_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct am654_hbmc_priv *priv; struct am654_hbmc_priv *priv;
struct resource res;
int ret; int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 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); 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")) { if (of_property_read_bool(dev->of_node, "mux-controls")) {
struct mux_control *control = devm_mux_control_get(dev, NULL); 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; 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.dev = dev;
priv->ctlr.ops = &am654_hbmc_ops; priv->ctlr.ops = &am654_hbmc_ops;
priv->hbdev.ctlr = &priv->ctlr; priv->hbdev.ctlr = &priv->ctlr;

View File

@ -10,7 +10,6 @@
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/types.h> #include <linux/types.h>
static struct hyperbus_device *map_to_hbdev(struct map_info *map) static struct hyperbus_device *map_to_hbdev(struct map_info *map)
@ -62,7 +61,6 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
struct hyperbus_ctlr *ctlr; struct hyperbus_ctlr *ctlr;
struct device_node *np; struct device_node *np;
struct map_info *map; struct map_info *map;
struct resource res;
struct device *dev; struct device *dev;
int ret; int ret;
@ -73,22 +71,15 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
np = hbdev->np; np = hbdev->np;
ctlr = hbdev->ctlr; ctlr = hbdev->ctlr;
if (!of_device_is_compatible(np, "cypress,hyperflash")) if (!of_device_is_compatible(np, "cypress,hyperflash")) {
dev_err(ctlr->dev, "\"cypress,hyperflash\" compatible missing\n");
return -ENODEV; return -ENODEV;
}
hbdev->memtype = HYPERFLASH; hbdev->memtype = HYPERFLASH;
ret = of_address_to_resource(np, 0, &res);
if (ret)
return ret;
dev = ctlr->dev; dev = ctlr->dev;
map = &hbdev->map; map = &hbdev->map;
map->size = resource_size(&res);
map->virt = devm_ioremap_resource(dev, &res);
if (IS_ERR(map->virt))
return PTR_ERR(map->virt);
map->name = dev_name(dev); map->name = dev_name(dev);
map->bankwidth = 2; map->bankwidth = 2;
map->device_node = np; map->device_node = np;