Re: [PATCH v2 2/2] reset: Add GPIO support to reset controller framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi Maxime,

Am Montag, den 06.01.2014, 19:14 +0100 schrieb Maxime Ripard:
> > +struct reset_control *gpio_reset_control_get(struct device *dev, const char *id)
> > +{
> > +	const char *assert_prop = "reset-initially-asserted";
> 
> I guess you meant reset-boot-asserted here, right?

Yes, thank you.

> > +	const char *gpio_con_id = "reset";
> > +	struct reset_controller_dev *rcdev;
> > +	struct reset_control *rstc;
> > +	struct gpio_desc *gpiod;
> > +	bool asserted = false;
> > +	char scratch[48];
> > +	int ret;
> > +
> > +	if (id) {
> > +		snprintf(scratch, 48, "%s-reset-boot-asserted", id);
> > +		assert_prop = scratch;
> > +	}
> > +
> > +	asserted = of_property_read_bool(dev->of_node, assert_prop);
> > +
> > +	if (id) {
> > +		snprintf(scratch, 48, "%s-reset", id);
> > +		gpio_con_id = scratch;
> > +	}
> > +
> > +	gpiod = gpiod_get(dev, gpio_con_id);
> > +	if (IS_ERR(gpiod)) {
> > +		dev_err(dev, "Failed to get GPIO reset: %ld\n", PTR_ERR(gpiod));
> > +		return ERR_CAST(gpiod);
> > +	}
> > +
> > +	ret = gpiod_direction_output(gpiod, asserted);
> > +	if (ret < 0)
> > +		goto err_put;
> 
> What happens if the GPIO is active low? I see no way in your binding
> and driver to give that information, and that would change the
> behaviour quite a bit.

I was under the (wrong) impression that gpiod_direction_output takes a
logical value as gpiod_set_value does. Will fix that.

regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux