Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'renesas-pinctrl-for-v5.13-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into devel

pinctrl: renesas: Updates for v5.13 (take two)

- Add bias support for the R-Car M2-W and M2-N, and RZ/G1M and RZ/G1N
SoCs,
- Miscellaneous cleanups and improvements.

+497 -202
-20
drivers/pinctrl/renesas/core.c
··· 394 394 return 0; 395 395 } 396 396 397 - const struct pinmux_bias_reg * 398 - sh_pfc_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin, 399 - unsigned int *bit) 400 - { 401 - unsigned int i, j; 402 - 403 - for (i = 0; pfc->info->bias_regs[i].puen; i++) { 404 - for (j = 0; j < ARRAY_SIZE(pfc->info->bias_regs[i].pins); j++) { 405 - if (pfc->info->bias_regs[i].pins[j] == pin) { 406 - *bit = j; 407 - return &pfc->info->bias_regs[i]; 408 - } 409 - } 410 - } 411 - 412 - WARN_ONCE(1, "Pin %u is not in bias info list\n", pin); 413 - 414 - return NULL; 415 - } 416 - 417 397 static int sh_pfc_init_ranges(struct sh_pfc *pfc) 418 398 { 419 399 struct sh_pfc_pin_range *range;
-8
drivers/pinctrl/renesas/core.h
··· 29 29 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin); 30 30 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type); 31 31 32 - const struct pinmux_bias_reg * 33 - sh_pfc_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin, 34 - unsigned int *bit); 35 - 36 - unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin); 37 - void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 38 - unsigned int bias); 39 - 40 32 #endif /* __SH_PFC_CORE_H__ */
+5 -43
drivers/pinctrl/renesas/pfc-r8a73a4.c
··· 2649 2649 PINMUX_IRQ(329), /* IRQ57 */ 2650 2650 }; 2651 2651 2652 - #define PORTCR_PULMD_OFF (0 << 6) 2653 - #define PORTCR_PULMD_DOWN (2 << 6) 2654 - #define PORTCR_PULMD_UP (3 << 6) 2655 - #define PORTCR_PULMD_MASK (3 << 6) 2656 - 2657 2652 static const unsigned int r8a73a4_portcr_offsets[] = { 2658 2653 0x00000000, 0x00001000, 0x00000000, 0x00001000, 2659 2654 0x00001000, 0x00002000, 0x00002000, 0x00002000, 2660 2655 0x00002000, 0x00003000, 0x00003000, 2661 2656 }; 2662 2657 2663 - static unsigned int r8a73a4_pinmux_get_bias(struct sh_pfc *pfc, 2664 - unsigned int pin) 2658 + static void __iomem *r8a73a4_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin) 2665 2659 { 2666 - void __iomem *addr; 2667 - 2668 - addr = pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; 2669 - 2670 - switch (ioread8(addr) & PORTCR_PULMD_MASK) { 2671 - case PORTCR_PULMD_UP: 2672 - return PIN_CONFIG_BIAS_PULL_UP; 2673 - case PORTCR_PULMD_DOWN: 2674 - return PIN_CONFIG_BIAS_PULL_DOWN; 2675 - case PORTCR_PULMD_OFF: 2676 - default: 2677 - return PIN_CONFIG_BIAS_DISABLE; 2678 - } 2679 - } 2680 - 2681 - static void r8a73a4_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 2682 - unsigned int bias) 2683 - { 2684 - void __iomem *addr; 2685 - u32 value; 2686 - 2687 - addr = pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; 2688 - value = ioread8(addr) & ~PORTCR_PULMD_MASK; 2689 - 2690 - switch (bias) { 2691 - case PIN_CONFIG_BIAS_PULL_UP: 2692 - value |= PORTCR_PULMD_UP; 2693 - break; 2694 - case PIN_CONFIG_BIAS_PULL_DOWN: 2695 - value |= PORTCR_PULMD_DOWN; 2696 - break; 2697 - } 2698 - 2699 - iowrite8(value, addr); 2660 + return pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; 2700 2661 } 2701 2662 2702 2663 static const struct sh_pfc_soc_operations r8a73a4_pfc_ops = { 2703 - .get_bias = r8a73a4_pinmux_get_bias, 2704 - .set_bias = r8a73a4_pinmux_set_bias, 2664 + .get_bias = rmobile_pinmux_get_bias, 2665 + .set_bias = rmobile_pinmux_set_bias, 2666 + .pin_to_portcr = r8a73a4_pin_to_portcr, 2705 2667 }; 2706 2668 2707 2669 const struct sh_pfc_soc_info r8a73a4_pinmux_info = {
+4 -42
drivers/pinctrl/renesas/pfc-r8a7740.c
··· 3672 3672 PINMUX_IRQ(41, 167), /* IRQ31A */ 3673 3673 }; 3674 3674 3675 - #define PORTnCR_PULMD_OFF (0 << 6) 3676 - #define PORTnCR_PULMD_DOWN (2 << 6) 3677 - #define PORTnCR_PULMD_UP (3 << 6) 3678 - #define PORTnCR_PULMD_MASK (3 << 6) 3679 - 3680 3675 struct r8a7740_portcr_group { 3681 3676 unsigned int end_pin; 3682 3677 unsigned int offset; ··· 3681 3686 { 83, 0x0000 }, { 114, 0x1000 }, { 209, 0x2000 }, { 211, 0x3000 }, 3682 3687 }; 3683 3688 3684 - static void __iomem *r8a7740_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) 3689 + static void __iomem *r8a7740_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin) 3685 3690 { 3686 3691 unsigned int i; 3687 3692 ··· 3696 3701 return NULL; 3697 3702 } 3698 3703 3699 - static unsigned int r8a7740_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) 3700 - { 3701 - void __iomem *addr = r8a7740_pinmux_portcr(pfc, pin); 3702 - u32 value = ioread8(addr) & PORTnCR_PULMD_MASK; 3703 - 3704 - switch (value) { 3705 - case PORTnCR_PULMD_UP: 3706 - return PIN_CONFIG_BIAS_PULL_UP; 3707 - case PORTnCR_PULMD_DOWN: 3708 - return PIN_CONFIG_BIAS_PULL_DOWN; 3709 - case PORTnCR_PULMD_OFF: 3710 - default: 3711 - return PIN_CONFIG_BIAS_DISABLE; 3712 - } 3713 - } 3714 - 3715 - static void r8a7740_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 3716 - unsigned int bias) 3717 - { 3718 - void __iomem *addr = r8a7740_pinmux_portcr(pfc, pin); 3719 - u32 value = ioread8(addr) & ~PORTnCR_PULMD_MASK; 3720 - 3721 - switch (bias) { 3722 - case PIN_CONFIG_BIAS_PULL_UP: 3723 - value |= PORTnCR_PULMD_UP; 3724 - break; 3725 - case PIN_CONFIG_BIAS_PULL_DOWN: 3726 - value |= PORTnCR_PULMD_DOWN; 3727 - break; 3728 - } 3729 - 3730 - iowrite8(value, addr); 3731 - } 3732 - 3733 3704 static const struct sh_pfc_soc_operations r8a7740_pfc_ops = { 3734 - .get_bias = r8a7740_pinmux_get_bias, 3735 - .set_bias = r8a7740_pinmux_set_bias, 3705 + .get_bias = rmobile_pinmux_get_bias, 3706 + .set_bias = rmobile_pinmux_set_bias, 3707 + .pin_to_portcr = r8a7740_pin_to_portcr, 3736 3708 }; 3737 3709 3738 3710 const struct sh_pfc_soc_info r8a7740_pinmux_info = {
-1
drivers/pinctrl/renesas/pfc-r8a7778.c
··· 16 16 #include <linux/kernel.h> 17 17 #include <linux/pinctrl/pinconf-generic.h> 18 18 19 - #include "core.h" 20 19 #include "sh_pfc.h" 21 20 22 21 #define PORT_GP_PUP_1(bank, pin, fn, sfx) \
+371 -16
drivers/pinctrl/renesas/pfc-r8a7791.c
··· 16 16 * which case they support both 3.3V and 1.8V signalling. 17 17 */ 18 18 #define CPU_ALL_GP(fn, sfx) \ 19 - PORT_GP_32(0, fn, sfx), \ 20 - PORT_GP_26(1, fn, sfx), \ 21 - PORT_GP_32(2, fn, sfx), \ 22 - PORT_GP_32(3, fn, sfx), \ 23 - PORT_GP_32(4, fn, sfx), \ 24 - PORT_GP_32(5, fn, sfx), \ 25 - PORT_GP_CFG_24(6, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE), \ 26 - PORT_GP_1(6, 24, fn, sfx), \ 27 - PORT_GP_1(6, 25, fn, sfx), \ 28 - PORT_GP_1(6, 26, fn, sfx), \ 29 - PORT_GP_1(6, 27, fn, sfx), \ 30 - PORT_GP_1(6, 28, fn, sfx), \ 31 - PORT_GP_1(6, 29, fn, sfx), \ 32 - PORT_GP_1(6, 30, fn, sfx), \ 33 - PORT_GP_1(6, 31, fn, sfx), \ 34 - PORT_GP_26(7, fn, sfx) 19 + PORT_GP_CFG_32(0, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 20 + PORT_GP_CFG_26(1, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 21 + PORT_GP_CFG_32(2, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 22 + PORT_GP_CFG_32(3, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 23 + PORT_GP_CFG_32(4, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 24 + PORT_GP_CFG_32(5, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 25 + PORT_GP_CFG_24(6, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE | SH_PFC_PIN_CFG_PULL_UP), \ 26 + PORT_GP_CFG_1(6, 24, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 27 + PORT_GP_CFG_1(6, 25, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 28 + PORT_GP_CFG_1(6, 26, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 29 + PORT_GP_CFG_1(6, 27, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 30 + PORT_GP_CFG_1(6, 28, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 31 + PORT_GP_CFG_1(6, 29, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 32 + PORT_GP_CFG_1(6, 30, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 33 + PORT_GP_CFG_1(6, 31, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 34 + PORT_GP_CFG_7(7, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 35 + PORT_GP_1(7, 7, fn, sfx), \ 36 + PORT_GP_1(7, 8, fn, sfx), \ 37 + PORT_GP_1(7, 9, fn, sfx), \ 38 + PORT_GP_CFG_1(7, 10, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 39 + PORT_GP_CFG_1(7, 11, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 40 + PORT_GP_CFG_1(7, 12, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 41 + PORT_GP_CFG_1(7, 13, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 42 + PORT_GP_CFG_1(7, 14, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 43 + PORT_GP_CFG_1(7, 15, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 44 + PORT_GP_CFG_1(7, 16, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 45 + PORT_GP_CFG_1(7, 17, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 46 + PORT_GP_CFG_1(7, 18, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 47 + PORT_GP_CFG_1(7, 19, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 48 + PORT_GP_CFG_1(7, 20, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 49 + PORT_GP_CFG_1(7, 21, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 50 + PORT_GP_CFG_1(7, 22, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 51 + PORT_GP_CFG_1(7, 23, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 52 + PORT_GP_CFG_1(7, 24, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \ 53 + PORT_GP_CFG_1(7, 25, fn, sfx, SH_PFC_PIN_CFG_PULL_UP) 54 + 55 + #define CPU_ALL_NOGP(fn) \ 56 + PIN_NOGP_CFG(ASEBRK_N_ACK, "ASEBRK#/ACK", fn, SH_PFC_PIN_CFG_PULL_DOWN), \ 57 + PIN_NOGP_CFG(AVS1, "AVS1", fn, SH_PFC_PIN_CFG_PULL_UP), \ 58 + PIN_NOGP_CFG(AVS2, "AVS2", fn, SH_PFC_PIN_CFG_PULL_UP), \ 59 + PIN_NOGP_CFG(TCK, "TCK", fn, SH_PFC_PIN_CFG_PULL_UP), \ 60 + PIN_NOGP_CFG(TDI, "TDI", fn, SH_PFC_PIN_CFG_PULL_UP), \ 61 + PIN_NOGP_CFG(TMS, "TMS", fn, SH_PFC_PIN_CFG_PULL_UP), \ 62 + PIN_NOGP_CFG(TRST_N, "TRST#", fn, SH_PFC_PIN_CFG_PULL_UP) 35 63 36 64 enum { 37 65 PINMUX_RESERVED = 0, ··· 1724 1696 PINMUX_IPSR_MSEL(IP16_11_10, CAN1_RX_B, SEL_CAN1_1), 1725 1697 }; 1726 1698 1699 + /* 1700 + * Pins not associated with a GPIO port. 1701 + */ 1702 + enum { 1703 + GP_ASSIGN_LAST(), 1704 + NOGP_ALL(), 1705 + }; 1706 + 1727 1707 static const struct sh_pfc_pin pinmux_pins[] = { 1728 1708 PINMUX_GPIO_GP_ALL(), 1709 + PINMUX_NOGP_ALL(), 1729 1710 }; 1730 1711 1731 1712 #if defined(CONFIG_PINCTRL_PFC_R8A7791) || defined(CONFIG_PINCTRL_PFC_R8A7793) ··· 6682 6645 return 31 - (pin & 0x1f); 6683 6646 } 6684 6647 6648 + static const struct pinmux_bias_reg pinmux_bias_regs[] = { 6649 + { PINMUX_BIAS_REG("PUPR0", 0xe6060100, "N/A", 0) { 6650 + [ 0] = RCAR_GP_PIN(1, 4), /* A20 */ 6651 + [ 1] = RCAR_GP_PIN(1, 5), /* A21 */ 6652 + [ 2] = RCAR_GP_PIN(1, 6), /* A22 */ 6653 + [ 3] = RCAR_GP_PIN(1, 7), /* A23 */ 6654 + [ 4] = RCAR_GP_PIN(1, 8), /* A24 */ 6655 + [ 5] = RCAR_GP_PIN(6, 31), /* DU0_DOTCLKIN */ 6656 + [ 6] = RCAR_GP_PIN(0, 0), /* D0 */ 6657 + [ 7] = RCAR_GP_PIN(0, 1), /* D1 */ 6658 + [ 8] = RCAR_GP_PIN(0, 2), /* D2 */ 6659 + [ 9] = RCAR_GP_PIN(0, 3), /* D3 */ 6660 + [10] = RCAR_GP_PIN(0, 4), /* D4 */ 6661 + [11] = RCAR_GP_PIN(0, 5), /* D5 */ 6662 + [12] = RCAR_GP_PIN(0, 6), /* D6 */ 6663 + [13] = RCAR_GP_PIN(0, 7), /* D7 */ 6664 + [14] = RCAR_GP_PIN(0, 8), /* D8 */ 6665 + [15] = RCAR_GP_PIN(0, 9), /* D9 */ 6666 + [16] = RCAR_GP_PIN(0, 10), /* D10 */ 6667 + [17] = RCAR_GP_PIN(0, 11), /* D11 */ 6668 + [18] = RCAR_GP_PIN(0, 12), /* D12 */ 6669 + [19] = RCAR_GP_PIN(0, 13), /* D13 */ 6670 + [20] = RCAR_GP_PIN(0, 14), /* D14 */ 6671 + [21] = RCAR_GP_PIN(0, 15), /* D15 */ 6672 + [22] = RCAR_GP_PIN(0, 16), /* A0 */ 6673 + [23] = RCAR_GP_PIN(0, 17), /* A1 */ 6674 + [24] = RCAR_GP_PIN(0, 18), /* A2 */ 6675 + [25] = RCAR_GP_PIN(0, 19), /* A3 */ 6676 + [26] = RCAR_GP_PIN(0, 20), /* A4 */ 6677 + [27] = RCAR_GP_PIN(0, 21), /* A5 */ 6678 + [28] = RCAR_GP_PIN(0, 22), /* A6 */ 6679 + [29] = RCAR_GP_PIN(0, 23), /* A7 */ 6680 + [30] = RCAR_GP_PIN(0, 24), /* A8 */ 6681 + [31] = RCAR_GP_PIN(0, 25), /* A9 */ 6682 + } }, 6683 + { PINMUX_BIAS_REG("PUPR1", 0xe6060104, "N/A", 0) { 6684 + [ 0] = RCAR_GP_PIN(0, 26), /* A10 */ 6685 + [ 1] = RCAR_GP_PIN(0, 27), /* A11 */ 6686 + [ 2] = RCAR_GP_PIN(0, 28), /* A12 */ 6687 + [ 3] = RCAR_GP_PIN(0, 29), /* A13 */ 6688 + [ 4] = RCAR_GP_PIN(0, 30), /* A14 */ 6689 + [ 5] = RCAR_GP_PIN(0, 31), /* A15 */ 6690 + [ 6] = RCAR_GP_PIN(1, 0), /* A16 */ 6691 + [ 7] = RCAR_GP_PIN(1, 1), /* A17 */ 6692 + [ 8] = RCAR_GP_PIN(1, 2), /* A18 */ 6693 + [ 9] = RCAR_GP_PIN(1, 3), /* A19 */ 6694 + [10] = PIN_TRST_N, /* TRST# */ 6695 + [11] = PIN_TCK, /* TCK */ 6696 + [12] = PIN_TMS, /* TMS */ 6697 + [13] = PIN_TDI, /* TDI */ 6698 + [14] = RCAR_GP_PIN(1, 11), /* CS1#/A26 */ 6699 + [15] = RCAR_GP_PIN(1, 12), /* EX_CS0# */ 6700 + [16] = RCAR_GP_PIN(1, 13), /* EX_CS1# */ 6701 + [17] = RCAR_GP_PIN(1, 14), /* EX_CS2# */ 6702 + [18] = RCAR_GP_PIN(1, 15), /* EX_CS3# */ 6703 + [19] = RCAR_GP_PIN(1, 16), /* EX_CS4# */ 6704 + [20] = RCAR_GP_PIN(1, 17), /* EX_CS5# */ 6705 + [21] = RCAR_GP_PIN(1, 18), /* BS# */ 6706 + [22] = RCAR_GP_PIN(1, 19), /* RD# */ 6707 + [23] = RCAR_GP_PIN(1, 20), /* RD/WR# */ 6708 + [24] = RCAR_GP_PIN(1, 21), /* WE0# */ 6709 + [25] = RCAR_GP_PIN(1, 22), /* WE1# */ 6710 + [26] = RCAR_GP_PIN(1, 23), /* EX_WAIT0 */ 6711 + [27] = RCAR_GP_PIN(1, 24), /* DREQ0 */ 6712 + [28] = RCAR_GP_PIN(1, 25), /* DACK0 */ 6713 + [29] = RCAR_GP_PIN(5, 31), /* SPEEDIN */ 6714 + [30] = RCAR_GP_PIN(2, 0), /* SSI_SCK0129 */ 6715 + [31] = RCAR_GP_PIN(2, 1), /* SSI_WS0129 */ 6716 + } }, 6717 + { PINMUX_BIAS_REG("PUPR2", 0xe6060108, "N/A", 0) { 6718 + [ 0] = RCAR_GP_PIN(2, 2), /* SSI_SDATA0 */ 6719 + [ 1] = RCAR_GP_PIN(2, 3), /* SSI_SCK1 */ 6720 + [ 2] = RCAR_GP_PIN(2, 4), /* SSI_WS1 */ 6721 + [ 3] = RCAR_GP_PIN(2, 5), /* SSI_SDATA1 */ 6722 + [ 4] = RCAR_GP_PIN(2, 6), /* SSI_SCK2 */ 6723 + [ 5] = RCAR_GP_PIN(2, 7), /* SSI_WS2 */ 6724 + [ 6] = RCAR_GP_PIN(2, 8), /* SSI_SDATA2 */ 6725 + [ 7] = RCAR_GP_PIN(2, 9), /* SSI_SCK34 */ 6726 + [ 8] = RCAR_GP_PIN(2, 10), /* SSI_WS34 */ 6727 + [ 9] = RCAR_GP_PIN(2, 11), /* SSI_SDATA3 */ 6728 + [10] = RCAR_GP_PIN(2, 12), /* SSI_SCK4 */ 6729 + [11] = RCAR_GP_PIN(2, 13), /* SSI_WS4 */ 6730 + [12] = RCAR_GP_PIN(2, 14), /* SSI_SDATA4 */ 6731 + [13] = RCAR_GP_PIN(2, 15), /* SSI_SCK5 */ 6732 + [14] = RCAR_GP_PIN(2, 16), /* SSI_WS5 */ 6733 + [15] = RCAR_GP_PIN(2, 17), /* SSI_SDATA5 */ 6734 + [16] = RCAR_GP_PIN(2, 18), /* SSI_SCK6 */ 6735 + [17] = RCAR_GP_PIN(2, 19), /* SSI_WS6 */ 6736 + [18] = RCAR_GP_PIN(2, 20), /* SSI_SDATA6 */ 6737 + [19] = RCAR_GP_PIN(2, 21), /* SSI_SCK78 */ 6738 + [20] = RCAR_GP_PIN(2, 22), /* SSI_WS78 */ 6739 + [21] = RCAR_GP_PIN(2, 23), /* SSI_SDATA7 */ 6740 + [22] = RCAR_GP_PIN(2, 24), /* SSI_SDATA8 */ 6741 + [23] = RCAR_GP_PIN(2, 25), /* SSI_SCK9 */ 6742 + [24] = RCAR_GP_PIN(2, 26), /* SSI_WS9 */ 6743 + [25] = RCAR_GP_PIN(2, 27), /* SSI_SDATA9 */ 6744 + [26] = RCAR_GP_PIN(2, 28), /* AUDIO_CLKA */ 6745 + [27] = RCAR_GP_PIN(2, 29), /* AUDIO_CLKB */ 6746 + [28] = RCAR_GP_PIN(2, 30), /* AUDIO_CLKC */ 6747 + [29] = RCAR_GP_PIN(2, 31), /* AUDIO_CLKOUT */ 6748 + [30] = RCAR_GP_PIN(7, 10), /* IRQ0 */ 6749 + [31] = RCAR_GP_PIN(7, 11), /* IRQ1 */ 6750 + } }, 6751 + { PINMUX_BIAS_REG("PUPR3", 0xe606010c, "N/A", 0) { 6752 + [ 0] = RCAR_GP_PIN(7, 12), /* IRQ2 */ 6753 + [ 1] = RCAR_GP_PIN(7, 13), /* IRQ3 */ 6754 + [ 2] = RCAR_GP_PIN(7, 14), /* IRQ4 */ 6755 + [ 3] = RCAR_GP_PIN(7, 15), /* IRQ5 */ 6756 + [ 4] = RCAR_GP_PIN(7, 16), /* IRQ6 */ 6757 + [ 5] = RCAR_GP_PIN(7, 17), /* IRQ7 */ 6758 + [ 6] = RCAR_GP_PIN(7, 18), /* IRQ8 */ 6759 + [ 7] = RCAR_GP_PIN(7, 19), /* IRQ9 */ 6760 + [ 8] = RCAR_GP_PIN(3, 0), /* DU1_DR0 */ 6761 + [ 9] = RCAR_GP_PIN(3, 1), /* DU1_DR1 */ 6762 + [10] = RCAR_GP_PIN(3, 2), /* DU1_DR2 */ 6763 + [11] = RCAR_GP_PIN(3, 3), /* DU1_DR3 */ 6764 + [12] = RCAR_GP_PIN(3, 4), /* DU1_DR4 */ 6765 + [13] = RCAR_GP_PIN(3, 5), /* DU1_DR5 */ 6766 + [14] = RCAR_GP_PIN(3, 6), /* DU1_DR6 */ 6767 + [15] = RCAR_GP_PIN(3, 7), /* DU1_DR7 */ 6768 + [16] = RCAR_GP_PIN(3, 8), /* DU1_DG0 */ 6769 + [17] = RCAR_GP_PIN(3, 9), /* DU1_DG1 */ 6770 + [18] = RCAR_GP_PIN(3, 10), /* DU1_DG2 */ 6771 + [19] = RCAR_GP_PIN(3, 11), /* DU1_DG3 */ 6772 + [20] = RCAR_GP_PIN(3, 12), /* DU1_DG4 */ 6773 + [21] = RCAR_GP_PIN(3, 13), /* DU1_DG5 */ 6774 + [22] = RCAR_GP_PIN(3, 14), /* DU1_DG6 */ 6775 + [23] = RCAR_GP_PIN(3, 15), /* DU1_DG7 */ 6776 + [24] = RCAR_GP_PIN(3, 16), /* DU1_DB0 */ 6777 + [25] = RCAR_GP_PIN(3, 17), /* DU1_DB1 */ 6778 + [26] = RCAR_GP_PIN(3, 18), /* DU1_DB2 */ 6779 + [27] = RCAR_GP_PIN(3, 19), /* DU1_DB3 */ 6780 + [28] = RCAR_GP_PIN(3, 20), /* DU1_DB4 */ 6781 + [29] = RCAR_GP_PIN(3, 21), /* DU1_DB5 */ 6782 + [30] = RCAR_GP_PIN(3, 22), /* DU1_DB6 */ 6783 + [31] = RCAR_GP_PIN(3, 23), /* DU1_DB7 */ 6784 + } }, 6785 + { PINMUX_BIAS_REG("PUPR4", 0xe6060110, "N/A", 0) { 6786 + [ 0] = RCAR_GP_PIN(3, 24), /* DU1_DOTCLKIN */ 6787 + [ 1] = RCAR_GP_PIN(3, 25), /* DU1_DOTCLKOUT0 */ 6788 + [ 2] = RCAR_GP_PIN(3, 26), /* DU1_DOTCLKOUT1 */ 6789 + [ 3] = RCAR_GP_PIN(3, 27), /* DU1_EXHSYNC_DU1_HSYNC */ 6790 + [ 4] = RCAR_GP_PIN(3, 28), /* DU1_EXVSYNC_DU1_VSYNC */ 6791 + [ 5] = RCAR_GP_PIN(3, 29), /* DU1_EXODDF_DU1_ODDF_DISP_CDE */ 6792 + [ 6] = RCAR_GP_PIN(3, 30), /* DU1_DISP */ 6793 + [ 7] = RCAR_GP_PIN(3, 31), /* DU1_CDE */ 6794 + [ 8] = RCAR_GP_PIN(4, 0), /* VI0_CLK */ 6795 + [ 9] = RCAR_GP_PIN(4, 1), /* VI0_CLKENB */ 6796 + [10] = RCAR_GP_PIN(4, 2), /* VI0_FIELD */ 6797 + [11] = RCAR_GP_PIN(4, 3), /* VI0_HSYNC# */ 6798 + [12] = RCAR_GP_PIN(4, 4), /* VI0_VSYNC# */ 6799 + [13] = RCAR_GP_PIN(4, 5), /* VI0_DATA0_VI0_B0 */ 6800 + [14] = RCAR_GP_PIN(4, 6), /* VI0_DATA1_VI0_B1 */ 6801 + [15] = RCAR_GP_PIN(4, 7), /* VI0_DATA2_VI0_B2 */ 6802 + [16] = RCAR_GP_PIN(4, 8), /* VI0_DATA3_VI0_B3 */ 6803 + [17] = RCAR_GP_PIN(4, 9), /* VI0_DATA4_VI0_B4 */ 6804 + [18] = RCAR_GP_PIN(4, 10), /* VI0_DATA5_VI0_B5 */ 6805 + [19] = RCAR_GP_PIN(4, 11), /* VI0_DATA6_VI0_B6 */ 6806 + [20] = RCAR_GP_PIN(4, 12), /* VI0_DATA7_VI0_B7 */ 6807 + [21] = RCAR_GP_PIN(4, 13), /* VI0_G0 */ 6808 + [22] = RCAR_GP_PIN(4, 14), /* VI0_G1 */ 6809 + [23] = RCAR_GP_PIN(4, 15), /* VI0_G2 */ 6810 + [24] = RCAR_GP_PIN(4, 16), /* VI0_G3 */ 6811 + [25] = RCAR_GP_PIN(4, 17), /* VI0_G4 */ 6812 + [26] = RCAR_GP_PIN(4, 18), /* VI0_G5 */ 6813 + [27] = RCAR_GP_PIN(4, 19), /* VI0_G6 */ 6814 + [28] = RCAR_GP_PIN(4, 20), /* VI0_G7 */ 6815 + [29] = RCAR_GP_PIN(4, 21), /* VI0_R0 */ 6816 + [30] = RCAR_GP_PIN(4, 22), /* VI0_R1 */ 6817 + [31] = RCAR_GP_PIN(4, 23), /* VI0_R2 */ 6818 + } }, 6819 + { PINMUX_BIAS_REG("PUPR5", 0xe6060114, "N/A", 0) { 6820 + [ 0] = RCAR_GP_PIN(4, 24), /* VI0_R3 */ 6821 + [ 1] = RCAR_GP_PIN(4, 25), /* VI0_R4 */ 6822 + [ 2] = RCAR_GP_PIN(4, 26), /* VI0_R5 */ 6823 + [ 3] = RCAR_GP_PIN(4, 27), /* VI0_R6 */ 6824 + [ 4] = RCAR_GP_PIN(4, 28), /* VI0_R7 */ 6825 + [ 5] = RCAR_GP_PIN(5, 0), /* VI1_HSYNC# */ 6826 + [ 6] = RCAR_GP_PIN(5, 1), /* VI1_VSYNC# */ 6827 + [ 7] = RCAR_GP_PIN(5, 2), /* VI1_CLKENB */ 6828 + [ 8] = RCAR_GP_PIN(5, 3), /* VI1_FIELD */ 6829 + [ 9] = RCAR_GP_PIN(5, 4), /* VI1_CLK */ 6830 + [10] = RCAR_GP_PIN(5, 5), /* VI1_DATA0 */ 6831 + [11] = RCAR_GP_PIN(5, 6), /* VI1_DATA1 */ 6832 + [12] = RCAR_GP_PIN(5, 7), /* VI1_DATA2 */ 6833 + [13] = RCAR_GP_PIN(5, 8), /* VI1_DATA3 */ 6834 + [14] = RCAR_GP_PIN(5, 9), /* VI1_DATA4 */ 6835 + [15] = RCAR_GP_PIN(5, 10), /* VI1_DATA5 */ 6836 + [16] = RCAR_GP_PIN(5, 11), /* VI1_DATA6 */ 6837 + [17] = RCAR_GP_PIN(5, 12), /* VI1_DATA7 */ 6838 + [18] = RCAR_GP_PIN(5, 13), /* ETH_MDIO */ 6839 + [19] = RCAR_GP_PIN(5, 14), /* ETH_CRS_DV */ 6840 + [20] = RCAR_GP_PIN(5, 15), /* ETH_RX_ER */ 6841 + [21] = RCAR_GP_PIN(5, 16), /* ETH_RXD0 */ 6842 + [22] = RCAR_GP_PIN(5, 17), /* ETH_RXD1 */ 6843 + [23] = RCAR_GP_PIN(5, 18), /* ETH_LINK */ 6844 + [24] = RCAR_GP_PIN(5, 19), /* ETH_REFCLK */ 6845 + [25] = RCAR_GP_PIN(5, 20), /* ETH_TXD1 */ 6846 + [26] = RCAR_GP_PIN(5, 21), /* ETH_TX_EN */ 6847 + [27] = RCAR_GP_PIN(5, 22), /* ETH_MAGIC */ 6848 + [28] = RCAR_GP_PIN(5, 23), /* ETH_TXD0 */ 6849 + [29] = RCAR_GP_PIN(5, 24), /* ETH_MDC */ 6850 + [30] = RCAR_GP_PIN(5, 25), /* STP_IVCXO27_0 */ 6851 + [31] = RCAR_GP_PIN(5, 26), /* STP_ISCLK_0 */ 6852 + } }, 6853 + { PINMUX_BIAS_REG("PUPR6", 0xe6060118, "N/A", 0) { 6854 + [ 0] = RCAR_GP_PIN(5, 27), /* STP_ISD_0 */ 6855 + [ 1] = RCAR_GP_PIN(5, 28), /* STP_ISEN_0 */ 6856 + [ 2] = RCAR_GP_PIN(5, 29), /* STP_ISSYNC_0 */ 6857 + [ 3] = RCAR_GP_PIN(5, 30), /* STP_OPWM_0 */ 6858 + [ 4] = RCAR_GP_PIN(6, 0), /* SD0_CLK */ 6859 + [ 5] = RCAR_GP_PIN(6, 1), /* SD0_CMD */ 6860 + [ 6] = RCAR_GP_PIN(6, 2), /* SD0_DATA0 */ 6861 + [ 7] = RCAR_GP_PIN(6, 3), /* SD0_DATA1 */ 6862 + [ 8] = RCAR_GP_PIN(6, 4), /* SD0_DATA2 */ 6863 + [ 9] = RCAR_GP_PIN(6, 5), /* SD0_DATA3 */ 6864 + [10] = RCAR_GP_PIN(6, 6), /* SD0_CD */ 6865 + [11] = RCAR_GP_PIN(6, 7), /* SD0_WP */ 6866 + [12] = RCAR_GP_PIN(6, 8), /* SD2_CLK */ 6867 + [13] = RCAR_GP_PIN(6, 9), /* SD2_CMD */ 6868 + [14] = RCAR_GP_PIN(6, 10), /* SD2_DATA0 */ 6869 + [15] = RCAR_GP_PIN(6, 11), /* SD2_DATA1 */ 6870 + [16] = RCAR_GP_PIN(6, 12), /* SD2_DATA2 */ 6871 + [17] = RCAR_GP_PIN(6, 13), /* SD2_DATA3 */ 6872 + [18] = RCAR_GP_PIN(6, 14), /* SD2_CD */ 6873 + [19] = RCAR_GP_PIN(6, 15), /* SD2_WP */ 6874 + [20] = RCAR_GP_PIN(6, 16), /* SD3_CLK */ 6875 + [21] = RCAR_GP_PIN(6, 17), /* SD3_CMD */ 6876 + [22] = RCAR_GP_PIN(6, 18), /* SD3_DATA0 */ 6877 + [23] = RCAR_GP_PIN(6, 19), /* SD3_DATA1 */ 6878 + [24] = RCAR_GP_PIN(6, 20), /* SD3_DATA2 */ 6879 + [25] = RCAR_GP_PIN(6, 21), /* SD3_DATA3 */ 6880 + [26] = RCAR_GP_PIN(6, 22), /* SD3_CD */ 6881 + [27] = RCAR_GP_PIN(6, 23), /* SD3_WP */ 6882 + [28] = RCAR_GP_PIN(6, 24), /* MSIOF0_SCK */ 6883 + [29] = RCAR_GP_PIN(6, 25), /* MSIOF0_SYNC */ 6884 + [30] = RCAR_GP_PIN(6, 26), /* MSIOF0_TXD */ 6885 + [31] = RCAR_GP_PIN(6, 27), /* MSIOF0_RXD */ 6886 + } }, 6887 + { PINMUX_BIAS_REG("PUPR7", 0xe606011c, "N/A", 0) { 6888 + /* PUPR7 pull-up pins */ 6889 + [ 0] = RCAR_GP_PIN(6, 28), /* MSIOF0_SS1 */ 6890 + [ 1] = RCAR_GP_PIN(6, 29), /* MSIOF0_SS2 */ 6891 + [ 2] = RCAR_GP_PIN(4, 29), /* SIM0_RST */ 6892 + [ 3] = RCAR_GP_PIN(4, 30), /* SIM0_CLK */ 6893 + [ 4] = RCAR_GP_PIN(4, 31), /* SIM0_D */ 6894 + [ 5] = RCAR_GP_PIN(7, 20), /* GPS_CLK */ 6895 + [ 6] = RCAR_GP_PIN(7, 21), /* GPS_SIGN */ 6896 + [ 7] = RCAR_GP_PIN(7, 22), /* GPS_MAG */ 6897 + [ 8] = RCAR_GP_PIN(7, 0), /* HCTS0# */ 6898 + [ 9] = RCAR_GP_PIN(7, 1), /* HRTS0# */ 6899 + [10] = RCAR_GP_PIN(7, 2), /* HSCK0 */ 6900 + [11] = RCAR_GP_PIN(7, 3), /* HRX0 */ 6901 + [12] = RCAR_GP_PIN(7, 4), /* HTX0 */ 6902 + [13] = RCAR_GP_PIN(7, 5), /* HRX1 */ 6903 + [14] = RCAR_GP_PIN(7, 6), /* HTX1 */ 6904 + [15] = SH_PFC_PIN_NONE, 6905 + [16] = SH_PFC_PIN_NONE, 6906 + [17] = SH_PFC_PIN_NONE, 6907 + [18] = RCAR_GP_PIN(1, 9), /* A25 */ 6908 + [19] = SH_PFC_PIN_NONE, 6909 + [20] = RCAR_GP_PIN(1, 10), /* CS0# */ 6910 + [21] = RCAR_GP_PIN(7, 23), /* USB0_PWEN */ 6911 + [22] = RCAR_GP_PIN(7, 24), /* USB0_OVC */ 6912 + [23] = RCAR_GP_PIN(7, 25), /* USB1_PWEN */ 6913 + [24] = RCAR_GP_PIN(6, 30), /* USB1_OVC */ 6914 + [25] = PIN_AVS1, /* AVS1 */ 6915 + [26] = PIN_AVS2, /* AVS2 */ 6916 + [27] = SH_PFC_PIN_NONE, 6917 + [28] = SH_PFC_PIN_NONE, 6918 + [29] = SH_PFC_PIN_NONE, 6919 + [30] = SH_PFC_PIN_NONE, 6920 + [31] = SH_PFC_PIN_NONE, 6921 + } }, 6922 + { PINMUX_BIAS_REG("N/A", 0, "PUPR7", 0xe606011c) { 6923 + /* PUPR7 pull-down pins */ 6924 + [ 0] = SH_PFC_PIN_NONE, 6925 + [ 1] = SH_PFC_PIN_NONE, 6926 + [ 2] = SH_PFC_PIN_NONE, 6927 + [ 3] = SH_PFC_PIN_NONE, 6928 + [ 4] = SH_PFC_PIN_NONE, 6929 + [ 5] = SH_PFC_PIN_NONE, 6930 + [ 6] = SH_PFC_PIN_NONE, 6931 + [ 7] = SH_PFC_PIN_NONE, 6932 + [ 8] = SH_PFC_PIN_NONE, 6933 + [ 9] = SH_PFC_PIN_NONE, 6934 + [10] = SH_PFC_PIN_NONE, 6935 + [11] = SH_PFC_PIN_NONE, 6936 + [12] = SH_PFC_PIN_NONE, 6937 + [13] = SH_PFC_PIN_NONE, 6938 + [14] = SH_PFC_PIN_NONE, 6939 + [15] = SH_PFC_PIN_NONE, 6940 + [16] = SH_PFC_PIN_NONE, 6941 + [17] = SH_PFC_PIN_NONE, 6942 + [18] = SH_PFC_PIN_NONE, 6943 + [19] = PIN_ASEBRK_N_ACK, /* ASEBRK#/ACK */ 6944 + [20] = SH_PFC_PIN_NONE, 6945 + [21] = SH_PFC_PIN_NONE, 6946 + [22] = SH_PFC_PIN_NONE, 6947 + [23] = SH_PFC_PIN_NONE, 6948 + [24] = SH_PFC_PIN_NONE, 6949 + [25] = SH_PFC_PIN_NONE, 6950 + [26] = SH_PFC_PIN_NONE, 6951 + [27] = SH_PFC_PIN_NONE, 6952 + [28] = SH_PFC_PIN_NONE, 6953 + [29] = SH_PFC_PIN_NONE, 6954 + [30] = SH_PFC_PIN_NONE, 6955 + [31] = SH_PFC_PIN_NONE, 6956 + } }, 6957 + { /* sentinel */ }, 6958 + }; 6959 + 6685 6960 static const struct sh_pfc_soc_operations r8a7791_pinmux_ops = { 6686 6961 .pin_to_pocctrl = r8a7791_pin_to_pocctrl, 6962 + .get_bias = rcar_pinmux_get_bias, 6963 + .set_bias = rcar_pinmux_set_bias, 6687 6964 }; 6688 6965 6689 6966 #ifdef CONFIG_PINCTRL_PFC_R8A7743 ··· 7016 6665 .nr_functions = ARRAY_SIZE(pinmux_functions.common), 7017 6666 7018 6667 .cfg_regs = pinmux_config_regs, 6668 + .bias_regs = pinmux_bias_regs, 7019 6669 7020 6670 .pinmux_data = pinmux_data, 7021 6671 .pinmux_data_size = ARRAY_SIZE(pinmux_data), ··· 7039 6687 .nr_functions = ARRAY_SIZE(pinmux_functions.common), 7040 6688 7041 6689 .cfg_regs = pinmux_config_regs, 6690 + .bias_regs = pinmux_bias_regs, 7042 6691 7043 6692 .pinmux_data = pinmux_data, 7044 6693 .pinmux_data_size = ARRAY_SIZE(pinmux_data), ··· 7064 6711 ARRAY_SIZE(pinmux_functions.automotive), 7065 6712 7066 6713 .cfg_regs = pinmux_config_regs, 6714 + .bias_regs = pinmux_bias_regs, 7067 6715 7068 6716 .pinmux_data = pinmux_data, 7069 6717 .pinmux_data_size = ARRAY_SIZE(pinmux_data), ··· 7089 6735 ARRAY_SIZE(pinmux_functions.automotive), 7090 6736 7091 6737 .cfg_regs = pinmux_config_regs, 6738 + .bias_regs = pinmux_bias_regs, 7092 6739 7093 6740 .pinmux_data = pinmux_data, 7094 6741 .pinmux_data_size = ARRAY_SIZE(pinmux_data),
-1
drivers/pinctrl/renesas/pfc-r8a7792.c
··· 8 8 9 9 #include <linux/kernel.h> 10 10 11 - #include "core.h" 12 11 #include "sh_pfc.h" 13 12 14 13 #define CPU_ALL_GP(fn, sfx) \
-1
drivers/pinctrl/renesas/pfc-r8a77950.c
··· 8 8 #include <linux/errno.h> 9 9 #include <linux/kernel.h> 10 10 11 - #include "core.h" 12 11 #include "sh_pfc.h" 13 12 14 13 #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
-1
drivers/pinctrl/renesas/pfc-r8a77951.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/sys_soc.h> 11 11 12 - #include "core.h" 13 12 #include "sh_pfc.h" 14 13 15 14 #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
-1
drivers/pinctrl/renesas/pfc-r8a7796.c
··· 14 14 #include <linux/errno.h> 15 15 #include <linux/kernel.h> 16 16 17 - #include "core.h" 18 17 #include "sh_pfc.h" 19 18 20 19 #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
-1
drivers/pinctrl/renesas/pfc-r8a77965.c
··· 15 15 #include <linux/errno.h> 16 16 #include <linux/kernel.h> 17 17 18 - #include "core.h" 19 18 #include "sh_pfc.h" 20 19 21 20 #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
-1
drivers/pinctrl/renesas/pfc-r8a77970.c
··· 16 16 #include <linux/io.h> 17 17 #include <linux/kernel.h> 18 18 19 - #include "core.h" 20 19 #include "sh_pfc.h" 21 20 22 21 #define CPU_ALL_GP(fn, sfx) \
-1
drivers/pinctrl/renesas/pfc-r8a77980.c
··· 16 16 #include <linux/io.h> 17 17 #include <linux/kernel.h> 18 18 19 - #include "core.h" 20 19 #include "sh_pfc.h" 21 20 22 21 #define CPU_ALL_GP(fn, sfx) \
-1
drivers/pinctrl/renesas/pfc-r8a77990.c
··· 14 14 #include <linux/errno.h> 15 15 #include <linux/kernel.h> 16 16 17 - #include "core.h" 18 17 #include "sh_pfc.h" 19 18 20 19 #define CFG_FLAGS (SH_PFC_PIN_CFG_PULL_UP_DOWN)
-1
drivers/pinctrl/renesas/pfc-r8a77995.c
··· 14 14 #include <linux/errno.h> 15 15 #include <linux/kernel.h> 16 16 17 - #include "core.h" 18 17 #include "sh_pfc.h" 19 18 20 19 #define CPU_ALL_GP(fn, sfx) \
-1
drivers/pinctrl/renesas/pfc-r8a779a0.c
··· 11 11 #include <linux/io.h> 12 12 #include <linux/kernel.h> 13 13 14 - #include "core.h" 15 14 #include "sh_pfc.h" 16 15 17 16 #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
+5 -41
drivers/pinctrl/renesas/pfc-sh73a0.c
··· 13 13 #include <linux/regulator/machine.h> 14 14 #include <linux/slab.h> 15 15 16 - #include "core.h" 17 16 #include "sh_pfc.h" 18 17 19 18 #define CPU_ALL_PORT(fn, pfx, sfx) \ ··· 4309 4310 * Pin bias 4310 4311 */ 4311 4312 4312 - #define PORTnCR_PULMD_OFF (0 << 6) 4313 - #define PORTnCR_PULMD_DOWN (2 << 6) 4314 - #define PORTnCR_PULMD_UP (3 << 6) 4315 - #define PORTnCR_PULMD_MASK (3 << 6) 4316 - 4317 4313 static const unsigned int sh73a0_portcr_offsets[] = { 4318 4314 0x00000000, 0x00001000, 0x00001000, 0x00002000, 0x00002000, 4319 4315 0x00002000, 0x00002000, 0x00003000, 0x00003000, 0x00002000, 4320 4316 }; 4321 4317 4322 - static unsigned int sh73a0_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) 4318 + static void __iomem *sh73a0_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin) 4323 4319 { 4324 - void __iomem *addr = pfc->windows->virt 4325 - + sh73a0_portcr_offsets[pin >> 5] + pin; 4326 - u32 value = ioread8(addr) & PORTnCR_PULMD_MASK; 4327 - 4328 - switch (value) { 4329 - case PORTnCR_PULMD_UP: 4330 - return PIN_CONFIG_BIAS_PULL_UP; 4331 - case PORTnCR_PULMD_DOWN: 4332 - return PIN_CONFIG_BIAS_PULL_DOWN; 4333 - case PORTnCR_PULMD_OFF: 4334 - default: 4335 - return PIN_CONFIG_BIAS_DISABLE; 4336 - } 4337 - } 4338 - 4339 - static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 4340 - unsigned int bias) 4341 - { 4342 - void __iomem *addr = pfc->windows->virt 4343 - + sh73a0_portcr_offsets[pin >> 5] + pin; 4344 - u32 value = ioread8(addr) & ~PORTnCR_PULMD_MASK; 4345 - 4346 - switch (bias) { 4347 - case PIN_CONFIG_BIAS_PULL_UP: 4348 - value |= PORTnCR_PULMD_UP; 4349 - break; 4350 - case PIN_CONFIG_BIAS_PULL_DOWN: 4351 - value |= PORTnCR_PULMD_DOWN; 4352 - break; 4353 - } 4354 - 4355 - iowrite8(value, addr); 4320 + return pfc->windows->virt + sh73a0_portcr_offsets[pin >> 5] + pin; 4356 4321 } 4357 4322 4358 4323 /* ----------------------------------------------------------------------------- ··· 4346 4383 4347 4384 static const struct sh_pfc_soc_operations sh73a0_pfc_ops = { 4348 4385 .init = sh73a0_pinmux_soc_init, 4349 - .get_bias = sh73a0_pinmux_get_bias, 4350 - .set_bias = sh73a0_pinmux_set_bias, 4386 + .get_bias = rmobile_pinmux_get_bias, 4387 + .set_bias = rmobile_pinmux_set_bias, 4388 + .pin_to_portcr = sh73a0_pin_to_portcr, 4351 4389 }; 4352 4390 4353 4391 const struct sh_pfc_soc_info sh73a0_pinmux_info = {
+92 -17
drivers/pinctrl/renesas/pinctrl.c
··· 10 10 #include <linux/device.h> 11 11 #include <linux/err.h> 12 12 #include <linux/init.h> 13 + #include <linux/io.h> 13 14 #include <linux/module.h> 14 15 #include <linux/of.h> 15 16 #include <linux/pinctrl/consumer.h> ··· 841 840 return pinctrl_enable(pmx->pctl); 842 841 } 843 842 843 + static const struct pinmux_bias_reg * 844 + rcar_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin, 845 + unsigned int *bit) 846 + { 847 + unsigned int i, j; 848 + 849 + for (i = 0; pfc->info->bias_regs[i].puen || pfc->info->bias_regs[i].pud; i++) { 850 + for (j = 0; j < ARRAY_SIZE(pfc->info->bias_regs[i].pins); j++) { 851 + if (pfc->info->bias_regs[i].pins[j] == pin) { 852 + *bit = j; 853 + return &pfc->info->bias_regs[i]; 854 + } 855 + } 856 + } 857 + 858 + WARN_ONCE(1, "Pin %u is not in bias info list\n", pin); 859 + 860 + return NULL; 861 + } 862 + 844 863 unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) 845 864 { 846 865 const struct pinmux_bias_reg *reg; 847 866 unsigned int bit; 848 867 849 - reg = sh_pfc_pin_to_bias_reg(pfc, pin, &bit); 868 + reg = rcar_pin_to_bias_reg(pfc, pin, &bit); 850 869 if (!reg) 851 870 return PIN_CONFIG_BIAS_DISABLE; 852 871 853 - if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit))) 854 - return PIN_CONFIG_BIAS_DISABLE; 855 - else if (!reg->pud || (sh_pfc_read(pfc, reg->pud) & BIT(bit))) 856 - return PIN_CONFIG_BIAS_PULL_UP; 857 - else 858 - return PIN_CONFIG_BIAS_PULL_DOWN; 872 + if (reg->puen) { 873 + if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit))) 874 + return PIN_CONFIG_BIAS_DISABLE; 875 + else if (!reg->pud || (sh_pfc_read(pfc, reg->pud) & BIT(bit))) 876 + return PIN_CONFIG_BIAS_PULL_UP; 877 + else 878 + return PIN_CONFIG_BIAS_PULL_DOWN; 879 + } else { 880 + if (sh_pfc_read(pfc, reg->pud) & BIT(bit)) 881 + return PIN_CONFIG_BIAS_PULL_DOWN; 882 + else 883 + return PIN_CONFIG_BIAS_DISABLE; 884 + } 859 885 } 860 886 861 887 void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, ··· 892 864 u32 enable, updown; 893 865 unsigned int bit; 894 866 895 - reg = sh_pfc_pin_to_bias_reg(pfc, pin, &bit); 867 + reg = rcar_pin_to_bias_reg(pfc, pin, &bit); 896 868 if (!reg) 897 869 return; 898 870 899 - enable = sh_pfc_read(pfc, reg->puen) & ~BIT(bit); 900 - if (bias != PIN_CONFIG_BIAS_DISABLE) 901 - enable |= BIT(bit); 871 + if (reg->puen) { 872 + enable = sh_pfc_read(pfc, reg->puen) & ~BIT(bit); 873 + if (bias != PIN_CONFIG_BIAS_DISABLE) 874 + enable |= BIT(bit); 902 875 903 - if (reg->pud) { 904 - updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); 905 - if (bias == PIN_CONFIG_BIAS_PULL_UP) 906 - updown |= BIT(bit); 876 + if (reg->pud) { 877 + updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); 878 + if (bias == PIN_CONFIG_BIAS_PULL_UP) 879 + updown |= BIT(bit); 907 880 908 - sh_pfc_write(pfc, reg->pud, updown); 881 + sh_pfc_write(pfc, reg->pud, updown); 882 + } 883 + 884 + sh_pfc_write(pfc, reg->puen, enable); 885 + } else { 886 + enable = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); 887 + if (bias == PIN_CONFIG_BIAS_PULL_DOWN) 888 + enable |= BIT(bit); 889 + 890 + sh_pfc_write(pfc, reg->pud, enable); 891 + } 892 + } 893 + 894 + #define PORTnCR_PULMD_OFF (0 << 6) 895 + #define PORTnCR_PULMD_DOWN (2 << 6) 896 + #define PORTnCR_PULMD_UP (3 << 6) 897 + #define PORTnCR_PULMD_MASK (3 << 6) 898 + 899 + unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) 900 + { 901 + void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin); 902 + u32 value = ioread8(reg) & PORTnCR_PULMD_MASK; 903 + 904 + switch (value) { 905 + case PORTnCR_PULMD_UP: 906 + return PIN_CONFIG_BIAS_PULL_UP; 907 + case PORTnCR_PULMD_DOWN: 908 + return PIN_CONFIG_BIAS_PULL_DOWN; 909 + case PORTnCR_PULMD_OFF: 910 + default: 911 + return PIN_CONFIG_BIAS_DISABLE; 912 + } 913 + } 914 + 915 + void rmobile_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 916 + unsigned int bias) 917 + { 918 + void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin); 919 + u32 value = ioread8(reg) & ~PORTnCR_PULMD_MASK; 920 + 921 + switch (bias) { 922 + case PIN_CONFIG_BIAS_PULL_UP: 923 + value |= PORTnCR_PULMD_UP; 924 + break; 925 + case PIN_CONFIG_BIAS_PULL_DOWN: 926 + value |= PORTnCR_PULMD_DOWN; 927 + break; 909 928 } 910 929 911 - sh_pfc_write(pfc, reg->puen, enable); 930 + iowrite8(value, reg); 912 931 }
+20 -4
drivers/pinctrl/renesas/sh_pfc.h
··· 188 188 .reg = r, \ 189 189 .fields = 190 190 191 - struct pinmux_bias_reg { 191 + struct pinmux_bias_reg { /* At least one of puen/pud must exist */ 192 192 u32 puen; /* Pull-enable or pull-up control register */ 193 - u32 pud; /* Pull-up/down control register (optional) */ 193 + u32 pud; /* Pull-up/down or pull-down control register */ 194 194 const u16 pins[32]; 195 195 }; 196 196 ··· 273 273 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin, 274 274 unsigned int bias); 275 275 int (*pin_to_pocctrl)(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl); 276 + void __iomem * (*pin_to_portcr)(struct sh_pfc *pfc, unsigned int pin); 276 277 }; 277 278 278 279 struct sh_pfc_soc_info { ··· 479 478 PORT_GP_CFG_1(bank, 5, fn, sfx, cfg) 480 479 #define PORT_GP_6(bank, fn, sfx) PORT_GP_CFG_6(bank, fn, sfx, 0) 481 480 482 - #define PORT_GP_CFG_8(bank, fn, sfx, cfg) \ 481 + #define PORT_GP_CFG_7(bank, fn, sfx, cfg) \ 483 482 PORT_GP_CFG_6(bank, fn, sfx, cfg), \ 484 - PORT_GP_CFG_1(bank, 6, fn, sfx, cfg), \ 483 + PORT_GP_CFG_1(bank, 6, fn, sfx, cfg) 484 + #define PORT_GP_7(bank, fn, sfx) PORT_GP_CFG_7(bank, fn, sfx, 0) 485 + 486 + #define PORT_GP_CFG_8(bank, fn, sfx, cfg) \ 487 + PORT_GP_CFG_7(bank, fn, sfx, cfg), \ 485 488 PORT_GP_CFG_1(bank, 7, fn, sfx, cfg) 486 489 #define PORT_GP_8(bank, fn, sfx) PORT_GP_CFG_8(bank, fn, sfx, 0) 487 490 ··· 777 772 * GPIO number helper macro for R-Car 778 773 */ 779 774 #define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin)) 775 + 776 + /* 777 + * Bias helpers 778 + */ 779 + unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin); 780 + void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 781 + unsigned int bias); 782 + 783 + unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin); 784 + void rmobile_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, 785 + unsigned int bias); 780 786 781 787 #endif /* __SH_PFC_H */