[U-Boot] dm gpio
Simon Glass
sjg at chromium.org
Wed Sep 2 04:48:32 CEST 2015
Hi Bin,
On 1 September 2015 at 04:44, Bin Meng <bmeng.cn at gmail.com> wrote:
> Hi Simon,
>
> I have the following codes to control a gpio pin in my board codes:
>
> void board_assert_perst(void)
> {
> gpio_request(32, "PERST");
> gpio_direction_output(32, 0);
> }
>
> But when I read <asm-generic/gpio.h>, I found these two apis are
> deprecated. Instead it suggests we should use corresponding dm gpio
> apis like gpio_request_by_name(), etc. However these dm gpio apis
> takes one udevice* as a parameter, which requires a dm driver.
>
> I don't think I am going to create a dm driver for this. What's the
> guideline here?
You can use gpio_request_by_name_nodev() if you have a GPIO in the device tree.
If not then you need to use dm_gpio_request().
Regards,
Simon
More information about the U-Boot
mailing list