Commit 029e728fc247bff680d202316071af64ca376aea

Authored by Eric Lee
1 parent 27b1dc5fe2

Unlock SPI NOR in sf utility.

Showing 1 changed file with 15 additions and 3 deletions Side-by-side Diff

... ... @@ -10,6 +10,7 @@
10 10 #include <div64.h>
11 11 #include <malloc.h>
12 12 #include <spi_flash.h>
  13 +#include <asm/gpio.h>
13 14  
14 15 #include <asm/io.h>
15 16  
16 17  
... ... @@ -502,7 +503,9 @@
502 503 ++argv;
503 504  
504 505 if (strcmp(cmd, "probe") == 0) {
  506 + gpio_direction_output(IMX_GPIO_NR(4,20), 1);
505 507 ret = do_spi_flash_probe(argc, argv);
  508 + gpio_direction_output(IMX_GPIO_NR(4,20), 0);
506 509 goto done;
507 510 }
508 511  
509 512  
510 513  
511 514  
512 515  
... ... @@ -513,13 +516,22 @@
513 516 }
514 517  
515 518 if (strcmp(cmd, "read") == 0 || strcmp(cmd, "write") == 0 ||
516   - strcmp(cmd, "update") == 0)
  519 + strcmp(cmd, "update") == 0){
  520 + gpio_direction_output(IMX_GPIO_NR(4,20), 1);
517 521 ret = do_spi_flash_read_write(argc, argv);
518   - else if (strcmp(cmd, "erase") == 0)
  522 + gpio_direction_output(IMX_GPIO_NR(4,20), 0);
  523 + }
  524 + else if (strcmp(cmd, "erase") == 0){
  525 + gpio_direction_output(IMX_GPIO_NR(4,20), 1);
519 526 ret = do_spi_flash_erase(argc, argv);
  527 + gpio_direction_output(IMX_GPIO_NR(4,20), 0);
  528 + }
520 529 #ifdef CONFIG_CMD_SF_TEST
521   - else if (!strcmp(cmd, "test"))
  530 + else if (!strcmp(cmd, "test")){
  531 + gpio_direction_output(IMX_GPIO_NR(4,20), 1);
522 532 ret = do_spi_flash_test(argc, argv);
  533 + gpio_direction_output(IMX_GPIO_NR(4,20), 0);
  534 + }
523 535 #endif
524 536 else
525 537 ret = -1;