-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support for per-camera (or per EEPROM) DTB overlays #53
base: main
Are you sure you want to change the base?
Support for per-camera (or per EEPROM) DTB overlays #53
Conversation
be81360
to
f646940
Compare
Hello, I am not sure I am able to understand the goal of what you are trying to do. NV UEFI reads all EEPROMs based on information in eeprom-manager node in the DTB. All EEPROMs read from this are then used to apply the overlays to kernel DTB. Thanks |
Hi,
The current behaviour of NV UEFI is that:
This behaviour is a problem as it:
This PR adds support for a new, more controlled overlay behaviour via the new (optional) So for this
The overlay will only be applied if an EEPROM is read from one of those 2 DT paths, and that EEPROM Product ID also matches Let me know if anything else is unclear |
(This also fixes a prior bug where devices with no phandle in the device tree will end up with duplicate device indexes of 0. Now the combination of GUID + device index is guaranteed to uniquely identify a device) |
Hello, Let's go over the issues one by one to be able to handle them better. My comment will be purely from the perspective of NV providing UEFI for its reference platform and what we want to support there and via what mechanism.
Thanks |
Thanks for coming back to me.
I don't think this is a safe assumption at all - it's quite standard for EEPROM nodes not to be referenced by other nodes - that doesn't mean nothing is talking to those devices. The existence of a phandle doesn't tell you anything about how a driver might interpret a device tree node, especially those with
The reference
To be clear, NV UEFI already supports adding I appreciate you might need to check in with the product team to decide whether you want to add this feature, but I think it would be very useful, even for your reference e3333 interposer, not just on custom carriers, (and you should be able to test/verify with it once I add the TCA9546A support). It would allow CSI cameras to behave more like |
Hello, Thanks for your feedback. Lets again go through them one by one.
I would get back to you when I have more on 4. Meanwhile, please feel free to provide a commit for 3 as and when you have it. Thanks |
Surely the reference e3333 interposer with 6x
You keep saying this, but that isn't true! This code has been present since the initial commit... |
Let me reply issue by issue: Issue 1. Both approaches yield the same result. I would define a property /firmware/uefi/skip-eeprom-crc in DTB which can be used to skip CRC check for all EEPROMs. I would look at the issues at appropriate priority and post a fix as and when available. If you want to help out expedite this, please feel free and post targeted commits for each of the issues. Appreciate your help on this. Thanks |
Sure, I'll split these into separate commits 🙂 |
Thank You. Please try to have the commit message in the following format so that I can use it as is. Also, please add signed-off-by tag as well. fix/chore/feat: title description |
a62a2b0
to
4c1473e
Compare
Thank You. I will review these in a few days. I will need to rewrite the commit message to follow the NV format more closely. |
As a side question, do you guys have a |
We use uncrustify as in https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting |
4c1473e
to
c39673b
Compare
Hello, Please update the commit message to have the fix/feat/chore in small case. The title should be approximately 80 characters and the description say 100 in one line but you can have as many lines as you want. Also, we would need a legit email address so that it is clear that someone is contributing the code with the applicable license. Thanks |
FYI, I just verified the final result of this branch with my rewritten commits (I changed a few details on the way), on my board using PCA9547, using a base DT that looks like:
And overlays that look like:
And it's all working fine 🎉 |
c39673b
to
807d067
Compare
How about now? |
…ly unique This could (and did) happen in the following cases: * the device tree node had no phandle (so would default to 0, which could collide with other devices which also don't have a phandle) * or if the device tree phandle address happened to be the same as the Count of EEPROM devices * or if an atmel compatible EEPROM was defined directly under the i2c bus, this `Count` could (incorrectly) collide with the `Count` used for /eeprom-manager defined devices Instead of using a mix of phandles and Counts, this commit switches to using ((ControllerID << 16) | NumberOfI2cDevices), which should be globally unique across all buses Signed-off-by: eh-steve <[email protected]>
…_PROTOCOL Previously I2C devices behind a mux or switch were not visible to UEFI, and camera EEPROMs behind a mux would not get probed during boot. This commit adds support for all pca954x type I2C mux/switches, which the TCA9548A on the reference e3333 interposer board is compatible with. This allows the device tree to define an I2c mux using a `compatible = "nxp,pca9547"` prop, with child nodes inside, and for UEFI to be able to read camera EEPROMS behind these muxes. It does not yet add support for "i2c-mux-gpio" type muxes, but could potentially be added later. Signed-off-by: eh-steve <[email protected]>
To allow I2cIo drivers (and any other I2C driver) to lookup device tree nodes using DeviceGUID + DeviceIndex. This allows I2C device drivers to get more information about their hardware (e.g. full device tree paths of I2C devices, and read device tree properties) Signed-off-by: eh-steve <[email protected]>
… property NV UEFI currently skips the CRC check for Leopard camera eeproms whose product ID data starts with "LPRD" via a hardcoded exception. Other camera vendors may or may not set the last byte to the CRC8 value, so this exposes a device tree property "uefi-skip-crc" to be added to the eeprom device tree node, so hardcoded exceptions can be gradually removed and moved to device tree instead. This enables Framos camera support Signed-off-by: eh-steve <[email protected]>
…paths" Adds support for specific overlay triggers based on a combination of EEPROM IDs and the exact device tree paths of those EEPROMS. The current behaviour of NV UEFI is that if any EEPROM product ID from any I2C bus matches any of the ids listed in board_config, the overlay is triggered. Effectively all EEPROMs add to a global list of Board IDs, regardless of which device they actually represent. This means a single camera plugged into a single port would make the whole board be treated as matching that camera. This is a problem, since: * it prevents plugging different camera models into different ports and have them work without re-flashing the whole device (any CSI camera port change requires a reflash, instead of supporting various models automatically, and having the interposer board partly populated) * Causes the kernel to create devnodes for devices that don't exist, (causing preventable error logs in nvargus-daemon) This PR adds support for a new, more controlled overlay behaviour via the new (optional) eeprom-dt-paths board_config property, where an overlay can be triggered based on a match of the ID in the EEPROM and a match of the exact I2C device tree path the EEPROM product ID came from. (Old behaviour with existing board_configs should be unchanged). This means that the presence of a single camera no longer adds this Product ID to the global list of board IDs, but that you can selectively apply an overlay only when a specific ID was read from a specific device tree path (i.e. individual CSI cameras can be enumerated during boot and the kernel never creates devnodes for missing devices). ``` board_config { ids = "framos-imx462-0"; eeprom-dt-paths = "/i2c@3180000/pca9547@70/i2c@1/eeprom@55", "/i2c@3180000/pca9547@70/i2c@1/eeprom@56"; sw-modules = "kernel"; }; ``` Signed-off-by: eh-steve <[email protected]>
807d067
to
badb4fb
Compare
Also should this be based on |
Sorry for the delay in absorbing your patches. I would definitely get to it in the second week of June. Your patches are on main branch which is what we want. |
Hi, just checking in on this - did you get a chance to test it on the e3333? |
Hi, did you get a chance to review these changes? |
Hi Steve. Sorry for the delay. We have been busy with some other release milestones and would get to this in due time. Again, sorry for the delay. |
No worries 🙂 and thanks for getting back to me! |
Hello, just bumping this again |
Signed-off-by: eh-steve <[email protected]>
This PR adds 4 new features:
I2cSlaveDeviceTreePath
protocol to allow the lookup of the device tree path of anyI2cIo
device using its GUID and globally unique device index (+ also fixed bugs with non-unique device indices)EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL
. This allows the bootloader to traverse i2cmux sub-nodes in the device tree, and to switch between mux channels in order to communicate with these I2C slaves. While currently onlypca9547
compatible muxes are supported (and must be on the same bus), it should be fairly simple to add others (e.g.i2c-mux-gpio
compatible orpca9546
/pca9548
compatible switch) with a small refactor.board_config
-eeprom-dt-paths
. This can be used in tandem withids
to specify the exact EEPROM device which must match the IDs in order to apply a given overlay - this allows multiple camera models/manufacturers to be plugged in and supported at the same time via selectively applied overlays, and also to only selectively enable cameras/devices which are plugged inLPRD
).Overall, this PR enables the use of a 6 camera/12 channel base device tree with all devices disabled by default like:
Then by using 6 separate DTB overlays (one for each camera) like:
The bootloader can selectively enable overlays/cameras whose EEPROMs match both the
ids
andeeprom-dt-paths
, without triggering overlays for devices which aren't present on a particular port.