forked from Mirrors/opensbi
lib: utils/gpio: Use FDT node offset as GPIO chip ID
Since the FDT is not modified during driver initialization, node offsets are just as suitable as phandles for use as identifiers: they are stable and unique. With this change, it is no longer necessary to pass the phandle to the driver init functions, so these init functions now use the same prototype as other kinds of drivers. This matches what is already done for I2C adapters. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
598cf961d8
commit
d71150ee70
@@ -75,7 +75,7 @@ static void dw_gpio_set(struct gpio_pin *gp, int value)
|
||||
* bank A is the only one with irq support but we're not using it here
|
||||
*/
|
||||
|
||||
static int dw_gpio_init_bank(const void *fdt, int nodeoff, u32 phandle,
|
||||
static int dw_gpio_init_bank(const void *fdt, int nodeoff,
|
||||
const struct fdt_match *match)
|
||||
{
|
||||
struct dw_gpio_chip *chip;
|
||||
@@ -111,7 +111,7 @@ static int dw_gpio_init_bank(const void *fdt, int nodeoff, u32 phandle,
|
||||
chip->dr = (void *)(uintptr_t)addr + (bank * 0xc);
|
||||
chip->ext = (void *)(uintptr_t)addr + (bank * 4) + 0x50;
|
||||
chip->chip.driver = &fdt_gpio_designware;
|
||||
chip->chip.id = phandle;
|
||||
chip->chip.id = nodeoff;
|
||||
chip->chip.ngpio = nr_pins;
|
||||
chip->chip.set = dw_gpio_set;
|
||||
chip->chip.direction_output = dw_gpio_direction_output;
|
||||
|
Reference in New Issue
Block a user