flash.c 748 B

12345678910111213141516171819202122232425262728293031323334
  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 > 1) {
  18. dflg = simple_strtoul(argv[1], NULL, 16);
  19. faddr |= (dflg << 21);
  20. gpio_cfi_flash_swizzle((void *)faddr);
  21. } else {
  22. data = bfin_read_PORTFIO();
  23. printf("Port F data %04x (PF4:%i)\n", data, !!(data & PF4));
  24. }
  25. return 0;
  26. }
  27. U_BOOT_CMD(pf, 3, 0, do_pf,
  28. "set/clear PF4 GPIO flash bank switch\n",
  29. "<pf4> - set PF4 GPIO pin state\n");