Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSPI driver does not assign the 'op_mode' and 'duplex' in mspi_cfg #80064

Open
FRASTM opened this issue Oct 18, 2024 · 1 comment · May be fixed by #80089
Open

MSPI driver does not assign the 'op_mode' and 'duplex' in mspi_cfg #80064

FRASTM opened this issue Oct 18, 2024 · 1 comment · May be fixed by #80089
Assignees
Labels
area: MSPI bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@FRASTM
Copy link
Collaborator

FRASTM commented Oct 18, 2024

Describe the bug
in the description of the devicetree for the Multi-bit SPI Bus
property op-mode and duplex are supposed to be set as follows

 			op-mode = "MSPI_CONTROLLER";
			duplex = "MSPI_HALF_DUPLEX";

The MSPI_CONFIG macro is capturing the mspi_cfg with (see drivers/mspi/mspi_emul.c)

		.op_mode = DT_ENUM_IDX_OR(n, op_mode, MSPI_OP_MODE_CONTROLLER),
		.duplex = DT_ENUM_IDX_OR(n, duplex, MSPI_HALF_DUPLEX),

which does not accept
op-mode = "MSPI_CONTROLLER";
duplex = "MSPI_HALF_DUPLEX";

To Reproduce
Steps to reproduce the behavior:

  1. add overlay file for the mspi1 node with properties 'op-mode' and 'duplex' as above
  2. west build
  3. See error

Expected behavior
Use the appropriate DT macro to retrieve the mspi_config

mspi_config = 	
	{
		.channel_num = EMUL_MSPI_INST_ID, 		
		.op_mode = MSPI_OP_MODE_CONTROLLER,
		.duplex = MSPI_HALF_DUPLEX,
		etc.
	}

Logs and console output

devicetree_generated.h:8377:46: error: incompatible types when initializing type 'enum mspi_op_mode' using type 'char *'
...
in expansion of macro 'MSPI_BUS_NODE'
   37 |         .op_mode                  = DT_PROP_OR(MSPI_BUS_NODE, op_mode, MSPI_OP_MODE_CONTROLLER),


devicetree_generated.h:8393:45: error: incompatible types when initializing type 'enum mspi_duplex' using type 'char *'
...
 in expansion of macro 'MSPI_BUS_NODE'
   38 |         .duplex                   = DT_PROP_OR(MSPI_BUS_NODE, duplex, MSPI_HALF_DUPLEX),

Environment (please complete the following information):

  • OS: (e.g. Linux, MacOS, Windows) ubuntu
  • Toolchain (e.g Zephyr SDK, ...) 0.16.8
  • Commit SHA or Version used 03959a2

-->

@FRASTM FRASTM added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug area: MSPI labels Oct 18, 2024
@swift-tk
Copy link
Collaborator

swift-tk commented Oct 19, 2024

In the error, it uses DT_PROP_OR not DT_ENUM_IDX_OR.
Although it should have been DT_INST_ENUM_IDX_OR... caught a slient fail in mspi_emul.c

oh, i see the code is in tests/drivers/mspi/api/src/main.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: MSPI bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants