flash.c 858 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * flash.c - helper commands for working with GPIO-assisted flash
  3. *
  4. * Copyright (c) 2005-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <common.h>
  9. #include <command.h>
  10. #include <asm/blackfin.h>
  11. #include "gpio_cfi_flash.h"
  12. int do_pf(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  13. {
  14. ulong faddr = CONFIG_SYS_FLASH_BASE;
  15. ushort data;
  16. ulong dflg;
  17. if (argc == 3) {
  18. dflg = simple_strtoul(argv[1], NULL, 16);
  19. faddr |= (dflg << 21);
  20. dflg = simple_strtoul(argv[2], NULL, 16);
  21. faddr |= (dflg << 22);
  22. gpio_cfi_flash_swizzle((void *)faddr);
  23. } else {
  24. data = bfin_read_PORTFIO();
  25. printf("Port F data %04x (PF4:%i PF5:%i)\n", data,
  26. !!(data & PF4), !!(data & PF5));
  27. }
  28. return 0;
  29. }
  30. U_BOOT_CMD(pf, 3, 0, do_pf,
  31. "set/clear PF4/PF5 GPIO flash bank switch\n",
  32. "<pf4> <pf5> - set PF4/PF5 GPIO pin state\n");