Skip to content

Commit 6b9d19d

Browse files
ranmapaulfertser
authored andcommitted
flash: Add support for Atheros (ath79) SPI interface
Supported SoCs: AR71xx, AR724x, AR91xx, AR93xx, QCA9558 Extended and revised version of my original patch submitted by Dmytro here: http://openocd.zylin.com/#/c/3390 This driver is using pure SPI mode, so the flash base address is not used except some flash commands (e.g. "flash program") need it to distinguish the banks. Example config with all 3 chip selects: flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 flash bank flash1 ath79 0x10000000 0 0 0 $_TARGETNAME cs1 flash bank flash2 ath79 0x20000000 0 0 0 $_TARGETNAME cs2 Example usage: > flash probe flash0 Found flash device 'win w25q128fv' (ID 0x001840ef) flash 'ath79' found at 0x00000000 > flash probe flash1 No SPI flash found > flash probe flash2 No SPI flash found > flash banks > flash read_bank flash0 /tmp/test.bin 0x00000000 0x1000 reading 4096 bytes from flash @0x00000000 wrote 4096 bytes to file /tmp/test.bin from flash bank 0 at offset 0x00000000 in 28.688066s (0.139 KiB/s) Change-Id: I5feb697722c07e83a9c1b361a9db7b06bc699aa8 Signed-off-by: Tobias Diedrich <[email protected]> Reviewed-on: http://openocd.zylin.com/3612 Tested-by: jenkins Reviewed-by: Dmytro <[email protected]> Reviewed-by: Paul Fertser <[email protected]>
1 parent 83c67b7 commit 6b9d19d

File tree

6 files changed

+948
-1
lines changed

6 files changed

+948
-1
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ XScale, Intel Quark.
123123
Flash drivers
124124
-------------
125125

126-
ADUC702x, AT91SAM, AVR, CFI, DSP5680xx, EFM32, EM357, FM3, FM4, Kinetis,
126+
ADUC702x, AT91SAM, ATH79, AVR, CFI, DSP5680xx, EFM32, EM357, FM3, FM4, Kinetis,
127127
LPC8xx/LPC1xxx/LPC2xxx/LPC541xx, LPC2900, LPCSPIFI, Marvell QSPI,
128128
Milandr, NIIET, NuMicro, PIC32mx, PSoC4, SiM3x, Stellaris, STM32, STMSMI,
129129
STR7x, STR9x, nRF51; NAND controllers of AT91SAM9, LPC3180, LPC32xx,

doc/openocd.texi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4999,6 +4999,45 @@ flash bank $_FLASHNAME mrvlqspi 0x0 0 0 0 $_TARGETNAME 0x46010000
49994999

50005000
@end deffn
50015001

5002+
@deffn {Flash Driver} ath79
5003+
@cindex Atheros ath79 SPI driver
5004+
@cindex ath79
5005+
Members of ATH79 SoC family from Atheros include a SPI interface with 3
5006+
chip selects.
5007+
On reset a SPI flash connected to the first chip select (CS0) is made
5008+
directly read-accessible in the CPU address space (up to 16MBytes)
5009+
and is usually used to store the bootloader and operating system.
5010+
Normal OpenOCD commands like @command{mdw} can be used to display
5011+
the flash content while it is in memory-mapped mode (only the first
5012+
4MBytes are accessible without additional configuration on reset).
5013+
5014+
The setup command only requires the @var{base} parameter in order
5015+
to identify the memory bank. The actual value for the base address
5016+
is not otherwise used by the driver. However the mapping is passed
5017+
to gdb. Thus for the memory mapped flash (chipselect CS0) the base
5018+
address should be the actual memory mapped base address. For unmapped
5019+
chipselects (CS1 and CS2) care should be taken to use a base address
5020+
that does not overlap with real memory regions.
5021+
Additional information, like flash size, are detected automatically.
5022+
An optional additional parameter sets the chipselect for the bank,
5023+
with the default CS0.
5024+
CS1 and CS2 require additional GPIO setup before they can be used
5025+
since the alternate function must be enabled on the GPIO pin
5026+
CS1/CS2 is routed to on the given SoC.
5027+
5028+
@example
5029+
flash bank $_FLASHNAME ath79 0 0 0 0 $_TARGETNAME
5030+
5031+
# When using multiple chipselects the base should be different for each,
5032+
# otherwise the write_image command is not able to distinguish the
5033+
# banks.
5034+
flash bank flash0 ath79 0x00000000 0 0 0 $_TARGETNAME cs0
5035+
flash bank flash1 ath79 0x10000000 0 0 0 $_TARGETNAME cs1
5036+
flash bank flash2 ath79 0x20000000 0 0 0 $_TARGETNAME cs2
5037+
@end example
5038+
5039+
@end deffn
5040+
50025041
@subsection Internal Flash (Microcontrollers)
50035042

50045043
@deffn {Flash Driver} aduc702x

src/flash/nor/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ NOR_DRIVERS = \
1515
%D%/at91samd.c \
1616
%D%/at91sam3.c \
1717
%D%/at91sam7.c \
18+
%D%/ath79.c \
1819
%D%/atsamv.c \
1920
%D%/avrf.c \
2021
%D%/cfi.c \

0 commit comments

Comments
 (0)