[U-Boot] [PATCH 5/5] mpc5200: digsy_mtc: add support for writing 'appreg' value

Detlev Zundel dzu at denx.de
Fri May 27 17:36:01 CEST 2011


Hi Anatolij,

> Up to now only reading 'appreg' value was implemented in the
> digsyMTC special 'mtc appreg' command. Extend the command to
> support writing appreg value, too.
>
> Signed-off-by: Werner Pfister <Pfister_Werner at intercontrol.de>
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
> ---
>  board/digsy_mtc/cmd_mtc.c |   46 +++++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 40 insertions(+), 6 deletions(-)
>
> diff --git a/board/digsy_mtc/cmd_mtc.c b/board/digsy_mtc/cmd_mtc.c
> index ba0c367..a12becf 100644
> --- a/board/digsy_mtc/cmd_mtc.c
> +++ b/board/digsy_mtc/cmd_mtc.c

[...]

> @@ -214,13 +222,34 @@ static int do_mtc_appreg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
>  	pcmd.cmd_val0 = 5;	/* max. Count */
>  	pcmd.cmd_val1 = 5;	/* max. Time */
>  	pcmd.cmd_val2 = 0;	/* =0 means read appreg */
> +	pcmd.user_out = user_out;
>  
>  	mtc_calculate_checksum(&pcmd);
>  	err = msp430_xfer(&pcmd, &prx);
>  
> +	/* on success decide between read or write */
>  	if (!err) {
> -		sprintf(buf, "%d", prx.ack2);
> -		setenv("appreg", buf);
> +		if (argc == 2) {
> +			appreg = simple_strtol(argv[1], NULL, 10);
> +			if (appreg == 0) {
> +				printf("mtc appreg: invalid parameter - "
> +				       "must be betwenn 1 and 255\n");

Typo, should be "between"

Otherwise

Acked-by: Detlev Zundel <dzu at denx.de>

Thanks
  Detlev

-- 
An elephant is a mouse with an operating system.
                                        -- Donald Knuth
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list