|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +/* The SRAM is defined for nrf52840 in DTS to take entire 256KiB |
| 8 | + * of RAM there is. We need some for the Disk, so we need to |
| 9 | + * remove the original definition and replace it with smaller one. |
| 10 | + */ |
| 11 | +/delete-node/ &sram0; |
| 12 | + |
| 13 | +/ { |
| 14 | + |
| 15 | + soc { |
| 16 | + /* This is defined based on dts and dtsi files for |
| 17 | + * nrf52840 SoC; because we are not able to just |
| 18 | + * change the size, what we have to do is to remove |
| 19 | + * the sram0 definition, which is a combined result |
| 20 | + * of all the sram0 referencing entries in included |
| 21 | + * dts files, and replace it with our own. |
| 22 | + * The first one is reduced in size original sram0: |
| 23 | + */ |
| 24 | + sram0: memory@20000000 { |
| 25 | + compatible = "mmio-sram"; |
| 26 | + reg = <0x20000000 DT_SIZE_K(192)>; |
| 27 | + }; |
| 28 | + /* The second one is 64kiB region taken out of SRAM, |
| 29 | + * labeled here ram_disk, label can be anything, |
| 30 | + * used later in disk definition. |
| 31 | + */ |
| 32 | + ram_disk: memory@20030000 { |
| 33 | + compatible = "mmio-sram"; |
| 34 | + reg = <0x20030000 DT_SIZE_K(64)>; |
| 35 | + }; |
| 36 | + }; |
| 37 | + |
| 38 | + msc_disk0 { |
| 39 | + status="okay"; |
| 40 | + compatible = "zephyr,ram-disk"; |
| 41 | + /* Sample, to make things easier, mounts all FAT |
| 42 | + * systems at "SD". |
| 43 | + */ |
| 44 | + disk-name = "SD"; |
| 45 | + /* Disk size is 64kB, 128 sectors of 512B, the minimal |
| 46 | + * required by FAT FS. |
| 47 | + */ |
| 48 | + sector-size = <512>; |
| 49 | + sector-count = <128>; |
| 50 | + /* Here is the reference to the memory reserved for our |
| 51 | + * disk using a phandle; note that we reference the |
| 52 | + * region by label we have defined it above. |
| 53 | + */ |
| 54 | + ram-region = <&ram_disk>; |
| 55 | + }; |
| 56 | +}; |
0 commit comments