mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: rdu2: add command to reset network switch
Date: Thu, 13 Dec 2018 07:47:07 +0100	[thread overview]
Message-ID: <20181213064707.termfqcixpsnhdal@pengutronix.de> (raw)
In-Reply-To: <20181210133814.29219-1-l.stach@pengutronix.de>

On Mon, Dec 10, 2018 at 02:38:14PM +0100, Lucas Stach wrote:
> This command allows to reset the network switch on the DEB,
> clearing any DSA configuration, which may still be present from
> a prior boot.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---

Applied, thanks

Sascha

>  arch/arm/boards/zii-imx6q-rdu2/Makefile     |  2 +-
>  arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c | 49 +++++++++++++++++++++
>  2 files changed, 50 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c
> 
> diff --git a/arch/arm/boards/zii-imx6q-rdu2/Makefile b/arch/arm/boards/zii-imx6q-rdu2/Makefile
> index c6285362f2ee..10dfba3a3cf3 100644
> --- a/arch/arm/boards/zii-imx6q-rdu2/Makefile
> +++ b/arch/arm/boards/zii-imx6q-rdu2/Makefile
> @@ -1,3 +1,3 @@
> -obj-y += board.o
> +obj-y += board.o switch-cmd.o
>  lwl-y += lowlevel.o
>  bbenv-y += defaultenv-rdu2
> diff --git a/arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c b/arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c
> new file mode 100644
> index 000000000000..bdba46fb3615
> --- /dev/null
> +++ b/arch/arm/boards/zii-imx6q-rdu2/switch-cmd.c
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2018 Zodiac Inflight Innovation
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include <common.h>
> +#include <command.h>
> +#include <i2c/i2c.h>
> +
> +static int do_rave_switch_reset(int argc, char *argv[])
> +{
> +	struct i2c_client client;
> +	u8 reg;
> +
> +	if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
> +	    !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
> +		return -ENODEV;
> +
> +	client.adapter = i2c_get_adapter(1);
> +	if (!client.adapter)
> +		return -ENODEV;
> +
> +	/* address of the switch watchdog microcontroller */
> +	client.addr = 0x38;
> +	reg = 0x78;
> +	/* set switch reset time to 100ms */
> +	i2c_write_reg(&client, 0x0a, &reg, 1);
> +	/* reset the switch */
> +	reg = 0x01;
> +	i2c_write_reg(&client, 0x0d, &reg, 1);
> +	/* issue dummy command to work around firmware bug */
> +	i2c_read_reg(&client, 0x01, &reg, 1);
> +
> +	return 0;
> +}
> +
> +BAREBOX_CMD_START(rave_reset_switch)
> +	.cmd		= do_rave_switch_reset,
> +	BAREBOX_CMD_DESC("reset ethernet switch on RDU2")
> +	BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
> +BAREBOX_CMD_END
> -- 
> 2.19.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

      reply	other threads:[~2018-12-13  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 13:38 Lucas Stach
2018-12-13  6:47 ` Sascha Hauer [this message]

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=20181213064707.termfqcixpsnhdal@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@pengutronix.de \
    /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