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

Enhance DTS yaml support to handle device being on different bus types #11375

Closed
galak opened this issue Nov 14, 2018 · 3 comments
Closed

Enhance DTS yaml support to handle device being on different bus types #11375

galak opened this issue Nov 14, 2018 · 3 comments
Labels
area: Devicetree Enhancement Changes/Updates/Additions to existing features

Comments

@galak
Copy link
Collaborator

galak commented Nov 14, 2018

Currently we have sensors that can be connected over either I2C or SPI. To handle this we have different compatible names like ("st,lsm6dsl-spi" & "st,lsm6dsl"). We really should only have a single compatible for the device ("st,lsm6dsl").

@galak galak added Enhancement Changes/Updates/Additions to existing features area: Devicetree labels Nov 14, 2018
@erwango
Copy link
Member

erwango commented Nov 19, 2018

I'm surprised by this request.
Node for spi bus slave or i2c bus slave will have different properties, how can we make map this to single compatible ? (which mean a single driver will have to be able to handle both)

@galak
Copy link
Collaborator Author

galak commented Nov 19, 2018

I'm surprised by this request.
Node for spi bus slave or i2c bus slave will have different properties, how can we make map this to single compatible ? (which mean a single driver will have to be able to handle both)

All of the properties that aren't bus specific should be identical for the same sensor like st,lsm6dsl. I assume that if a sensor supports connecting over I2C or SPI that everything else is the same.

@erwango
Copy link
Member

erwango commented Nov 19, 2018

Ok, so then, they can share a common "phy", but I don't how we can have common bus slaves.
So 2 bus slaves variants that share the same sensor phy node?

galak added a commit to galak/zephyr that referenced this issue Dec 7, 2018
There are a number of cases in which we a sensor can be either connected
on I2C or SPI.  We've been treating these cases as different compatiable
properties, but they really should use the same compatiable and just
determine the info based on the parent bus in the device tree.  We can
now support having two different binding files for the same compatiable
to handle the case of a sensor supporting either I2C or SPI as how its
connected.

We put "sensor" nodes in a bus specific dict bus_bindings[bus] that
we can than lookup later based on the DTS and determining the bus type
that the "sensor" node is on.

Fixes zephyrproject-rtos#11375

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
@galak galak closed this as completed in 2442382 Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

2 participants