diff options
-rw-r--r-- | drivers/pinctrl/pinctrl-baytrail.c | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 7c65c9dab215..975572e2f260 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -43,9 +43,20 @@ | |||
43 | #define BYT_INT_STAT_REG 0x800 | 43 | #define BYT_INT_STAT_REG 0x800 |
44 | 44 | ||
45 | /* BYT_CONF0_REG register bits */ | 45 | /* BYT_CONF0_REG register bits */ |
46 | #define BYT_IODEN BIT(31) | ||
46 | #define BYT_TRIG_NEG BIT(26) | 47 | #define BYT_TRIG_NEG BIT(26) |
47 | #define BYT_TRIG_POS BIT(25) | 48 | #define BYT_TRIG_POS BIT(25) |
48 | #define BYT_TRIG_LVL BIT(24) | 49 | #define BYT_TRIG_LVL BIT(24) |
50 | #define BYT_PULL_STR_SHIFT 9 | ||
51 | #define BYT_PULL_STR_MASK (3 << BYT_PULL_STR_SHIFT) | ||
52 | #define BYT_PULL_STR_2K (0 << BYT_PULL_STR_SHIFT) | ||
53 | #define BYT_PULL_STR_10K (1 << BYT_PULL_STR_SHIFT) | ||
54 | #define BYT_PULL_STR_20K (2 << BYT_PULL_STR_SHIFT) | ||
55 | #define BYT_PULL_STR_40K (3 << BYT_PULL_STR_SHIFT) | ||
56 | #define BYT_PULL_ASSIGN_SHIFT 7 | ||
57 | #define BYT_PULL_ASSIGN_MASK (3 << BYT_PULL_ASSIGN_SHIFT) | ||
58 | #define BYT_PULL_ASSIGN_UP (1 << BYT_PULL_ASSIGN_SHIFT) | ||
59 | #define BYT_PULL_ASSIGN_DOWN (2 << BYT_PULL_ASSIGN_SHIFT) | ||
49 | #define BYT_PIN_MUX 0x07 | 60 | #define BYT_PIN_MUX 0x07 |
50 | 61 | ||
51 | /* BYT_VAL_REG register bits */ | 62 | /* BYT_VAL_REG register bits */ |
@@ -321,6 +332,8 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
321 | spin_lock_irqsave(&vg->lock, flags); | 332 | spin_lock_irqsave(&vg->lock, flags); |
322 | 333 | ||
323 | for (i = 0; i < vg->chip.ngpio; i++) { | 334 | for (i = 0; i < vg->chip.ngpio; i++) { |
335 | const char *pull_str = NULL; | ||
336 | const char *pull = NULL; | ||
324 | const char *label; | 337 | const char *label; |
325 | offs = vg->range->pins[i] * 16; | 338 | offs = vg->range->pins[i] * 16; |
326 | conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG); | 339 | conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG); |
@@ -330,8 +343,32 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
330 | if (!label) | 343 | if (!label) |
331 | label = "Unrequested"; | 344 | label = "Unrequested"; |
332 | 345 | ||
346 | switch (conf0 & BYT_PULL_ASSIGN_MASK) { | ||
347 | case BYT_PULL_ASSIGN_UP: | ||
348 | pull = "up"; | ||
349 | break; | ||
350 | case BYT_PULL_ASSIGN_DOWN: | ||
351 | pull = "down"; | ||
352 | break; | ||
353 | } | ||
354 | |||
355 | switch (conf0 & BYT_PULL_STR_MASK) { | ||
356 | case BYT_PULL_STR_2K: | ||
357 | pull_str = "2k"; | ||
358 | break; | ||
359 | case BYT_PULL_STR_10K: | ||
360 | pull_str = "10k"; | ||
361 | break; | ||
362 | case BYT_PULL_STR_20K: | ||
363 | pull_str = "20k"; | ||
364 | break; | ||
365 | case BYT_PULL_STR_40K: | ||
366 | pull_str = "40k"; | ||
367 | break; | ||
368 | } | ||
369 | |||
333 | seq_printf(s, | 370 | seq_printf(s, |
334 | " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n", | 371 | " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s", |
335 | i, | 372 | i, |
336 | label, | 373 | label, |
337 | val & BYT_INPUT_EN ? " " : "in", | 374 | val & BYT_INPUT_EN ? " " : "in", |
@@ -339,9 +376,19 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
339 | val & BYT_LEVEL ? "hi" : "lo", | 376 | val & BYT_LEVEL ? "hi" : "lo", |
340 | vg->range->pins[i], offs, | 377 | vg->range->pins[i], offs, |
341 | conf0 & 0x7, | 378 | conf0 & 0x7, |
342 | conf0 & BYT_TRIG_NEG ? " fall" : "", | 379 | conf0 & BYT_TRIG_NEG ? " fall" : " ", |
343 | conf0 & BYT_TRIG_POS ? " rise" : "", | 380 | conf0 & BYT_TRIG_POS ? " rise" : " ", |
344 | conf0 & BYT_TRIG_LVL ? " level" : ""); | 381 | conf0 & BYT_TRIG_LVL ? " level" : " "); |
382 | |||
383 | if (pull && pull_str) | ||
384 | seq_printf(s, " %-4s %-3s", pull, pull_str); | ||
385 | else | ||
386 | seq_puts(s, " "); | ||
387 | |||
388 | if (conf0 & BYT_IODEN) | ||
389 | seq_puts(s, " open-drain"); | ||
390 | |||
391 | seq_puts(s, "\n"); | ||
345 | } | 392 | } |
346 | spin_unlock_irqrestore(&vg->lock, flags); | 393 | spin_unlock_irqrestore(&vg->lock, flags); |
347 | } | 394 | } |