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

arm: dts: Update coraz7s to match changes on the hdl. #2657

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gastmaier
Copy link

@gastmaier gastmaier commented Nov 26, 2024

PR Description

Related to analogdevicesinc/hdl#1517

To allow automatic EVB detection with the CoraZ7S, an IIC Controller is added to pin ARD SCL SDA at of the CoraZ7S.
The projects shall remove the controller if it is unused, but they cannot reuse the pins for Active In High signal (out from the evb),
to avoid a short during the runtime with the common bitstream, prior to switching to the project bitstream.

Since some projects already had IIC Controller, and to normalize across projects the addresses and irq pins, the following changes are applied:

    IIC Changes:
    Project       Old          New          IIC Subordinate     EEPROM ADDR**
    ad4170_asdz   ps-12, 44a4  ps-11, 4160  24AA32A             0x52
    ad57xx_ardz   PS7 IIC      ps-11, 4160  24AA32A             0x54
    pulsar_adc    none         ps-11, 4160  - 
    ad719x_asdz   none         ps-11, 4160  -
    cn0579        ps-12, 44a4  ps-11, 4160  AD5696
    cn0540        ps-12, 44a4  ps-11, 4160  LTC2606
    cn0561        PS7 IIC      ps-11, 4160  M24C02

    IRQ index changes:
    ad4170_asdz
    * $hier_spi_engine 11 -> 12

    ad57xx_ardz
    * ad57xx_dma 12 -> 13
    * $hier_spi_engine 11 -> 12

    cn0579
    * cn0579_dma 13 -> 12
    * axi_iic_ard 12 -> 11

    cn0540
    * $hier_spi_engine 11 -> 12
    * axi_iic_cn0540   12 -> 11

** Stopped checking after the first different value.

And to sync the changes to committed devicetrees, the following files were analyzed and modified:

devicetree                      HDL project     Change
zynq-coraz7s-ad7687-pmdz.dts    pulsar_adc      None, ignore IIC
zynq-coraz7s-ad7689-ardz.dts    pulsar_adc      None, ignore IIC
zynq-coraz7s-ad7946.dts         pulsar_adc      None, ignore IIC
zynq-coraz7s-ad7984.dts         pulsar_adc      None, ignore IIC
zynq-coraz7s-adaq4003.dts       pulsar_adc      None, ignore IIC
zynq-coraz7s-cn0501.dts         -               Removed
zynq-coraz7s-cn0540.dts         cn0540          IIC IRQ, ADDR ; SPI IRQ
zynq-coraz7s-cn0579_i2c.dts     cn0579          IIC IRQ, ADDR ; DMA IRQ
zynq-coraz7s.dts                common          Added IIC with EEPROM at 0x50
zynq-coraz7s.dtsi               -               None

Changes:

  • Remove zynq-coraz7s-cn0501.dts, since the hdl project was removed, see analogdevicesinc/hdl@f5184b4
  • Add IIC Controller to zynq-coraz7s.dts with EEPROM (address 0x50 is placeholder, evb change)
  • Update cn0540 and cn0579_i2c

Notes:

  • dts for hdl project ad4170_asdz and ad57xx_ardz not on main, ad4170_asdz may be staging.
  • No dts is upstream

Faq:

Why not add the IIC Controller to zynq-coraz7s.dtsi?
The projects shall not instantiate the IIC Controller, or replace to something else.

What is the expected behavior for the common project with and EVB without EEPROM?

The IIC controller (i2c-xiic.c) will probe and the i2c eeprom driver (at24.c) will fail to probe due to NACK transfer at test_byte.
The software layer then acts accordingly (no project detection).

If the common project has the controller, how can the project not have the controller?
The devicetrees described are used as a base for a more complex setup where they are converted to overlays,
and the pipeline is:

┌──► load common bitstream ─► load common overlay ─► (detect evb | user) ─► unload overlay ─┐
│                                                                                           │
│ ┌─────────────────────────────────────────────────────────────────────────────────────────┘
│ │                                                                                          
│ └► load (auto | manual) project bitstream ─► load overlay ─►(evaluation)─► unload overlay ┐
│                                                                                           │
└───────────────────────────────────────────────────────────────────────────────────────────┘

This PR aims to sync the HDL changes with the merged to main devicetrees,
fixing the addresses and irq indexes.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

Add IIC Controller and EEPROM to common dts, used to detect the evb if
the EEPROM is available.
If not, the at24.c driver fails to probe at the first test_byte due to
NACKed transfer.

Signed-off-by: Jorge Marques <[email protected]>
Update IIC Controller IRQ index and SPI Engine IRQ index.
To sync with the changes on the HDL project.

Signed-off-by: Jorge Marques <[email protected]>
Update IIC Controller IRQ index and RX DMA IRQ index.
To sync with the changes on the HDL project.

Signed-off-by: Jorge Marques <[email protected]>
The board development was canceled.
See hdl/f5184b4e14bc61cd18dad7b5a648ea76e1f1ec5e

Signed-off-by: Jorge Marques <[email protected]>
};

};
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should then add it to the common DT? To me is always odd to add a device that's not present just to have it failing probe... Following this approach could be dangerous (example with MMIO devices). For it to be in the common DT, I assume it's used in the vast majority of the projects? For the ones where's not used we could just delete the node from the top level DT...

Copy link
Author

@gastmaier gastmaier Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, if /delete-node/ is an option I can add it to the necessary devicetrees and move the controller&eeprom to the dtsi.
But we need to clarify to which device: The IIC Controller or the EEPROM?
The IIC Controller needs to removed if not on the bitstream because r/w to the axi addr always causes a kernel panic.
Drivers on the I2C bus fail to probe gracefully.

At the HDL side, I kept the iic controller for the pulsar project even though no pulsar-evb has an eeprom; for this one in particular*, we can remove either the device or controller from the devicetree.
What do you prefer?
*zynq-coraz7s-ad7687-pmdz.dts,zynq-coraz7s-ad7689-ardz.dts,zynq-coraz7s-ad7946.dts,zynq-coraz7s-ad7984.dts,zynq-coraz7s-adaq4003.dts

I prefer the 4th option better or the current pr solution, but here are other ideas:

2th option (move to dtsi, keep pulsar unused):

devicetree                      HDL project     Change
zynq-coraz7s-ad7687-pmdz.dts    pulsar_adc      None (already on dtsi)
zynq-coraz7s-ad7689-ardz.dts    pulsar_adc      None (already on dtsi)
zynq-coraz7s-ad7946.dts         pulsar_adc      None (already on dtsi)
zynq-coraz7s-ad7984.dts         pulsar_adc      None (already on dtsi)
zynq-coraz7s-adaq4003.dts       pulsar_adc      None (already on dtsi)
zynq-coraz7s-cn0501.dts         -               Removed
zynq-coraz7s-cn0540.dts         cn0540          Remove IIC (already on dtsi); SPI IRQ
zynq-coraz7s-cn0579_i2c.dts     cn0579          Remove IIC (already on dtsi); DMA IRQ
zynq-coraz7s.dts                common          None
zynq-coraz7s.dtsi               -               Added IIC with EEPROM at 0x50

3th option (move to dtsi, remove from pulsar:

devicetree                      HDL project     Change
zynq-coraz7s-ad7687-pmdz.dts    pulsar_adc      Delete ICC (unused)
zynq-coraz7s-ad7689-ardz.dts    pulsar_adc      Delete ICC (unused)
zynq-coraz7s-ad7946.dts         pulsar_adc      Delete ICC (unused)
zynq-coraz7s-ad7984.dts         pulsar_adc      Delete ICC (unused)
zynq-coraz7s-adaq4003.dts       pulsar_adc      Delete ICC (unused)
zynq-coraz7s-cn0501.dts         -               Removed
zynq-coraz7s-cn0540.dts         cn0540          Remove IIC (already on dtsi); SPI IRQ
zynq-coraz7s-cn0579_i2c.dts     cn0579          Remove IIC (already on dtsi); DMA IRQ
zynq-coraz7s.dts                common          None
zynq-coraz7s.dtsi               -               Added IIC with EEPROM at 0x50

Also, the EEPROM addresses are not consistent; and is a problem we already have with the zed projects.

And I'm using zynq-coraz7s.dts as zynq-zed-adv7511.dtsi, a fourth option is to create
zynq-coraz7s-iic.dtsi and import that to other projects:


zynq-coraz7s-ad7687-pmdz.dts    pulsar_adc      None
zynq-coraz7s-ad7689-ardz.dts    pulsar_adc      None
zynq-coraz7s-ad7946.dts         pulsar_adc      None
zynq-coraz7s-ad7984.dts         pulsar_adc      None
zynq-coraz7s-adaq4003.dts       pulsar_adc      None
zynq-coraz7s-cn0501.dts         -               Removed
zynq-coraz7s-cn0540.dts         cn0540          Remove IIC; SPI IRQ, import zynq-coraz7s-iic.dtsi
zynq-coraz7s-cn0579_i2c.dts     cn0579          Remove IIC; DMA IRQ, import zynq-coraz7s-iic.dtsi
zynq-coraz7s.dts                common          None
zynq-coraz7s.dtsi               -               None
zynq-coraz7s-iic.dtsi           -               Created with IIC and EEPROM at 0x50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants