From: Detlev Zundel Date: Fri, 27 May 2011 17:36:01 +0200 Subject: [U-Boot] [PATCH 5/5] mpc5200: digsy_mtc: add support for writing 'appreg' value In-Reply-To: <1306505304-9593-6-git-send-email-agust@denx.de> (Anatolij Gustschin's message of "Fri, 27 May 2011 16:08:24 +0200") References: <1306505304-9593-1-git-send-email-agust@denx.de> <1306505304-9593-6-git-send-email-agust@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > Signed-off-by: Anatolij Gustschin > --- > 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 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