Commit 92614ad5 authored by Joel Stanley's avatar Joel Stanley

drm/aspeed: Look up syscon by phandle

This scales better to multiple families of SoC. The lookup by compatible
can be removed in a future change.

The fallback path is for the ast2500 platform only. Other platforms will
be added with the new style, so they won't need fallback paths.
Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
Reviewed-by: default avatarAndrew Jeffery <andrew@aj.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20210209123734.130483-2-joel@jms.id.au
parent f1a75f4d
...@@ -103,6 +103,7 @@ static int aspeed_gfx_load(struct drm_device *drm) ...@@ -103,6 +103,7 @@ static int aspeed_gfx_load(struct drm_device *drm)
{ {
struct platform_device *pdev = to_platform_device(drm->dev); struct platform_device *pdev = to_platform_device(drm->dev);
struct aspeed_gfx *priv = to_aspeed_gfx(drm); struct aspeed_gfx *priv = to_aspeed_gfx(drm);
struct device_node *np = pdev->dev.of_node;
struct resource *res; struct resource *res;
int ret; int ret;
...@@ -111,11 +112,14 @@ static int aspeed_gfx_load(struct drm_device *drm) ...@@ -111,11 +112,14 @@ static int aspeed_gfx_load(struct drm_device *drm)
if (IS_ERR(priv->base)) if (IS_ERR(priv->base))
return PTR_ERR(priv->base); return PTR_ERR(priv->base);
priv->scu = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(priv->scu)) {
priv->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2500-scu"); priv->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2500-scu");
if (IS_ERR(priv->scu)) { if (IS_ERR(priv->scu)) {
dev_err(&pdev->dev, "failed to find SCU regmap\n"); dev_err(&pdev->dev, "failed to find SCU regmap\n");
return PTR_ERR(priv->scu); return PTR_ERR(priv->scu);
} }
}
ret = of_reserved_mem_device_init(drm->dev); ret = of_reserved_mem_device_init(drm->dev);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment