]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/tcm-bf537/flash.c
52c5bd83c9c077e1f77ebf411f4f5d2e30111276
[karo-tx-uboot.git] / board / tcm-bf537 / flash.c
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
9 #include <common.h>
10 #include <command.h>
11 #include <asm/blackfin.h>
12 #include "gpio_cfi_flash.h"
13
14 int do_pf(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
15 {
16         ulong faddr = CONFIG_SYS_FLASH_BASE;
17         ushort data;
18         ulong dflg;
19
20         if (argc == 3) {
21                 dflg = simple_strtoul(argv[1], NULL, 16);
22                 faddr |= (dflg << 21);
23                 dflg = simple_strtoul(argv[2], NULL, 16);
24                 faddr |= (dflg << 22);
25                 gpio_cfi_flash_swizzle((void *)faddr);
26         } else {
27                 data = bfin_read_PORTFIO();
28                 printf("Port F data %04x (PF4:%i PF5:%i)\n", data,
29                         !!(data & PF4), !!(data & PF5));
30         }
31
32         return 0;
33 }
34
35 U_BOOT_CMD(pf, 3, 0, do_pf,
36         "set/clear PF4/PF5 GPIO flash bank switch\n",
37         "<pf4> <pf5> - set PF4/PF5 GPIO pin state\n");