[U-Boot] dm gpio
Bin Meng
bmeng.cn at gmail.com
Wed Sep 2 05:04:24 CEST 2015
Hi Simon,
On Wed, Sep 2, 2015 at 10:48 AM, Simon Glass <sjg at chromium.org> wrote:
> 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().
>
Thanks, I will have a try.
Regards,
Bin
More information about the U-Boot
mailing list