From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 07/15] watchdog: imx: Add big endian register access support
Date: Wed, 13 Mar 2019 10:41:54 +0100 [thread overview]
Message-ID: <20190313094202.14901-8-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190313094202.14901-1-s.hauer@pengutronix.de>
Layerscape SoCs feature the same watchdog as the i.MX SoCs, but in big
endian mode. Add support for it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/watchdog/Kconfig | 2 +-
drivers/watchdog/Makefile | 1 +
drivers/watchdog/imxwd.c | 12 ++++++++++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 2793ee93d9..04efb1a3c8 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -48,7 +48,7 @@ config WATCHDOG_MXS28
config WATCHDOG_IMX
bool "i.MX watchdog"
- depends on ARCH_IMX
+ depends on ARCH_IMX || ARCH_LAYERSCAPE
help
Add support for watchdog found on Freescale i.MX SoCs.
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 69189ba1f3..6c8d36c8b8 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
obj-$(CONFIG_WATCHDOG_DW) += dw_wdt.o
obj-$(CONFIG_WATCHDOG_JZ4740) += jz4740.o
obj-$(CONFIG_WATCHDOG_IMX_RESET_SOURCE) += imxwd.o
+obj-$(CONFIG_WATCHDOG_IMX) += imxwd.o
obj-$(CONFIG_WATCHDOG_ORION) += orion_wdt.o
obj-$(CONFIG_ARCH_BCM283X) += bcm2835_wdt.o
obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index e2c3b9f96e..77a3bd76ce 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -38,6 +38,7 @@ struct imx_wd {
const struct imx_wd_ops *ops;
struct restart_handler restart;
bool ext_reset;
+ bool bigendian;
};
#define to_imx_wd(h) container_of(h, struct imx_wd, wd)
@@ -68,12 +69,18 @@ struct imx_wd {
static void imxwd_write(struct imx_wd *priv, int reg, uint16_t val)
{
- writew(val, priv->base + reg);
+ if (priv->bigendian)
+ out_be16(priv->base + reg, val);
+ else
+ writew(val, priv->base + reg);
}
static uint16_t imxwd_read(struct imx_wd *priv, int reg)
{
- return readw(priv->base + reg);
+ if (priv->bigendian)
+ return in_be16(priv->base + reg);
+ else
+ return readw(priv->base + reg);
}
static int imx1_watchdog_set_timeout(struct imx_wd *priv, unsigned timeout)
@@ -230,6 +237,7 @@ static int imx_wd_probe(struct device_d *dev)
priv->wd.timeout_max = priv->ops->timeout_max;
priv->wd.hwdev = dev;
priv->dev = dev;
+ priv->bigendian = of_device_is_big_endian(dev->device_node);
priv->ext_reset = of_property_read_bool(dev->device_node,
"fsl,ext-reset-output");
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-03-13 9:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-13 9:41 [PATCH 00/15] barebox Layerscape support Sascha Hauer
2019-03-13 9:41 ` [PATCH 01/15] mci: imx-esdhc: Actually enable cache snooping Sascha Hauer
2019-03-13 9:41 ` [PATCH 02/15] Add Freescale QUICC Engine firmware support Sascha Hauer
2019-03-13 9:41 ` [PATCH 03/15] net: Add Freescale FMan ethernet support Sascha Hauer
2019-03-13 9:41 ` [PATCH 04/15] ARM: Add arm64 pbl udelay Sascha Hauer
2019-03-19 18:12 ` Andrey Smirnov
2019-03-20 8:16 ` Sascha Hauer
2019-03-22 6:41 ` Andrey Smirnov
2019-03-13 9:41 ` [PATCH 05/15] esdhc-xload: Add support for Layerscape Sascha Hauer
2019-03-13 9:41 ` [PATCH 06/15] watchdog: imx: Add register accessor functions Sascha Hauer
2019-03-13 9:41 ` Sascha Hauer [this message]
2019-03-13 9:41 ` [PATCH 08/15] scripts: Add Layerscape image tool Sascha Hauer
2019-03-13 9:41 ` [PATCH 09/15] i2c: i.MX: Add layerscape support Sascha Hauer
2019-03-13 9:41 ` [PATCH 10/15] ddr: fsl: Add Freescale ddr driver Sascha Hauer
2019-03-13 9:41 ` [PATCH 11/15] ARM: Add basic Layerscape support Sascha Hauer
2019-03-13 9:41 ` [PATCH 12/15] clk: Add Layerscape clk support Sascha Hauer
2019-03-13 9:42 ` [PATCH 13/15] ARM: Layerscape: Add LS1046a RDB board support Sascha Hauer
2019-03-13 9:42 ` [PATCH 14/15] ARM: Layerscape: Add TQ TQMLS1046a " Sascha Hauer
2019-03-13 9:42 ` [PATCH 15/15] ARM: Add layerscape_defconfig Sascha Hauer
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=20190313094202.14901-8-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox