Skip to content

Commit

Permalink
same70b: Add support for SMC for SAME70- and SAMV71-series
Browse files Browse the repository at this point in the history
Add smc definition in same70.dtsi
Add atmel,smc-bus-width to atmel,sam-smc dts bindings.
Update driver to select bus width from DT

Signed-off-by: Asgeir Stavik Hustad <[email protected]>
  • Loading branch information
Asgeir Stavik Hustad committed Sep 9, 2024
1 parent 36940db commit 99848b5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
6 changes: 5 additions & 1 deletion drivers/memc/memc_sam_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ static int memc_smc_init(const struct device *dev)
SMC_CYCLE_NWE_CYCLE(DT_PROP_BY_IDX(node_id, atmel_smc_cycle_timing, 0)) \
| SMC_CYCLE_NRD_CYCLE(DT_PROP_BY_IDX(node_id, atmel_smc_cycle_timing, 1))

#define BUS_WIDTH(node_id) COND_CODE_1(DT_ENUM_IDX(node_id, atmel_smc_bus_width), \
(SMC_MODE_DBW_16_BIT), (0))

#define BANK_CONFIG(node_id) \
{ \
.cs = DT_REG_ADDR(node_id), \
.mode = COND_CODE_1(DT_ENUM_IDX(node_id, atmel_smc_write_mode), \
.mode = BUS_WIDTH(node_id) \
| COND_CODE_1(DT_ENUM_IDX(node_id, atmel_smc_write_mode), \
(SMC_MODE_WRITE_MODE), (0)) \
| COND_CODE_1(DT_ENUM_IDX(node_id, atmel_smc_read_mode), \
(SMC_MODE_READ_MODE), (0)), \
Expand Down
9 changes: 9 additions & 0 deletions dts/arm/atmel/same70.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,15 @@
alarms-count = <1>;
status = "disabled";
};

smc: smc@40080000 {
compatible = "atmel,sam-smc";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40080000 0x4000>;
clocks = <&pmc PMC_TYPE_PERIPHERAL 9>;
status = "disabled";
};
};
};

Expand Down
14 changes: 14 additions & 0 deletions dts/bindings/memory-controllers/atmel,sam-smc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,17 @@ child-binding:
is encoded in 9 bits where the two highest bits are multiplied
with an offset of 256.
Effective value for each element: 256 x cycle[8:7] + cycle[6:0]
atmel,smc-bus-width:
type: int
default: 8
description: |
Bus Width configuration for the Static Memory Controller that
is wired to the external device.
SMC on SAMx7 supports 8/16-bit bus width, on SAM4
only 8-bit data buses are supported.
The default value is 8-bit data buses.
enum:
- 8
- 16
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ manifest:
groups:
- hal
- name: hal_atmel
revision: 56d60ebc909ad065bf6554cee73487969857614b
revision: pull/41/head
path: modules/hal/atmel
groups:
- hal
Expand Down

0 comments on commit 99848b5

Please sign in to comment.