1 /***************************************************************************
2 * Copyright (C) 2016 by Maxim Integrated *
3 * Kevin Gillespie <kevin.gillespie@maximintegrated.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
30 * r3 = count (32bit words)
31 * r4 = pFLASH_CTRL_BASE
42 ldr r8, [r0, #0] /* read wp */
43 cmp r8, #0 /* abort if wp == 0 */
45 ldr r7, [r0, #4] /* read rp */
46 cmp r7, r8 /* wait until rp != wp */
50 str r2, [r4, #0x00] /* FLSH_ADDR - write address */
51 add r2, r2, #4 /* increment target address */
53 str r8, [r4, #0x30] /* FLSH_DATA0 - write data */
54 ldr r5, [r4, #0x08] /* FLSH_CN */
56 str r5, [r4, #0x08] /* FLSH_CN - enable write */
58 ldr r8, [r4, #0x08] /* FLSH_CN */
62 cmp r7, r1 /* wrap rp at end of buffer */
64 addcs r7, r0, #8 /* skip loader args */
65 str r7, [r0, #4] /* store rp */
66 subs r3, r3, #1 /* decrement word count */
67 cbz r3, exit /* loop if not done */