flash.c 755 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_ph(cmd_tbl_t *cmdtp, int flag, int argc, char * const 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_PORTHIO();
  23. printf("Port H data %04x (PH0:%i)\n", data, !!(data & PH0));
  24. }
  25. return 0;
  26. }
  27. U_BOOT_CMD(ph, 3, 0, do_ph,
  28. "set/clear PH0 GPIO flash bank switch\n",
  29. "<ph0> - set PH0 GPIO pin state\n");