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 8, 2024
1 parent 36940db commit ccdd7ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
10 changes: 9 additions & 1 deletion drivers/memc/memc_sam_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ 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))

#if defined(CONFIG_SOC_SERIES_SAME70) || defined(CONFIG_SOC_SERIES_SAMV71)
#define BUS_WIDTH(node_id) COND_CODE_1( DT_ENUM_IDX(node_id, atmel_smc_bus_width), \

Check failure on line 79 in drivers/memc/memc_sam_smc.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/memc/memc_sam_smc.c:79 space prohibited after that open parenthesis '('
(SMC_MODE_DBW_16_BIT), (SMC_MODE_DBW_8_BIT))
#else
#define BUS_WIDTH(node_id) (0)
#endif

#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
13 changes: 13 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,16 @@ 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
required: false
default: 8
description: |
Bus Width configuration for the External Bus Interface / the
Static Memory Controller that is wired to the external device.
SMC on SAME70 (and S70/V70/V71) supports 8- or 16-bit bus width.
On SAM4S (and 4E) only 8-bit data buses are supported, therefore 8-bit is set as default.
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 ccdd7ab

Please sign in to comment.