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

drivers: reset: Add generic reset MMIO driver #87501

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

saimohith-google
Copy link

Introduce a generic reset MMIO driver to be used for devices with a single memory mapped reset bit required to take them out of reset.


description: MMIO Reset

compatible: "zephyr,reset-mmio"
Copy link
Member

Choose a reason for hiding this comment

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

This isn't Zephyr-specific?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, but I wasn't sure how to give this a generic name in zephyr, do you have a suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

If @henrikbrixandersen doesn't have a better idea, I don't either

required: true
num_resets:
type: int
default: 1
Copy link
Member

Choose a reason for hiding this comment

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

Defaults need to be described in the textual description.

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not resolved. The description needs to say why the value chosen, and not just restate the value. Please read https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#rules-for-default-values and update this PR accordingly. (Hint: if you can't come up with a justification that follows the rules, consider making this required instead.)

Copy link
Author

Choose a reason for hiding this comment

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

Done, I don't have a good justification for setting the default to 1 so changed this to a required property.


config RESET_MMIO
bool "Generic MMIO reset driver"
default n
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be default y + depends on DT_HAS_your_compatible_goes_here_ENABLED. Search the tree for other drivers for examples.

Copy link
Author

Choose a reason for hiding this comment

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

Done

required: true
num_resets:
type: int
default: 1
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not resolved. The description needs to say why the value chosen, and not just restate the value. Please read https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#rules-for-default-values and update this PR accordingly. (Hint: if you can't come up with a justification that follows the rules, consider making this required instead.)

@@ -0,0 +1,10 @@
# Copyright (c) 2025 Google LLC
# SPDX-License-Identifier: Apache-2.0
set(BOARD qemu_x86)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't hard-code the board here. This prevents people from testing this on other platforms that might actually have real hardware.

Follow the platform_allow / integration_platforms pattern in tests/drivers/gpio/gpio_reserved_ranges/testcase.yaml instead. See the twister documentation for more details if you need them.

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@mbolivar mbolivar left a comment

Choose a reason for hiding this comment

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

Thanks for the update!

A few more things from my side, otherwise I don't see any blockers.

Comment on lines 18 to 19
description: Number of resets controlled by the register. Can be in the
range [1, 31].
Copy link
Contributor

Choose a reason for hiding this comment

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

This style isn't permitted upstream -- see https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#descriptions and please fix

Copy link
Author

Choose a reason for hiding this comment

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

Done


description: MMIO Reset

compatible: "zephyr,reset-mmio"
Copy link
Contributor

Choose a reason for hiding this comment

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

If @henrikbrixandersen doesn't have a better idea, I don't either

properties:
reg:
required: true
num_resets:
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Done

required: true
description: Number of resets controlled by the register. Can be in the
range [1, 31].
active_low:
Copy link
Contributor

Choose a reason for hiding this comment

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

active-low

Copy link
Author

Choose a reason for hiding this comment

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

Done

Introduce a generic reset MMIO driver to be used for devices with a
single memory mapped reset bit required to take them out of reset.

Signed-off-by: Mohith Potluri <saimohith@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants