]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/bc3450/cmd_bc3450.c
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[karo-tx-uboot.git] / board / bc3450 / cmd_bc3450.c
index 6bbe4e6a5d2059cc68ca59ed7583d950354f3c9e..3c6e798ac338c32ad5f54f3c05da69acfcb6ff39 100644 (file)
@@ -5,23 +5,7 @@
  * (C) Copyright 2005
  * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de.
  *
- * 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+
  */
 
 #include <common.h>
 /*
  * BC3450 specific commands
  */
-#if (CONFIG_COMMANDS & CFG_CMD_BSP)
-
-#undef DEBUG
-#ifdef DEBUG
-# define dprintf(fmt,args...)  printf(fmt, ##args)
-#else
-# define dprintf(fmt,args...)
-#endif
+#if defined(CONFIG_CMD_BSP)
 
 /*
  * Definitions for DS1620 chip
@@ -52,9 +29,8 @@
 #define THERM_WRITE_TL         0x02
 #define THERM_WRITE_TH         0x01
 
-#define CFG_CPU                        2
-#define CFG_1SHOT              1
-#define CFG_STANDALONE         0
+#define CONFIG_SYS_1SHOT               1
+#define CONFIG_SYS_STANDALONE          0
 
 struct therm {
        int hi;
@@ -69,7 +45,7 @@ struct therm {
 #define SM501_POWER_MODE0_GATE         0x00000040UL
 #define SM501_POWER_MODE1_GATE         0x00000048UL
 #define POWER_MODE_GATE_GPIO_PWM_I2C   0x00000040UL
-#define SM501_GPIO_DATA_LOW            0x00010000UL
+#define SM501_GPIO_DATA_LOW            0x00010000UL
 #define SM501_GPIO_DATA_HIGH           0x00010004UL
 #define SM501_GPIO_DATA_DIR_LOW                0x00010008UL
 #define SM501_GPIO_DATA_DIR_HIGH       0x0001000CUL
@@ -129,7 +105,7 @@ int sm501_gpio_init (void)
        static int init_done = 0;
 
        if (init_done) {
-/*     dprintf("sm501_gpio_init: nothing to be done.\n"); */
+               debug("sm501_gpio_init: nothing to be done.\n");
                return 1;
        }
 
@@ -162,7 +138,8 @@ int sm501_gpio_init (void)
                (PWR_OFF | BUZZER | FP_DATA_TRI);
 
        init_done = 1;
-/*  dprintf("sm501_gpio_init: done.\n"); */
+       debug("sm501_gpio_init: done.\n");
+
        return 0;
 }
 
@@ -173,7 +150,7 @@ int sm501_gpio_init (void)
  * read and prints the dip switch
  * and/or external config inputs (4bits) 0...0x0F
  */
-int cmd_dip (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int cmd_dip (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
        vu_long rc = 0;
 
@@ -189,23 +166,23 @@ int cmd_dip (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
        if (rc > 0x0F)
                return -1;
 
-       printf ("0x%x\n", rc);
+       printf ("0x%lx\n", rc);
        return 0;
 }
 
 U_BOOT_CMD (dip, 1, 1, cmd_dip,
-           "dip     - read dip switch and config inputs\n",
+           "read dip switch and config inputs",
            "\n"
            "     - prints the state of the dip switch and/or\n"
            "       external configuration inputs as hex value.\n"
-           "     - \"Config 1\" is the LSB\n");
+           "     - \"Config 1\" is the LSB");
 
 
 /*
  * buz - turns Buzzer on/off
  */
 #ifdef CONFIG_BC3450_BUZZER
-static int cmd_buz (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+static int cmd_buz (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
        if (argc != 2) {
                printf ("Usage:\nspecify one argument: \"on\" or \"off\"\n");
@@ -228,15 +205,15 @@ static int cmd_buz (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD (buz, 2, 1, cmd_buz,
-           "buz     - turns buzzer on/off\n",
-           "\n" "buz <on/off>\n" "     - turns the buzzer on or off\n");
+           "turns buzzer on/off",
+           "\n" "buz <on/off>\n" "     - turns the buzzer on or off");
 #endif /* CONFIG_BC3450_BUZZER */
 
 
 /*
  * fp - front panel commands
  */
-static int cmd_fp (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+static int cmd_fp (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
        sm501_gpio_init ();
 
@@ -322,18 +299,18 @@ static int cmd_fp (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD (fp, 3, 1, cmd_fp,
-           "fp      - front panes access functions\n",
+           "front panes access functions",
            "\n"
            "fp bl <on/off>\n"
            "     - turns the CCFL backlight of the display on/off\n"
-           "fp <on/off>\n" "     - turns the whole display on/off\n"
+           "fp <on/off>\n" "     - turns the whole display on/off"
 #ifdef CONFIG_BC3450_CRT
+           "\n"
            "fp crt <on/off>\n"
-           "     - enables/disables the crt output (debug only)\n"
+           "     - enables/disables the crt output (debug only)"
 #endif /* CONFIG_BC3450_CRT */
        );
 
-
 /*
  * temp - DS1620 thermometer
  */
@@ -491,7 +468,7 @@ static void ds1620_write_state (struct therm *therm)
        ds1620_out (THERM_START_CONVERT, 0, 0);
 }
 
-static int cmd_temp (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+static int cmd_temp (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
        int i;
        struct therm therm;
@@ -513,7 +490,7 @@ static int cmd_temp (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
                        therm.hi <<= 1;
                        therm.lo <<= 1;
                        ds1620_write_state (&therm);
-                       ds1620_out (THERM_WRITE_CONFIG, 8, CFG_STANDALONE);
+                       ds1620_out (THERM_WRITE_CONFIG, 8, CONFIG_SYS_STANDALONE);
                        return 0;
                }
        }
@@ -523,8 +500,8 @@ static int cmd_temp (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 }
 
 U_BOOT_CMD (temp, 3, 1, cmd_temp,
-           "temp    - print current temperature\n",
-           "\n" "temp\n" "     - print current temperature\n");
+           "print current temperature",
+           "\n" "temp\n" "     - print current temperature");
 
 #ifdef CONFIG_BC3450_CAN
 /*
@@ -538,9 +515,9 @@ int can_init (void)
        static int init_done = 0;
        int i;
        struct mpc5xxx_mscan *can1 =
-               (struct mpc5xxx_mscan *) (CFG_MBAR + 0x0900);
+               (struct mpc5xxx_mscan *) (CONFIG_SYS_MBAR + 0x0900);
        struct mpc5xxx_mscan *can2 =
-               (struct mpc5xxx_mscan *) (CFG_MBAR + 0x0980);
+               (struct mpc5xxx_mscan *) (CONFIG_SYS_MBAR + 0x0980);
 
        /* GPIO configuration of the CAN pins is done in BC3450.h */
 
@@ -682,13 +659,13 @@ int can_init (void)
  * return 1 on CAN failure
  * return 0 if no failure
  */
-int do_can (char *argv[])
+int do_can (char * const argv[])
 {
        int i;
        struct mpc5xxx_mscan *can1 =
-               (struct mpc5xxx_mscan *) (CFG_MBAR + 0x0900);
+               (struct mpc5xxx_mscan *) (CONFIG_SYS_MBAR + 0x0900);
        struct mpc5xxx_mscan *can2 =
-               (struct mpc5xxx_mscan *) (CFG_MBAR + 0x0980);
+               (struct mpc5xxx_mscan *) (CONFIG_SYS_MBAR + 0x0980);
 
        /* send a message on CAN1 */
        can1->cantbsel = 0x01;
@@ -777,7 +754,7 @@ int do_can (char *argv[])
 /*
  * test - BC3450 HW test routines
  */
-int cmd_test (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int cmd_test (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 #ifdef CONFIG_BC3450_CAN
        int rcode;
@@ -816,12 +793,13 @@ int cmd_test (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
        return 1;
 }
 
-U_BOOT_CMD (test, 2, 1, cmd_test, "test    - unit test routines\n", "\n"
+U_BOOT_CMD (test, 2, 1, cmd_test, "unit test routines", "\n"
 #ifdef CONFIG_BC3450_CAN
-           "test can\n"
-           "     - connect CAN1 (X8) with CAN2 (X9) for this test\n"
+       "test can\n"
+       "     - connect CAN1 (X8) with CAN2 (X9) for this test\n"
 #endif /* CONFIG_BC3450_CAN */
-           "test unit-off\n"
-           "     - turns off the BC3450 unit\n"
-           "       WARNING: Unsaved environment variables will be lost!\n");
-#endif /* CFG_CMD_BSP */
+       "test unit-off\n"
+       "     - turns off the BC3450 unit\n"
+       "       WARNING: Unsaved environment variables will be lost!"
+);
+#endif