Commit 73b2e2e3 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Jakub Kicinski

net: mdio: mux-bcm-iproc: Use alignment helpers and SZ_4K

Instead of open coding, use IS_ALIGNED() and ALIGN_DOWN() when dealing
with alignment. Replace also literals with SZ_4K.
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Acked-by: default avatarRay Jui <ray.jui@broadcom.com>
Link: https://lore.kernel.org/r/20231229145232.6163-1-ilpo.jarvinen@linux.intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2ab1efad
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* /*
* Copyright 2016 Broadcom * Copyright 2016 Broadcom
*/ */
#include <linux/align.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -11,6 +12,7 @@ ...@@ -11,6 +12,7 @@
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/sizes.h>
#define MDIO_RATE_ADJ_EXT_OFFSET 0x000 #define MDIO_RATE_ADJ_EXT_OFFSET 0x000
#define MDIO_RATE_ADJ_INT_OFFSET 0x004 #define MDIO_RATE_ADJ_INT_OFFSET 0x004
...@@ -220,12 +222,12 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev) ...@@ -220,12 +222,12 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(md->base)) if (IS_ERR(md->base))
return PTR_ERR(md->base); return PTR_ERR(md->base);
if (res->start & 0xfff) { if (!IS_ALIGNED(res->start, SZ_4K)) {
/* For backward compatibility in case the /* For backward compatibility in case the
* base address is specified with an offset. * base address is specified with an offset.
*/ */
dev_info(&pdev->dev, "fix base address in dt-blob\n"); dev_info(&pdev->dev, "fix base address in dt-blob\n");
res->start &= ~0xfff; res->start = ALIGN_DOWN(res->start, SZ_4K);
res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1; res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
} }
......
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