* [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC
@ 2017-05-29 20:02 Lucas Stach
2017-05-29 20:02 ` [PATCH 2/2] ARM: imx6: gw54xx: fixup watchdog nodes on pre rev E boards Lucas Stach
2017-06-01 6:21 ` [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2017-05-29 20:02 UTC (permalink / raw)
To: barebox
This parses the board revision from the GSC EEPROm model string.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/boards/gateworks-ventana/gsc.c | 14 ++++++++++++++
arch/arm/boards/gateworks-ventana/gsc.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/arch/arm/boards/gateworks-ventana/gsc.c b/arch/arm/boards/gateworks-ventana/gsc.c
index 3614230..92244d1 100644
--- a/arch/arm/boards/gateworks-ventana/gsc.c
+++ b/arch/arm/boards/gateworks-ventana/gsc.c
@@ -65,3 +65,17 @@ int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count)
return ret;
}
+
+char gsc_get_rev(struct i2c_client *client)
+{
+ int i;
+ u8 model[16];
+
+ gsc_i2c_read(client, 0x30, model, 16);
+ for (i = sizeof(model) - 1; i > 0; i--) {
+ if (model[i] >= 'A')
+ return model[i];
+ }
+
+ return 'A';
+}
diff --git a/arch/arm/boards/gateworks-ventana/gsc.h b/arch/arm/boards/gateworks-ventana/gsc.h
index a6e7e22..13f2262 100644
--- a/arch/arm/boards/gateworks-ventana/gsc.h
+++ b/arch/arm/boards/gateworks-ventana/gsc.h
@@ -56,3 +56,5 @@
*/
int gsc_i2c_read(struct i2c_client *client, u32 addr, u8 *buf, u16 count);
int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count);
+
+char gsc_get_rev(struct i2c_client *client);
--
2.9.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ARM: imx6: gw54xx: fixup watchdog nodes on pre rev E boards
2017-05-29 20:02 [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Lucas Stach
@ 2017-05-29 20:02 ` Lucas Stach
2017-06-01 6:21 ` [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2017-05-29 20:02 UTC (permalink / raw)
To: barebox
Older boards before revision E don't have the external watchdog signal
wired up to the PMIC, so they must use watchdog 1, which is able to
reset the SoC internally.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
arch/arm/boards/gateworks-ventana/board.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm/boards/gateworks-ventana/board.c b/arch/arm/boards/gateworks-ventana/board.c
index 82dba7c..3ff142e 100644
--- a/arch/arm/boards/gateworks-ventana/board.c
+++ b/arch/arm/boards/gateworks-ventana/board.c
@@ -24,6 +24,19 @@
#include "gsc.h"
+static int gw54xx_wdog_of_fixup(struct device_node *root, void *context)
+{
+ struct device_node *np;
+
+ /* switch to the watchdog with internal reset capabilities */
+ np = of_find_node_by_name(root, "wdog@020c0000");
+ of_device_disable(np);
+ np = of_find_node_by_name(root, "wdog@020bc000");
+ of_device_enable(np);
+
+ return 0;
+}
+
static int gw54xx_devices_init(void)
{
struct i2c_client client;
@@ -60,6 +73,10 @@ static int gw54xx_devices_init(void)
of_eth_register_ethaddr(dnode, mac);
}
+ /* boards before rev E don't have the external watchdog signal */
+ if (gsc_get_rev(&client) < 'E')
+ of_register_fixup(gw54xx_wdog_of_fixup, NULL);
+
imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT);
barebox_set_hostname("gw54xx");
--
2.9.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC
2017-05-29 20:02 [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Lucas Stach
2017-05-29 20:02 ` [PATCH 2/2] ARM: imx6: gw54xx: fixup watchdog nodes on pre rev E boards Lucas Stach
@ 2017-06-01 6:21 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2017-06-01 6:21 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Mon, May 29, 2017 at 10:02:41PM +0200, Lucas Stach wrote:
> This parses the board revision from the GSC EEPROm model string.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> arch/arm/boards/gateworks-ventana/gsc.c | 14 ++++++++++++++
> arch/arm/boards/gateworks-ventana/gsc.h | 2 ++
> 2 files changed, 16 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/boards/gateworks-ventana/gsc.c b/arch/arm/boards/gateworks-ventana/gsc.c
> index 3614230..92244d1 100644
> --- a/arch/arm/boards/gateworks-ventana/gsc.c
> +++ b/arch/arm/boards/gateworks-ventana/gsc.c
> @@ -65,3 +65,17 @@ int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count)
>
> return ret;
> }
> +
> +char gsc_get_rev(struct i2c_client *client)
> +{
> + int i;
> + u8 model[16];
> +
> + gsc_i2c_read(client, 0x30, model, 16);
> + for (i = sizeof(model) - 1; i > 0; i--) {
> + if (model[i] >= 'A')
> + return model[i];
> + }
> +
> + return 'A';
> +}
> diff --git a/arch/arm/boards/gateworks-ventana/gsc.h b/arch/arm/boards/gateworks-ventana/gsc.h
> index a6e7e22..13f2262 100644
> --- a/arch/arm/boards/gateworks-ventana/gsc.h
> +++ b/arch/arm/boards/gateworks-ventana/gsc.h
> @@ -56,3 +56,5 @@
> */
> int gsc_i2c_read(struct i2c_client *client, u32 addr, u8 *buf, u16 count);
> int gsc_i2c_write(struct i2c_client *client, u32 addr, const u8 *buf, u16 count);
> +
> +char gsc_get_rev(struct i2c_client *client);
> --
> 2.9.4
>
>
> _______________________________________________
> 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] 3+ messages in thread
end of thread, other threads:[~2017-06-01 6:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29 20:02 [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Lucas Stach
2017-05-29 20:02 ` [PATCH 2/2] ARM: imx6: gw54xx: fixup watchdog nodes on pre rev E boards Lucas Stach
2017-06-01 6:21 ` [PATCH 1/2] ARM: imx6: gw54xx: add function to retrieve board revision from GSC Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox