Skip to contentSkip to conversation

sh: lockless gpio_set_value()

PATCH In review Magnus Damm 1 participant 1 message Dec 25, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 sh: lockless gpio_set_value()

From: Magnus Damm <[email protected]>

This patch optimizes the gpio data register handling for gpio_set_value().

Instead of using the good old spinlock-plus-read-modify-write strategy we now use a shadow register and atomic operations.

This improves the bitbanging mmc performance on Migo-R from 26 Kbytes/s to 40 Kbytes/s.

---

 arch/sh/include/asm/gpio.h |    2 
 arch/sh/kernel/gpio.c      |  106 +++++++++++++++++++++++++++++++++-----------
 2 files changed, 82 insertions(+), 26 deletions(-)
arch/sh/include/asm/gpio.h +1 -1
@@ -59,7 +59,7 @@ struct pinmux_cfg_reg {
 	.enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \
 
 struct pinmux_data_reg {
-	unsigned long reg, reg_width;
+	unsigned long reg, reg_width, reg_shadow;
 	pinmux_enum_t *enum_ids;
 };
 
arch/sh/kernel/gpio.c +81 -25

151 lines not on this page · raw message