From: Bastian Krause <bst@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Bastian Krause <bst@pengutronix.de>
Subject: [PATCH v2] mfd: rn5t568: add complete register map to header and use it
Date: Wed, 20 Dec 2023 11:43:41 +0100 [thread overview]
Message-ID: <20231220104341.4184187-1-bst@pengutronix.de> (raw)
This allows lowlevel board code to use these symbols to perform power
sequencing with the PBL PMIC helper functions.
Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
Changes since (implicit) v1:
- add missing include of linux/bits.h as suggested by Ahmad
---
drivers/mfd/rn5t568.c | 24 +-------
include/mfd/rn5t568.h | 134 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 135 insertions(+), 23 deletions(-)
create mode 100644 include/mfd/rn5t568.h
diff --git a/drivers/mfd/rn5t568.c b/drivers/mfd/rn5t568.c
index 12de689734d..f1e2eeb0c88 100644
--- a/drivers/mfd/rn5t568.c
+++ b/drivers/mfd/rn5t568.c
@@ -16,29 +16,7 @@
#include <linux/regmap.h>
#include <reset_source.h>
#include <restart.h>
-
-#define RN5T568_LSIVER 0x00
-#define RN5T568_OTPVER 0x01
-#define RN5T568_PONHIS 0x09
-# define RN5T568_PONHIS_ON_EXTINPON BIT(3)
-# define RN5T568_PONHIS_ON_REPWRPON BIT(1)
-# define RN5T568_PONHIS_ON_PWRONPON BIT(0)
-#define RN5T568_POFFHIS 0x0a
-# define RN5T568_POFFHIS_N_OEPOFF BIT(7)
-# define RN5T568_POFFHIS_DCLIMPOFF BIT(6)
-# define RN5T568_POFFHIS_WDGPOFF BIT(5)
-# define RN5T568_POFFHIS_CPUPOFF BIT(4)
-# define RN5T568_POFFHIS_IODETPOFF BIT(3)
-# define RN5T568_POFFHIS_VINDETPOFF BIT(2)
-# define RN5T568_POFFHIS_TSHUTPOFF BIT(1)
-# define RN5T568_POFFHIS_PWRONPOFF BIT(0)
-#define RN5T568_SLPCNT 0x0e
-# define RN5T568_SLPCNT_SWPPWROFF BIT(0)
-#define RN5T568_REPCNT 0x0f
-# define RN5T568_REPCNT_OFF_RESETO_16MS 0x30
-# define RN5T568_REPCNT_OFF_REPWRTIM_1000MS 0x06
-# define RN5T568_REPCNT_OFF_REPWRON BIT(0)
-#define RN5T568_MAX_REG 0xbc
+#include <mfd/rn5t568.h>
struct rn5t568 {
struct restart_handler restart;
diff --git a/include/mfd/rn5t568.h b/include/mfd/rn5t568.h
new file mode 100644
index 00000000000..04b6c832a5d
--- /dev/null
+++ b/include/mfd/rn5t568.h
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ * Copyright (C) 2016 Toradex AG
+ */
+
+#ifndef __MFD_RN5T568_H
+#define __MFD_RN5T568_H
+
+#include <linux/bits.h>
+
+/* RN5T568 registers */
+enum {
+ RN5T568_LSIVER = 0x00,
+ RN5T568_OTPVER = 0x01,
+ RN5T568_IODAC = 0x02,
+ RN5T568_VINDAC = 0x03,
+ RN5T568_OUT32KEN = 0x05,
+
+ RN5T568_CPUCNT = 0x06,
+
+ RN5T568_PSWR = 0x07,
+ RN5T568_PONHIS = 0x09,
+ RN5T568_POFFHIS = 0x0A,
+ RN5T568_WATCHDOG = 0x0B,
+ RN5T568_WATCHDOGCNT = 0x0C,
+ RN5T568_PWRFUNC = 0x0D,
+ RN5T568_SLPCNT = 0x0E,
+ RN5T568_REPCNT = 0x0F,
+ RN5T568_PWRONTIMSET = 0x10,
+ RN5T568_NOETIMSETCNT = 0x11,
+ RN5T568_PWRIREN = 0x12,
+ RN5T568_PWRIRQ = 0x13,
+ RN5T568_PWRMON = 0x14,
+ RN5T568_PWRIRSEL = 0x15,
+
+ RN5T568_DC1_SLOT = 0x16,
+ RN5T568_DC2_SLOT = 0x17,
+ RN5T568_DC3_SLOT = 0x18,
+ RN5T568_DC4_SLOT = 0x19,
+
+ RN5T568_LDO1_SLOT = 0x1B,
+ RN5T568_LDO2_SLOT = 0x1C,
+ RN5T568_LDO3_SLOT = 0x1D,
+ RN5T568_LDO4_SLOT = 0x1E,
+ RN5T568_LDO5_SLOT = 0x1F,
+
+ RN5T568_PSO0_SLOT = 0x25,
+ RN5T568_PSO1_SLOT = 0x26,
+ RN5T568_PSO2_SLOT = 0x27,
+ RN5T568_PSO3_SLOT = 0x28,
+
+ RN5T568_LDORTC1_SLOT = 0x2A,
+
+ RN5T568_DC1CTL = 0x2C,
+ RN5T568_DC1CTL2 = 0x2D,
+ RN5T568_DC2CTL = 0x2E,
+ RN5T568_DC2CTL2 = 0x2F,
+ RN5T568_DC3CTL = 0x30,
+ RN5T568_DC3CTL2 = 0x31,
+ RN5T568_DC4CTL = 0x32,
+ RN5T568_DC4CTL2 = 0x33,
+
+ RN5T568_DC1DAC = 0x36,
+ RN5T568_DC2DAC = 0x37,
+ RN5T568_DC3DAC = 0x38,
+ RN5T568_DC4DAC = 0x39,
+
+ RN5T568_DC1DAC_SLP = 0x3B,
+ RN5T568_DC2DAC_SLP = 0x3C,
+ RN5T568_DC3DAC_SLP = 0x3D,
+ RN5T568_DC4DAC_SLP = 0x3E,
+
+ RN5T568_DCIREN = 0x40,
+ RN5T568_DCIRQ = 0x41,
+ RN5T568_DCIRMON = 0x42,
+
+ RN5T568_LDOEN1 = 0x44,
+ RN5T568_LDOEN2 = 0x45,
+ RN5T568_LDODIS1 = 0x46,
+
+ RN5T568_LDO1DAC = 0x4C,
+ RN5T568_LDO2DAC = 0x4D,
+ RN5T568_LDO3DAC = 0x4E,
+ RN5T568_LDO4DAC = 0x4F,
+ RN5T568_LDO5DAC = 0x50,
+
+ RN5T568_LDORTC1DAC = 0x56,
+ RN5T568_LDORTC2DAC = 0x57,
+
+ RN5T568_LDO1DAC_SLP = 0x58,
+ RN5T568_LDO2DAC_SLP = 0x59,
+ RN5T568_LDO3DAC_SLP = 0x5A,
+ RN5T568_LDO4DAC_SLP = 0x5B,
+ RN5T568_LDO5DAC_SLP = 0x5C,
+
+ RN5T568_IOSEL = 0x90,
+ RN5T568_IOOUT = 0x91,
+ RN5T568_GPEDGE1 = 0x92,
+ RN5T568_EN_GPIR = 0x94,
+ RN5T568_IR_GPR = 0x95,
+ RN5T568_IR_GPF = 0x96,
+ RN5T568_MON_IOIN = 0x97,
+ RN5T568_GPLED_FUNC = 0x98,
+ RN5T568_INTPOL = 0x9C,
+ RN5T568_INTEN = 0x9D,
+ RN5T568_INTMON = 0x9E,
+
+ RN5T568_PREVINDAC = 0xB0,
+ RN5T568_OVTEMP = 0xBC,
+
+ RN5T568_MAX_REG = 0xBC,
+};
+
+#define RN5T568_PONHIS_ON_EXTINPON BIT(3)
+#define RN5T568_PONHIS_ON_REPWRPON BIT(1)
+#define RN5T568_PONHIS_ON_PWRONPON BIT(0)
+
+#define RN5T568_POFFHIS_N_OEPOFF BIT(7)
+#define RN5T568_POFFHIS_DCLIMPOFF BIT(6)
+#define RN5T568_POFFHIS_WDGPOFF BIT(5)
+#define RN5T568_POFFHIS_CPUPOFF BIT(4)
+#define RN5T568_POFFHIS_IODETPOFF BIT(3)
+#define RN5T568_POFFHIS_VINDETPOFF BIT(2)
+#define RN5T568_POFFHIS_TSHUTPOFF BIT(1)
+#define RN5T568_POFFHIS_PWRONPOFF BIT(0)
+
+#define RN5T568_SLPCNT_SWPPWROFF BIT(0)
+
+#define RN5T568_REPCNT_OFF_RESETO_16MS 0x30
+#define RN5T568_REPCNT_OFF_REPWRTIM_1000MS 0x06
+#define RN5T568_REPCNT_OFF_REPWRON BIT(0)
+
+#endif
--
2.39.2
next reply other threads:[~2023-12-20 10:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 10:43 Bastian Krause [this message]
2023-12-20 11:20 ` Ahmad Fatoum
2024-01-02 9:17 ` 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=20231220104341.4184187-1-bst@pengutronix.de \
--to=bst@pengutronix.de \
--cc=a.fatoum@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