Commit 4326b454744b47777f6575d62e84622d941da5ea

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent 60911104f3

cmd: remove Blackfin specific commands

These commands have no user since commit ea3310e8aafa ("Blackfin:
Remove").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 7 changed files with 0 additions and 734 deletions Side-by-side Diff

... ... @@ -23,7 +23,6 @@
23 23 obj-$(CONFIG_CMD_BMP) += bmp.o
24 24 obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o
25 25 obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o
26   -obj-$(CONFIG_CMD_BOOTLDR) += bootldr.o
27 26 obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o
28 27 obj-$(CONFIG_CMD_BOOTZ) += bootz.o
29 28 obj-$(CONFIG_CMD_BOOTI) += booti.o
... ... @@ -32,7 +31,6 @@
32 31 obj-$(CONFIG_CMD_CLK) += clk.o
33 32 obj-$(CONFIG_CMD_CONFIG) += config.o
34 33 obj-$(CONFIG_CMD_CONSOLE) += console.o
35   -obj-$(CONFIG_CMD_CPLBINFO) += cplbinfo.o
36 34 obj-$(CONFIG_CMD_CPU) += cpu.o
37 35 obj-$(CONFIG_DATAFLASH_MMC_SELECT) += dataflash_mmc_mux.o
38 36 obj-$(CONFIG_CMD_DATE) += date.o
... ... @@ -77,7 +75,6 @@
77 75 obj-$(CONFIG_CMD_ITEST) += itest.o
78 76 obj-$(CONFIG_CMD_JFFS2) += jffs2.o
79 77 obj-$(CONFIG_CMD_CRAMFS) += cramfs.o
80   -obj-$(CONFIG_CMD_LDRINFO) += ldrinfo.o
81 78 obj-$(CONFIG_LED_STATUS_CMD) += legacy_led.o
82 79 obj-$(CONFIG_CMD_LED) += led.o
83 80 obj-$(CONFIG_CMD_LICENSE) += license.o
... ... @@ -100,7 +97,6 @@
100 97 obj-$(CONFIG_CMD_NAND) += nand.o
101 98 obj-$(CONFIG_CMD_NET) += net.o
102 99 obj-$(CONFIG_CMD_ONENAND) += onenand.o
103   -obj-$(CONFIG_CMD_OTP) += otp.o
104 100 obj-$(CONFIG_CMD_PART) += part.o
105 101 ifdef CONFIG_PCI
106 102 obj-$(CONFIG_CMD_PCI) += pci.o
107 103  
... ... @@ -119,9 +115,7 @@
119 115 obj-$(CONFIG_SCSI) += scsi.o disk.o
120 116 obj-$(CONFIG_CMD_SHA1SUM) += sha1sum.o
121 117 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
122   -obj-$(CONFIG_CMD_SOFTSWITCH) += softswitch.o
123 118 obj-$(CONFIG_CMD_SPI) += spi.o
124   -obj-$(CONFIG_CMD_SPIBOOTLDR) += spibootldr.o
125 119 obj-$(CONFIG_CMD_STRINGS) += strings.o
126 120 obj-$(CONFIG_CMD_TERMINAL) += terminal.o
127 121 obj-$(CONFIG_CMD_TIME) += time.o
cmd/bootldr.c
1   -/*
2   - * U-Boot - bootldr.c
3   - *
4   - * Copyright (c) 2005-2008 Analog Devices Inc.
5   - *
6   - * See file CREDITS for list of people who contributed to this
7   - * project.
8   - *
9   - * Licensed under the GPL-2 or later.
10   - */
11   -
12   -#include <config.h>
13   -#include <common.h>
14   -#include <command.h>
15   -
16   -#include <asm/blackfin.h>
17   -#include <asm/mach-common/bits/bootrom.h>
18   -
19   -/* Simple sanity check on the specified address to make sure it contains
20   - * an LDR image of some sort.
21   - */
22   -static bool ldr_valid_signature(uint8_t *data)
23   -{
24   -#if defined(__ADSPBF561__)
25   -
26   - /* BF56x has a 4 byte global header */
27   - if (data[3] == (GFLAG_56X_SIGN_MAGIC << (GFLAG_56X_SIGN_SHIFT - 24)))
28   - return true;
29   -
30   -#elif defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
31   - defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) || \
32   - defined(__ADSPBF538__) || defined(__ADSPBF539__)
33   -
34   - /* all the BF53x should start at this address mask */
35   - uint32_t addr;
36   - memmove(&addr, data, sizeof(addr));
37   - if ((addr & 0xFF0FFF0F) == 0xFF000000)
38   - return true;
39   -#else
40   -
41   - /* everything newer has a magic byte */
42   - uint32_t count;
43   - memmove(&count, data + 8, sizeof(count));
44   - if (data[3] == 0xAD && count == 0)
45   - return true;
46   -
47   -#endif
48   -
49   - return false;
50   -}
51   -
52   -/* If the Blackfin is new enough, the Blackfin on-chip ROM supports loading
53   - * LDRs from random memory addresses. So whenever possible, use that. In
54   - * the older cases (BF53x/BF561), parse the LDR format ourselves.
55   - */
56   -static void ldr_load(uint8_t *base_addr)
57   -{
58   -#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
59   - /*defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) ||*/\
60   - defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
61   -
62   - uint32_t addr;
63   - uint32_t count;
64   - uint16_t flags;
65   -
66   - /* the bf56x has a 4 byte global header ... but it is useless to
67   - * us when booting an LDR from a memory address, so skip it
68   - */
69   -# ifdef __ADSPBF561__
70   - base_addr += 4;
71   -# endif
72   -
73   - memmove(&flags, base_addr + 8, sizeof(flags));
74   - bfin_write_EVT1(flags & BFLAG_53X_RESVECT ? 0xFFA00000 : 0xFFA08000);
75   -
76   - do {
77   - /* block header may not be aligned */
78   - memmove(&addr, base_addr, sizeof(addr));
79   - memmove(&count, base_addr+4, sizeof(count));
80   - memmove(&flags, base_addr+8, sizeof(flags));
81   - base_addr += sizeof(addr) + sizeof(count) + sizeof(flags);
82   -
83   - printf("loading to 0x%08x (%#x bytes) flags: 0x%04x\n",
84   - addr, count, flags);
85   -
86   - if (!(flags & BFLAG_53X_IGNORE)) {
87   - if (flags & BFLAG_53X_ZEROFILL)
88   - memset((void *)addr, 0x00, count);
89   - else
90   - memcpy((void *)addr, base_addr, count);
91   -
92   - if (flags & BFLAG_53X_INIT) {
93   - void (*init)(void) = (void *)addr;
94   - init();
95   - }
96   - }
97   -
98   - if (!(flags & BFLAG_53X_ZEROFILL))
99   - base_addr += count;
100   - } while (!(flags & BFLAG_53X_FINAL));
101   -
102   -#endif
103   -}
104   -
105   -/* For BF537, we use the _BOOTROM_BOOT_DXE_FLASH funky ROM function.
106   - * For all other BF53x/BF56x, we just call the entry point.
107   - * For everything else (newer), we use _BOOTROM_MEMBOOT ROM function.
108   - */
109   -static void ldr_exec(void *addr)
110   -{
111   -#if defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__)
112   -
113   - /* restore EVT1 to reset value as this is what the bootrom uses as
114   - * the default entry point when booting the final block of LDRs
115   - */
116   - bfin_write_EVT1(L1_INST_SRAM);
117   - __asm__("call (%0);" : : "a"(_BOOTROM_MEMBOOT), "q7"(addr) : "RETS", "memory");
118   -
119   -#elif defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
120   - defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
121   -
122   - void (*ldr_entry)(void) = (void *)bfin_read_EVT1();
123   - ldr_entry();
124   -
125   -#else
126   -
127   - int32_t (*BOOTROM_MEM)(void *, int32_t, int32_t, void *) = (void *)_BOOTROM_MEMBOOT;
128   - BOOTROM_MEM(addr, 0, 0, NULL);
129   -
130   -#endif
131   -}
132   -
133   -/*
134   - * the bootldr command loads an address, checks to see if there
135   - * is a Boot stream that the on-chip BOOTROM can understand,
136   - * and loads it via the BOOTROM Callback. It is possible
137   - * to also add booting from SPI, or TWI, but this function does
138   - * not currently support that.
139   - */
140   -int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
141   -{
142   - void *addr;
143   -
144   - /* Get the address */
145   - if (argc < 2)
146   - addr = (void *)load_addr;
147   - else
148   - addr = (void *)simple_strtoul(argv[1], NULL, 16);
149   -
150   - /* Check if it is a LDR file */
151   - if (ldr_valid_signature(addr)) {
152   - printf("## Booting ldr image at 0x%p ...\n", addr);
153   - ldr_load(addr);
154   -
155   - icache_disable();
156   - dcache_disable();
157   -
158   - ldr_exec(addr);
159   - } else
160   - printf("## No ldr image at address 0x%p\n", addr);
161   -
162   - return 0;
163   -}
164   -
165   -U_BOOT_CMD(
166   - bootldr, 2, 0, do_bootldr,
167   - "boot ldr image from memory",
168   - "[addr]\n"
169   - ""
170   -);
cmd/cplbinfo.c
1   -/*
2   - * cmd_cplbinfo.c - dump the instruction/data cplb tables
3   - *
4   - * Copyright (c) 2007-2008 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 <asm/cplb.h>
13   -#include <asm/mach-common/bits/mpu.h>
14   -
15   -/*
16   - * Translate the PAGE_SIZE bits into a human string
17   - */
18   -static const char *cplb_page_size(uint32_t data)
19   -{
20   - static const char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
21   - return page_size_string_table[(data & PAGE_SIZE_MASK) >> PAGE_SIZE_SHIFT];
22   -}
23   -
24   -/*
25   - * show a hardware cplb table
26   - */
27   -static void show_cplb_table(uint32_t *addr, uint32_t *data)
28   -{
29   - int i;
30   - printf(" Address Data Size Valid Locked\n");
31   - for (i = 1; i <= 16; ++i) {
32   - printf(" %2i 0x%p 0x%05X %s %c %c\n",
33   - i, (void *)*addr, *data,
34   - cplb_page_size(*data),
35   - (*data & CPLB_VALID ? 'Y' : 'N'),
36   - (*data & CPLB_LOCK ? 'Y' : 'N'));
37   - ++addr;
38   - ++data;
39   - }
40   -}
41   -
42   -/*
43   - * display current instruction and data cplb tables
44   - */
45   -int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
46   -{
47   - printf("%s CPLB table [%08x]:\n", "Instruction", *(uint32_t *)DMEM_CONTROL);
48   - show_cplb_table((uint32_t *)ICPLB_ADDR0, (uint32_t *)ICPLB_DATA0);
49   -
50   - printf("%s CPLB table [%08x]:\n", "Data", *(uint32_t *)IMEM_CONTROL);
51   - show_cplb_table((uint32_t *)DCPLB_ADDR0, (uint32_t *)DCPLB_DATA0);
52   -
53   - return 0;
54   -}
55   -
56   -U_BOOT_CMD(
57   - cplbinfo, 1, 0, do_cplbinfo,
58   - "display current CPLB tables",
59   - ""
60   -);
cmd/ldrinfo.c
1   -/*
2   - * U-Boot - ldrinfo
3   - *
4   - * Copyright (c) 2010 Analog Devices Inc.
5   - *
6   - * See file CREDITS for list of people who contributed to this
7   - * project.
8   - *
9   - * Licensed under the GPL-2 or later.
10   - */
11   -
12   -#include <config.h>
13   -#include <common.h>
14   -#include <command.h>
15   -
16   -#include <asm/blackfin.h>
17   -#include <asm/mach-common/bits/bootrom.h>
18   -
19   -static uint32_t ldrinfo_header(const void *addr)
20   -{
21   - uint32_t skip = 0;
22   -
23   -#if defined(__ADSPBF561__)
24   - /* BF56x has a 4 byte global header */
25   - uint32_t header, sign;
26   - static const char * const spi_speed[] = {
27   - "500K", "1M", "2M", "??",
28   - };
29   -
30   - memcpy(&header, addr, sizeof(header));
31   -
32   - sign = (header & GFLAG_56X_SIGN_MASK) >> GFLAG_56X_SIGN_SHIFT;
33   - printf("Header: %08X ( %s-bit-flash wait:%i hold:%i spi:%s %s)\n",
34   - header,
35   - (header & GFLAG_56X_16BIT_FLASH) ? "16" : "8",
36   - (header & GFLAG_56X_WAIT_MASK) >> GFLAG_56X_WAIT_SHIFT,
37   - (header & GFLAG_56X_HOLD_MASK) >> GFLAG_56X_HOLD_SHIFT,
38   - spi_speed[(header & GFLAG_56X_SPI_MASK) >> GFLAG_56X_SPI_SHIFT],
39   - sign == GFLAG_56X_SIGN_MAGIC ? "" : "!!hdrsign!! ");
40   -
41   - skip = 4;
42   -#endif
43   -
44   - /* |Block @ 12345678: 12345678 12345678 12345678 12345678 | */
45   -#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
46   - defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) || \
47   - defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
48   - printf(" Address Count Flags\n");
49   -#else
50   - printf(" BCode Address Count Argument\n");
51   -#endif
52   -
53   - return skip;
54   -}
55   -
56   -struct ldr_flag {
57   - uint16_t flag;
58   - const char *desc;
59   -};
60   -
61   -static uint32_t ldrinfo_block(const void *base_addr)
62   -{
63   - uint32_t count;
64   -
65   - printf("Block @ %08X: ", (uint32_t)base_addr);
66   -
67   -#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
68   - defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) || \
69   - defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
70   -
71   - uint32_t addr, pval;
72   - uint16_t flags;
73   - int i;
74   - static const struct ldr_flag ldr_flags[] = {
75   - { BFLAG_53X_ZEROFILL, "zerofill" },
76   - { BFLAG_53X_RESVECT, "resvect" },
77   - { BFLAG_53X_INIT, "init" },
78   - { BFLAG_53X_IGNORE, "ignore" },
79   - { BFLAG_53X_COMPRESSED, "compressed"},
80   - { BFLAG_53X_FINAL, "final" },
81   - };
82   -
83   - memcpy(&addr, base_addr, sizeof(addr));
84   - memcpy(&count, base_addr+4, sizeof(count));
85   - memcpy(&flags, base_addr+8, sizeof(flags));
86   -
87   - printf("%08X %08X %04X ( ", addr, count, flags);
88   -
89   - for (i = 0; i < ARRAY_SIZE(ldr_flags); ++i)
90   - if (flags & ldr_flags[i].flag)
91   - printf("%s ", ldr_flags[i].desc);
92   -
93   - pval = (flags & BFLAG_53X_PFLAG_MASK) >> BFLAG_53X_PFLAG_SHIFT;
94   - if (pval)
95   - printf("gpio%i ", pval);
96   - pval = (flags & BFLAG_53X_PPORT_MASK) >> BFLAG_53X_PPORT_SHIFT;
97   - if (pval)
98   - printf("port%c ", 'e' + pval);
99   -
100   - if (flags & BFLAG_53X_ZEROFILL)
101   - count = 0;
102   - if (flags & BFLAG_53X_FINAL)
103   - count = 0;
104   - else
105   - count += sizeof(addr) + sizeof(count) + sizeof(flags);
106   -
107   -#else
108   -
109   - const uint8_t *raw8 = base_addr;
110   - uint32_t bcode, addr, arg, sign, chk;
111   - int i;
112   - static const struct ldr_flag ldr_flags[] = {
113   - { BFLAG_SAFE, "safe" },
114   - { BFLAG_AUX, "aux" },
115   - { BFLAG_FILL, "fill" },
116   - { BFLAG_QUICKBOOT, "quickboot" },
117   - { BFLAG_CALLBACK, "callback" },
118   - { BFLAG_INIT, "init" },
119   - { BFLAG_IGNORE, "ignore" },
120   - { BFLAG_INDIRECT, "indirect" },
121   - { BFLAG_FIRST, "first" },
122   - { BFLAG_FINAL, "final" },
123   - };
124   -
125   - memcpy(&bcode, base_addr, sizeof(bcode));
126   - memcpy(&addr, base_addr+4, sizeof(addr));
127   - memcpy(&count, base_addr+8, sizeof(count));
128   - memcpy(&arg, base_addr+12, sizeof(arg));
129   -
130   - printf("%08X %08X %08X %08X ( ", bcode, addr, count, arg);
131   -
132   - if (addr % 4)
133   - printf("!!addralgn!! ");
134   - if (count % 4)
135   - printf("!!cntalgn!! ");
136   -
137   - sign = (bcode & BFLAG_HDRSIGN_MASK) >> BFLAG_HDRSIGN_SHIFT;
138   - if (sign != BFLAG_HDRSIGN_MAGIC)
139   - printf("!!hdrsign!! ");
140   -
141   - chk = 0;
142   - for (i = 0; i < 16; ++i)
143   - chk ^= raw8[i];
144   - if (chk)
145   - printf("!!hdrchk!! ");
146   -
147   - printf("dma:%i ", bcode & BFLAG_DMACODE_MASK);
148   -
149   - for (i = 0; i < ARRAY_SIZE(ldr_flags); ++i)
150   - if (bcode & ldr_flags[i].flag)
151   - printf("%s ", ldr_flags[i].desc);
152   -
153   - if (bcode & BFLAG_FILL)
154   - count = 0;
155   - if (bcode & BFLAG_FINAL)
156   - count = 0;
157   - else
158   - count += sizeof(bcode) + sizeof(addr) + sizeof(count) + sizeof(arg);
159   -
160   -#endif
161   -
162   - printf(")\n");
163   -
164   - return count;
165   -}
166   -
167   -static int do_ldrinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
168   -{
169   - const void *addr;
170   - uint32_t skip;
171   -
172   - /* Get the address */
173   - if (argc < 2)
174   - addr = (void *)load_addr;
175   - else
176   - addr = (void *)simple_strtoul(argv[1], NULL, 16);
177   -
178   - /* Walk the LDR */
179   - addr += ldrinfo_header(addr);
180   - do {
181   - skip = ldrinfo_block(addr);
182   - addr += skip;
183   - } while (skip);
184   -
185   - return 0;
186   -}
187   -
188   -U_BOOT_CMD(
189   - ldrinfo, 2, 0, do_ldrinfo,
190   - "validate ldr image in memory",
191   - "[addr]\n"
192   -);
1   -/*
2   - * cmd_otp.c - interface to Blackfin on-chip One-Time-Programmable memory
3   - *
4   - * Copyright (c) 2007-2008 Analog Devices Inc.
5   - *
6   - * Licensed under the GPL-2 or later.
7   - */
8   -
9   -/* There are 512 128-bit "pages" (0x000 through 0x1FF).
10   - * The pages are accessable as 64-bit "halfpages" (an upper and lower half).
11   - * The pages are not part of the memory map. There is an OTP controller which
12   - * handles scanning in/out of bits. While access is done through OTP MMRs,
13   - * the bootrom provides C-callable helper functions to handle the interaction.
14   - */
15   -
16   -#include <config.h>
17   -#include <common.h>
18   -#include <command.h>
19   -#include <console.h>
20   -
21   -#include <asm/blackfin.h>
22   -#include <asm/clock.h>
23   -#include <asm/mach-common/bits/otp.h>
24   -
25   -static const char *otp_strerror(uint32_t err)
26   -{
27   - switch (err) {
28   - case 0: return "no error";
29   - case OTP_WRITE_ERROR: return "OTP fuse write error";
30   - case OTP_READ_ERROR: return "OTP fuse read error";
31   - case OTP_ACC_VIO_ERROR: return "invalid OTP address";
32   - case OTP_DATA_MULT_ERROR: return "multiple bad bits detected";
33   - case OTP_ECC_MULT_ERROR: return "error in ECC bits";
34   - case OTP_PREV_WR_ERROR: return "space already written";
35   - case OTP_DATA_SB_WARN: return "single bad bit in half page";
36   - case OTP_ECC_SB_WARN: return "single bad bit in ECC";
37   - default: return "unknown error";
38   - }
39   -}
40   -
41   -#define lowup(x) ((x) % 2 ? "upper" : "lower")
42   -
43   -static int check_voltage(void)
44   -{
45   - /* Make sure voltage limits are within datasheet spec */
46   - uint16_t vr_ctl = bfin_read_VR_CTL();
47   -
48   -#ifdef __ADSPBF54x__
49   - /* 0.9V <= VDDINT <= 1.1V */
50   - if ((vr_ctl & 0xc) && (vr_ctl & 0xc0) == 0xc0)
51   - return 1;
52   -#else
53   - /* for the parts w/out qualification yet */
54   - (void)vr_ctl;
55   -#endif
56   -
57   - return 0;
58   -}
59   -
60   -static void set_otp_timing(bool write)
61   -{
62   - static uint32_t timing;
63   - if (!timing) {
64   - uint32_t tp1, tp2, tp3;
65   - /* OTP_TP1 = 1000 / sclk_period (in nanoseconds)
66   - * OTP_TP1 = 1000 / (1 / get_sclk() * 10^9)
67   - * OTP_TP1 = (1000 * get_sclk()) / 10^9
68   - * OTP_TP1 = get_sclk() / 10^6
69   - */
70   - tp1 = get_sclk() / 1000000;
71   - /* OTP_TP2 = 400 / (2 * sclk_period)
72   - * OTP_TP2 = 400 / (2 * 1 / get_sclk() * 10^9)
73   - * OTP_TP2 = (400 * get_sclk()) / (2 * 10^9)
74   - * OTP_TP2 = (2 * get_sclk()) / 10^7
75   - */
76   - tp2 = (2 * get_sclk() / 10000000) << 8;
77   - /* OTP_TP3 = magic constant */
78   - tp3 = (0x1401) << 15;
79   - timing = tp1 | tp2 | tp3;
80   - }
81   -
82   - bfrom_OtpCommand(OTP_INIT, write ? timing : timing & ~(-1 << 15));
83   -}
84   -
85   -int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
86   -{
87   - char *cmd;
88   - uint32_t ret, base_flags;
89   - bool prompt_user, force_read;
90   - uint32_t (*otp_func)(uint32_t page, uint32_t flags, uint64_t *page_content);
91   -
92   - if (argc < 4) {
93   - usage:
94   - return CMD_RET_USAGE;
95   - }
96   -
97   - prompt_user = false;
98   - base_flags = 0;
99   - cmd = argv[1];
100   - if (!strcmp(cmd, "read"))
101   - otp_func = bfrom_OtpRead;
102   - else if (!strcmp(cmd, "dump")) {
103   - otp_func = bfrom_OtpRead;
104   - force_read = true;
105   - } else if (!strcmp(cmd, "write")) {
106   - otp_func = bfrom_OtpWrite;
107   - base_flags = OTP_CHECK_FOR_PREV_WRITE;
108   - if (!strcmp(argv[2], "--force")) {
109   - argv++;
110   - --argc;
111   - } else
112   - prompt_user = false;
113   - } else if (!strcmp(cmd, "lock")) {
114   - if (argc != 4)
115   - goto usage;
116   - otp_func = bfrom_OtpWrite;
117   - base_flags = OTP_LOCK;
118   - } else
119   - goto usage;
120   -
121   - uint64_t *addr = (uint64_t *)simple_strtoul(argv[2], NULL, 16);
122   - uint32_t page = simple_strtoul(argv[3], NULL, 16);
123   - uint32_t flags;
124   - size_t i, count;
125   - ulong half;
126   -
127   - if (argc > 4)
128   - count = simple_strtoul(argv[4], NULL, 16);
129   - else
130   - count = 2;
131   -
132   - if (argc > 5) {
133   - half = simple_strtoul(argv[5], NULL, 16);
134   - if (half != 0 && half != 1) {
135   - puts("Error: 'half' can only be '0' or '1'\n");
136   - goto usage;
137   - }
138   - } else
139   - half = 0;
140   -
141   - /* "otp lock" has slightly different semantics */
142   - if (base_flags & OTP_LOCK) {
143   - count = page;
144   - page = (uint32_t)addr;
145   - addr = NULL;
146   - }
147   -
148   - /* do to the nature of OTP, make sure users are sure */
149   - if (prompt_user) {
150   - printf(
151   - "Writing one time programmable memory\n"
152   - "Make sure your operating voltages and temperature are within spec\n"
153   - " source address: 0x%p\n"
154   - " OTP destination: %s page 0x%03X - %s page 0x%03lX\n"
155   - " number to write: %lu halfpages\n"
156   - " type \"YES\" (no quotes) to confirm: ",
157   - addr,
158   - lowup(half), page,
159   - lowup(half + count - 1), page + (half + count - 1) / 2,
160   - half + count
161   - );
162   - if (!confirm_yesno()) {
163   - printf(" Aborting\n");
164   - return 1;
165   - }
166   - }
167   -
168   - printf("OTP memory %s: addr 0x%p page 0x%03X count %zu ... ",
169   - cmd, addr, page, count);
170   -
171   - set_otp_timing(otp_func == bfrom_OtpWrite);
172   - if (otp_func == bfrom_OtpWrite && check_voltage()) {
173   - puts("ERROR: VDDINT voltage is out of spec for writing\n");
174   - return -1;
175   - }
176   -
177   - /* Do the actual reading/writing stuff */
178   - ret = 0;
179   - for (i = half; i < count + half; ++i) {
180   - flags = base_flags | (i % 2 ? OTP_UPPER_HALF : OTP_LOWER_HALF);
181   - try_again:
182   - ret = otp_func(page, flags, addr);
183   - if (ret & OTP_MASTER_ERROR) {
184   - if (force_read) {
185   - if (flags & OTP_NO_ECC)
186   - break;
187   - else
188   - flags |= OTP_NO_ECC;
189   - puts("E");
190   - goto try_again;
191   - } else
192   - break;
193   - } else if (ret)
194   - puts("W");
195   - else
196   - puts(".");
197   - if (!(base_flags & OTP_LOCK)) {
198   - ++addr;
199   - if (i % 2)
200   - ++page;
201   - } else
202   - ++page;
203   - }
204   - if (ret & 0x1)
205   - printf("\nERROR at page 0x%03X (%s-halfpage): 0x%03X: %s\n",
206   - page, lowup(i), ret, otp_strerror(ret));
207   - else
208   - puts(" done\n");
209   -
210   - /* Make sure we disable writing */
211   - set_otp_timing(false);
212   - bfrom_OtpCommand(OTP_CLOSE, 0);
213   -
214   - return ret;
215   -}
216   -
217   -U_BOOT_CMD(
218   - otp, 7, 0, do_otp,
219   - "One-Time-Programmable sub-system",
220   - "read <addr> <page> [count] [half]\n"
221   - " - read 'count' half-pages starting at 'page' (offset 'half') to 'addr'\n"
222   - "otp dump <addr> <page> [count] [half]\n"
223   - " - like 'otp read', but skip read errors\n"
224   - "otp write [--force] <addr> <page> [count] [half]\n"
225   - " - write 'count' half-pages starting at 'page' (offset 'half') from 'addr'\n"
226   - "otp lock <page> <count>\n"
227   - " - lock 'count' pages starting at 'page'"
228   -);
cmd/softswitch.c
1   -/*
2   - * cmd_softswitch.c - set the softswitch for bf60x
3   - *
4   - * Copyright (c) 2012 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 <asm/soft_switch.h>
13   -
14   -int do_softswitch(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15   -{
16   - int switchaddr, value, pin, port;
17   -
18   - if (argc != 5)
19   - return CMD_RET_USAGE;
20   -
21   - if (strcmp(argv[2], "GPA") == 0)
22   - port = IO_PORT_A;
23   - else if (strcmp(argv[2], "GPB") == 0)
24   - port = IO_PORT_B;
25   - else
26   - return CMD_RET_USAGE;
27   -
28   - switchaddr = simple_strtoul(argv[1], NULL, 16);
29   - pin = simple_strtoul(argv[3], NULL, 16);
30   - value = simple_strtoul(argv[4], NULL, 16);
31   -
32   - config_switch_bit(switchaddr, port, (1 << pin), IO_PORT_OUTPUT, value);
33   -
34   - return 0;
35   -}
36   -
37   -U_BOOT_CMD(
38   - softswitch_output, 5, 1, do_softswitch,
39   - "switchaddr GPA/GPB pin_offset value",
40   - ""
41   -);
cmd/spibootldr.c
1   -/*
2   - * U-Boot - spibootldr.c
3   - *
4   - * Copyright (c) 2005-2008 Analog Devices Inc.
5   - *
6   - * See file CREDITS for list of people who contributed to this
7   - * project.
8   - *
9   - * Licensed under the GPL-2 or later.
10   - */
11   -
12   -#include <common.h>
13   -#include <command.h>
14   -
15   -#include <asm/blackfin.h>
16   -#include <asm/mach-common/bits/bootrom.h>
17   -
18   -int do_spibootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
19   -{
20   - s32 addr;
21   -
22   - /* Get the address */
23   - if (argc < 2)
24   - addr = 0;
25   - else
26   - addr = simple_strtoul(argv[1], NULL, 16);
27   -
28   - printf("## Booting ldr image at SPI offset 0x%x ...\n", addr);
29   -
30   - return bfrom_SpiBoot(addr, BFLAG_PERIPHERAL | 4, 0, NULL);
31   -}
32   -
33   -U_BOOT_CMD(
34   - spibootldr, 2, 0, do_spibootldr,
35   - "boot ldr image from spi",
36   - "[offset]\n"
37   - " - boot ldr image stored at offset into spi\n");