[U-Boot] [U-BOOT PATCH v1 0/2] add gpio support for HiFive Unleashed A00 board.

Bin Meng bmeng.cn at gmail.com
Wed Sep 18 07:53:00 UTC 2019


Hi Sagar,

On Tue, Sep 10, 2019 at 11:44 PM Sagar Shrikant Kadam
<sagar.kadam at sifive.com> wrote:
>
> U-Boot currently is missing GPIO support for FU540-C000 SoC which is
> mounted on HiFive Unleashed A00 board. This patch is intended to add DM
> based GPIO controller driver in order to access GPIO pins within the SoC
> using GPIO command in U-Boot. More details on the GPIO controller within
> the SoC can be found at[1]
>
> The driver is based above master branch of u-boot-riscv.git and provides a
> method to configure Input/Output mode of the GPIO pin along with an option
> to set or clear state of the GPIO pin. The patch is available in
> dev/sagark/gpio_v3 branch here[2].
>
> GPIO device node added to the mainline bound device tree for HiFive
> Unleashed is available in dev/sagark/mlv5.3-rc5 branch of repo here[3].
>
> This implementation is ported from linux driver submitted for review
> at [4].
>
> More details of GPIO pin routing on J1 header is available in schematic
> document[5]
>
> [1] https://static.dev.sifive.com/FU540-C000-v1.0.pdf
> [2] https://github.com/sagsifive/u-boot
> [3] https://github.com/sagsifive/riscv-linux-hifive/
> [4] https://lkml.org/lkml/2018/10/9/1103
> [5] https://static.dev.sifive.com/dev-kits/hifive-unleashed/hifive-unleashed-a00-schematics.pdf
>
> Driver Testing:
> #Set GPIO1 high.
> =>gpio set 1
>   Can be confirmed by probing pin No #24 on J1 Header or memory dump of
>   gpio register space viz: #md 0x10060000
>
> #Set GPIO1 low
> =>gpio clear 0
>
> #Toggle GPIO1
> =>gpio toggle 1         #Toggle value of GPIO1
> =>gpio toggle 1         #Toggle value of GPIO1
>
> #Configure pin as input
> =>gpio input 3          #Configure gpio line 3 as input.
>
> #Error check
> =>gpio set 16           #Not a valid GPIO number for FU540-C000
>   GPIO: '16' not found
>   Command 'gpio' failed: Error -22
>

I tested this:

=> gpio status -a
Bank gpio at 10060000:
gpio at 100600000: unknown
gpio at 100600001: unknown
gpio at 100600002: unknown
gpio at 100600003: unknown
gpio at 100600004: unknown
gpio at 100600005: unknown
gpio at 100600006: unknown
gpio at 100600007: unknown
gpio at 100600008: unknown
gpio at 100600009: unknown
gpio at 1006000010: unknown
gpio at 1006000011: unknown
gpio at 1006000012: unknown
gpio at 1006000013: unknown
gpio at 1006000014: unknown
gpio at 1006000015: unknown

The status is "unknown" for all gpio pins, which is wrong. It should
be either input or output.

Also the gpio pin name is weird. I think we should use "0, 1, 2 ..."

Regards,
Bin

Regards,
Bin


More information about the U-Boot mailing list