atsam: Configure the atsam sram matrix register

The sram matrix configuration is, bizarrely, configured with a slow
default.  It will typically add an extra wait state to every memory
access.  Set the matrix sram controller to improve the performance.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-02-07 13:12:35 -05:00
parent af8376e203
commit 74c216543c
1 changed files with 11 additions and 0 deletions

View File

@ -102,11 +102,22 @@ usb_request_bootloader(void)
* Startup
****************************************************************/
static void
matrix_init(void)
{
// The ATSAM sram is in a "no default master" state at reset
// (despite the specs). That typically adds 1 wait cycle to every
// memory access. Set it to "last access master" to avoid that.
MATRIX->MATRIX_SCFG[0] = (MATRIX_SCFG_SLOT_CYCLE(64)
| MATRIX_SCFG_DEFMSTR_TYPE(1));
}
// Main entry point
int
main(void)
{
SystemInit();
matrix_init();
sched_main();
return 0;
}