X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fcmd_mfsl.c;h=e8e8e3c0de8c3f1a85512e331d4371c079f2383c;hb=c2c5b94f8959cd9e05be9e187dc597c6b6e2e786;hp=8d4c1a38d7fcba45e840d7a7965643d8ec042284;hpb=78549bbf44bd2c8d1a0730fb068836071751afaa;p=karo-tx-uboot.git diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 8d4c1a38d7..e8e8e3c0de 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -3,23 +3,7 @@ * * Michal SIMEK * - * See file CREDITS for list of people who contributed to this - * project. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -29,27 +13,22 @@ #include #include #include - -#if defined(CONFIG_CMD_MFSL) #include -int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int fslnum; unsigned int num; unsigned int blocking; - if (argc < 2) { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } + if (argc < 2) + return CMD_RET_USAGE; fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16); if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) { puts ("Bad number of FSL\n"); - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; + return CMD_RET_USAGE; } switch (fslnum) { @@ -185,30 +164,26 @@ int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; } - printf ("%01x: 0x%08lx - %s %s read\n", fslnum, num, + printf ("%01x: 0x%08x - %s %s read\n", fslnum, num, blocking < 2 ? "non blocking" : "blocking", ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); return 0; } -int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int fslnum; unsigned int num; unsigned int blocking; - if (argc < 3) { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } + if (argc < 3) + return CMD_RET_USAGE; fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16); num = (unsigned int)simple_strtoul (argv[2], NULL, 16); blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16); - if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) { - printf ("Bad number of FSL\nUsage:\n%s\n", cmdtp->usage); - return 1; - } + if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) + return CMD_RET_USAGE; switch (fslnum) { #if (XILINX_FSL_NUMBER > 0) @@ -343,31 +318,29 @@ int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; } - printf ("%01x: 0x%08lx - %s %s write\n", fslnum, num, + printf ("%01x: 0x%08x - %s %s write\n", fslnum, num, blocking < 2 ? "non blocking" : "blocking", ((blocking == 1) || (blocking == 3)) ? "control" : "data" ); return 0; } -int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int reg = 0; unsigned int val = 0; + if (argc < 2) + return CMD_RET_USAGE; + reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); val = (unsigned int)simple_strtoul (argv[2], NULL, 16); - if (argc < 1) { - printf ("Usage:\n%s\n", cmdtp->usage); - return 1; - } switch (reg) { case 0x1: if (argc > 2) { MTS (val, rmsr); NOP; MFS (val, rmsr); - } else { MFS (val, rmsr); } @@ -382,36 +355,34 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) puts ("ESR"); break; default: + puts ("Unsupported register\n"); return 1; } - printf (": 0x%08lx\n", val); + printf (": 0x%08x\n", val); return 0; } /***************************************************/ U_BOOT_CMD (frd, 3, 1, do_frd, - "frd - read data from FSL\n", + "read data from FSL", "- [fslnum [0|1|2|3]]\n" " 0 - non blocking data read\n" " 1 - non blocking control read\n" " 2 - blocking data read\n" - " 3 - blocking control read\n"); - + " 3 - blocking control read"); U_BOOT_CMD (fwr, 4, 1, do_fwr, - "fwr - write data to FSL\n", + "write data to FSL", "- [fslnum [0|1|2|3]]\n" " 0 - non blocking data write\n" " 1 - non blocking control write\n" " 2 - blocking data write\n" - " 3 - blocking control write\n"); + " 3 - blocking control write"); U_BOOT_CMD (rspr, 3, 1, do_rspr, - "rmsr - read/write special purpose register\n", + "read/write special purpose register", "- reg_num [write value] read/write special purpose register\n" - " 0 - MSR - Machine status register\n" - " 1 - EAR - Exception address register\n" - " 2 - ESR - Exception status register\n"); - -#endif + " 1 - MSR - Machine status register\n" + " 3 - EAR - Exception address register\n" + " 5 - ESR - Exception status register");