sh: make gpio_get/set_value() O(1)
PATCH 1/4 sh: make gpio_get/set_value() O(1)
From: Magnus Damm <[email protected]>
This patch modifies the table based SuperH gpio implementation to make use of direct table lookups. With this change the functions gpio_get_value() and gpio_set_value() are O(1).
Tested on Migo-R using bitbanging mmc. Performance is improved from 11 KBytes/s to 26 Kbytes/s.
Signed-off-by Magnus Damm <[email protected]>
---
arch/sh/include/asm/gpio.h | 7 +++++- arch/sh/kernel/gpio.c | 48 +++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 12 deletions(-)
arch/sh/include/asm/gpio.h +6 -1
@@ -20,7 +20,7 @@#endif typedef unsigned short pinmux_enum_t ; -typedef unsigned char pinmux_flag_t ; +typedef unsigned short pinmux_flag_t ;#define PINMUX_TYPE_NONE 0#define PINMUX_TYPE_FUNCTION 1
@@ -34,6 +34,11 @@ typedef unsigned char pinmux_flag_t;#define PINMUX_FLAG_WANT_PULLUP (1 << 3)#define PINMUX_FLAG_WANT_PULLDOWN (1 << 4) +#define PINMUX_FLAG_DBIT_SHIFT 5 +#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT) +#define PINMUX_FLAG_DREG_SHIFT 10 +#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT) +struct pinmux_gpio {pinmux_enum_t enum_id;pinmux_flag_t flags;
arch/sh/kernel/gpio.c +37 -11
100 lines not on this page · raw message