Patch Set 2:

(1 comment)

Patch Set 2:

(1 comment)

Hmm, this makes me want to attack the power resource problem again...
With the devtree alias patches in, expressing power resource dependencies is even cleaner, e.g.,:

```
chip drivers/generic/power_resource/
register "on" = "{{GPIO_L(GPP_A1), 50},
{GPIO_L(GPIO_B2), 1},}"
register "off" = "{{GPIO_L(GPP_B2), 1},
{GPIO(GPP_A1), 10},}"
# or even the current interface in generic/2c with the stop_gpio, reset_gpio, etc.
# but I kind of like this explicit sequencing you get here.
device generic 0 alias i2c1_power_res on end
end
chip drivers/i2c/generic
use i2c1_power_res as power_resource;
device i2c 1f on end
end
chip drivers/spi/generic
use i2c1_power_res as power_resource;
device spi 0 on end
end
```

Each "resource" in the 'on' and 'off' list (i.e., GPIOs) can emit enable/disable methods that use reference counting to keep track of when it's safe to actually assert/deassert the pins.

WDYT? If you don't want to tackle that right now, factoring out the power resource fields into a common `struct power_resource_config` or similar would be better than copy-pasting these fields around into different drivers.

We might want to eventually do something like you recommended i.e. having a separate power resource device especially if multiple devices have to share power resource. Last week you mentioned that this might probably be a use case for the camera device.

One thing that we will probably have to think about some more is -- if a driver wants to expose the GPIOs in _CRS in addition to generating the power resource, then it will require both on/off as well as reset/enable GPIOs to be provided by mainboard in the devicetree entry. It might be helpful to write these thoughts in a doc/bug so that we can capture all scenarios.

About adding a power_resource structure - I think that can be a quick way forward right now especially if Karthik is looking to unblock the mainboard CLs. However, if you plan to refactor and add a new power_resource driver, do you want to wait until then to decide what the structure should really look like?

Just a strawman for the moment 😊

There are other considerations too, like ensuring that _PR0/_PR3 get emitted too. I have some thoughts, I should collect them into a doc.

View Change

1 comment:

To view, visit change 46713. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Icc1aebfb9e3e646a7f608f0cd391079fd30dd1c0
Gerrit-Change-Number: 46713
Gerrit-PatchSet: 2
Gerrit-Owner: Karthik Ramasubramanian <kramasub@google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Comment-Date: Tue, 03 Nov 2020 01:18:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Furquan Shaikh <furquan@google.com>
Gerrit-MessageType: comment