From fe808b10578de39c397c9a4ba37a0572b6f288ee Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 6 Apr 2016 15:00:45 -0600 Subject: Adapt to latest U-Boot driver code changes This makes the script generate code that matches U-Boot as of its commit "ARM: tegra: use DT bindings for GPIO naming". Signed-off-by: Stephen Warren --- board-to-uboot.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/board-to-uboot.py b/board-to-uboot.py index d5e2708..7c57958 100755 --- a/board-to-uboot.py +++ b/board-to-uboot.py @@ -59,9 +59,9 @@ print('''\ #ifndef _PINMUX_CONFIG_%(board_define)s_H_ #define _PINMUX_CONFIG_%(board_define)s_H_ -#define GPIO_INIT(_gpio, _init) \\ +#define GPIO_INIT(_port, _gpio, _init) \\ { \\ - .gpio = GPIO_P##_gpio, \\ + .gpio = TEGRA_GPIO(_port, _gpio), \\ .init = TEGRA_GPIO_INIT_##_init, \\ } @@ -77,12 +77,18 @@ gpio_table = [] for pincfg in board.pincfgs_by_num(): if not pincfg.gpio_init: continue + gpio = pincfg.gpio_pin.gpio.upper() + port = gpio[:-1] + assert port.isalpha() + pin = gpio[-1] + assert pin.isdigit() row = ( - pincfg.gpio_pin.gpio.upper(), + port, + pin, pincfg.gpio_init.upper(), ) gpio_table.append(row) -headings = ('gpio', 'init_val') +headings = ('port', 'pin', 'init_val') dump_c_table(headings, 'GPIO_INIT', gpio_table) print('''\ -- cgit v1.2.1