All of lore.kernel.org
 help / color / mirror / Atom feed
* [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support
@ 2019-07-15 14:17 Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 1/6] rtc: nvmem: use devm_nvmem_register() Biju Das
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

This patch series add RTC support for EK874 platform.

This patch series is based on linux-4.19.y-cip and all the patches
in this series are cherry-picked from linux rc tree.

This patch series is depend on the below patch series
https://patchwork.kernel.org/project/cip-dev/list/?series=145931

Alexandre Belloni (2):
  rtc: nvmem: use devm_nvmem_register()
  rtc: nvmem: remove nvmem from struct rtc_device

Biju Das (4):
  dt-bindings: rtc: add rx8571 compatible
  rtc: rx8581: Add support for Epson rx8571 RTC
  arm64: defconfig: enable RX-8581 config option
  arm64: dts: renesas: r8a774c0-cat874: add RTC support

 .../devicetree/bindings/trivial-devices.txt        |   1 +
 arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts    |  19 ++++
 arch/arm64/configs/defconfig                       |   1 +
 drivers/rtc/Kconfig                                |   5 +-
 drivers/rtc/nvmem.c                                |  29 ++----
 drivers/rtc/rtc-rx8581.c                           | 114 +++++++++++++++++++--
 include/linux/rtc.h                                |   1 -
 7 files changed, 139 insertions(+), 31 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 1/6] rtc: nvmem: use devm_nvmem_register()
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 2/6] rtc: nvmem: remove nvmem from struct rtc_device Biju Das
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

commit 461e557b97277b693cd8008c32a9d01c7f8f453b upstream.

Use the resource managed variant of nvmem_register().

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
---
 drivers/rtc/nvmem.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c
index 36ab183..2a7220d 100644
--- a/drivers/rtc/nvmem.c
+++ b/drivers/rtc/nvmem.c
@@ -93,7 +93,7 @@ int rtc_nvmem_register(struct rtc_device *rtc,
 
 	nvmem_config->dev = rtc->dev.parent;
 	nvmem_config->owner = rtc->owner;
-	rtc->nvmem = nvmem_register(nvmem_config);
+	rtc->nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
 	if (IS_ERR(rtc->nvmem))
 		return PTR_ERR(rtc->nvmem);
 
@@ -107,12 +107,7 @@ EXPORT_SYMBOL_GPL(rtc_nvmem_register);
 
 void rtc_nvmem_unregister(struct rtc_device *rtc)
 {
-	if (IS_ERR_OR_NULL(rtc->nvmem))
-		return;
-
 	/* unregister the old ABI */
 	if (rtc->nvram)
 		rtc_nvram_unregister(rtc);
-
-	nvmem_unregister(rtc->nvmem);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 2/6] rtc: nvmem: remove nvmem from struct rtc_device
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 1/6] rtc: nvmem: use devm_nvmem_register() Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 3/6] dt-bindings: rtc: add rx8571 compatible Biju Das
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

commit 41c9e132c5cc3e5f28cf44032ff82f7614a42989 upstream.

Using devm_nvmem_register allows to avoid tracking the nvmem pointer in the
rtc_device structure.
This ultimately allows to register multiple nvmem devices from an RTC
driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
---
 drivers/rtc/nvmem.c | 24 ++++++++++--------------
 include/linux/rtc.h |  1 -
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c
index 2a7220d..ebdfe8e 100644
--- a/drivers/rtc/nvmem.c
+++ b/drivers/rtc/nvmem.c
@@ -25,11 +25,9 @@ rtc_nvram_read(struct file *filp, struct kobject *kobj,
 	       struct bin_attribute *attr,
 	       char *buf, loff_t off, size_t count)
 {
-	struct rtc_device *rtc = attr->private;
-
 	dev_warn_once(kobj_to_dev(kobj), nvram_warning);
 
-	return nvmem_device_read(rtc->nvmem, off, count, buf);
+	return nvmem_device_read(attr->private, off, count, buf);
 }
 
 static ssize_t
@@ -37,14 +35,13 @@ rtc_nvram_write(struct file *filp, struct kobject *kobj,
 		struct bin_attribute *attr,
 		char *buf, loff_t off, size_t count)
 {
-	struct rtc_device *rtc = attr->private;
-
 	dev_warn_once(kobj_to_dev(kobj), nvram_warning);
 
-	return nvmem_device_write(rtc->nvmem, off, count, buf);
+	return nvmem_device_write(attr->private, off, count, buf);
 }
 
-static int rtc_nvram_register(struct rtc_device *rtc, size_t size)
+static int rtc_nvram_register(struct rtc_device *rtc,
+			      struct nvmem_device *nvmem, size_t size)
 {
 	int err;
 
@@ -56,7 +53,7 @@ static int rtc_nvram_register(struct rtc_device *rtc, size_t size)
 
 	rtc->nvram->attr.name = "nvram";
 	rtc->nvram->attr.mode = 0644;
-	rtc->nvram->private = rtc;
+	rtc->nvram->private = nvmem;
 
 	sysfs_bin_attr_init(rtc->nvram);
 
@@ -85,21 +82,20 @@ static void rtc_nvram_unregister(struct rtc_device *rtc)
 int rtc_nvmem_register(struct rtc_device *rtc,
 		       struct nvmem_config *nvmem_config)
 {
-	if (!IS_ERR_OR_NULL(rtc->nvmem))
-		return -EBUSY;
+	struct nvmem_device *nvmem;
 
 	if (!nvmem_config)
 		return -ENODEV;
 
 	nvmem_config->dev = rtc->dev.parent;
 	nvmem_config->owner = rtc->owner;
-	rtc->nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
-	if (IS_ERR(rtc->nvmem))
-		return PTR_ERR(rtc->nvmem);
+	nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
+	if (IS_ERR(nvmem))
+		return PTR_ERR(nvmem);
 
 	/* Register the old ABI */
 	if (rtc->nvram_old_abi)
-		rtc_nvram_register(rtc, nvmem_config->size);
+		rtc_nvram_register(rtc, nvmem, nvmem_config->size);
 
 	return 0;
 }
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6aedc30..6e9cb05 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -138,7 +138,6 @@ struct rtc_device {
 
 	bool registered;
 
-	struct nvmem_device *nvmem;
 	/* Old ABI support */
 	bool nvram_old_abi;
 	struct bin_attribute *nvram;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 3/6] dt-bindings: rtc: add rx8571 compatible
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 1/6] rtc: nvmem: use devm_nvmem_register() Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 2/6] rtc: nvmem: remove nvmem from struct rtc_device Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC Biju Das
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

commit 57e883b576dc056f59a5612713b679432db36bfa upstream.

The Epson rx8571 is compatible with the Epson rx8581 RTC.

The difference between the rx8571 and rx8581 RTC is that the former has
16 bytes more RAM. This renders them incompatible from a DT point of view.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
[Backported to 4.19-cip]
---
 Documentation/devicetree/bindings/trivial-devices.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/trivial-devices.txt b/Documentation/devicetree/bindings/trivial-devices.txt
index 763a280..8a7e937 100644
--- a/Documentation/devicetree/bindings/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/trivial-devices.txt
@@ -52,6 +52,7 @@ dlg,da9063		DA9063: system PMIC for quad-core application processors
 domintech,dmard09	DMARD09: 3-axis Accelerometer
 domintech,dmard10	DMARD10: 3-axis Accelerometer
 epson,rx8010		I2C-BUS INTERFACE REAL TIME CLOCK MODULE
+epson,rx8571		I2C-BUS INTERFACE REAL TIME CLOCK MODULE with Battery Backed RAM
 epson,rx8581		I2C-BUS INTERFACE REAL TIME CLOCK MODULE
 emmicro,em3027		EM Microelectronic EM3027 Real-time Clock
 fsl,mag3110		MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
                   ` (2 preceding siblings ...)
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 3/6] dt-bindings: rtc: add rx8571 compatible Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-16 20:22   ` Pavel Machek
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 5/6] arm64: defconfig: enable RX-8581 config option Biju Das
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

commit 51f896ffd1a5aacbda82ed82552c4077e3cc3b68 upstream.

Add support for Epson rx8571 real-time clock. rx8571 rtc is compatible
with rx8581,except that rx8571 has additional 16 bytes of RAM.

16 bytes of nvmem is supported and exposed in sysfs (# is the instance
number,starting with 0): /sys/bus/nvmem/devices/rx8571-#/nvmem

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/Kconfig      |   5 ++-
 drivers/rtc/rtc-rx8581.c | 114 +++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 108 insertions(+), 11 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 7d7be60..ec2cba4 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -600,9 +600,10 @@ config RTC_DRV_RX8010
 	  will be called rtc-rx8010.
 
 config RTC_DRV_RX8581
-	tristate "Epson RX-8581"
+	tristate "Epson RX-8571/RX-8581"
 	help
-	  If you say yes here you will get support for the Epson RX-8581.
+	  If you say yes here you will get support for the Epson RX-8571/
+	  RX-8581.
 
 	  This driver can also be built as a module. If so the module
 	  will be called rtc-rx8581.
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index eac8821..776e3a2 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/bcd.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/rtc.h>
 #include <linux/log2.h>
@@ -51,11 +53,19 @@
 #define RX8581_CTRL_STOP	0x02 /* STOP bit */
 #define RX8581_CTRL_RESET	0x01 /* RESET bit */
 
+#define RX8571_USER_RAM		0x10
+#define RX8571_NVRAM_SIZE	0x10
+
 struct rx8581 {
 	struct regmap		*regmap;
 	struct rtc_device	*rtc;
 };
 
+struct rx85x1_config {
+	struct regmap_config regmap;
+	unsigned int num_nvram;
+};
+
 /*
  * In the routines that deal directly with the rx8581 hardware, we use
  * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
@@ -181,25 +191,103 @@ static const struct rtc_class_ops rx8581_rtc_ops = {
 	.set_time	= rx8581_rtc_set_time,
 };
 
-static int rx8581_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int rx8571_nvram_read(void *priv, unsigned int offset, void *val,
+			     size_t bytes)
 {
-	struct rx8581	  *rx8581;
-	static const struct regmap_config config = {
+	struct rx8581 *rx8581 = priv;
+
+	return regmap_bulk_read(rx8581->regmap, RX8571_USER_RAM + offset,
+				val, bytes);
+}
+
+static int rx8571_nvram_write(void *priv, unsigned int offset, void *val,
+			      size_t bytes)
+{
+	struct rx8581 *rx8581 = priv;
+
+	return regmap_bulk_write(rx8581->regmap, RX8571_USER_RAM + offset,
+				 val, bytes);
+}
+
+static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
+			     size_t bytes)
+{
+	struct rx8581 *rx8581 = priv;
+	unsigned int tmp_val;
+	int ret;
+
+	ret = regmap_read(rx8581->regmap, RX8581_REG_RAM, &tmp_val);
+	(*(unsigned char *)val) = (unsigned char) tmp_val;
+
+	return ret;
+}
+
+static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val,
+			      size_t bytes)
+{
+	struct rx8581 *rx8581 = priv;
+	unsigned char tmp_val;
+
+	tmp_val = *((unsigned char *)val);
+	return regmap_write(rx8581->regmap, RX8581_REG_RAM,
+				(unsigned int)tmp_val);
+}
+
+static const struct rx85x1_config rx8581_config = {
+	.regmap = {
 		.reg_bits = 8,
 		.val_bits = 8,
 		.max_register = 0xf,
+	},
+	.num_nvram = 1
+};
+
+static const struct rx85x1_config rx8571_config = {
+	.regmap = {
+		.reg_bits = 8,
+		.val_bits = 8,
+		.max_register = 0x1f,
+	},
+	.num_nvram = 2
+};
+
+static int rx8581_probe(struct i2c_client *client,
+			const struct i2c_device_id *id)
+{
+	struct rx8581 *rx8581;
+	const struct rx85x1_config *config = &rx8581_config;
+	const void *data = of_device_get_match_data(&client->dev);
+	static struct nvmem_config nvmem_cfg[] = {
+		{
+			.name = "rx85x1-",
+			.word_size = 1,
+			.stride = 1,
+			.size = 1,
+			.reg_read = rx85x1_nvram_read,
+			.reg_write = rx85x1_nvram_write,
+		}, {
+			.name = "rx8571-",
+			.word_size = 1,
+			.stride = 1,
+			.size = RX8571_NVRAM_SIZE,
+			.reg_read = rx8571_nvram_read,
+			.reg_write = rx8571_nvram_write,
+		},
 	};
+	int ret, i;
 
 	dev_dbg(&client->dev, "%s\n", __func__);
 
+	if (data)
+		config = data;
+
 	rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581), GFP_KERNEL);
 	if (!rx8581)
 		return -ENOMEM;
 
 	i2c_set_clientdata(client, rx8581);
 
-	rx8581->regmap = devm_regmap_init_i2c(client, &config);
+	rx8581->regmap = devm_regmap_init_i2c(client, &config->regmap);
 	if (IS_ERR(rx8581->regmap))
 		return PTR_ERR(rx8581->regmap);
 
@@ -213,7 +301,14 @@ static int rx8581_probe(struct i2c_client *client,
 	rx8581->rtc->start_secs = 0;
 	rx8581->rtc->set_start_time = true;
 
-	return rtc_register_device(rx8581->rtc);
+	ret = rtc_register_device(rx8581->rtc);
+
+	for (i = 0; i < config->num_nvram; i++) {
+		nvmem_cfg[i].priv = rx8581;
+		rtc_nvmem_register(rx8581->rtc, &nvmem_cfg[i]);
+	}
+
+	return ret;
 }
 
 static const struct i2c_device_id rx8581_id[] = {
@@ -223,8 +318,9 @@ static const struct i2c_device_id rx8581_id[] = {
 MODULE_DEVICE_TABLE(i2c, rx8581_id);
 
 static const struct of_device_id rx8581_of_match[] = {
-	{ .compatible = "epson,rx8581" },
-	{ }
+	{ .compatible = "epson,rx8571", .data = &rx8571_config },
+	{ .compatible = "epson,rx8581", .data = &rx8581_config },
+	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, rx8581_of_match);
 
@@ -240,5 +336,5 @@ static struct i2c_driver rx8581_driver = {
 module_i2c_driver(rx8581_driver);
 
 MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>");
-MODULE_DESCRIPTION("Epson RX-8581 RTC driver");
+MODULE_DESCRIPTION("Epson RX-8571/RX-8581 RTC driver");
 MODULE_LICENSE("GPL");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 5/6] arm64: defconfig: enable RX-8581 config option
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
                   ` (3 preceding siblings ...)
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 6/6] arm64: dts: renesas: r8a774c0-cat874: add RTC support Biju Das
  2019-07-16 20:32 ` [cip-dev] [PATCH 4.19.y-cip 0/6] Add " Pavel Machek
  6 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

commit 940d1a288a598ee18afa25ee74f4ca124bddd364 upstream.

Enable support for RX-8571/RX-8581 RTC by turning on
CONFIG_RTC_DRV_RX8581 as module.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 11f9f0d..8561bef 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -546,6 +546,7 @@ CONFIG_EDAC_GHES=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_MAX77686=y
 CONFIG_RTC_DRV_RK808=m
+CONFIG_RTC_DRV_RX8581=m
 CONFIG_RTC_DRV_S5M=y
 CONFIG_RTC_DRV_DS3232=y
 CONFIG_RTC_DRV_EFI=y
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 6/6] arm64: dts: renesas: r8a774c0-cat874: add RTC support
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
                   ` (4 preceding siblings ...)
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 5/6] arm64: defconfig: enable RX-8581 config option Biju Das
@ 2019-07-15 14:17 ` Biju Das
  2019-07-16 20:32 ` [cip-dev] [PATCH 4.19.y-cip 0/6] Add " Pavel Machek
  6 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-15 14:17 UTC (permalink / raw)
  To: cip-dev

commit 07e72397f722d3a522991dcba82ce2ddb8c3c6e1 upstream.

This patch adds Epson RX-8571 real time clock support.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts b/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
index 4333af8..f08778e 100644
--- a/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
+++ b/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
@@ -61,6 +61,19 @@
 	clock-frequency = <48000000>;
 };
 
+&i2c1 {
+	pinctrl-0 = <&i2c1_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+	clock-frequency = <400000>;
+
+	rtc at 32 {
+		compatible = "epson,rx8571";
+		reg = <0x32>;
+	};
+};
+
 &ohci0 {
 	dr_mode = "host";
 	status = "okay";
@@ -76,6 +89,12 @@
 };
 
 &pfc {
+
+	i2c1_pins: i2c1 {
+		groups = "i2c1_b";
+		function = "i2c1";
+	};
+
 	scif2_pins: scif2 {
 		groups = "scif2_data_a";
 		function = "scif2";
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC Biju Das
@ 2019-07-16 20:22   ` Pavel Machek
  2019-07-17  6:46     ` Biju Das
  0 siblings, 1 reply; 10+ messages in thread
From: Pavel Machek @ 2019-07-16 20:22 UTC (permalink / raw)
  To: cip-dev

Hi!

> +static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
> +			     size_t bytes)
> +{
> +	struct rx8581 *rx8581 = priv;
> +	unsigned int tmp_val;
> +	int ret;
> +
> +	ret = regmap_read(rx8581->regmap, RX8581_REG_RAM, &tmp_val);
> +	(*(unsigned char *)val) = (unsigned char) tmp_val;
> +
> +	return ret;
> +}
> +
> +static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val,
> +			      size_t bytes)
> +{
> +	struct rx8581 *rx8581 = priv;
> +	unsigned char tmp_val;
> +
> +	tmp_val = *((unsigned char *)val);
> +	return regmap_write(rx8581->regmap, RX8581_REG_RAM,
> +				(unsigned int)tmp_val);
> +}

I see that 85x1 has single byte of RAM. I'd still expect return of
error in case of offset != 0 or bytes != 1.

Probably best done in mainline first...

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190716/22b19a6e/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support
  2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
                   ` (5 preceding siblings ...)
  2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 6/6] arm64: dts: renesas: r8a774c0-cat874: add RTC support Biju Das
@ 2019-07-16 20:32 ` Pavel Machek
  6 siblings, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2019-07-16 20:32 UTC (permalink / raw)
  To: cip-dev

On Mon 2019-07-15 15:17:19, Biju Das wrote:
> This patch series add RTC support for EK874 platform.
> 
> This patch series is based on linux-4.19.y-cip and all the patches
> in this series are cherry-picked from linux rc tree.
> 
> This patch series is depend on the below patch series
> https://patchwork.kernel.org/project/cip-dev/list/?series=145931

Thanks for the series, applied, and pushed out.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20190716/5503864b/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC
  2019-07-16 20:22   ` Pavel Machek
@ 2019-07-17  6:46     ` Biju Das
  0 siblings, 0 replies; 10+ messages in thread
From: Biju Das @ 2019-07-17  6:46 UTC (permalink / raw)
  To: cip-dev

Hi Pavel,

Thanks for the feedback.

> Subject: Re: [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for
> Epson rx8571 RTC
> 
> Hi!
> 
> > +static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
> > +			     size_t bytes)
> > +{
> > +	struct rx8581 *rx8581 = priv;
> > +	unsigned int tmp_val;
> > +	int ret;
> > +
> > +	ret = regmap_read(rx8581->regmap, RX8581_REG_RAM, &tmp_val);
> > +	(*(unsigned char *)val) = (unsigned char) tmp_val;
> > +
> > +	return ret;
> > +}
> > +
> > +static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val,
> > +			      size_t bytes)
> > +{
> > +	struct rx8581 *rx8581 = priv;
> > +	unsigned char tmp_val;
> > +
> > +	tmp_val = *((unsigned char *)val);
> > +	return regmap_write(rx8581->regmap, RX8581_REG_RAM,
> > +				(unsigned int)tmp_val);
> > +}
> 
> I see that 85x1 has single byte of RAM. I'd still expect return of error in case
> of offset != 0 or bytes != 1.

As per the discussion we had in ML. Any validation to be done at nvmem framework level.

> Probably best done in mainline first...

We need to fix this issue at nvmem frame work level. Which involves API changes.
Please see the mail discussion related to this.

https://patchwork.kernel.org/patch/10723299/

May be at some point, we will have a fix for this issues.

regards,
Biju

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-07-17  6:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 14:17 [cip-dev] [PATCH 4.19.y-cip 0/6] Add RTC support Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 1/6] rtc: nvmem: use devm_nvmem_register() Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 2/6] rtc: nvmem: remove nvmem from struct rtc_device Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 3/6] dt-bindings: rtc: add rx8571 compatible Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 4/6] rtc: rx8581: Add support for Epson rx8571 RTC Biju Das
2019-07-16 20:22   ` Pavel Machek
2019-07-17  6:46     ` Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 5/6] arm64: defconfig: enable RX-8581 config option Biju Das
2019-07-15 14:17 ` [cip-dev] [PATCH 4.19.y-cip 6/6] arm64: dts: renesas: r8a774c0-cat874: add RTC support Biju Das
2019-07-16 20:32 ` [cip-dev] [PATCH 4.19.y-cip 0/6] Add " Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.