flash: sam0: Define LOCK_REGIONS in dts

The amount of lock regions differs between different sam0 MCUs.

	saml10:  2
	saml11:  4
	samd2x:	16
	saml2x: 16
	samd5x: 32

ASF does not provide a definition for this, so create a new one
in dts.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
This commit is contained in:
Benjamin Valentin 2019-05-16 17:16:24 +02:00 committed by Anas Nashif
commit fc7f458ab3
3 changed files with 8 additions and 1 deletions

View file

@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(flash_sam0);
* Number of lock regions. The number is fixed and the region size
* grows with the flash size.
*/
#define LOCK_REGIONS 16
#define LOCK_REGIONS DT_ATMEL_SAM0_NVMCTRL_0_LOCK_REGIONS
#define LOCK_REGION_SIZE (FLASH_SIZE / LOCK_REGIONS)
#if defined(NVMCTRL_BLOCK_SIZE)

View file

@ -60,6 +60,7 @@
label = "FLASH_CTRL";
reg = <0x41004000 0x22>;
interrupts = <5 0>;
lock-regions = <16>;
#address-cells = <1>;
#size-cells = <1>;

View file

@ -3,3 +3,9 @@ description: Atmel SAM0 NVMC (Non-Volatile Memory Controller)
compatible: "atmel,sam0-nvmctrl"
include: flash-controller.yaml
properties:
lock-regions:
type: int
required: true
description: Number of lock regions