lib: utils/gpio: Use fdt_driver for initialization

FDT gpio drivers have an extra .xlate operation, so they need to embed
the `struct fdt_driver` inside the subsystem-specific type. The gpio
subsystem always initializes the driver for a specific DT node.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-11-11 14:02:49 -08:00
committed by Anup Patel
parent 10df2d6fb5
commit bef8f9b806
7 changed files with 28 additions and 40 deletions

View File

@@ -60,7 +60,7 @@ static void sifive_gpio_set(struct gpio_pin *gp, int value)
writel(v, (volatile void *)(chip->addr + SIFIVE_GPIO_OUTVAL));
}
extern struct fdt_gpio fdt_gpio_sifive;
const struct fdt_gpio fdt_gpio_sifive;
static int sifive_gpio_init(const void *fdt, int nodeoff,
const struct fdt_match *match)
@@ -99,8 +99,10 @@ static const struct fdt_match sifive_gpio_match[] = {
{ },
};
struct fdt_gpio fdt_gpio_sifive = {
.match_table = sifive_gpio_match,
const struct fdt_gpio fdt_gpio_sifive = {
.driver = {
.match_table = sifive_gpio_match,
.init = sifive_gpio_init,
},
.xlate = fdt_gpio_simple_xlate,
.init = sifive_gpio_init,
};