* [PATCH 1/6] ARM: dts: rdu2: Remove obsolete 'pic' node in uart4
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-24 22:26 ` [PATCH 2/6] ARM: dts: rdu2: Add nodes for RAVE SP EEPROM Andrey Smirnov
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
All of the code in this commit is:
a) Obsolete and intended to work with a driver that has never been
submitted upstream anywhere and is no longer used
b) Superceeded by the DT code in Linux DT tree
Remove it all and rely on Linux DTS files to properly specify RAVE SP
MFD with a watchdog child node.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 67 ------------------------------
1 file changed, 67 deletions(-)
diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index 7ab569b78..6d9c38d7e 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -55,73 +55,6 @@
};
};
-&uart4 {
- pic {
- compatible = "zii,pic-rdu2";
- current-speed = <1000000>;
- status = "okay";
-
- main_eeprom {
- compatible = "zii,pic-main-eeprom";
- #address-cells = <1>;
- #size-cells = <1>;
- status = "okay";
-
- boot_source: boot-source@83 {
- reg = <0x83 1>;
- };
- max_failed_boots: max-failed-boots@8E {
- reg = <0x8E 2>;
- };
- };
-
- dds_eeprom {
- compatible = "zii,pic-dds-eeprom";
- #address-cells = <1>;
- #size-cells = <1>;
- status = "okay";
- };
-
- watchdog {
- compatible = "zii,pic-watchdog";
- status = "okay";
- };
-
- hwmon {
- compatible = "zii,pic-hwmon";
- sensors = "RMB_3V3_PMIC",
- "RMB_3V3_MCU",
- "RMB_5V_MAIN",
- "RMB_12V_MAIN",
- "RMB_28V_FIL",
- "RMB_28V_HOTSWAP",
- "DEB_1V8",
- "DEB_3V3",
- "DEB_28V_DEB",
- "DEB_28V_RDU",
- "TEMPERATURE",
- "TEMPERATURE_2",
- "RMB_28V_CURRENT";
- status = "okay";
- };
-
- backlight {
- compatible = "zii,pic-backlight";
- status = "okay";
- };
-
- leds {
- compatible = "zii,pic-leds";
- status = "okay";
- };
-
- pwrbutton {
- compatible = "zii,pic-pwrbutton";
- status = "okay";
- };
- };
-};
-
&ecspi1 {
nor_flash: flash@0 {
#address-cells = <1>;
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/6] ARM: dts: rdu2: Add nodes for RAVE SP EEPROM
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
2018-06-24 22:26 ` [PATCH 1/6] ARM: dts: rdu2: Remove obsolete 'pic' node in uart4 Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-24 22:26 ` [PATCH 3/6] watchdog: rave-sp-wdt: Remove bogus leftover code Andrey Smirnov
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index 6d9c38d7e..bdf76bc4e 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -52,6 +52,31 @@
aliases {
ethernet0 = &fec;
ethernet1 = &i210;
+ /*
+ * Aliases to match Linux kernel naming in /dev/
+ */
+ main-eeprom = &main_eeprom;
+ dds-eeprom = &dds_eeprom;
+ };
+};
+
+
+&uart4 {
+ rave-sp {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ dds_eeprom: eeprom@a3 {
+ compatible = "zii,rave-sp-eeprom";
+ reg = <0xa3 0x4000>;
+ };
+
+ main_eeprom: eeprom@a4 {
+ compatible = "zii,rave-sp-eeprom";
+ reg = <0xa4 0x4000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
};
};
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/6] watchdog: rave-sp-wdt: Remove bogus leftover code
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
2018-06-24 22:26 ` [PATCH 1/6] ARM: dts: rdu2: Remove obsolete 'pic' node in uart4 Andrey Smirnov
2018-06-24 22:26 ` [PATCH 2/6] ARM: dts: rdu2: Add nodes for RAVE SP EEPROM Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-24 22:26 ` [PATCH 4/6] watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsource Andrey Smirnov
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
This code should've been removed when the driver was rebased against
latest watchdog plumbing in Barebox.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/watchdog/rave-sp-wdt.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/watchdog/rave-sp-wdt.c b/drivers/watchdog/rave-sp-wdt.c
index 164316785..bd1c43b0f 100644
--- a/drivers/watchdog/rave-sp-wdt.c
+++ b/drivers/watchdog/rave-sp-wdt.c
@@ -75,7 +75,6 @@ struct rave_sp_wdt {
struct restart_handler restart;
unsigned int timeout;
unsigned int boot_source;
- struct device_d dev;
};
static struct rave_sp_wdt *to_rave_sp_wdt(struct watchdog *wdd)
@@ -357,10 +356,8 @@ static int rave_sp_wdt_probe(struct device_d *dev)
rave_sp_wdt_set_boot_source,
rave_sp_wdt_get_boot_source,
&sp_wd->boot_source, "%u", sp_wd);
- if (IS_ERR(p)) {
- unregister_device(&sp_wd->dev);
+ if (IS_ERR(p))
return PTR_ERR(p);
- }
ret = sp_wd->variant->reset_reason(wdd);
if (ret < 0) {
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/6] watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsource
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
` (2 preceding siblings ...)
2018-06-24 22:26 ` [PATCH 3/6] watchdog: rave-sp-wdt: Remove bogus leftover code Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-24 22:26 ` [PATCH 5/6] ARM: dts: rdu2: Specify "boot-source" NVMEM cell Andrey Smirnov
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
RAVE SP firmware versions found on RDU2 provide decicated bootsource
manipulation commands, which, under the hood, are just thin wrappers
around write/read to a particular location in EEPROM.
Unfortunately, RAVE SP firmware found on RDU1, does not provide any
dedicated bootsource commands and its users are expected to access
EEPROM directly.
In order to avoid having separate code paths for handling those two
cases, convert the code to access EEPROM directly via NVMEM API.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/watchdog/rave-sp-wdt.c | 79 ++++++++++++++++++----------------
1 file changed, 41 insertions(+), 38 deletions(-)
diff --git a/drivers/watchdog/rave-sp-wdt.c b/drivers/watchdog/rave-sp-wdt.c
index bd1c43b0f..dc673ee35 100644
--- a/drivers/watchdog/rave-sp-wdt.c
+++ b/drivers/watchdog/rave-sp-wdt.c
@@ -37,9 +37,6 @@ enum {
RAVE_SP_RESET_REASON_CP_REQUEST = 13,
RAVE_SP_RESET_DELAY_MS = 500,
-
- RAVE_SP_BOOT_SOURCE_GET = 0,
- RAVE_SP_BOOT_SOURCE_SET = 1,
};
/**
@@ -75,6 +72,7 @@ struct rave_sp_wdt {
struct restart_handler restart;
unsigned int timeout;
unsigned int boot_source;
+ struct nvmem_cell *boot_source_cell;
};
static struct rave_sp_wdt *to_rave_sp_wdt(struct watchdog *wdd)
@@ -89,26 +87,6 @@ static int rave_sp_wdt_exec(struct watchdog *wdd, void *data,
data, data_size, NULL, 0);
}
-
-static int rave_sp_wdt_access_boot_source(struct rave_sp_wdt *sp_wd, u8 set_get)
-{
- u8 cmd[] = {
- [0] = RAVE_SP_CMD_BOOT_SOURCE,
- [1] = 0,
- [2] = set_get,
- [3] = sp_wd->boot_source,
- };
- u8 response;
- int ret;
-
- ret = rave_sp_exec(sp_wd->sp, cmd, sizeof(cmd), &response,
- sizeof(response));
- if (ret)
- return ret;
-
- return response;
-}
-
static int __rave_sp_wdt_rdu_reset_reason(struct watchdog *wdd,
uint8_t response[],
size_t response_len)
@@ -277,9 +255,12 @@ static const struct of_device_id rave_sp_wdt_of_match[] = {
static int rave_sp_wdt_set_boot_source(struct param_d *param, void *priv)
{
+ struct rave_sp_wdt *sp_wd = priv;
+ u8 boot_source = sp_wd->boot_source;
int ret;
- ret = rave_sp_wdt_access_boot_source(priv, RAVE_SP_BOOT_SOURCE_SET);
+ ret = nvmem_cell_write(sp_wd->boot_source_cell, &boot_source,
+ sizeof(boot_source));
if (ret < 0)
return ret;
@@ -289,13 +270,38 @@ static int rave_sp_wdt_set_boot_source(struct param_d *param, void *priv)
static int rave_sp_wdt_get_boot_source(struct param_d *param, void *priv)
{
struct rave_sp_wdt *sp_wd = priv;
- int ret;
+ u8 *boot_source;
+ size_t len;
- ret = rave_sp_wdt_access_boot_source(sp_wd, RAVE_SP_BOOT_SOURCE_GET);
- if (ret < 0)
- return ret;
+ boot_source = nvmem_cell_read(sp_wd->boot_source_cell, &len);
+ if (IS_ERR(boot_source))
+ return PTR_ERR(boot_source);
+
+ sp_wd->boot_source = *boot_source;
+ kfree(boot_source);
+
+ return 0;
+}
+
+static int rave_sp_wdt_add_params(struct rave_sp_wdt *sp_wd)
+{
+ struct watchdog *wdd = &sp_wd->wdd;
+ struct device_node *np = wdd->hwdev->device_node;
+ struct param_d *p;
+
+ sp_wd->boot_source_cell = of_nvmem_cell_get(np, "boot-source");
+ if (IS_ERR(sp_wd->boot_source_cell)) {
+ dev_warn(wdd->hwdev, "No bootsource info availible\n");
+ return 0;
+ }
+
+ p = dev_add_param_int(&wdd->dev, "boot_source",
+ rave_sp_wdt_set_boot_source,
+ rave_sp_wdt_get_boot_source,
+ &sp_wd->boot_source, "%u", sp_wd);
+ if (IS_ERR(p))
+ return PTR_ERR(p);
- sp_wd->boot_source = ret;
return 0;
}
@@ -306,7 +312,6 @@ static int rave_sp_wdt_probe(struct device_d *dev)
struct nvmem_cell *cell;
struct watchdog *wdd;
__le16 timeout = 60;
- struct param_d *p;
int ret;
sp_wd = xzalloc(sizeof(*sp_wd));
@@ -343,6 +348,12 @@ static int rave_sp_wdt_probe(struct device_d *dev)
return ret;
}
+ ret = rave_sp_wdt_add_params(sp_wd);
+ if (ret) {
+ dev_err(dev, "Failed to register device parameters");
+ return ret;
+ }
+
sp_wd->restart.name = "rave-sp-wdt";
sp_wd->restart.restart = rave_sp_wdt_restart_handler;
sp_wd->restart.priority = 200;
@@ -351,14 +362,6 @@ static int rave_sp_wdt_probe(struct device_d *dev)
if (ret)
dev_warn(dev, "Cannot register restart handler\n");
-
- p = dev_add_param_int(&wdd->dev, "boot_source",
- rave_sp_wdt_set_boot_source,
- rave_sp_wdt_get_boot_source,
- &sp_wd->boot_source, "%u", sp_wd);
- if (IS_ERR(p))
- return PTR_ERR(p);
-
ret = sp_wd->variant->reset_reason(wdd);
if (ret < 0) {
dev_warn(dev, "Failed to query reset reason\n");
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/6] ARM: dts: rdu2: Specify "boot-source" NVMEM cell
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
` (3 preceding siblings ...)
2018-06-24 22:26 ` [PATCH 4/6] watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsource Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-24 22:26 ` [PATCH 6/6] ARM: dts: rdu2: Add node for backlight device Andrey Smirnov
2018-06-26 4:59 ` [PATCH 0/6] RAVE SP RDU2-related changes Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index bdf76bc4e..f22c68aca 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -66,6 +66,11 @@
#address-cells = <1>;
#size-cells = <1>;
+ watchdog {
+ nvmem-cells = <&boot_source>;
+ nvmem-cell-names = "boot-source";
+ };
+
dds_eeprom: eeprom@a3 {
compatible = "zii,rave-sp-eeprom";
reg = <0xa3 0x4000>;
@@ -76,6 +81,10 @@
reg = <0xa4 0x4000>;
#address-cells = <1>;
#size-cells = <1>;
+
+ boot_source: boot-source@83 {
+ reg = <0x83 1>;
+ };
};
};
};
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/6] ARM: dts: rdu2: Add node for backlight device
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
` (4 preceding siblings ...)
2018-06-24 22:26 ` [PATCH 5/6] ARM: dts: rdu2: Specify "boot-source" NVMEM cell Andrey Smirnov
@ 2018-06-24 22:26 ` Andrey Smirnov
2018-06-26 4:59 ` [PATCH 0/6] RAVE SP RDU2-related changes Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-06-24 22:26 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
index f22c68aca..4fa23b5e6 100644
--- a/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/dts/imx6qdl-zii-rdu2.dtsi
@@ -86,6 +86,10 @@
reg = <0x83 1>;
};
};
+
+ backlight {
+ compatible = "zii,rave-sp-backlight";
+ };
};
};
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] RAVE SP RDU2-related changes
2018-06-24 22:26 [PATCH 0/6] RAVE SP RDU2-related changes Andrey Smirnov
` (5 preceding siblings ...)
2018-06-24 22:26 ` [PATCH 6/6] ARM: dts: rdu2: Add node for backlight device Andrey Smirnov
@ 2018-06-26 4:59 ` Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2018-06-26 4:59 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Sun, Jun 24, 2018 at 03:26:17PM -0700, Andrey Smirnov wrote:
> Everyone:
>
> This is the series of loosely related RDU2/RAVE SP chagnes that bring
> the following:
>
> - Remove old/stale RAVE SP entries from RDU2's DT
>
> - Adds EEPROM DT node to bind against recently accepted RAVE SP
> EEPROM driver
>
> - Introduces unified way of accessing (getting or setting) boot
> source for both RDU2 and RDU1 (support for which is coming)
>
> - Add backlight DT node to bind against recently accepted RAVE SP
> backlight driver
Applied, thanks
Sascha
>
> Feedback is welcome!
>
> Thanks,
> Andrey Smirnov
>
>
> Andrey Smirnov (6):
> ARM: dts: rdu2: Remove obsolete 'pic' node in uart4
> ARM: dts: rdu2: Add nodes for RAVE SP EEPROM
> watchdog: rave-sp-wdt: Remove bogus leftover code
> watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsource
> ARM: dts: rdu2: Specify "boot-source" NVMEM cell
> ARM: dts: rdu2: Add node for backlight device
>
> arch/arm/dts/imx6qdl-zii-rdu2.dtsi | 75 +++++++++------------------
> drivers/watchdog/rave-sp-wdt.c | 82 +++++++++++++++---------------
> 2 files changed, 64 insertions(+), 93 deletions(-)
>
> --
> 2.17.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread