Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2008 |
| 3 | * Heiko Schocher, DENX Software Engineering, hs@denx.de. |
| 4 | * |
Holger Brunck | bf20a88 | 2011-06-05 22:22:18 +0000 | [diff] [blame] | 5 | * (C) Copyright 2011 |
| 6 | * Holger Brunck, Keymile GmbH Hannover, holger.brunck@keymile.com |
| 7 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 12 | #include <ioports.h> |
Holger Brunck | 3066492 | 2011-05-04 01:47:30 +0000 | [diff] [blame] | 13 | #include <command.h> |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 14 | #include <malloc.h> |
Heiko Schocher | e5b6c2e | 2008-10-15 09:41:00 +0200 | [diff] [blame] | 15 | #include <hush.h> |
Heiko Schocher | d19a6ec | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 16 | #include <net.h> |
Heiko Schocher | 466924f | 2010-02-18 08:08:25 +0100 | [diff] [blame] | 17 | #include <netdev.h> |
Heiko Schocher | d19a6ec | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 18 | #include <asm/io.h> |
Thomas Herzmann | 2c8a0c8 | 2011-05-12 19:59:22 +0000 | [diff] [blame] | 19 | #include <linux/ctype.h> |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 20 | |
Thomas Herzmann | b2c3160 | 2012-05-04 10:55:58 +0200 | [diff] [blame] | 21 | #if defined(CONFIG_POST) |
| 22 | #include "post.h" |
| 23 | #endif |
Holger Brunck | bf20a88 | 2011-06-05 22:22:18 +0000 | [diff] [blame] | 24 | #include "common.h" |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 25 | #include <i2c.h> |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 26 | |
Holger Brunck | 015a60f | 2011-09-14 10:54:12 +0200 | [diff] [blame] | 27 | #if !defined(CONFIG_MPC83xx) |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 28 | static void i2c_write_start_seq(void); |
Holger Brunck | 015a60f | 2011-09-14 10:54:12 +0200 | [diff] [blame] | 29 | #endif |
| 30 | |
Heiko Schocher | cfc5804 | 2010-04-26 13:07:28 +0200 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 32 | |
Heiko Schocher | cfc5804 | 2010-04-26 13:07:28 +0200 | [diff] [blame] | 33 | /* |
| 34 | * Set Keymile specific environment variables |
| 35 | * Currently only some memory layout variables are calculated here |
| 36 | * ... ------------------------------------------------ |
| 37 | * ... |@rootfsaddr |@pnvramaddr |@varaddr |@reserved |@END_OF_RAM |
| 38 | * ... |<------------------- pram ------------------->| |
| 39 | * ... ------------------------------------------------ |
| 40 | * @END_OF_RAM: denotes the RAM size |
| 41 | * @pnvramaddr: Startadress of pseudo non volatile RAM in hex |
| 42 | * @pram : preserved ram size in k |
| 43 | * @varaddr : startadress for /var mounted into RAM |
| 44 | */ |
| 45 | int set_km_env(void) |
| 46 | { |
| 47 | uchar buf[32]; |
| 48 | unsigned int pnvramaddr; |
| 49 | unsigned int pram; |
| 50 | unsigned int varaddr; |
Andreas Huber | 28c63c7 | 2011-09-13 23:06:11 +0000 | [diff] [blame] | 51 | unsigned int kernelmem; |
| 52 | char *p; |
| 53 | unsigned long rootfssize = 0; |
Heiko Schocher | cfc5804 | 2010-04-26 13:07:28 +0200 | [diff] [blame] | 54 | |
| 55 | pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM |
| 56 | - CONFIG_KM_PNVRAM; |
| 57 | sprintf((char *)buf, "0x%x", pnvramaddr); |
| 58 | setenv("pnvramaddr", (char *)buf); |
| 59 | |
Andreas Huber | 28c63c7 | 2011-09-13 23:06:11 +0000 | [diff] [blame] | 60 | /* try to read rootfssize (ram image) from envrionment */ |
| 61 | p = getenv("rootfssize"); |
| 62 | if (p != NULL) |
| 63 | strict_strtoul(p, 16, &rootfssize); |
| 64 | pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + |
| 65 | CONFIG_KM_PNVRAM) / 0x400; |
Heiko Schocher | cfc5804 | 2010-04-26 13:07:28 +0200 | [diff] [blame] | 66 | sprintf((char *)buf, "0x%x", pram); |
| 67 | setenv("pram", (char *)buf); |
| 68 | |
| 69 | varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM; |
| 70 | sprintf((char *)buf, "0x%x", varaddr); |
| 71 | setenv("varaddr", (char *)buf); |
Andreas Huber | 28c63c7 | 2011-09-13 23:06:11 +0000 | [diff] [blame] | 72 | |
| 73 | kernelmem = gd->ram_size - 0x400 * pram; |
| 74 | sprintf((char *)buf, "0x%x", kernelmem); |
| 75 | setenv("kernelmem", (char *)buf); |
| 76 | |
Heiko Schocher | cfc5804 | 2010-04-26 13:07:28 +0200 | [diff] [blame] | 77 | return 0; |
| 78 | } |
| 79 | |
Holger Brunck | 015a60f | 2011-09-14 10:54:12 +0200 | [diff] [blame] | 80 | #if defined(CONFIG_SYS_I2C_INIT_BOARD) |
Heiko Schocher | 466924f | 2010-02-18 08:08:25 +0100 | [diff] [blame] | 81 | #if !defined(CONFIG_MPC83xx) |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 82 | static void i2c_write_start_seq(void) |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 83 | { |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 84 | set_sda(1); |
| 85 | udelay(DELAY_HALF_PERIOD); |
| 86 | set_scl(1); |
| 87 | udelay(DELAY_HALF_PERIOD); |
| 88 | set_sda(0); |
| 89 | udelay(DELAY_HALF_PERIOD); |
| 90 | set_scl(0); |
| 91 | udelay(DELAY_HALF_PERIOD); |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 92 | } |
| 93 | |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 94 | /* |
| 95 | * I2C is a synchronous protocol and resets of the processor in the middle |
| 96 | * of an access can block the I2C Bus until a powerdown of the full unit is |
| 97 | * done. This function toggles the SCL until the SCL and SCA line are |
| 98 | * released, but max. 16 times, after this a I2C start-sequence is sent. |
| 99 | * This I2C Deblocking mechanism was developed by Keymile in association |
| 100 | * with Anatech and Atmel in 1998. |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 101 | */ |
Holger Brunck | bf20a88 | 2011-06-05 22:22:18 +0000 | [diff] [blame] | 102 | int i2c_make_abort(void) |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 103 | { |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 104 | |
| 105 | #if defined(CONFIG_HARD_I2C) && !defined(MACH_TYPE_KM_KIRKWOOD) |
Holger Brunck | b8205f9 | 2012-11-02 00:15:09 +0000 | [diff] [blame] | 106 | immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 107 | i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c; |
| 108 | |
| 109 | /* |
| 110 | * disable I2C controller first, otherwhise it thinks we want to |
| 111 | * talk to the slave port... |
| 112 | */ |
| 113 | clrbits_8(&i2c->i2c_i2mod, 0x01); |
| 114 | |
| 115 | /* Set the PortPins to GPIO */ |
| 116 | setports(1); |
| 117 | #endif |
| 118 | |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 119 | int scl_state = 0; |
| 120 | int sda_state = 0; |
| 121 | int i = 0; |
| 122 | int ret = 0; |
| 123 | |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 124 | if (!get_sda()) { |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 125 | ret = -1; |
| 126 | while (i < 16) { |
| 127 | i++; |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 128 | set_scl(0); |
| 129 | udelay(DELAY_ABORT_SEQ); |
| 130 | set_scl(1); |
| 131 | udelay(DELAY_ABORT_SEQ); |
| 132 | scl_state = get_scl(); |
| 133 | sda_state = get_sda(); |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 134 | if (scl_state && sda_state) { |
| 135 | ret = 0; |
| 136 | break; |
| 137 | } |
| 138 | } |
| 139 | } |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 140 | if (ret == 0) |
| 141 | for (i = 0; i < 5; i++) |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 142 | i2c_write_start_seq(); |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 143 | |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 144 | /* respect stop setup time */ |
| 145 | udelay(DELAY_ABORT_SEQ); |
| 146 | set_scl(1); |
| 147 | udelay(DELAY_ABORT_SEQ); |
| 148 | set_sda(1); |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 149 | get_sda(); |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 150 | |
| 151 | #if defined(CONFIG_HARD_I2C) |
| 152 | /* Set the PortPins back to use for I2C */ |
| 153 | setports(0); |
| 154 | #endif |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 155 | return ret; |
| 156 | } |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 157 | #endif |
| 158 | |
Heiko Schocher | d9e1095 | 2011-03-08 10:51:15 +0100 | [diff] [blame] | 159 | /** |
| 160 | * i2c_init_board - reset i2c bus. When the board is powercycled during a |
| 161 | * bus transfer it might hang; for details see doc/I2C_Edge_Conditions. |
| 162 | */ |
| 163 | void i2c_init_board(void) |
| 164 | { |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 165 | /* Now run the AbortSequence() */ |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 166 | i2c_make_abort(); |
Heiko Schocher | 5e51b48 | 2008-10-15 09:39:08 +0200 | [diff] [blame] | 167 | } |
Holger Brunck | 015a60f | 2011-09-14 10:54:12 +0200 | [diff] [blame] | 168 | #endif |
| 169 | |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 170 | int board_eth_init(bd_t *bis) |
Heiko Schocher | d19a6ec | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 171 | { |
Heiko Schocher | 8ce3dd5 | 2011-03-15 16:52:29 +0100 | [diff] [blame] | 172 | if (ethernet_present()) |
Heiko Schocher | 466924f | 2010-02-18 08:08:25 +0100 | [diff] [blame] | 173 | return cpu_eth_init(bis); |
| 174 | |
| 175 | return -1; |
Heiko Schocher | d19a6ec | 2008-11-21 08:29:40 +0100 | [diff] [blame] | 176 | } |
Holger Brunck | 3066492 | 2011-05-04 01:47:30 +0000 | [diff] [blame] | 177 | |
| 178 | /* |
| 179 | * do_setboardid command |
| 180 | * read out the board id and the hw key from the intventory EEPROM and set |
| 181 | * this values as environment variables. |
| 182 | */ |
| 183 | static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, |
| 184 | char *const argv[]) |
| 185 | { |
| 186 | unsigned char buf[32]; |
| 187 | char *p; |
| 188 | |
| 189 | p = get_local_var("IVM_BoardId"); |
| 190 | if (p == NULL) { |
| 191 | printf("can't get the IVM_Boardid\n"); |
| 192 | return 1; |
| 193 | } |
| 194 | sprintf((char *)buf, "%s", p); |
| 195 | setenv("boardid", (char *)buf); |
Holger Brunck | de79984 | 2011-07-04 22:23:59 +0000 | [diff] [blame] | 196 | printf("set boardid=%s\n", buf); |
Holger Brunck | 3066492 | 2011-05-04 01:47:30 +0000 | [diff] [blame] | 197 | |
| 198 | p = get_local_var("IVM_HWKey"); |
| 199 | if (p == NULL) { |
| 200 | printf("can't get the IVM_HWKey\n"); |
| 201 | return 1; |
| 202 | } |
| 203 | sprintf((char *)buf, "%s", p); |
| 204 | setenv("hwkey", (char *)buf); |
Holger Brunck | de79984 | 2011-07-04 22:23:59 +0000 | [diff] [blame] | 205 | printf("set hwkey=%s\n", buf); |
| 206 | printf("Execute manually saveenv for persistent storage.\n"); |
Holger Brunck | 3066492 | 2011-05-04 01:47:30 +0000 | [diff] [blame] | 207 | |
| 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " |
| 212 | "hwkey from IVM and set in environment"); |
Thomas Herzmann | 2c8a0c8 | 2011-05-12 19:59:22 +0000 | [diff] [blame] | 213 | |
| 214 | /* |
| 215 | * command km_checkbidhwk |
| 216 | * if "boardid" and "hwkey" are not already set in the environment, do: |
| 217 | * if a "boardIdListHex" exists in the environment: |
| 218 | * - read ivm data for boardid and hwkey |
| 219 | * - compare each entry of the boardIdListHex with the |
| 220 | * IVM data: |
| 221 | * if match: |
| 222 | * set environment variables boardid, boardId, |
| 223 | * hwkey, hwKey to the found values |
| 224 | * both (boardid and boardId) are set because |
| 225 | * they might be used differently in the |
| 226 | * application and in the init scripts (?) |
| 227 | * return 0 in case of match, 1 if not match or error |
| 228 | */ |
| 229 | int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc, |
| 230 | char *const argv[]) |
| 231 | { |
| 232 | unsigned long ivmbid = 0, ivmhwkey = 0; |
| 233 | unsigned long envbid = 0, envhwkey = 0; |
| 234 | char *p; |
| 235 | int verbose = argc > 1 && *argv[1] == 'v'; |
| 236 | int rc = 0; |
| 237 | |
| 238 | /* |
| 239 | * first read out the real inventory values, these values are |
| 240 | * already stored in the local hush variables |
| 241 | */ |
| 242 | p = get_local_var("IVM_BoardId"); |
| 243 | if (p == NULL) { |
| 244 | printf("can't get the IVM_Boardid\n"); |
| 245 | return 1; |
| 246 | } |
| 247 | rc = strict_strtoul(p, 16, &ivmbid); |
| 248 | |
| 249 | p = get_local_var("IVM_HWKey"); |
| 250 | if (p == NULL) { |
| 251 | printf("can't get the IVM_HWKey\n"); |
| 252 | return 1; |
| 253 | } |
| 254 | rc = strict_strtoul(p, 16, &ivmhwkey); |
| 255 | |
| 256 | if (!ivmbid || !ivmhwkey) { |
| 257 | printf("Error: IVM_BoardId and/or IVM_HWKey not set!\n"); |
| 258 | return rc; |
| 259 | } |
| 260 | |
| 261 | /* now try to read values from environment if available */ |
| 262 | p = getenv("boardid"); |
| 263 | if (p != NULL) |
| 264 | rc = strict_strtoul(p, 16, &envbid); |
| 265 | p = getenv("hwkey"); |
| 266 | if (p != NULL) |
| 267 | rc = strict_strtoul(p, 16, &envhwkey); |
| 268 | |
| 269 | if (rc != 0) { |
| 270 | printf("strict_strtoul returns error: %d", rc); |
| 271 | return rc; |
| 272 | } |
| 273 | |
| 274 | if (!envbid || !envhwkey) { |
| 275 | /* |
| 276 | * BoardId/HWkey not available in the environment, so try the |
| 277 | * environment variable for BoardId/HWkey list |
| 278 | */ |
| 279 | char *bidhwklist = getenv("boardIdListHex"); |
| 280 | |
| 281 | if (bidhwklist) { |
| 282 | int found = 0; |
| 283 | char *rest = bidhwklist; |
| 284 | char *endp; |
| 285 | |
| 286 | if (verbose) { |
| 287 | printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n", |
| 288 | ivmbid, ivmhwkey); |
| 289 | printf("boardIdHwKeyList: %s\n", |
| 290 | bidhwklist); |
| 291 | } |
| 292 | while (!found) { |
| 293 | /* loop over each bid/hwkey pair in the list */ |
| 294 | unsigned long bid = 0; |
| 295 | unsigned long hwkey = 0; |
| 296 | |
| 297 | while (*rest && !isxdigit(*rest)) |
| 298 | rest++; |
| 299 | /* |
| 300 | * use simple_strtoul because we need &end and |
| 301 | * we know we got non numeric char at the end |
| 302 | */ |
| 303 | bid = simple_strtoul(rest, &endp, 16); |
| 304 | /* BoardId and HWkey are separated with a "_" */ |
| 305 | if (*endp == '_') { |
| 306 | rest = endp + 1; |
| 307 | /* |
| 308 | * use simple_strtoul because we need |
| 309 | * &end |
| 310 | */ |
| 311 | hwkey = simple_strtoul(rest, &endp, 16); |
| 312 | rest = endp; |
| 313 | while (*rest && !isxdigit(*rest)) |
| 314 | rest++; |
| 315 | } |
| 316 | if ((!bid) || (!hwkey)) { |
| 317 | /* end of list */ |
| 318 | break; |
| 319 | } |
| 320 | if (verbose) { |
| 321 | printf("trying bid=0x%lX, hwkey=%ld\n", |
| 322 | bid, hwkey); |
| 323 | } |
| 324 | /* |
| 325 | * Compare the values of the found entry in the |
| 326 | * list with the valid values which are stored |
| 327 | * in the inventory eeprom. If they are equal |
Holger Brunck | bc4e15f | 2011-06-05 22:22:17 +0000 | [diff] [blame] | 328 | * set the values in environment variables. |
Thomas Herzmann | 2c8a0c8 | 2011-05-12 19:59:22 +0000 | [diff] [blame] | 329 | */ |
| 330 | if ((bid == ivmbid) && (hwkey == ivmhwkey)) { |
| 331 | char buf[10]; |
| 332 | |
| 333 | found = 1; |
| 334 | envbid = bid; |
| 335 | envhwkey = hwkey; |
| 336 | sprintf(buf, "%lx", bid); |
| 337 | setenv("boardid", buf); |
| 338 | sprintf(buf, "%lx", hwkey); |
| 339 | setenv("hwkey", buf); |
Thomas Herzmann | 2c8a0c8 | 2011-05-12 19:59:22 +0000 | [diff] [blame] | 340 | } |
| 341 | } /* end while( ! found ) */ |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | /* compare now the values */ |
| 346 | if ((ivmbid == envbid) && (ivmhwkey == envhwkey)) { |
| 347 | printf("boardid=0x%3lX, hwkey=%ld\n", envbid, envhwkey); |
| 348 | rc = 0; /* match */ |
| 349 | } else { |
Holger Brunck | de79984 | 2011-07-04 22:23:59 +0000 | [diff] [blame] | 350 | printf("Error: env boardid=0x%3lX, hwkey=%ld\n", envbid, |
| 351 | envhwkey); |
Thomas Herzmann | 2c8a0c8 | 2011-05-12 19:59:22 +0000 | [diff] [blame] | 352 | printf(" IVM bId=0x%3lX, hwKey=%ld\n", ivmbid, ivmhwkey); |
| 353 | rc = 1; /* don't match */ |
| 354 | } |
| 355 | return rc; |
| 356 | } |
| 357 | |
| 358 | U_BOOT_CMD(km_checkbidhwk, 2, 0, do_checkboardidhwk, |
| 359 | "check boardid and hwkey", |
| 360 | "[v]\n - check environment parameter "\ |
| 361 | "\"boardIdListHex\" against stored boardid and hwkey "\ |
| 362 | "from the IVM\n v: verbose output" |
| 363 | ); |
Thomas Herzmann | b2c3160 | 2012-05-04 10:55:58 +0200 | [diff] [blame] | 364 | |
| 365 | /* |
| 366 | * command km_checktestboot |
| 367 | * if the testpin of the board is asserted, return 1 |
| 368 | * * else return 0 |
| 369 | */ |
| 370 | int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc, |
| 371 | char *const argv[]) |
| 372 | { |
| 373 | int testpin = 0; |
| 374 | char *s = NULL; |
| 375 | int testboot = 0; |
| 376 | int verbose = argc > 1 && *argv[1] == 'v'; |
| 377 | |
| 378 | #if defined(CONFIG_POST) |
| 379 | testpin = post_hotkeys_pressed(); |
| 380 | s = getenv("test_bank"); |
| 381 | #endif |
| 382 | /* when test_bank is not set, act as if testpin is not asserted */ |
| 383 | testboot = (testpin != 0) && (s); |
| 384 | if (verbose) { |
| 385 | printf("testpin = %d\n", testpin); |
| 386 | printf("test_bank = %s\n", s ? s : "not set"); |
| 387 | printf("boot test app : %s\n", (testboot) ? "yes" : "no"); |
| 388 | } |
| 389 | /* return 0 means: testboot, therefore we need the inversion */ |
| 390 | return !testboot; |
| 391 | } |
| 392 | |
| 393 | U_BOOT_CMD(km_checktestboot, 2, 0, do_checktestboot, |
| 394 | "check if testpin is asserted", |
| 395 | "[v]\n v - verbose output" |
| 396 | ); |