diff options
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-at91.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index e907093b5b13..6f443c3728cb 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -574,6 +574,17 @@ static unsigned at91_mux_sam9x5_get_drivestrength(void __iomem *pio, | |||
574 | return tmp; | 574 | return tmp; |
575 | } | 575 | } |
576 | 576 | ||
577 | static unsigned at91_mux_sam9x60_get_drivestrength(void __iomem *pio, | ||
578 | unsigned pin) | ||
579 | { | ||
580 | unsigned tmp = readl_relaxed(pio + SAM9X60_PIO_DRIVER1); | ||
581 | |||
582 | if (tmp & BIT(pin)) | ||
583 | return DRIVE_STRENGTH_BIT_HI; | ||
584 | |||
585 | return DRIVE_STRENGTH_BIT_LOW; | ||
586 | } | ||
587 | |||
577 | static void set_drive_strength(void __iomem *reg, unsigned pin, u32 strength) | 588 | static void set_drive_strength(void __iomem *reg, unsigned pin, u32 strength) |
578 | { | 589 | { |
579 | unsigned tmp = readl_relaxed(reg); | 590 | unsigned tmp = readl_relaxed(reg); |
@@ -611,6 +622,27 @@ static void at91_mux_sam9x5_set_drivestrength(void __iomem *pio, unsigned pin, | |||
611 | setting); | 622 | setting); |
612 | } | 623 | } |
613 | 624 | ||
625 | static void at91_mux_sam9x60_set_drivestrength(void __iomem *pio, unsigned pin, | ||
626 | u32 setting) | ||
627 | { | ||
628 | unsigned int tmp; | ||
629 | |||
630 | if (setting <= DRIVE_STRENGTH_BIT_DEF || | ||
631 | setting == DRIVE_STRENGTH_BIT_MED || | ||
632 | setting > DRIVE_STRENGTH_BIT_HI) | ||
633 | return; | ||
634 | |||
635 | tmp = readl_relaxed(pio + SAM9X60_PIO_DRIVER1); | ||
636 | |||
637 | /* Strength is 0: low, 1: hi */ | ||
638 | if (setting == DRIVE_STRENGTH_BIT_LOW) | ||
639 | tmp &= ~BIT(pin); | ||
640 | else | ||
641 | tmp |= BIT(pin); | ||
642 | |||
643 | writel_relaxed(tmp, pio + SAM9X60_PIO_DRIVER1); | ||
644 | } | ||
645 | |||
614 | static struct at91_pinctrl_mux_ops at91rm9200_ops = { | 646 | static struct at91_pinctrl_mux_ops at91rm9200_ops = { |
615 | .get_periph = at91_mux_get_periph, | 647 | .get_periph = at91_mux_get_periph, |
616 | .mux_A_periph = at91_mux_set_A_periph, | 648 | .mux_A_periph = at91_mux_set_A_periph, |
@@ -639,6 +671,26 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = { | |||
639 | .irq_type = alt_gpio_irq_type, | 671 | .irq_type = alt_gpio_irq_type, |
640 | }; | 672 | }; |
641 | 673 | ||
674 | static const struct at91_pinctrl_mux_ops sam9x60_ops = { | ||
675 | .get_periph = at91_mux_pio3_get_periph, | ||
676 | .mux_A_periph = at91_mux_pio3_set_A_periph, | ||
677 | .mux_B_periph = at91_mux_pio3_set_B_periph, | ||
678 | .mux_C_periph = at91_mux_pio3_set_C_periph, | ||
679 | .mux_D_periph = at91_mux_pio3_set_D_periph, | ||
680 | .get_deglitch = at91_mux_pio3_get_deglitch, | ||
681 | .set_deglitch = at91_mux_pio3_set_deglitch, | ||
682 | .get_debounce = at91_mux_pio3_get_debounce, | ||
683 | .set_debounce = at91_mux_pio3_set_debounce, | ||
684 | .get_pulldown = at91_mux_pio3_get_pulldown, | ||
685 | .set_pulldown = at91_mux_pio3_set_pulldown, | ||
686 | .get_schmitt_trig = at91_mux_pio3_get_schmitt_trig, | ||
687 | .disable_schmitt_trig = at91_mux_pio3_disable_schmitt_trig, | ||
688 | .get_drivestrength = at91_mux_sam9x60_get_drivestrength, | ||
689 | .set_drivestrength = at91_mux_sam9x60_set_drivestrength, | ||
690 | .irq_type = alt_gpio_irq_type, | ||
691 | |||
692 | }; | ||
693 | |||
642 | static struct at91_pinctrl_mux_ops sama5d3_ops = { | 694 | static struct at91_pinctrl_mux_ops sama5d3_ops = { |
643 | .get_periph = at91_mux_pio3_get_periph, | 695 | .get_periph = at91_mux_pio3_get_periph, |
644 | .mux_A_periph = at91_mux_pio3_set_A_periph, | 696 | .mux_A_periph = at91_mux_pio3_set_A_periph, |