2009-06-23 21:01:14 -05:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2009 by Duane Ellis *
|
|
|
|
* openocd@duaneellis.com *
|
|
|
|
* *
|
2010-06-25 13:21:31 -05:00
|
|
|
* Copyright (C) 2010 by Olaf Lüke (at91sam3s* support) *
|
|
|
|
* olaf@uni-paderborn.de *
|
2012-03-06 12:57:45 -06:00
|
|
|
* *
|
|
|
|
* Copyright (C) 2011 by Olivier Schonken (at91sam3x* support) * *
|
|
|
|
* and Jim Norris *
|
2009-06-23 21:01:14 -05:00
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
2016-05-16 15:41:00 -05:00
|
|
|
* it under the terms of the GNU General Public License as published by *
|
2009-06-23 21:01:14 -05:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
2016-05-16 15:41:00 -05:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
2009-06-23 21:01:14 -05:00
|
|
|
* *
|
2016-05-16 15:41:00 -05:00
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
2009-06-23 21:01:14 -05:00
|
|
|
****************************************************************************/
|
|
|
|
|
2020-07-11 17:00:47 -05:00
|
|
|
/* Some of the lower level code was based on code supplied by
|
2009-06-23 21:01:14 -05:00
|
|
|
* ATMEL under this copyright. */
|
|
|
|
|
|
|
|
/* BEGIN ATMEL COPYRIGHT */
|
|
|
|
/* ----------------------------------------------------------------------------
|
2009-06-24 04:38:21 -05:00
|
|
|
* ATMEL Microcontroller Software Support
|
2009-06-23 21:01:14 -05:00
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* Copyright (c) 2009, Atmel Corporation
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the disclaimer below.
|
|
|
|
*
|
|
|
|
* Atmel's name may not be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
|
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/* END ATMEL COPYRIGHT */
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-12-04 16:06:20 -06:00
|
|
|
#include "imp.h"
|
2009-12-03 06:14:29 -06:00
|
|
|
#include <helper/time_support.h>
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
#define REG_NAME_WIDTH (12)
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* at91sam3u series (has one or two flash banks) */
|
2010-06-25 13:21:31 -05:00
|
|
|
#define FLASH_BANK0_BASE_U 0x00080000
|
|
|
|
#define FLASH_BANK1_BASE_U 0x00100000
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* at91sam3s series (has always one flash bank) */
|
2010-06-25 13:21:31 -05:00
|
|
|
#define FLASH_BANK_BASE_S 0x00400000
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2013-05-27 05:58:46 -05:00
|
|
|
/* at91sam3sd series (has always two flash banks) */
|
|
|
|
#define FLASH_BANK0_BASE_SD FLASH_BANK_BASE_S
|
|
|
|
#define FLASH_BANK1_BASE_512K_SD (FLASH_BANK0_BASE_SD+(512*1024/2))
|
|
|
|
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* at91sam3n series (has always one flash bank) */
|
2011-10-10 08:09:22 -05:00
|
|
|
#define FLASH_BANK_BASE_N 0x00400000
|
|
|
|
|
2012-03-06 12:57:45 -06:00
|
|
|
/* at91sam3a/x series has two flash banks*/
|
|
|
|
#define FLASH_BANK0_BASE_AX 0x00080000
|
|
|
|
/*Bank 1 of the at91sam3a/x series starts at 0x00080000 + half flash size*/
|
|
|
|
#define FLASH_BANK1_BASE_256K_AX 0x000A0000
|
|
|
|
#define FLASH_BANK1_BASE_512K_AX 0x000C0000
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
#define AT91C_EFC_FCMD_GETD (0x0) /* (EFC) Get Flash Descriptor */
|
|
|
|
#define AT91C_EFC_FCMD_WP (0x1) /* (EFC) Write Page */
|
|
|
|
#define AT91C_EFC_FCMD_WPL (0x2) /* (EFC) Write Page and Lock */
|
|
|
|
#define AT91C_EFC_FCMD_EWP (0x3) /* (EFC) Erase Page and Write Page */
|
2012-10-04 10:18:15 -05:00
|
|
|
#define AT91C_EFC_FCMD_EWPL (0x4) /* (EFC) Erase Page and Write Page then Lock */
|
2012-01-31 11:55:03 -06:00
|
|
|
#define AT91C_EFC_FCMD_EA (0x5) /* (EFC) Erase All */
|
2012-10-04 10:18:15 -05:00
|
|
|
/* cmd6 is not present in the at91sam3u4/2/1 data sheet table 17-2 */
|
2012-01-31 11:55:03 -06:00
|
|
|
/* #define AT91C_EFC_FCMD_EPL (0x6) // (EFC) Erase plane? */
|
2012-10-04 10:18:15 -05:00
|
|
|
/* cmd7 is not present in the at91sam3u4/2/1 data sheet table 17-2 */
|
2012-01-31 11:55:03 -06:00
|
|
|
/* #define AT91C_EFC_FCMD_EPA (0x7) // (EFC) Erase pages? */
|
|
|
|
#define AT91C_EFC_FCMD_SLB (0x8) /* (EFC) Set Lock Bit */
|
|
|
|
#define AT91C_EFC_FCMD_CLB (0x9) /* (EFC) Clear Lock Bit */
|
|
|
|
#define AT91C_EFC_FCMD_GLB (0xA) /* (EFC) Get Lock Bit */
|
|
|
|
#define AT91C_EFC_FCMD_SFB (0xB) /* (EFC) Set Fuse Bit */
|
|
|
|
#define AT91C_EFC_FCMD_CFB (0xC) /* (EFC) Clear Fuse Bit */
|
|
|
|
#define AT91C_EFC_FCMD_GFB (0xD) /* (EFC) Get Fuse Bit */
|
|
|
|
#define AT91C_EFC_FCMD_STUI (0xE) /* (EFC) Start Read Unique ID */
|
|
|
|
#define AT91C_EFC_FCMD_SPUI (0xF) /* (EFC) Stop Read Unique ID */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
#define offset_EFC_FMR 0
|
|
|
|
#define offset_EFC_FCR 4
|
|
|
|
#define offset_EFC_FSR 8
|
|
|
|
#define offset_EFC_FRR 12
|
|
|
|
|
2018-12-13 13:53:59 -06:00
|
|
|
extern const struct flash_driver at91sam3_flash;
|
2010-11-16 20:25:55 -06:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static float _tomhz(uint32_t freq_hz)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
float f;
|
|
|
|
|
|
|
|
f = ((float)(freq_hz)) / 1000000.0;
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* How the chip is configured. */
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_cfg {
|
|
|
|
uint32_t unique_id[4];
|
|
|
|
|
|
|
|
uint32_t slow_freq;
|
|
|
|
uint32_t rc_freq;
|
|
|
|
uint32_t mainosc_freq;
|
|
|
|
uint32_t plla_freq;
|
|
|
|
uint32_t mclk_freq;
|
|
|
|
uint32_t cpu_freq;
|
|
|
|
uint32_t fclk_freq;
|
|
|
|
uint32_t pclk0_freq;
|
|
|
|
uint32_t pclk1_freq;
|
|
|
|
uint32_t pclk2_freq;
|
|
|
|
|
|
|
|
|
|
|
|
#define SAM3_CHIPID_CIDR (0x400E0740)
|
|
|
|
uint32_t CHIPID_CIDR;
|
2012-03-06 12:57:45 -06:00
|
|
|
#define SAM3_CHIPID_CIDR2 (0x400E0940) /*SAM3X and SAM3A cidr at this address*/
|
|
|
|
uint32_t CHIPID_CIDR2;
|
2009-06-23 21:01:14 -05:00
|
|
|
#define SAM3_CHIPID_EXID (0x400E0744)
|
|
|
|
uint32_t CHIPID_EXID;
|
2012-03-06 12:57:45 -06:00
|
|
|
#define SAM3_CHIPID_EXID2 (0x400E0944) /*SAM3X and SAM3A cidr at this address*/
|
|
|
|
uint32_t CHIPID_EXID2;
|
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
#define SAM3_PMC_BASE (0x400E0400)
|
|
|
|
#define SAM3_PMC_SCSR (SAM3_PMC_BASE + 0x0008)
|
|
|
|
uint32_t PMC_SCSR;
|
|
|
|
#define SAM3_PMC_PCSR (SAM3_PMC_BASE + 0x0018)
|
|
|
|
uint32_t PMC_PCSR;
|
|
|
|
#define SAM3_CKGR_UCKR (SAM3_PMC_BASE + 0x001c)
|
|
|
|
uint32_t CKGR_UCKR;
|
|
|
|
#define SAM3_CKGR_MOR (SAM3_PMC_BASE + 0x0020)
|
|
|
|
uint32_t CKGR_MOR;
|
|
|
|
#define SAM3_CKGR_MCFR (SAM3_PMC_BASE + 0x0024)
|
|
|
|
uint32_t CKGR_MCFR;
|
|
|
|
#define SAM3_CKGR_PLLAR (SAM3_PMC_BASE + 0x0028)
|
|
|
|
uint32_t CKGR_PLLAR;
|
|
|
|
#define SAM3_PMC_MCKR (SAM3_PMC_BASE + 0x0030)
|
|
|
|
uint32_t PMC_MCKR;
|
|
|
|
#define SAM3_PMC_PCK0 (SAM3_PMC_BASE + 0x0040)
|
|
|
|
uint32_t PMC_PCK0;
|
|
|
|
#define SAM3_PMC_PCK1 (SAM3_PMC_BASE + 0x0044)
|
|
|
|
uint32_t PMC_PCK1;
|
|
|
|
#define SAM3_PMC_PCK2 (SAM3_PMC_BASE + 0x0048)
|
|
|
|
uint32_t PMC_PCK2;
|
|
|
|
#define SAM3_PMC_SR (SAM3_PMC_BASE + 0x0068)
|
|
|
|
uint32_t PMC_SR;
|
|
|
|
#define SAM3_PMC_IMR (SAM3_PMC_BASE + 0x006c)
|
|
|
|
uint32_t PMC_IMR;
|
|
|
|
#define SAM3_PMC_FSMR (SAM3_PMC_BASE + 0x0070)
|
|
|
|
uint32_t PMC_FSMR;
|
|
|
|
#define SAM3_PMC_FSPR (SAM3_PMC_BASE + 0x0074)
|
|
|
|
uint32_t PMC_FSPR;
|
|
|
|
};
|
|
|
|
|
2011-10-27 05:14:55 -05:00
|
|
|
/*
|
|
|
|
* The AT91SAM3N data sheet 04-Oct-2010, AT91SAM3U data sheet 22-Aug-2011
|
|
|
|
* and AT91SAM3S data sheet 09-Feb-2011 state that for flash writes
|
|
|
|
* the flash wait state (FWS) should be set to 6. It seems like that the
|
|
|
|
* cause of the problem is not the flash itself, but the flash write
|
|
|
|
* buffer. Ie the wait states have to be set before writing into the
|
|
|
|
* buffer.
|
|
|
|
* Tested and confirmed with SAM3N and SAM3U
|
|
|
|
*/
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
struct sam3_bank_private {
|
2020-07-01 03:21:52 -05:00
|
|
|
bool probed;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* DANGER: THERE ARE DRAGONS HERE.. */
|
|
|
|
/* NOTE: If you add more 'ghost' pointers */
|
|
|
|
/* be aware that you must *manually* update */
|
|
|
|
/* these pointers in the function sam3_GetDetails() */
|
|
|
|
/* See the comment "Here there be dragons" */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* so we can find the chip we belong to */
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_chip *pChip;
|
2012-10-04 10:18:15 -05:00
|
|
|
/* so we can find the original bank pointer */
|
2009-11-13 13:32:28 -06:00
|
|
|
struct flash_bank *pBank;
|
2009-06-23 21:01:14 -05:00
|
|
|
unsigned bank_number;
|
|
|
|
uint32_t controller_address;
|
|
|
|
uint32_t base_address;
|
2011-10-27 05:14:55 -05:00
|
|
|
uint32_t flash_wait_states;
|
2009-06-23 21:01:14 -05:00
|
|
|
bool present;
|
|
|
|
unsigned size_bytes;
|
|
|
|
unsigned nsectors;
|
|
|
|
unsigned sector_size;
|
|
|
|
unsigned page_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sam3_chip_details {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* THERE ARE DRAGONS HERE.. */
|
|
|
|
/* note: If you add pointers here */
|
2012-10-04 10:18:15 -05:00
|
|
|
/* be careful about them as they */
|
2012-01-31 11:55:03 -06:00
|
|
|
/* may need to be updated inside */
|
|
|
|
/* the function: "sam3_GetDetails() */
|
|
|
|
/* which copy/overwrites the */
|
|
|
|
/* 'runtime' copy of this structure */
|
2009-06-23 21:01:14 -05:00
|
|
|
uint32_t chipid_cidr;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
unsigned n_gpnvms;
|
|
|
|
#define SAM3_N_NVM_BITS 3
|
2012-01-31 11:55:03 -06:00
|
|
|
unsigned gpnvm[SAM3_N_NVM_BITS];
|
|
|
|
unsigned total_flash_size;
|
|
|
|
unsigned total_sram_size;
|
|
|
|
unsigned n_banks;
|
2009-06-23 21:01:14 -05:00
|
|
|
#define SAM3_MAX_FLASH_BANKS 2
|
2012-01-31 11:55:03 -06:00
|
|
|
/* these are "initialized" from the global const data */
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sam3_chip {
|
|
|
|
struct sam3_chip *next;
|
2020-07-01 03:21:52 -05:00
|
|
|
bool probed;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* this is "initialized" from the global const structure */
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_chip_details details;
|
2009-11-13 12:11:13 -06:00
|
|
|
struct target *target;
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_cfg cfg;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct sam3_reg_list {
|
|
|
|
uint32_t address; size_t struct_offset; const char *name;
|
2009-06-24 04:38:08 -05:00
|
|
|
void (*explain_func)(struct sam3_chip *pInfo);
|
2009-06-23 21:01:14 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct sam3_chip *all_sam3_chips;
|
|
|
|
|
2019-03-31 20:45:54 -05:00
|
|
|
static struct sam3_chip *get_current_sam3(struct command_invocation *cmd)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2009-11-13 12:11:13 -06:00
|
|
|
struct target *t;
|
2009-06-23 21:01:14 -05:00
|
|
|
static struct sam3_chip *p;
|
|
|
|
|
2019-03-31 20:45:54 -05:00
|
|
|
t = get_current_target(cmd->ctx);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!t) {
|
2021-04-23 03:47:17 -05:00
|
|
|
command_print_sameline(cmd, "No current target?\n");
|
2009-06-23 21:01:14 -05:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = all_sam3_chips;
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!p) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* this should not happen */
|
|
|
|
/* the command is not registered until the chip is created? */
|
2021-04-23 03:47:17 -05:00
|
|
|
command_print_sameline(cmd, "No SAM3 chips exist?\n");
|
2009-06-23 21:01:14 -05:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
while (p) {
|
2012-01-31 11:55:03 -06:00
|
|
|
if (p->target == t)
|
2009-06-23 21:01:14 -05:00
|
|
|
return p;
|
|
|
|
p = p->next;
|
|
|
|
}
|
2021-04-23 03:47:17 -05:00
|
|
|
command_print_sameline(cmd, "Cannot find SAM3 chip?\n");
|
2009-06-23 21:01:14 -05:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* these are used to *initialize* the "pChip->details" structure. */
|
2009-06-23 21:01:14 -05:00
|
|
|
static const struct sam3_chip_details all_sam3_details[] = {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Start at91sam3u* series */
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28100960,
|
|
|
|
.name = "at91sam3u4e",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 52 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 3,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 2,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_U,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x281a0760,
|
|
|
|
.name = "at91sam3u2e",
|
|
|
|
.total_flash_size = 128 * 1024,
|
2012-01-31 11:55:03 -06:00
|
|
|
.total_sram_size = 36 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 2,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28190560,
|
|
|
|
.name = "at91sam3u1e",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 20 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 2,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* .bank[0] = { */
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28000960,
|
|
|
|
.name = "at91sam3u4c",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 52 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 3,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 2,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_U,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x280a0760,
|
|
|
|
.name = "at91sam3u2c",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 36 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 2,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28090560,
|
|
|
|
.name = "at91sam3u1c",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 20 * 1024,
|
2009-06-24 04:38:21 -05:00
|
|
|
.n_gpnvms = 2,
|
2009-06-23 21:01:14 -05:00
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:28 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_U,
|
|
|
|
.controller_address = 0x400e0800,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 8192,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2009-06-23 21:01:14 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Start at91sam3s* series */
|
2010-06-25 13:21:31 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Note: The preliminary at91sam3s datasheet says on page 302 */
|
|
|
|
/* that the flash controller is at address 0x400E0800. */
|
2013-05-27 06:21:07 -05:00
|
|
|
/* This is _not_ the case, the controller resides at address 0x400e0a00. */
|
2010-06-25 13:21:31 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28A00960,
|
|
|
|
.name = "at91sam3s4c",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 48 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28900960,
|
|
|
|
.name = "at91sam3s4b",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 48 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28800960,
|
|
|
|
.name = "at91sam3s4a",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 48 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28AA0760,
|
|
|
|
.name = "at91sam3s2c",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 32 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x289A0760,
|
|
|
|
.name = "at91sam3s2b",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 32 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
2013-05-27 06:21:07 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x298B0A60,
|
|
|
|
.name = "at91sam3sd8a",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:21:07 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:21:07 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x299B0A60,
|
|
|
|
.name = "at91sam3sd8b",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:21:07 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:21:07 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2012-05-29 15:23:27 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29ab0a60,
|
|
|
|
.name = "at91sam3sd8c",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-05-29 15:23:27 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
2013-05-27 05:58:46 -05:00
|
|
|
.sector_size = 32768,
|
2012-05-29 15:23:27 -05:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-05-29 15:23:27 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_SD,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
2013-05-27 05:58:46 -05:00
|
|
|
.sector_size = 32768,
|
2012-05-29 15:23:27 -05:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x288A0760,
|
|
|
|
.name = "at91sam3s2a",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 32 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28A90560,
|
|
|
|
.name = "at91sam3s1c",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28990560,
|
|
|
|
.name = "at91sam3s1b",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28890560,
|
|
|
|
.name = "at91sam3s1a",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
2012-02-28 02:44:25 -06:00
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
2012-01-31 11:55:03 -06:00
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
2010-06-25 13:21:31 -05:00
|
|
|
},
|
|
|
|
},
|
2013-05-27 06:41:46 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x288B0A60,
|
|
|
|
.name = "at91sam3s8a",
|
|
|
|
.total_flash_size = 256 * 2048,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 2048,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x289B0A60,
|
|
|
|
.name = "at91sam3s8b",
|
|
|
|
.total_flash_size = 256 * 2048,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 2048,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x28AB0A60,
|
|
|
|
.name = "at91sam3s8c",
|
|
|
|
.total_flash_size = 256 * 2048,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 2,
|
|
|
|
.n_banks = 1,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_S,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 2048,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 32768,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2013-05-27 06:41:46 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Start at91sam3n* series */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29540960,
|
|
|
|
.name = "at91sam3n4c",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 24 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29440960,
|
|
|
|
.name = "at91sam3n4b",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 24 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29340960,
|
|
|
|
.name = "at91sam3n4a",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 24 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29590760,
|
|
|
|
.name = "at91sam3n2c",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29490760,
|
|
|
|
.name = "at91sam3n2b",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29390760,
|
|
|
|
.name = "at91sam3n2a",
|
|
|
|
.total_flash_size = 128 * 1024,
|
|
|
|
.total_sram_size = 16 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29580560,
|
|
|
|
.name = "at91sam3n1c",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 8 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29480560,
|
|
|
|
.name = "at91sam3n1b",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 8 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29380560,
|
|
|
|
.name = "at91sam3n1a",
|
|
|
|
.total_flash_size = 64 * 1024,
|
|
|
|
.total_sram_size = 8 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
/* .bank[0] = { */
|
2011-10-10 08:09:22 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 64 * 1024,
|
|
|
|
.nsectors = 4,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-01-31 11:55:03 -06:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
2011-10-10 08:09:22 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2014-03-13 16:18:29 -05:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29480360,
|
|
|
|
.name = "at91sam3n0b",
|
|
|
|
.total_flash_size = 32 * 1024,
|
|
|
|
.total_sram_size = 8 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 32 * 1024,
|
|
|
|
.nsectors = 2,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29380360,
|
|
|
|
.name = "at91sam3n0a",
|
|
|
|
.total_flash_size = 32 * 1024,
|
|
|
|
.total_sram_size = 8 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 32 * 1024,
|
|
|
|
.nsectors = 2,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29450260,
|
|
|
|
.name = "at91sam3n00b",
|
|
|
|
.total_flash_size = 16 * 1024,
|
|
|
|
.total_sram_size = 4 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 16 * 1024,
|
|
|
|
.nsectors = 1,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x29350260,
|
|
|
|
.name = "at91sam3n00a",
|
|
|
|
.total_flash_size = 16 * 1024,
|
|
|
|
.total_sram_size = 4 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 1,
|
|
|
|
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK_BASE_N,
|
|
|
|
.controller_address = 0x400e0A00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 16 * 1024,
|
|
|
|
.nsectors = 1,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
|
|
|
.present = 0,
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2014-03-13 16:18:29 -05:00
|
|
|
.bank_number = 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2012-03-06 12:57:45 -06:00
|
|
|
/* Start at91sam3a series*/
|
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
|
|
|
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x283E0A60,
|
|
|
|
.name = "at91sam3a8c",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 96 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x283B0960,
|
|
|
|
.name = "at91sam3a4c",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_256K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Start at91sam3x* series */
|
|
|
|
/* System boots at address 0x0 */
|
|
|
|
/* gpnvm[1] = selects boot code */
|
|
|
|
/* if gpnvm[1] == 0 */
|
|
|
|
/* boot is via "SAMBA" (rom) */
|
|
|
|
/* else */
|
|
|
|
/* boot is via FLASH */
|
|
|
|
/* Selection is via gpnvm[2] */
|
|
|
|
/* endif */
|
|
|
|
/* */
|
|
|
|
/* NOTE: banks 0 & 1 switch places */
|
|
|
|
/* if gpnvm[2] == 0 */
|
|
|
|
/* Bank0 is the boot rom */
|
|
|
|
/* else */
|
|
|
|
/* Bank1 is the boot rom */
|
|
|
|
/* endif */
|
2012-04-19 01:53:27 -05:00
|
|
|
/*at91sam3x8h - ES has an incorrect CIDR of 0x286E0A20*/
|
2012-03-06 12:57:45 -06:00
|
|
|
{
|
|
|
|
.chipid_cidr = 0x286E0A20,
|
2012-04-19 01:53:27 -05:00
|
|
|
.name = "at91sam3x8h - ES",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 96 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-04-19 01:53:27 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-04-19 01:53:27 -05:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/*at91sam3x8h - ES2 and up uses the correct CIDR of 0x286E0A60*/
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x286E0A60,
|
2012-03-06 12:57:45 -06:00
|
|
|
.name = "at91sam3x8h",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 96 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x285E0A60,
|
|
|
|
.name = "at91sam3x8e",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 96 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_512K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x284E0A60,
|
|
|
|
.name = "at91sam3x8c",
|
|
|
|
.total_flash_size = 512 * 1024,
|
|
|
|
.total_sram_size = 96 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
2019-05-06 11:16:17 -05:00
|
|
|
.base_address = FLASH_BANK1_BASE_512K_AX,
|
2012-03-06 12:57:45 -06:00
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 256 * 1024,
|
|
|
|
.nsectors = 16,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x285B0960,
|
|
|
|
.name = "at91sam3x4e",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_256K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.chipid_cidr = 0x284B0960,
|
|
|
|
.name = "at91sam3x4c",
|
|
|
|
.total_flash_size = 256 * 1024,
|
|
|
|
.total_sram_size = 64 * 1024,
|
|
|
|
.n_gpnvms = 3,
|
|
|
|
.n_banks = 2,
|
|
|
|
{
|
|
|
|
/* .bank[0] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 0,
|
|
|
|
.base_address = FLASH_BANK0_BASE_AX,
|
|
|
|
.controller_address = 0x400e0a00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
},
|
|
|
|
/* .bank[1] = { */
|
|
|
|
{
|
2020-07-01 03:21:52 -05:00
|
|
|
.probed = false,
|
2012-03-06 12:57:45 -06:00
|
|
|
.pChip = NULL,
|
|
|
|
.pBank = NULL,
|
|
|
|
.bank_number = 1,
|
|
|
|
.base_address = FLASH_BANK1_BASE_256K_AX,
|
|
|
|
.controller_address = 0x400e0c00,
|
|
|
|
.flash_wait_states = 6, /* workaround silicon bug */
|
|
|
|
.present = 1,
|
|
|
|
.size_bytes = 128 * 1024,
|
|
|
|
.nsectors = 8,
|
|
|
|
.sector_size = 16384,
|
|
|
|
.page_size = 256,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2012-01-31 11:55:03 -06:00
|
|
|
/* terminate */
|
2009-06-24 04:38:21 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
.chipid_cidr = 0,
|
|
|
|
.name = NULL,
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Globals above */
|
|
|
|
/***********************************************************************
|
|
|
|
**********************************************************************
|
|
|
|
**********************************************************************
|
|
|
|
**********************************************************************
|
|
|
|
**********************************************************************
|
|
|
|
**********************************************************************/
|
|
|
|
/* *ATMEL* style code - from the SAM3 driver code */
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Get the current status of the EEFC and
|
2009-06-23 21:01:14 -05:00
|
|
|
* the value of some status bits (LOCKE, PROGE).
|
|
|
|
* @param pPrivate - info about the bank
|
|
|
|
* @param v - result goes here
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int EFC_GetStatus(struct sam3_bank_private *pPrivate, uint32_t *v)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
2012-01-31 11:55:03 -06:00
|
|
|
r = target_read_u32(pPrivate->pChip->target,
|
|
|
|
pPrivate->controller_address + offset_EFC_FSR,
|
|
|
|
v);
|
2009-06-24 04:38:21 -05:00
|
|
|
LOG_DEBUG("Status: 0x%08x (lockerror: %d, cmderror: %d, ready: %d)",
|
2012-01-31 11:55:03 -06:00
|
|
|
(unsigned int)(*v),
|
|
|
|
((unsigned int)((*v >> 2) & 1)),
|
|
|
|
((unsigned int)((*v >> 1) & 1)),
|
|
|
|
((unsigned int)((*v >> 0) & 1)));
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Get the result of the last executed command.
|
2009-06-23 21:01:14 -05:00
|
|
|
* @param pPrivate - info about the bank
|
|
|
|
* @param v - result goes here
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int EFC_GetResult(struct sam3_bank_private *pPrivate, uint32_t *v)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
uint32_t rv;
|
2012-01-31 11:55:03 -06:00
|
|
|
r = target_read_u32(pPrivate->pChip->target,
|
|
|
|
pPrivate->controller_address + offset_EFC_FRR,
|
|
|
|
&rv);
|
|
|
|
if (v)
|
2009-06-23 21:01:14 -05:00
|
|
|
*v = rv;
|
|
|
|
LOG_DEBUG("Result: 0x%08x", ((unsigned int)(rv)));
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int EFC_StartCommand(struct sam3_bank_private *pPrivate,
|
|
|
|
unsigned command, unsigned argument)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
uint32_t n, v;
|
2009-06-23 21:01:14 -05:00
|
|
|
int r;
|
|
|
|
int retry;
|
|
|
|
|
|
|
|
retry = 0;
|
2012-01-31 11:55:03 -06:00
|
|
|
do_retry:
|
|
|
|
|
|
|
|
/* Check command & argument */
|
|
|
|
switch (command) {
|
|
|
|
|
|
|
|
case AT91C_EFC_FCMD_WP:
|
|
|
|
case AT91C_EFC_FCMD_WPL:
|
|
|
|
case AT91C_EFC_FCMD_EWP:
|
|
|
|
case AT91C_EFC_FCMD_EWPL:
|
|
|
|
/* case AT91C_EFC_FCMD_EPL: */
|
|
|
|
/* case AT91C_EFC_FCMD_EPA: */
|
|
|
|
case AT91C_EFC_FCMD_SLB:
|
|
|
|
case AT91C_EFC_FCMD_CLB:
|
|
|
|
n = (pPrivate->size_bytes / pPrivate->page_size);
|
|
|
|
if (argument >= n)
|
|
|
|
LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n));
|
|
|
|
break;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
case AT91C_EFC_FCMD_SFB:
|
|
|
|
case AT91C_EFC_FCMD_CFB:
|
|
|
|
if (argument >= pPrivate->pChip->details.n_gpnvms) {
|
|
|
|
LOG_ERROR("*BUG*: Embedded flash has only %d GPNVMs",
|
|
|
|
pPrivate->pChip->details.n_gpnvms);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AT91C_EFC_FCMD_GETD:
|
|
|
|
case AT91C_EFC_FCMD_EA:
|
|
|
|
case AT91C_EFC_FCMD_GLB:
|
|
|
|
case AT91C_EFC_FCMD_GFB:
|
|
|
|
case AT91C_EFC_FCMD_STUI:
|
|
|
|
case AT91C_EFC_FCMD_SPUI:
|
|
|
|
if (argument != 0)
|
|
|
|
LOG_ERROR("Argument is meaningless for cmd: %d", command);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LOG_ERROR("Unknown command %d", command);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (command == AT91C_EFC_FCMD_SPUI) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* this is a very special situation. */
|
|
|
|
/* Situation (1) - error/retry - see below */
|
|
|
|
/* And we are being called recursively */
|
|
|
|
/* Situation (2) - normal, finished reading unique id */
|
2009-06-23 21:01:14 -05:00
|
|
|
} else {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* it should be "ready" */
|
2009-06-24 04:38:08 -05:00
|
|
|
EFC_GetStatus(pPrivate, &v);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (v & 1) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* then it is ready */
|
|
|
|
/* we go on */
|
2009-06-23 21:01:14 -05:00
|
|
|
} else {
|
2009-06-24 04:38:15 -05:00
|
|
|
if (retry) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* we have done this before */
|
|
|
|
/* the controller is not responding. */
|
|
|
|
LOG_ERROR("flash controller(%d) is not ready! Error",
|
|
|
|
pPrivate->bank_number);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
} else {
|
|
|
|
retry++;
|
2009-06-24 04:38:21 -05:00
|
|
|
LOG_ERROR("Flash controller(%d) is not ready, attempting reset",
|
2012-01-31 11:55:03 -06:00
|
|
|
pPrivate->bank_number);
|
|
|
|
/* we do that by issuing the *STOP* command */
|
2009-06-24 04:38:08 -05:00
|
|
|
EFC_StartCommand(pPrivate, AT91C_EFC_FCMD_SPUI, 0);
|
2012-01-31 11:55:03 -06:00
|
|
|
/* above is recursive, and further recursion is blocked by */
|
|
|
|
/* if (command == AT91C_EFC_FCMD_SPUI) above */
|
2009-06-23 21:01:14 -05:00
|
|
|
goto do_retry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
v = (0x5A << 24) | (argument << 8) | command;
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_DEBUG("Command: 0x%08x", ((unsigned int)(v)));
|
2009-06-24 04:38:21 -05:00
|
|
|
r = target_write_u32(pPrivate->pBank->target,
|
2012-01-31 11:55:03 -06:00
|
|
|
pPrivate->controller_address + offset_EFC_FCR, v);
|
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Error Write failed");
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Performs the given command and wait until its completion (or an error).
|
2009-06-23 21:01:14 -05:00
|
|
|
* @param pPrivate - info about the bank
|
|
|
|
* @param command - Command to perform.
|
|
|
|
* @param argument - Optional command argument.
|
|
|
|
* @param status - put command status bits here
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int EFC_PerformCommand(struct sam3_bank_private *pPrivate,
|
|
|
|
unsigned command,
|
|
|
|
unsigned argument,
|
|
|
|
uint32_t *status)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
int r;
|
|
|
|
uint32_t v;
|
2016-05-21 21:34:04 -05:00
|
|
|
int64_t ms_now, ms_end;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* default */
|
|
|
|
if (status)
|
2009-06-23 21:01:14 -05:00
|
|
|
*status = 0;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = EFC_StartCommand(pPrivate, command, argument);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
|
|
|
|
ms_end = 500 + timeval_ms();
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
do {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = EFC_GetStatus(pPrivate, &v);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
ms_now = timeval_ms();
|
2009-06-24 04:38:15 -05:00
|
|
|
if (ms_now > ms_end) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* error */
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Command timeout");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2012-01-31 11:55:03 -06:00
|
|
|
} while ((v & 1) == 0);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* error bits.. */
|
|
|
|
if (status)
|
2009-06-23 21:01:14 -05:00
|
|
|
*status = (v & 0x6);
|
|
|
|
return ERROR_OK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Read the unique ID.
|
|
|
|
* @param pPrivate - info about the bank
|
2009-06-23 21:01:14 -05:00
|
|
|
* The unique ID is stored in the 'pPrivate' structure.
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_ReadUniqueID(struct sam3_bank_private *pPrivate)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
uint32_t v;
|
|
|
|
int x;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* assume 0 */
|
|
|
|
pPrivate->pChip->cfg.unique_id[0] = 0;
|
|
|
|
pPrivate->pChip->cfg.unique_id[1] = 0;
|
|
|
|
pPrivate->pChip->cfg.unique_id[2] = 0;
|
|
|
|
pPrivate->pChip->cfg.unique_id[3] = 0;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
LOG_DEBUG("Begin");
|
2009-06-24 04:38:01 -05:00
|
|
|
r = EFC_StartCommand(pPrivate, AT91C_EFC_FCMD_STUI, 0);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r < 0)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
for (x = 0; x < 4; x++) {
|
2009-06-24 04:38:21 -05:00
|
|
|
r = target_read_u32(pPrivate->pChip->target,
|
2012-01-31 11:55:03 -06:00
|
|
|
pPrivate->pBank->base + (x * 4),
|
|
|
|
&v);
|
|
|
|
if (r < 0)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
pPrivate->pChip->cfg.unique_id[x] = v;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_SPUI, 0, NULL);
|
2009-06-24 04:37:37 -05:00
|
|
|
LOG_DEBUG("End: R=%d, id = 0x%08x, 0x%08x, 0x%08x, 0x%08x",
|
2012-01-31 11:55:03 -06:00
|
|
|
r,
|
|
|
|
(unsigned int)(pPrivate->pChip->cfg.unique_id[0]),
|
|
|
|
(unsigned int)(pPrivate->pChip->cfg.unique_id[1]),
|
|
|
|
(unsigned int)(pPrivate->pChip->cfg.unique_id[2]),
|
|
|
|
(unsigned int)(pPrivate->pChip->cfg.unique_id[3]));
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Erases the entire flash.
|
2009-06-23 21:01:14 -05:00
|
|
|
* @param pPrivate - the info about the bank.
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_EraseEntireBank(struct sam3_bank_private *pPrivate)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
LOG_DEBUG("Here");
|
2009-06-24 04:38:08 -05:00
|
|
|
return EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_EA, 0, NULL);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Gets current GPNVM state.
|
2009-06-23 21:01:14 -05:00
|
|
|
* @param pPrivate - info about the bank.
|
|
|
|
* @param gpnvm - GPNVM bit index.
|
|
|
|
* @param puthere - result stored here.
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
/* ------------------------------------------------------------------------------ */
|
|
|
|
static int FLASHD_GetGPNVM(struct sam3_bank_private *pPrivate, unsigned gpnvm, unsigned *puthere)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t v;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
LOG_DEBUG("Here");
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pPrivate->bank_number != 0) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("GPNVM only works with Bank0");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (gpnvm >= pPrivate->pChip->details.n_gpnvms) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Invalid GPNVM %d, max: %d, ignored",
|
2012-01-31 11:55:03 -06:00
|
|
|
gpnvm, pPrivate->pChip->details.n_gpnvms);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Get GPNVMs status */
|
2009-06-24 04:38:08 -05:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_GFB, 0, NULL);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Failed");
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
r = EFC_GetResult(pPrivate, &v);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (puthere) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Check if GPNVM is set */
|
|
|
|
/* get the bit and make it a 0/1 */
|
2009-06-23 21:01:14 -05:00
|
|
|
*puthere = (v >> gpnvm) & 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Clears the selected GPNVM bit.
|
|
|
|
* @param pPrivate info about the bank
|
|
|
|
* @param gpnvm GPNVM index.
|
|
|
|
* @returns 0 if successful; otherwise returns an error code.
|
2009-06-23 21:01:14 -05:00
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_ClrGPNVM(struct sam3_bank_private *pPrivate, unsigned gpnvm)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
unsigned v;
|
|
|
|
|
|
|
|
LOG_DEBUG("Here");
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pPrivate->bank_number != 0) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("GPNVM only works with Bank0");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (gpnvm >= pPrivate->pChip->details.n_gpnvms) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Invalid GPNVM %d, max: %d, ignored",
|
2012-01-31 11:55:03 -06:00
|
|
|
gpnvm, pPrivate->pChip->details.n_gpnvms);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_GetGPNVM(pPrivate, gpnvm, &v);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("Failed: %d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
2009-06-24 04:38:01 -05:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_CFB, gpnvm, NULL);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("End: %d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Sets the selected GPNVM bit.
|
|
|
|
* @param pPrivate info about the bank
|
|
|
|
* @param gpnvm GPNVM index.
|
2009-06-23 21:01:14 -05:00
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_SetGPNVM(struct sam3_bank_private *pPrivate, unsigned gpnvm)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
unsigned v;
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pPrivate->bank_number != 0) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("GPNVM only works with Bank0");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (gpnvm >= pPrivate->pChip->details.n_gpnvms) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Invalid GPNVM %d, max: %d, ignored",
|
2012-01-31 11:55:03 -06:00
|
|
|
gpnvm, pPrivate->pChip->details.n_gpnvms);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_GetGPNVM(pPrivate, gpnvm, &v);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
2009-06-24 04:38:15 -05:00
|
|
|
if (v) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* already set */
|
2009-06-23 21:01:14 -05:00
|
|
|
r = ERROR_OK;
|
|
|
|
} else {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* set it */
|
2009-06-24 04:38:08 -05:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_SFB, gpnvm, NULL);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Returns a bit field (at most 64) of locked regions within a page.
|
|
|
|
* @param pPrivate info about the bank
|
|
|
|
* @param v where to store locked bits
|
2009-06-23 21:01:14 -05:00
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_GetLockBits(struct sam3_bank_private *pPrivate, uint32_t *v)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
LOG_DEBUG("Here");
|
2012-01-31 11:55:03 -06:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_GLB, 0, NULL);
|
|
|
|
if (r == ERROR_OK)
|
2009-06-24 04:38:08 -05:00
|
|
|
r = EFC_GetResult(pPrivate, v);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("End: %d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Unlocks all the regions in the given address range.
|
|
|
|
* @param pPrivate info about the bank
|
|
|
|
* @param start_sector first sector to unlock
|
|
|
|
* @param end_sector last (inclusive) to unlock
|
2009-06-23 21:01:14 -05:00
|
|
|
*/
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_Unlock(struct sam3_bank_private *pPrivate,
|
|
|
|
unsigned start_sector,
|
|
|
|
unsigned end_sector)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t pg;
|
|
|
|
uint32_t pages_per_sector;
|
|
|
|
|
|
|
|
pages_per_sector = pPrivate->sector_size / pPrivate->page_size;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Unlock all pages */
|
|
|
|
while (start_sector <= end_sector) {
|
2009-06-23 21:01:14 -05:00
|
|
|
pg = start_sector * pages_per_sector;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_CLB, pg, &status);
|
|
|
|
if (r != ERROR_OK)
|
|
|
|
return r;
|
|
|
|
start_sector++;
|
|
|
|
}
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
return ERROR_OK;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Locks regions
|
|
|
|
* @param pPrivate - info about the bank
|
2009-06-23 21:01:14 -05:00
|
|
|
* @param start_sector - first sector to lock
|
|
|
|
* @param end_sector - last sector (inclusive) to lock
|
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static int FLASHD_Lock(struct sam3_bank_private *pPrivate,
|
|
|
|
unsigned start_sector,
|
|
|
|
unsigned end_sector)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t pg;
|
|
|
|
uint32_t pages_per_sector;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
pages_per_sector = pPrivate->sector_size / pPrivate->page_size;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Lock all pages */
|
|
|
|
while (start_sector <= end_sector) {
|
2009-06-23 21:01:14 -05:00
|
|
|
pg = start_sector * pages_per_sector;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
r = EFC_PerformCommand(pPrivate, AT91C_EFC_FCMD_SLB, pg, &status);
|
|
|
|
if (r != ERROR_OK)
|
|
|
|
return r;
|
|
|
|
start_sector++;
|
|
|
|
}
|
|
|
|
return ERROR_OK;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/****** END SAM3 CODE ********/
|
|
|
|
|
|
|
|
/* begin helpful debug code */
|
2012-01-31 11:55:03 -06:00
|
|
|
/* print the fieldname, the field value, in dec & hex, and return field value */
|
|
|
|
static uint32_t sam3_reg_fieldname(struct sam3_chip *pChip,
|
|
|
|
const char *regname,
|
|
|
|
uint32_t value,
|
|
|
|
unsigned shift,
|
|
|
|
unsigned width)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t v;
|
|
|
|
int hwidth, dwidth;
|
|
|
|
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* extract the field */
|
2009-06-23 21:01:14 -05:00
|
|
|
v = value >> shift;
|
|
|
|
v = v & ((1 << width)-1);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (width <= 16) {
|
2009-06-23 21:01:14 -05:00
|
|
|
hwidth = 4;
|
|
|
|
dwidth = 5;
|
|
|
|
} else {
|
|
|
|
hwidth = 8;
|
|
|
|
dwidth = 12;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* show the basics */
|
2013-09-30 04:31:57 -05:00
|
|
|
LOG_USER_N("\t%*s: %*" PRIu32 " [0x%0*" PRIx32 "] ",
|
2012-01-31 11:55:03 -06:00
|
|
|
REG_NAME_WIDTH, regname,
|
|
|
|
dwidth, v,
|
|
|
|
hwidth, v);
|
2009-06-23 21:01:14 -05:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char _unknown[] = "unknown";
|
2012-01-31 11:55:03 -06:00
|
|
|
static const char *const eproc_names[] = {
|
|
|
|
_unknown, /* 0 */
|
|
|
|
"arm946es", /* 1 */
|
|
|
|
"arm7tdmi", /* 2 */
|
2016-05-14 13:21:49 -05:00
|
|
|
"Cortex-M3", /* 3 */
|
2012-01-31 11:55:03 -06:00
|
|
|
"arm920t", /* 4 */
|
|
|
|
"arm926ejs", /* 5 */
|
|
|
|
_unknown, /* 6 */
|
|
|
|
_unknown, /* 7 */
|
|
|
|
_unknown, /* 8 */
|
|
|
|
_unknown, /* 9 */
|
|
|
|
_unknown, /* 10 */
|
|
|
|
_unknown, /* 11 */
|
|
|
|
_unknown, /* 12 */
|
|
|
|
_unknown, /* 13 */
|
|
|
|
_unknown, /* 14 */
|
|
|
|
_unknown, /* 15 */
|
2009-06-23 21:01:14 -05:00
|
|
|
};
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
#define nvpsize2 nvpsize /* these two tables are identical */
|
|
|
|
static const char *const nvpsize[] = {
|
|
|
|
"none", /* 0 */
|
|
|
|
"8K bytes", /* 1 */
|
|
|
|
"16K bytes", /* 2 */
|
|
|
|
"32K bytes", /* 3 */
|
|
|
|
_unknown, /* 4 */
|
|
|
|
"64K bytes", /* 5 */
|
|
|
|
_unknown, /* 6 */
|
|
|
|
"128K bytes", /* 7 */
|
|
|
|
_unknown, /* 8 */
|
|
|
|
"256K bytes", /* 9 */
|
|
|
|
"512K bytes", /* 10 */
|
|
|
|
_unknown, /* 11 */
|
|
|
|
"1024K bytes", /* 12 */
|
|
|
|
_unknown, /* 13 */
|
|
|
|
"2048K bytes", /* 14 */
|
|
|
|
_unknown, /* 15 */
|
2009-06-23 21:01:14 -05:00
|
|
|
};
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static const char *const sramsize[] = {
|
|
|
|
"48K Bytes", /* 0 */
|
|
|
|
"1K Bytes", /* 1 */
|
|
|
|
"2K Bytes", /* 2 */
|
|
|
|
"6K Bytes", /* 3 */
|
|
|
|
"112K Bytes", /* 4 */
|
|
|
|
"4K Bytes", /* 5 */
|
|
|
|
"80K Bytes", /* 6 */
|
|
|
|
"160K Bytes", /* 7 */
|
|
|
|
"8K Bytes", /* 8 */
|
|
|
|
"16K Bytes", /* 9 */
|
|
|
|
"32K Bytes", /* 10 */
|
|
|
|
"64K Bytes", /* 11 */
|
|
|
|
"128K Bytes", /* 12 */
|
|
|
|
"256K Bytes", /* 13 */
|
|
|
|
"96K Bytes", /* 14 */
|
|
|
|
"512K Bytes", /* 15 */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct archnames { unsigned value; const char *name; } archnames[] = {
|
2012-01-31 11:55:03 -06:00
|
|
|
{ 0x19, "AT91SAM9xx Series" },
|
|
|
|
{ 0x29, "AT91SAM9XExx Series" },
|
|
|
|
{ 0x34, "AT91x34 Series" },
|
|
|
|
{ 0x37, "CAP7 Series" },
|
|
|
|
{ 0x39, "CAP9 Series" },
|
|
|
|
{ 0x3B, "CAP11 Series" },
|
|
|
|
{ 0x40, "AT91x40 Series" },
|
|
|
|
{ 0x42, "AT91x42 Series" },
|
|
|
|
{ 0x55, "AT91x55 Series" },
|
|
|
|
{ 0x60, "AT91SAM7Axx Series" },
|
|
|
|
{ 0x61, "AT91SAM7AQxx Series" },
|
|
|
|
{ 0x63, "AT91x63 Series" },
|
|
|
|
{ 0x70, "AT91SAM7Sxx Series" },
|
|
|
|
{ 0x71, "AT91SAM7XCxx Series" },
|
|
|
|
{ 0x72, "AT91SAM7SExx Series" },
|
|
|
|
{ 0x73, "AT91SAM7Lxx Series" },
|
|
|
|
{ 0x75, "AT91SAM7Xxx Series" },
|
|
|
|
{ 0x76, "AT91SAM7SLxx Series" },
|
|
|
|
{ 0x80, "ATSAM3UxC Series (100-pin version)" },
|
|
|
|
{ 0x81, "ATSAM3UxE Series (144-pin version)" },
|
|
|
|
{ 0x83, "ATSAM3AxC Series (100-pin version)" },
|
|
|
|
{ 0x84, "ATSAM3XxC Series (100-pin version)" },
|
|
|
|
{ 0x85, "ATSAM3XxE Series (144-pin version)" },
|
|
|
|
{ 0x86, "ATSAM3XxG Series (208/217-pin version)" },
|
|
|
|
{ 0x88, "ATSAM3SxA Series (48-pin version)" },
|
|
|
|
{ 0x89, "ATSAM3SxB Series (64-pin version)" },
|
|
|
|
{ 0x8A, "ATSAM3SxC Series (100-pin version)" },
|
|
|
|
{ 0x92, "AT91x92 Series" },
|
2012-02-28 02:50:09 -06:00
|
|
|
{ 0x93, "ATSAM3NxA Series (48-pin version)" },
|
|
|
|
{ 0x94, "ATSAM3NxB Series (64-pin version)" },
|
|
|
|
{ 0x95, "ATSAM3NxC Series (100-pin version)" },
|
|
|
|
{ 0x98, "ATSAM3SDxA Series (48-pin version)" },
|
|
|
|
{ 0x99, "ATSAM3SDxB Series (64-pin version)" },
|
|
|
|
{ 0x9A, "ATSAM3SDxC Series (100-pin version)" },
|
|
|
|
{ 0xA5, "ATSAM5A" },
|
2012-01-31 11:55:03 -06:00
|
|
|
{ 0xF0, "AT75Cxx Series" },
|
2009-06-23 21:01:14 -05:00
|
|
|
{ -1, NULL },
|
|
|
|
};
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static const char *const nvptype[] = {
|
|
|
|
"rom", /* 0 */
|
|
|
|
"romless or onchip flash", /* 1 */
|
|
|
|
"embedded flash memory",/* 2 */
|
|
|
|
"rom(nvpsiz) + embedded flash (nvpsiz2)", /* 3 */
|
|
|
|
"sram emulating flash", /* 4 */
|
|
|
|
_unknown, /* 5 */
|
|
|
|
_unknown, /* 6 */
|
|
|
|
_unknown, /* 7 */
|
2009-06-23 21:01:14 -05:00
|
|
|
};
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
static const char *_yes_or_no(uint32_t v)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
if (v)
|
2009-06-23 21:01:14 -05:00
|
|
|
return "YES";
|
2012-01-31 11:55:03 -06:00
|
|
|
else
|
2009-06-23 21:01:14 -05:00
|
|
|
return "NO";
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static const char *const _rc_freq[] = {
|
2009-06-23 21:01:14 -05:00
|
|
|
"4 MHz", "8 MHz", "12 MHz", "reserved"
|
|
|
|
};
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static void sam3_explain_ckgr_mor(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t v;
|
|
|
|
uint32_t rcen;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MOSCXTEN", pChip->cfg.CKGR_MOR, 0, 1);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_USER("(main xtal enabled: %s)", _yes_or_no(v));
|
2009-06-24 04:38:21 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MOSCXTBY", pChip->cfg.CKGR_MOR, 1, 1);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_USER("(main osc bypass: %s)", _yes_or_no(v));
|
2011-01-25 10:15:30 -06:00
|
|
|
rcen = sam3_reg_fieldname(pChip, "MOSCRCEN", pChip->cfg.CKGR_MOR, 3, 1);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_USER("(onchip RC-OSC enabled: %s)", _yes_or_no(rcen));
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MOSCRCF", pChip->cfg.CKGR_MOR, 4, 3);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_USER("(onchip RC-OSC freq: %s)", _rc_freq[v]);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
pChip->cfg.rc_freq = 0;
|
2009-06-24 04:38:15 -05:00
|
|
|
if (rcen) {
|
|
|
|
switch (v) {
|
2012-01-31 11:55:03 -06:00
|
|
|
default:
|
|
|
|
pChip->cfg.rc_freq = 0;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
pChip->cfg.rc_freq = 4 * 1000 * 1000;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pChip->cfg.rc_freq = 8 * 1000 * 1000;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pChip->cfg.rc_freq = 12 * 1000 * 1000;
|
|
|
|
break;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
v = sam3_reg_fieldname(pChip, "MOSCXTST", pChip->cfg.CKGR_MOR, 8, 8);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(startup clks, time= %f uSecs)",
|
2012-01-31 11:55:03 -06:00
|
|
|
((float)(v * 1000000)) / ((float)(pChip->cfg.slow_freq)));
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MOSCSEL", pChip->cfg.CKGR_MOR, 24, 1);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(mainosc source: %s)",
|
2012-01-31 11:55:03 -06:00
|
|
|
v ? "external xtal" : "internal RC");
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
v = sam3_reg_fieldname(pChip, "CFDEN", pChip->cfg.CKGR_MOR, 25, 1);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(clock failure enabled: %s)",
|
2012-01-31 11:55:03 -06:00
|
|
|
_yes_or_no(v));
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static void sam3_explain_chipid_cidr(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int x;
|
|
|
|
uint32_t v;
|
|
|
|
const char *cp;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
sam3_reg_fieldname(pChip, "Version", pChip->cfg.CHIPID_CIDR, 0, 5);
|
2010-06-13 23:22:10 -05:00
|
|
|
LOG_USER_N("\n");
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "EPROC", pChip->cfg.CHIPID_CIDR, 5, 3);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s", eproc_names[v]);
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "NVPSIZE", pChip->cfg.CHIPID_CIDR, 8, 4);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s", nvpsize[v]);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "NVPSIZE2", pChip->cfg.CHIPID_CIDR, 12, 4);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s", nvpsize2[v]);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
v = sam3_reg_fieldname(pChip, "SRAMSIZE", pChip->cfg.CHIPID_CIDR, 16, 4);
|
|
|
|
LOG_USER("%s", sramsize[v]);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "ARCH", pChip->cfg.CHIPID_CIDR, 20, 8);
|
2009-06-23 21:01:14 -05:00
|
|
|
cp = _unknown;
|
2012-01-31 11:55:03 -06:00
|
|
|
for (x = 0; archnames[x].name; x++) {
|
2009-06-24 04:38:15 -05:00
|
|
|
if (v == archnames[x].value) {
|
2009-06-23 21:01:14 -05:00
|
|
|
cp = archnames[x].name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s", cp);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "NVPTYP", pChip->cfg.CHIPID_CIDR, 28, 3);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_USER("%s", nvptype[v]);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "EXTID", pChip->cfg.CHIPID_CIDR, 31, 1);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(exists: %s)", _yes_or_no(v));
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static void sam3_explain_ckgr_mcfr(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t v;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MAINFRDY", pChip->cfg.CKGR_MCFR, 16, 1);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(main ready: %s)", _yes_or_no(v));
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
v = sam3_reg_fieldname(pChip, "MAINF", pChip->cfg.CKGR_MCFR, 0, 16);
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
v = (v * pChip->cfg.slow_freq) / 16;
|
|
|
|
pChip->cfg.mainosc_freq = v;
|
|
|
|
|
2013-09-30 04:31:57 -05:00
|
|
|
LOG_USER("(%3.03f Mhz (%" PRIu32 ".%03" PRIu32 "khz slowclk)",
|
2012-01-31 11:55:03 -06:00
|
|
|
_tomhz(v),
|
2013-09-30 04:31:57 -05:00
|
|
|
(uint32_t)(pChip->cfg.slow_freq / 1000),
|
|
|
|
(uint32_t)(pChip->cfg.slow_freq % 1000));
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static void sam3_explain_ckgr_plla(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
uint32_t mula, diva;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
diva = sam3_reg_fieldname(pChip, "DIVA", pChip->cfg.CKGR_PLLAR, 0, 8);
|
2010-06-13 23:22:10 -05:00
|
|
|
LOG_USER_N("\n");
|
2009-06-24 04:38:08 -05:00
|
|
|
mula = sam3_reg_fieldname(pChip, "MULA", pChip->cfg.CKGR_PLLAR, 16, 11);
|
2010-06-13 23:22:10 -05:00
|
|
|
LOG_USER_N("\n");
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip->cfg.plla_freq = 0;
|
2012-01-31 11:55:03 -06:00
|
|
|
if (mula == 0)
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("\tPLLA Freq: (Disabled,mula = 0)");
|
2012-01-31 11:55:03 -06:00
|
|
|
else if (diva == 0)
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("\tPLLA Freq: (Disabled,diva = 0)");
|
2013-03-23 14:13:46 -05:00
|
|
|
else if (diva >= 1) {
|
|
|
|
pChip->cfg.plla_freq = (pChip->cfg.mainosc_freq * (mula + 1) / diva);
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("\tPLLA Freq: %3.03f MHz",
|
2012-01-31 11:55:03 -06:00
|
|
|
_tomhz(pChip->cfg.plla_freq));
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static void sam3_explain_mckr(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2009-06-30 16:13:53 -05:00
|
|
|
uint32_t css, pres, fin = 0;
|
|
|
|
int pdiv = 0;
|
|
|
|
const char *cp = NULL;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
css = sam3_reg_fieldname(pChip, "CSS", pChip->cfg.PMC_MCKR, 0, 2);
|
2009-06-24 04:38:15 -05:00
|
|
|
switch (css & 3) {
|
2012-01-31 11:55:03 -06:00
|
|
|
case 0:
|
|
|
|
fin = pChip->cfg.slow_freq;
|
|
|
|
cp = "slowclk";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fin = pChip->cfg.mainosc_freq;
|
|
|
|
cp = "mainosc";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fin = pChip->cfg.plla_freq;
|
|
|
|
cp = "plla";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (pChip->cfg.CKGR_UCKR & (1 << 16)) {
|
|
|
|
fin = 480 * 1000 * 1000;
|
|
|
|
cp = "upll";
|
|
|
|
} else {
|
|
|
|
fin = 0;
|
|
|
|
cp = "upll (*ERROR* UPLL is disabled)";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
break;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("%s (%3.03f Mhz)",
|
2012-01-31 11:55:03 -06:00
|
|
|
cp,
|
|
|
|
_tomhz(fin));
|
2009-06-24 04:38:08 -05:00
|
|
|
pres = sam3_reg_fieldname(pChip, "PRES", pChip->cfg.PMC_MCKR, 4, 3);
|
2009-06-24 04:38:15 -05:00
|
|
|
switch (pres & 0x07) {
|
2012-01-31 11:55:03 -06:00
|
|
|
case 0:
|
|
|
|
pdiv = 1;
|
|
|
|
cp = "selected clock";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pdiv = 2;
|
|
|
|
cp = "clock/2";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pdiv = 4;
|
|
|
|
cp = "clock/4";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pdiv = 8;
|
|
|
|
cp = "clock/8";
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
pdiv = 16;
|
|
|
|
cp = "clock/16";
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
pdiv = 32;
|
|
|
|
cp = "clock/32";
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
pdiv = 64;
|
|
|
|
cp = "clock/64";
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
pdiv = 6;
|
|
|
|
cp = "clock/6";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
break;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("(%s)", cp);
|
2009-06-23 21:01:14 -05:00
|
|
|
fin = fin / pdiv;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* sam3 has a *SINGLE* clock - */
|
|
|
|
/* other at91 series parts have divisors for these. */
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip->cfg.cpu_freq = fin;
|
|
|
|
pChip->cfg.mclk_freq = fin;
|
|
|
|
pChip->cfg.fclk_freq = fin;
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER("\t\tResult CPU Freq: %3.03f",
|
2012-01-31 11:55:03 -06:00
|
|
|
_tomhz(fin));
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
#if 0
|
2012-01-31 11:55:03 -06:00
|
|
|
static struct sam3_chip *target2sam3(struct target *pTarget)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_chip *pChip;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pTarget == NULL)
|
2009-06-23 21:01:14 -05:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pChip = all_sam3_chips;
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pChip) {
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pChip->target == pTarget)
|
|
|
|
break; /* return below */
|
|
|
|
else
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip = pChip->next;
|
|
|
|
}
|
|
|
|
return pChip;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static uint32_t *sam3_get_reg_ptr(struct sam3_cfg *pCfg, const struct sam3_reg_list *pList)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
/* this function exists to help */
|
|
|
|
/* keep funky offsetof() errors */
|
|
|
|
/* and casting from causing bugs */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* By using prototypes - we can detect what would */
|
|
|
|
/* be casting errors. */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
return (uint32_t *)(void *)(((char *)(pCfg)) + pList->struct_offset);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
#define SAM3_ENTRY(NAME, FUNC) { .address = SAM3_ ## NAME, .struct_offset = offsetof( \
|
|
|
|
struct sam3_cfg, \
|
|
|
|
NAME), # NAME, FUNC }
|
2009-06-23 21:01:14 -05:00
|
|
|
static const struct sam3_reg_list sam3_all_regs[] = {
|
2012-01-31 11:55:03 -06:00
|
|
|
SAM3_ENTRY(CKGR_MOR, sam3_explain_ckgr_mor),
|
|
|
|
SAM3_ENTRY(CKGR_MCFR, sam3_explain_ckgr_mcfr),
|
|
|
|
SAM3_ENTRY(CKGR_PLLAR, sam3_explain_ckgr_plla),
|
|
|
|
SAM3_ENTRY(CKGR_UCKR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_FSMR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_FSPR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_IMR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_MCKR, sam3_explain_mckr),
|
|
|
|
SAM3_ENTRY(PMC_PCK0, NULL),
|
|
|
|
SAM3_ENTRY(PMC_PCK1, NULL),
|
|
|
|
SAM3_ENTRY(PMC_PCK2, NULL),
|
|
|
|
SAM3_ENTRY(PMC_PCSR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_SCSR, NULL),
|
|
|
|
SAM3_ENTRY(PMC_SR, NULL),
|
|
|
|
SAM3_ENTRY(CHIPID_CIDR, sam3_explain_chipid_cidr),
|
2012-03-06 12:57:45 -06:00
|
|
|
SAM3_ENTRY(CHIPID_CIDR2, sam3_explain_chipid_cidr),
|
2012-01-31 11:55:03 -06:00
|
|
|
SAM3_ENTRY(CHIPID_EXID, NULL),
|
2012-03-06 12:57:45 -06:00
|
|
|
SAM3_ENTRY(CHIPID_EXID2, NULL),
|
2012-01-31 11:55:03 -06:00
|
|
|
/* TERMINATE THE LIST */
|
2009-06-23 21:01:14 -05:00
|
|
|
{ .name = NULL }
|
|
|
|
};
|
|
|
|
#undef SAM3_ENTRY
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static struct sam3_bank_private *get_sam3_bank_private(struct flash_bank *bank)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2013-09-28 14:43:37 -05:00
|
|
|
return bank->driver_priv;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-30 00:34:07 -05:00
|
|
|
/**
|
|
|
|
* Given a pointer to where it goes in the structure,
|
|
|
|
* determine the register name, address from the all registers table.
|
2009-06-23 21:01:14 -05:00
|
|
|
*/
|
2012-01-31 11:55:03 -06:00
|
|
|
static const struct sam3_reg_list *sam3_GetReg(struct sam3_chip *pChip, uint32_t *goes_here)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
const struct sam3_reg_list *pReg;
|
|
|
|
|
|
|
|
pReg = &(sam3_all_regs[0]);
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pReg->name) {
|
2009-06-23 21:01:14 -05:00
|
|
|
uint32_t *pPossible;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* calculate where this one go.. */
|
|
|
|
/* it is "possibly" this register. */
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2010-09-03 15:49:37 -05:00
|
|
|
pPossible = ((uint32_t *)(void *)(((char *)(&(pChip->cfg))) + pReg->struct_offset));
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* well? Is it this register */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pPossible == goes_here) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Jump for joy! */
|
2009-06-23 21:01:14 -05:00
|
|
|
return pReg;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* next... */
|
2009-06-23 21:01:14 -05:00
|
|
|
pReg++;
|
|
|
|
}
|
2012-01-31 11:55:03 -06:00
|
|
|
/* This is *TOTAL*PANIC* - we are totally screwed. */
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("INVALID SAM3 REGISTER");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_ReadThisReg(struct sam3_chip *pChip, uint32_t *goes_here)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
const struct sam3_reg_list *pReg;
|
|
|
|
int r;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
pReg = sam3_GetReg(pChip, goes_here);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!pReg)
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = target_read_u32(pChip->target, pReg->address, goes_here);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2011-01-05 13:24:54 -06:00
|
|
|
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d",
|
2012-01-31 11:55:03 -06:00
|
|
|
pReg->name, (unsigned)(pReg->address), r);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_ReadAllRegs(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
const struct sam3_reg_list *pReg;
|
|
|
|
|
|
|
|
pReg = &(sam3_all_regs[0]);
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pReg->name) {
|
2009-06-24 04:38:21 -05:00
|
|
|
r = sam3_ReadThisReg(pChip,
|
2012-01-31 11:55:03 -06:00
|
|
|
sam3_get_reg_ptr(&(pChip->cfg), pReg));
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-10-04 10:18:15 -05:00
|
|
|
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Error: %d",
|
2012-01-31 11:55:03 -06:00
|
|
|
pReg->name, ((unsigned)(pReg->address)), r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
pReg++;
|
|
|
|
}
|
|
|
|
|
2012-03-06 12:57:45 -06:00
|
|
|
/* Chip identification register
|
|
|
|
*
|
|
|
|
* Unfortunately, the chip identification register is not at
|
|
|
|
* a constant address across all of the SAM3 series'. As a
|
|
|
|
* consequence, a simple heuristic is used to find where it's
|
|
|
|
* at...
|
|
|
|
*
|
|
|
|
* If the contents at the first address is zero, then we know
|
|
|
|
* that the second address is where the chip id register is.
|
|
|
|
* We can deduce this because for those SAM's that have the
|
|
|
|
* chip id @ 0x400e0940, the first address, 0x400e0740, is
|
|
|
|
* located in the memory map of the Power Management Controller
|
|
|
|
* (PMC). Furthermore, the address is not used by the PMC.
|
|
|
|
* So when read, the memory controller returns zero.*/
|
|
|
|
if (pChip->cfg.CHIPID_CIDR == 0) {
|
|
|
|
/*Put the correct CIDR and EXID values in the pChip structure */
|
|
|
|
pChip->cfg.CHIPID_CIDR = pChip->cfg.CHIPID_CIDR2;
|
|
|
|
pChip->cfg.CHIPID_EXID = pChip->cfg.CHIPID_EXID2;
|
|
|
|
}
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_GetInfo(struct sam3_chip *pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
const struct sam3_reg_list *pReg;
|
|
|
|
uint32_t regval;
|
|
|
|
|
|
|
|
pReg = &(sam3_all_regs[0]);
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pReg->name) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* display all regs */
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_DEBUG("Start: %s", pReg->name);
|
|
|
|
regval = *sam3_get_reg_ptr(&(pChip->cfg), pReg);
|
2013-09-30 04:31:57 -05:00
|
|
|
LOG_USER("%*s: [0x%08" PRIx32 "] -> 0x%08" PRIx32,
|
2012-01-31 11:55:03 -06:00
|
|
|
REG_NAME_WIDTH,
|
|
|
|
pReg->name,
|
|
|
|
pReg->address,
|
|
|
|
regval);
|
|
|
|
if (pReg->explain_func)
|
2009-06-24 04:38:08 -05:00
|
|
|
(*(pReg->explain_func))(pChip);
|
|
|
|
LOG_DEBUG("End: %s", pReg->name);
|
2009-06-23 21:01:14 -05:00
|
|
|
pReg++;
|
|
|
|
}
|
2011-01-05 20:54:12 -06:00
|
|
|
LOG_USER(" rc-osc: %3.03f MHz", _tomhz(pChip->cfg.rc_freq));
|
|
|
|
LOG_USER(" mainosc: %3.03f MHz", _tomhz(pChip->cfg.mainosc_freq));
|
|
|
|
LOG_USER(" plla: %3.03f MHz", _tomhz(pChip->cfg.plla_freq));
|
|
|
|
LOG_USER(" cpu-freq: %3.03f MHz", _tomhz(pChip->cfg.cpu_freq));
|
|
|
|
LOG_USER("mclk-freq: %3.03f MHz", _tomhz(pChip->cfg.mclk_freq));
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2013-09-30 04:31:57 -05:00
|
|
|
LOG_USER(" UniqueId: 0x%08" PRIx32 " 0x%08" PRIx32 " 0x%08" PRIx32 " 0x%08" PRIx32,
|
2012-01-31 11:55:03 -06:00
|
|
|
pChip->cfg.unique_id[0],
|
|
|
|
pChip->cfg.unique_id[1],
|
|
|
|
pChip->cfg.unique_id[2],
|
|
|
|
pChip->cfg.unique_id[3]);
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_protect_check(struct flash_bank *bank)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
2012-01-31 11:55:03 -06:00
|
|
|
uint32_t v = 0;
|
2009-06-23 21:01:14 -05:00
|
|
|
unsigned x;
|
|
|
|
struct sam3_bank_private *pPrivate;
|
|
|
|
|
|
|
|
LOG_DEBUG("Begin");
|
|
|
|
if (bank->target->state != TARGET_HALTED) {
|
|
|
|
LOG_ERROR("Target not halted");
|
|
|
|
return ERROR_TARGET_NOT_HALTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPrivate = get_sam3_bank_private(bank);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!pPrivate) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("no private for this bank?");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!(pPrivate->probed))
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FLASH_BANK_NOT_PROBED;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
r = FLASHD_GetLockBits(pPrivate, &v);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("Failed: %d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
for (x = 0; x < pPrivate->nsectors; x++)
|
2009-06-23 21:01:14 -05:00
|
|
|
bank->sectors[x].is_protected = (!!(v & (1 << x)));
|
|
|
|
LOG_DEBUG("Done");
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 03:41:30 -06:00
|
|
|
FLASH_BANK_COMMAND_HANDLER(sam3_flash_bank_command)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_chip *pChip;
|
|
|
|
|
|
|
|
pChip = all_sam3_chips;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* is this an existing chip? */
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pChip) {
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pChip->target == bank->target)
|
2009-06-23 21:01:14 -05:00
|
|
|
break;
|
|
|
|
pChip = pChip->next;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!pChip) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* this is a *NEW* chip */
|
2009-06-24 04:38:08 -05:00
|
|
|
pChip = calloc(1, sizeof(struct sam3_chip));
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!pChip) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("NO RAM!");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
pChip->target = bank->target;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* insert at head */
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip->next = all_sam3_chips;
|
|
|
|
all_sam3_chips = pChip;
|
|
|
|
pChip->target = bank->target;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* assumption is this runs at 32khz */
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip->cfg.slow_freq = 32768;
|
2020-07-01 03:21:52 -05:00
|
|
|
pChip->probed = false;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
switch (bank->base) {
|
2012-01-31 11:55:03 -06:00
|
|
|
default:
|
|
|
|
LOG_ERROR("Address 0x%08x invalid bank address (try 0x%08x or 0x%08x "
|
|
|
|
"[at91sam3u series] or 0x%08x [at91sam3s series] or "
|
2012-03-06 12:57:45 -06:00
|
|
|
"0x%08x [at91sam3n series] or 0x%08x or 0x%08x or 0x%08x[at91sam3ax series] )",
|
2012-01-31 11:55:03 -06:00
|
|
|
((unsigned int)(bank->base)),
|
|
|
|
((unsigned int)(FLASH_BANK0_BASE_U)),
|
|
|
|
((unsigned int)(FLASH_BANK1_BASE_U)),
|
|
|
|
((unsigned int)(FLASH_BANK_BASE_S)),
|
2012-03-06 12:57:45 -06:00
|
|
|
((unsigned int)(FLASH_BANK_BASE_N)),
|
|
|
|
((unsigned int)(FLASH_BANK0_BASE_AX)),
|
|
|
|
((unsigned int)(FLASH_BANK1_BASE_256K_AX)),
|
|
|
|
((unsigned int)(FLASH_BANK1_BASE_512K_AX)));
|
2012-01-31 11:55:03 -06:00
|
|
|
return ERROR_FAIL;
|
|
|
|
|
2012-03-06 12:57:45 -06:00
|
|
|
/* at91sam3s and at91sam3n series only has bank 0*/
|
|
|
|
/* at91sam3u and at91sam3ax series has the same address for bank 0*/
|
|
|
|
case FLASH_BANK_BASE_S:
|
2012-01-31 11:55:03 -06:00
|
|
|
case FLASH_BANK0_BASE_U:
|
|
|
|
bank->driver_priv = &(pChip->details.bank[0]);
|
|
|
|
bank->bank_number = 0;
|
|
|
|
pChip->details.bank[0].pChip = pChip;
|
|
|
|
pChip->details.bank[0].pBank = bank;
|
|
|
|
break;
|
2012-03-06 12:57:45 -06:00
|
|
|
|
|
|
|
/* Bank 1 of at91sam3u or at91sam3ax series */
|
2012-01-31 11:55:03 -06:00
|
|
|
case FLASH_BANK1_BASE_U:
|
2012-03-06 12:57:45 -06:00
|
|
|
case FLASH_BANK1_BASE_256K_AX:
|
|
|
|
case FLASH_BANK1_BASE_512K_AX:
|
2012-01-31 11:55:03 -06:00
|
|
|
bank->driver_priv = &(pChip->details.bank[1]);
|
|
|
|
bank->bank_number = 1;
|
|
|
|
pChip->details.bank[1].pChip = pChip;
|
|
|
|
pChip->details.bank[1].pBank = bank;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we initialize after probing. */
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2018-02-15 03:18:37 -06:00
|
|
|
/**
|
2020-07-11 17:00:47 -05:00
|
|
|
* Remove all chips from the internal list without distinguishing which one
|
2018-02-15 03:18:37 -06:00
|
|
|
* is owned by this bank. This simplification works only for one shot
|
|
|
|
* deallocation like current flash_free_all_banks()
|
|
|
|
*/
|
2020-10-28 17:27:02 -05:00
|
|
|
static void sam3_free_driver_priv(struct flash_bank *bank)
|
2018-02-15 03:18:37 -06:00
|
|
|
{
|
|
|
|
struct sam3_chip *chip = all_sam3_chips;
|
|
|
|
while (chip) {
|
|
|
|
struct sam3_chip *next = chip->next;
|
|
|
|
free(chip);
|
|
|
|
chip = next;
|
|
|
|
}
|
|
|
|
all_sam3_chips = NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_GetDetails(struct sam3_bank_private *pPrivate)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
const struct sam3_chip_details *pDetails;
|
|
|
|
struct sam3_chip *pChip;
|
2009-11-13 13:32:28 -06:00
|
|
|
struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
|
2009-06-23 21:01:14 -05:00
|
|
|
unsigned x;
|
|
|
|
|
|
|
|
LOG_DEBUG("Begin");
|
|
|
|
pDetails = all_sam3_details;
|
2009-06-24 04:38:15 -05:00
|
|
|
while (pDetails->name) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Compare cidr without version bits */
|
2014-03-13 16:18:29 -05:00
|
|
|
if (((pDetails->chipid_cidr ^ pPrivate->pChip->cfg.CHIPID_CIDR) & 0xFFFFFFE0) == 0)
|
2009-06-23 21:01:14 -05:00
|
|
|
break;
|
2012-01-31 11:55:03 -06:00
|
|
|
else
|
2009-06-23 21:01:14 -05:00
|
|
|
pDetails++;
|
|
|
|
}
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pDetails->name == NULL) {
|
2012-03-06 12:57:45 -06:00
|
|
|
LOG_ERROR("SAM3 ChipID 0x%08x not found in table (perhaps you can ID this chip?)",
|
2012-01-31 11:55:03 -06:00
|
|
|
(unsigned int)(pPrivate->pChip->cfg.CHIPID_CIDR));
|
|
|
|
/* Help the victim, print details about the chip */
|
2013-09-30 04:31:57 -05:00
|
|
|
LOG_INFO("SAM3 CHIPID_CIDR: 0x%08" PRIx32 " decodes as follows",
|
2012-01-31 11:55:03 -06:00
|
|
|
pPrivate->pChip->cfg.CHIPID_CIDR);
|
2009-06-24 04:38:08 -05:00
|
|
|
sam3_explain_chipid_cidr(pPrivate->pChip);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* DANGER: THERE ARE DRAGONS HERE */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* get our pChip - it is going */
|
|
|
|
/* to be over-written shortly */
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip = pPrivate->pChip;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Note that, in reality: */
|
|
|
|
/* */
|
|
|
|
/* pPrivate = &(pChip->details.bank[0]) */
|
|
|
|
/* or pPrivate = &(pChip->details.bank[1]) */
|
|
|
|
/* */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* save the "bank" pointers */
|
|
|
|
for (x = 0; x < SAM3_MAX_FLASH_BANKS; x++)
|
|
|
|
saved_banks[x] = pChip->details.bank[x].pBank;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Overwrite the "details" structure. */
|
2009-06-24 04:38:21 -05:00
|
|
|
memcpy(&(pPrivate->pChip->details),
|
2012-01-31 11:55:03 -06:00
|
|
|
pDetails,
|
|
|
|
sizeof(pPrivate->pChip->details));
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* now fix the ghosted pointers */
|
|
|
|
for (x = 0; x < SAM3_MAX_FLASH_BANKS; x++) {
|
2009-06-23 21:01:14 -05:00
|
|
|
pChip->details.bank[x].pChip = pChip;
|
|
|
|
pChip->details.bank[x].pBank = saved_banks[x];
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* update the *BANK*SIZE* */
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
LOG_DEBUG("End");
|
|
|
|
return ERROR_OK;
|
2009-06-24 04:38:21 -05:00
|
|
|
}
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int _sam3_probe(struct flash_bank *bank, int noise)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
struct sam3_bank_private *pPrivate;
|
|
|
|
|
|
|
|
|
2020-06-07 10:00:13 -05:00
|
|
|
LOG_DEBUG("Begin: Bank: %u, Noise: %d", bank->bank_number, noise);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (bank->target->state != TARGET_HALTED) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Target not halted");
|
|
|
|
return ERROR_TARGET_NOT_HALTED;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
pPrivate = get_sam3_bank_private(bank);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!pPrivate) {
|
2011-01-05 13:24:54 -06:00
|
|
|
LOG_ERROR("Invalid/unknown bank number");
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = sam3_ReadAllRegs(pPrivate->pChip);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Here");
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pPrivate->pChip->probed)
|
2010-06-13 23:22:10 -05:00
|
|
|
r = sam3_GetInfo(pPrivate->pChip);
|
2012-01-31 11:55:03 -06:00
|
|
|
else
|
2010-06-13 23:22:10 -05:00
|
|
|
r = sam3_GetDetails(pPrivate);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* update the flash bank size */
|
2020-06-07 10:00:13 -05:00
|
|
|
for (unsigned int x = 0; x < SAM3_MAX_FLASH_BANKS; x++) {
|
2011-08-20 09:31:35 -05:00
|
|
|
if (bank->base == pPrivate->pChip->details.bank[x].base_address) {
|
2012-01-31 11:55:03 -06:00
|
|
|
bank->size = pPrivate->pChip->details.bank[x].size_bytes;
|
2009-06-23 21:01:14 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (bank->sectors == NULL) {
|
2012-01-31 11:55:03 -06:00
|
|
|
bank->sectors = calloc(pPrivate->nsectors, (sizeof((bank->sectors)[0])));
|
2009-06-24 04:38:15 -05:00
|
|
|
if (bank->sectors == NULL) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("No memory!");
|
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
bank->num_sectors = pPrivate->nsectors;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2020-06-07 10:00:13 -05:00
|
|
|
for (unsigned int x = 0; x < bank->num_sectors; x++) {
|
2012-01-31 11:55:03 -06:00
|
|
|
bank->sectors[x].size = pPrivate->sector_size;
|
|
|
|
bank->sectors[x].offset = x * (pPrivate->sector_size);
|
|
|
|
/* mark as unknown */
|
|
|
|
bank->sectors[x].is_erased = -1;
|
2009-06-23 21:01:14 -05:00
|
|
|
bank->sectors[x].is_protected = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-01 03:21:52 -05:00
|
|
|
pPrivate->probed = true;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_protect_check(bank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
|
|
|
|
LOG_DEBUG("Bank = %d, nbanks = %d",
|
2012-01-31 11:55:03 -06:00
|
|
|
pPrivate->bank_number, pPrivate->pChip->details.n_banks);
|
2009-06-24 04:38:15 -05:00
|
|
|
if ((pPrivate->bank_number + 1) == pPrivate->pChip->details.n_banks) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* read unique id, */
|
|
|
|
/* it appears to be associated with the *last* flash bank. */
|
2009-06-23 21:01:14 -05:00
|
|
|
FLASHD_ReadUniqueID(pPrivate);
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_probe(struct flash_bank *bank)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2009-06-24 04:38:08 -05:00
|
|
|
return _sam3_probe(bank, 1);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_auto_probe(struct flash_bank *bank)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2009-06-24 04:38:08 -05:00
|
|
|
return _sam3_probe(bank, 0);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2020-06-07 10:00:13 -05:00
|
|
|
static int sam3_erase(struct flash_bank *bank, unsigned int first,
|
|
|
|
unsigned int last)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_bank_private *pPrivate;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
LOG_DEBUG("Here");
|
|
|
|
if (bank->target->state != TARGET_HALTED) {
|
|
|
|
LOG_ERROR("Target not halted");
|
|
|
|
return ERROR_TARGET_NOT_HALTED;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_auto_probe(bank);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("Here,r=%d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
pPrivate = get_sam3_bank_private(bank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!(pPrivate->probed))
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FLASH_BANK_NOT_PROBED;
|
|
|
|
|
2020-06-07 10:00:13 -05:00
|
|
|
if ((first == 0) && ((last + 1) == pPrivate->nsectors)) {
|
2012-01-31 11:55:03 -06:00
|
|
|
/* whole chip */
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Here");
|
2009-06-24 04:38:08 -05:00
|
|
|
return FLASHD_EraseEntireBank(pPrivate);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2012-10-04 10:18:15 -05:00
|
|
|
LOG_INFO("sam3 auto-erases while programming (request ignored)");
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2020-06-07 10:00:13 -05:00
|
|
|
static int sam3_protect(struct flash_bank *bank, int set, unsigned int first,
|
|
|
|
unsigned int last)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_bank_private *pPrivate;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
LOG_DEBUG("Here");
|
|
|
|
if (bank->target->state != TARGET_HALTED) {
|
|
|
|
LOG_ERROR("Target not halted");
|
|
|
|
return ERROR_TARGET_NOT_HALTED;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
pPrivate = get_sam3_bank_private(bank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!(pPrivate->probed))
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FLASH_BANK_NOT_PROBED;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (set)
|
2020-06-07 10:00:13 -05:00
|
|
|
r = FLASHD_Lock(pPrivate, first, last);
|
2012-01-31 11:55:03 -06:00
|
|
|
else
|
2020-06-07 10:00:13 -05:00
|
|
|
r = FLASHD_Unlock(pPrivate, first, last);
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("End: r=%d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
return r;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_page_read(struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *buf)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t adr;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
adr = pagenum * pPrivate->page_size;
|
2012-09-02 02:45:15 -05:00
|
|
|
adr += pPrivate->base_address;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:21 -05:00
|
|
|
r = target_read_memory(pPrivate->pChip->target,
|
2012-01-31 11:55:03 -06:00
|
|
|
adr,
|
|
|
|
4, /* THIS*MUST*BE* in 32bit values */
|
|
|
|
pPrivate->page_size / 4,
|
|
|
|
buf);
|
|
|
|
if (r != ERROR_OK)
|
|
|
|
LOG_ERROR("SAM3: Flash program failed to read page phys address: 0x%08x",
|
|
|
|
(unsigned int)(adr));
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2014-03-10 16:23:07 -05:00
|
|
|
static int sam3_page_write(struct sam3_bank_private *pPrivate, unsigned pagenum, const uint8_t *buf)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
uint32_t adr;
|
|
|
|
uint32_t status;
|
2012-01-31 11:55:03 -06:00
|
|
|
uint32_t fmr; /* EEFC Flash Mode Register */
|
2009-06-23 21:01:14 -05:00
|
|
|
int r;
|
|
|
|
|
|
|
|
adr = pagenum * pPrivate->page_size;
|
2012-09-02 02:45:15 -05:00
|
|
|
adr += pPrivate->base_address;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2011-10-27 05:14:55 -05:00
|
|
|
/* Get flash mode register value */
|
|
|
|
r = target_read_u32(pPrivate->pChip->target, pPrivate->controller_address, &fmr);
|
|
|
|
if (r != ERROR_OK)
|
|
|
|
LOG_DEBUG("Error Read failed: read flash mode register");
|
|
|
|
|
|
|
|
/* Clear flash wait state field */
|
|
|
|
fmr &= 0xfffff0ff;
|
|
|
|
|
|
|
|
/* set FWS (flash wait states) field in the FMR (flash mode register) */
|
|
|
|
fmr |= (pPrivate->flash_wait_states << 8);
|
|
|
|
|
|
|
|
LOG_DEBUG("Flash Mode: 0x%08x", ((unsigned int)(fmr)));
|
|
|
|
r = target_write_u32(pPrivate->pBank->target, pPrivate->controller_address, fmr);
|
|
|
|
if (r != ERROR_OK)
|
|
|
|
LOG_DEBUG("Error Write failed: set flash mode register");
|
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_DEBUG("Wr Page %u @ phys address: 0x%08x", pagenum, (unsigned int)(adr));
|
2009-06-24 04:38:21 -05:00
|
|
|
r = target_write_memory(pPrivate->pChip->target,
|
2012-01-31 11:55:03 -06:00
|
|
|
adr,
|
|
|
|
4, /* THIS*MUST*BE* in 32bit values */
|
|
|
|
pPrivate->page_size / 4,
|
|
|
|
buf);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_ERROR("SAM3: Failed to write (buffer) page at phys address 0x%08x",
|
|
|
|
(unsigned int)(adr));
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:01 -05:00
|
|
|
r = EFC_PerformCommand(pPrivate,
|
2012-01-31 11:55:03 -06:00
|
|
|
/* send Erase & Write Page */
|
|
|
|
AT91C_EFC_FCMD_EWP,
|
|
|
|
pagenum,
|
|
|
|
&status);
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
|
|
|
LOG_ERROR("SAM3: Error performing Erase & Write page @ phys address 0x%08x",
|
|
|
|
(unsigned int)(adr));
|
2009-06-24 04:38:15 -05:00
|
|
|
if (status & (1 << 2)) {
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_ERROR("SAM3: Page @ Phys address 0x%08x is locked", (unsigned int)(adr));
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2009-06-24 04:38:15 -05:00
|
|
|
if (status & (1 << 1)) {
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_ERROR("SAM3: Flash Command error @phys address 0x%08x", (unsigned int)(adr));
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
return ERROR_OK;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
static int sam3_write(struct flash_bank *bank,
|
2014-03-10 16:23:07 -05:00
|
|
|
const uint8_t *buffer,
|
2012-01-31 11:55:03 -06:00
|
|
|
uint32_t offset,
|
|
|
|
uint32_t count)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
unsigned page_cur;
|
|
|
|
unsigned page_end;
|
|
|
|
int r;
|
|
|
|
unsigned page_offset;
|
|
|
|
struct sam3_bank_private *pPrivate;
|
|
|
|
uint8_t *pagebuffer;
|
|
|
|
|
2020-07-11 17:00:47 -05:00
|
|
|
/* in case we bail further below, set this to null */
|
2009-06-27 11:51:41 -05:00
|
|
|
pagebuffer = NULL;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* ignore dumb requests */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (count == 0) {
|
2009-06-27 11:51:41 -05:00
|
|
|
r = ERROR_OK;
|
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bank->target->state != TARGET_HALTED) {
|
|
|
|
LOG_ERROR("Target not halted");
|
2009-06-27 11:51:41 -05:00
|
|
|
r = ERROR_TARGET_NOT_HALTED;
|
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pPrivate = get_sam3_bank_private(bank);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!(pPrivate->probed)) {
|
2009-06-27 11:51:41 -05:00
|
|
|
r = ERROR_FLASH_BANK_NOT_PROBED;
|
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if ((offset + count) > pPrivate->size_bytes) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("Flash write error - past end of bank");
|
|
|
|
LOG_ERROR(" offset: 0x%08x, count 0x%08x, BankEnd: 0x%08x",
|
2012-01-31 11:55:03 -06:00
|
|
|
(unsigned int)(offset),
|
|
|
|
(unsigned int)(count),
|
|
|
|
(unsigned int)(pPrivate->size_bytes));
|
2009-06-27 11:51:41 -05:00
|
|
|
r = ERROR_FAIL;
|
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-06-27 11:51:41 -05:00
|
|
|
pagebuffer = malloc(pPrivate->page_size);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!pagebuffer) {
|
2009-06-27 11:51:41 -05:00
|
|
|
LOG_ERROR("No memory for %d Byte page buffer", (int)(pPrivate->page_size));
|
|
|
|
r = ERROR_FAIL;
|
|
|
|
goto done;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* what page do we start & end in? */
|
2009-06-23 21:01:14 -05:00
|
|
|
page_cur = offset / pPrivate->page_size;
|
|
|
|
page_end = (offset + count - 1) / pPrivate->page_size;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Offset: 0x%08x, Count: 0x%08x", (unsigned int)(offset), (unsigned int)(count));
|
2009-06-24 04:38:08 -05:00
|
|
|
LOG_DEBUG("Page start: %d, Page End: %d", (int)(page_cur), (int)(page_end));
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Special case: all one page */
|
|
|
|
/* */
|
|
|
|
/* Otherwise: */
|
|
|
|
/* (1) non-aligned start */
|
|
|
|
/* (2) body pages */
|
|
|
|
/* (3) non-aligned end. */
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* Handle special case - all one page. */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (page_cur == page_end) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Special case, all in one page");
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_read(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
page_offset = (offset & (pPrivate->page_size-1));
|
2009-06-24 04:38:01 -05:00
|
|
|
memcpy(pagebuffer + page_offset,
|
2012-01-31 11:55:03 -06:00
|
|
|
buffer,
|
|
|
|
count);
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_write(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
|
|
|
r = ERROR_OK;
|
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* non-aligned start */
|
2009-06-23 21:01:14 -05:00
|
|
|
page_offset = offset & (pPrivate->page_size - 1);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (page_offset) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_DEBUG("Not-Aligned start");
|
2012-01-31 11:55:03 -06:00
|
|
|
/* read the partial */
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_read(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* over-write with new data */
|
2009-06-24 04:38:08 -05:00
|
|
|
n = (pPrivate->page_size - page_offset);
|
2009-06-24 04:38:01 -05:00
|
|
|
memcpy(pagebuffer + page_offset,
|
2012-01-31 11:55:03 -06:00
|
|
|
buffer,
|
|
|
|
n);
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_write(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
|
|
|
|
count -= n;
|
|
|
|
offset += n;
|
|
|
|
buffer += n;
|
|
|
|
page_cur++;
|
|
|
|
}
|
|
|
|
|
2011-11-03 15:39:23 -05:00
|
|
|
/* By checking that offset is correct here, we also
|
|
|
|
fix a clang warning */
|
2012-02-24 04:18:12 -06:00
|
|
|
assert(offset % pPrivate->page_size == 0);
|
2011-11-03 15:39:23 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* intermediate large pages */
|
|
|
|
/* also - the final *terminal* */
|
|
|
|
/* if that terminal page is a full page */
|
2009-06-24 04:38:21 -05:00
|
|
|
LOG_DEBUG("Full Page Loop: cur=%d, end=%d, count = 0x%08x",
|
2012-01-31 11:55:03 -06:00
|
|
|
(int)page_cur, (int)page_end, (unsigned int)(count));
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2009-06-24 04:38:21 -05:00
|
|
|
while ((page_cur < page_end) &&
|
2012-01-31 11:55:03 -06:00
|
|
|
(count >= pPrivate->page_size)) {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_write(pPrivate, page_cur, buffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2012-01-31 11:55:03 -06:00
|
|
|
count -= pPrivate->page_size;
|
|
|
|
buffer += pPrivate->page_size;
|
2009-06-23 21:01:14 -05:00
|
|
|
page_cur += 1;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* terminal partial page? */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (count) {
|
2009-06-24 04:37:37 -05:00
|
|
|
LOG_DEBUG("Terminal partial page, count = 0x%08x", (unsigned int)(count));
|
2012-01-31 11:55:03 -06:00
|
|
|
/* we have a partial page */
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_page_read(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2012-01-31 11:55:03 -06:00
|
|
|
/* data goes at start */
|
2009-06-24 04:38:08 -05:00
|
|
|
memcpy(pagebuffer, buffer, count);
|
|
|
|
r = sam3_page_write(pPrivate, page_cur, pagebuffer);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-27 11:51:41 -05:00
|
|
|
goto done;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
LOG_DEBUG("Done!");
|
2009-06-27 11:51:41 -05:00
|
|
|
r = ERROR_OK;
|
2012-01-31 11:55:03 -06:00
|
|
|
done:
|
2020-08-17 03:08:35 -05:00
|
|
|
free(pagebuffer);
|
2009-06-27 11:51:41 -05:00
|
|
|
return r;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(sam3_handle_info_command)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_chip *pChip;
|
2019-03-31 20:45:54 -05:00
|
|
|
pChip = get_current_sam3(CMD);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
|
2011-11-03 15:39:23 -05:00
|
|
|
unsigned x;
|
|
|
|
int r;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* bank0 must exist before we can do anything */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pChip->details.bank[0].pBank == NULL) {
|
2009-06-23 21:01:14 -05:00
|
|
|
x = 0;
|
2012-01-31 11:55:03 -06:00
|
|
|
need_define:
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD,
|
2012-01-31 11:55:03 -06:00
|
|
|
"Please define bank %d via command: flash bank %s ... ",
|
|
|
|
x,
|
|
|
|
at91sam3_flash.name);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* if bank 0 is not probed, then probe it */
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!(pChip->details.bank[0].probed)) {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_auto_probe(pChip->details.bank[0].pBank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2012-01-31 11:55:03 -06:00
|
|
|
/* above guarantees the "chip details" structure is valid */
|
|
|
|
/* and thus, bank private areas are valid */
|
|
|
|
/* and we have a SAM3 chip, what a concept! */
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
/* auto-probe other banks, 0 done above */
|
|
|
|
for (x = 1; x < SAM3_MAX_FLASH_BANKS; x++) {
|
|
|
|
/* skip banks not present */
|
|
|
|
if (!(pChip->details.bank[x].present))
|
2009-06-23 21:01:14 -05:00
|
|
|
continue;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pChip->details.bank[x].pBank == NULL)
|
2009-06-23 21:01:14 -05:00
|
|
|
goto need_define;
|
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (pChip->details.bank[x].probed)
|
2009-06-23 21:01:14 -05:00
|
|
|
continue;
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_auto_probe(pChip->details.bank[x].pBank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_GetInfo(pChip);
|
2009-06-24 04:38:15 -05:00
|
|
|
if (r != ERROR_OK) {
|
2012-01-31 11:55:03 -06:00
|
|
|
LOG_DEBUG("Sam3Info, Failed %d", r);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(sam3_handle_gpnvm_command)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
2012-01-31 11:55:03 -06:00
|
|
|
unsigned x, v;
|
|
|
|
int r, who;
|
2009-06-23 21:01:14 -05:00
|
|
|
struct sam3_chip *pChip;
|
|
|
|
|
2019-03-31 20:45:54 -05:00
|
|
|
pChip = get_current_sam3(CMD);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pChip->target->state != TARGET_HALTED) {
|
2009-06-23 21:01:14 -05:00
|
|
|
LOG_ERROR("sam3 - target not halted");
|
|
|
|
return ERROR_TARGET_NOT_HALTED;
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (pChip->details.bank[0].pBank == NULL) {
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Bank0 must be defined first via: flash bank %s ...",
|
2012-01-31 11:55:03 -06:00
|
|
|
at91sam3_flash.name);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_FAIL;
|
|
|
|
}
|
2009-06-24 04:38:15 -05:00
|
|
|
if (!pChip->details.bank[0].probed) {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = sam3_auto_probe(pChip->details.bank[0].pBank);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-11-15 06:57:12 -06:00
|
|
|
switch (CMD_ARGC) {
|
2012-01-31 11:55:03 -06:00
|
|
|
default:
|
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
case 0:
|
|
|
|
goto showall;
|
|
|
|
case 1:
|
2009-06-23 21:01:14 -05:00
|
|
|
who = -1;
|
2012-01-31 11:55:03 -06:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if ((0 == strcmp(CMD_ARGV[0], "show")) && (0 == strcmp(CMD_ARGV[1], "all")))
|
|
|
|
who = -1;
|
|
|
|
else {
|
|
|
|
uint32_t v32;
|
|
|
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], v32);
|
|
|
|
who = v32;
|
|
|
|
}
|
|
|
|
break;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
|
2009-11-15 10:15:59 -06:00
|
|
|
if (0 == strcmp("show", CMD_ARGV[0])) {
|
2009-06-24 04:38:15 -05:00
|
|
|
if (who == -1) {
|
2010-01-09 10:58:38 -06:00
|
|
|
showall:
|
2009-06-24 19:12:40 -05:00
|
|
|
r = ERROR_OK;
|
2012-01-31 11:55:03 -06:00
|
|
|
for (x = 0; x < pChip->details.n_gpnvms; x++) {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), x, &v);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (r != ERROR_OK)
|
2009-06-23 21:01:14 -05:00
|
|
|
break;
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "sam3-gpnvm%u: %u", x, v);
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
2009-06-24 04:38:15 -05:00
|
|
|
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
|
2019-12-20 16:18:37 -06:00
|
|
|
if (r == ERROR_OK)
|
|
|
|
command_print(CMD, "sam3-gpnvm%u: %u", who, v);
|
2009-06-23 21:01:14 -05:00
|
|
|
return r;
|
|
|
|
} else {
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "sam3-gpnvm invalid GPNVM: %u", who);
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-24 04:38:15 -05:00
|
|
|
if (who == -1) {
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Missing GPNVM number");
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
}
|
2009-06-24 04:38:21 -05:00
|
|
|
|
2012-01-31 11:55:03 -06:00
|
|
|
if (0 == strcmp("set", CMD_ARGV[0]))
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_SetGPNVM(&(pChip->details.bank[0]), who);
|
2012-01-31 11:55:03 -06:00
|
|
|
else if ((0 == strcmp("clr", CMD_ARGV[0])) ||
|
|
|
|
(0 == strcmp("clear", CMD_ARGV[0]))) /* quietly accept both */
|
2009-06-24 04:38:08 -05:00
|
|
|
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
|
2012-01-31 11:55:03 -06:00
|
|
|
else {
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Unknown command: %s", CMD_ARGV[0]);
|
2009-06-23 21:01:14 -05:00
|
|
|
r = ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-11-10 01:56:52 -06:00
|
|
|
COMMAND_HANDLER(sam3_handle_slowclk_command)
|
2009-06-23 21:01:14 -05:00
|
|
|
{
|
|
|
|
struct sam3_chip *pChip;
|
|
|
|
|
2019-03-31 20:45:54 -05:00
|
|
|
pChip = get_current_sam3(CMD);
|
2012-01-31 11:55:03 -06:00
|
|
|
if (!pChip)
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
|
2009-11-15 06:57:12 -06:00
|
|
|
switch (CMD_ARGC) {
|
2012-01-31 11:55:03 -06:00
|
|
|
case 0:
|
|
|
|
/* show */
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
/* set */
|
|
|
|
uint32_t v;
|
|
|
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
|
|
|
|
if (v > 200000) {
|
|
|
|
/* absurd slow clock of 200Khz? */
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Absurd/illegal slow clock freq: %d\n", (int)(v));
|
2012-01-31 11:55:03 -06:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
|
|
}
|
|
|
|
pChip->cfg.slow_freq = v;
|
|
|
|
break;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
2012-01-31 11:55:03 -06:00
|
|
|
default:
|
|
|
|
/* error */
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Too many parameters");
|
2012-01-31 11:55:03 -06:00
|
|
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
2009-06-23 21:01:14 -05:00
|
|
|
}
|
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should switch to CMD as
first parameter.
Change prototype of command_print() and command_print_sameline()
to pass CMD instead of CMD_CTX.
Since the first parameter is currently not used, the change can be
done though scripts without manual coding.
This patch is created using the command:
sed -i PATTERN $(find src/ doc/ -type f)
with all the following patters:
's/\(command_print(cmd\)->ctx,/\1,/'
's/\(command_print(CMD\)_CTX,/\1,/'
's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/'
's/\(command_print_sameline(cmd\)->ctx,/\1,/'
's/\(command_print_sameline(CMD\)_CTX,/\1,/'
's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/'
This change is inspired by http://openocd.zylin.com/1815 from Paul
Fertser but is now done through scripting.
Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5081
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-03 03:37:24 -05:00
|
|
|
command_print(CMD, "Slowclk freq: %d.%03dkhz",
|
2012-01-31 11:55:03 -06:00
|
|
|
(int)(pChip->cfg.slow_freq / 1000),
|
|
|
|
(int)(pChip->cfg.slow_freq % 1000));
|
2009-06-23 21:01:14 -05:00
|
|
|
return ERROR_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-22 06:13:56 -06:00
|
|
|
static const struct command_registration at91sam3_exec_command_handlers[] = {
|
|
|
|
{
|
|
|
|
.name = "gpnvm",
|
2010-01-09 10:58:38 -06:00
|
|
|
.handler = sam3_handle_gpnvm_command,
|
2009-11-22 06:13:56 -06:00
|
|
|
.mode = COMMAND_EXEC,
|
2010-01-09 10:58:38 -06:00
|
|
|
.usage = "[('clr'|'set'|'show') bitnum]",
|
|
|
|
.help = "Without arguments, shows all bits in the gpnvm "
|
|
|
|
"register. Otherwise, clears, sets, or shows one "
|
|
|
|
"General Purpose Non-Volatile Memory (gpnvm) bit.",
|
2009-11-22 06:13:56 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "info",
|
2010-01-09 10:58:38 -06:00
|
|
|
.handler = sam3_handle_info_command,
|
2009-11-22 06:13:56 -06:00
|
|
|
.mode = COMMAND_EXEC,
|
2019-05-06 05:18:30 -05:00
|
|
|
.help = "Print information about the current at91sam3 chip "
|
2010-01-09 10:58:38 -06:00
|
|
|
"and its flash configuration.",
|
2019-01-04 11:16:00 -06:00
|
|
|
.usage = "",
|
2009-11-22 06:13:56 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "slowclk",
|
2010-01-09 10:58:38 -06:00
|
|
|
.handler = sam3_handle_slowclk_command,
|
2009-11-22 06:13:56 -06:00
|
|
|
.mode = COMMAND_EXEC,
|
2010-01-09 10:58:38 -06:00
|
|
|
.usage = "[clock_hz]",
|
|
|
|
.help = "Display or set the slowclock frequency "
|
|
|
|
"(default 32768 Hz).",
|
2009-11-22 06:13:56 -06:00
|
|
|
},
|
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
|
|
|
static const struct command_registration at91sam3_command_handlers[] = {
|
|
|
|
{
|
|
|
|
.name = "at91sam3",
|
|
|
|
.mode = COMMAND_ANY,
|
|
|
|
.help = "at91sam3 flash command group",
|
2012-01-09 10:14:18 -06:00
|
|
|
.usage = "",
|
2009-11-22 06:13:56 -06:00
|
|
|
.chain = at91sam3_exec_command_handlers,
|
|
|
|
},
|
|
|
|
COMMAND_REGISTRATION_DONE
|
|
|
|
};
|
2009-06-23 21:01:14 -05:00
|
|
|
|
2018-12-13 13:53:59 -06:00
|
|
|
const struct flash_driver at91sam3_flash = {
|
2010-01-29 15:52:08 -06:00
|
|
|
.name = "at91sam3",
|
|
|
|
.commands = at91sam3_command_handlers,
|
|
|
|
.flash_bank_command = sam3_flash_bank_command,
|
|
|
|
.erase = sam3_erase,
|
|
|
|
.protect = sam3_protect,
|
|
|
|
.write = sam3_write,
|
2010-05-10 22:16:33 -05:00
|
|
|
.read = default_flash_read,
|
2010-01-29 15:52:08 -06:00
|
|
|
.probe = sam3_probe,
|
|
|
|
.auto_probe = sam3_auto_probe,
|
2018-11-15 07:50:08 -06:00
|
|
|
.erase_check = default_flash_blank_check,
|
2010-01-29 15:52:08 -06:00
|
|
|
.protect_check = sam3_protect_check,
|
2018-02-15 03:18:37 -06:00
|
|
|
.free_driver_priv = sam3_free_driver_priv,
|
2010-01-29 15:52:08 -06:00
|
|
|
};
|