Skip to content

Commit e8d9dec

Browse files
danieldegrassenashif
authored andcommitted
drivers: memc: memc_mcux_flexspi: allow setting ahb alignment boundary
Some instances of the FLEXSPI IP permit limiting AHB bus access so that no memory access requests will straddle a page boundary. Add a property to manage this setting. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent df18121 commit e8d9dec

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/memc/memc_mcux_flexspi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct memc_flexspi_data {
5353
bool ahb_cacheable;
5454
bool ahb_prefetch;
5555
bool ahb_read_addr_opt;
56+
uint8_t ahb_boundary;
5657
bool combination_mode;
5758
bool sck_differential_clock;
5859
flexspi_read_sample_clock_t rx_sample_clock;
@@ -342,6 +343,12 @@ FSL_FEATURE_FLEXSPI_SUPPORT_SEPERATE_RXCLKSRC_PORTB
342343

343344
FLEXSPI_Init(data->base, &flexspi_config);
344345

346+
#if defined(FLEXSPI_AHBCR_ALIGNMENT_MASK)
347+
/* Configure AHB alignment boundary */
348+
data->base->AHBCR = (data->base->AHBCR & ~FLEXSPI_AHBCR_ALIGNMENT_MASK) |
349+
FLEXSPI_AHBCR_ALIGNMENT(data->ahb_boundary);
350+
#endif
351+
345352
if (memc_flexspi_is_running_xip(dev)) {
346353
/* Restore flash sizes */
347354
for (i = 0; i < kFLEXSPI_PortCount; i++) {
@@ -414,6 +421,7 @@ static int memc_flexspi_pm_action(const struct device *dev, enum pm_device_actio
414421
.ahb_cacheable = DT_INST_PROP(n, ahb_cacheable), \
415422
.ahb_prefetch = DT_INST_PROP(n, ahb_prefetch), \
416423
.ahb_read_addr_opt = DT_INST_PROP(n, ahb_read_addr_opt),\
424+
.ahb_boundary = DT_INST_ENUM_IDX(n, ahb_boundary), \
417425
.combination_mode = DT_INST_PROP(n, combination_mode), \
418426
.sck_differential_clock = DT_INST_PROP(n, sck_differential_clock), \
419427
.rx_sample_clock = DT_INST_PROP(n, rx_clock_source), \

dts/bindings/spi/nxp,imx-flexspi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ properties:
8686
master_id: AHBRXBUFxCRx[MSTRID]
8787
buf_size: AHBRXBUFxCRx[BUFSZ]
8888
89+
ahb-boundary:
90+
type: string
91+
default: "no-boundary"
92+
enum:
93+
- "no-boundary"
94+
- "1024"
95+
- "512"
96+
- "256"
97+
description: |
98+
Sets the AHB read/write boundary. Only supported by some versions of
99+
the FLEXSPI IP. When set, all memory accesses that cross an address
100+
boundary of the specified size will be divided into smaller sub accesses.
89101
90102
child-binding:
91103
description: NXP FlexSPI port

0 commit comments

Comments
 (0)