106763c74SThomas Petazzoni /* 206763c74SThomas Petazzoni * Marvell Dove pinctrl driver based on mvebu pinctrl core 306763c74SThomas Petazzoni * 406763c74SThomas Petazzoni * Author: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 506763c74SThomas Petazzoni * 606763c74SThomas Petazzoni * This program is free software; you can redistribute it and/or modify 706763c74SThomas Petazzoni * it under the terms of the GNU General Public License as published by 806763c74SThomas Petazzoni * the Free Software Foundation; either version 2 of the License, or 906763c74SThomas Petazzoni * (at your option) any later version. 1006763c74SThomas Petazzoni */ 1106763c74SThomas Petazzoni 1206763c74SThomas Petazzoni #include <linux/err.h> 1306763c74SThomas Petazzoni #include <linux/init.h> 1406763c74SThomas Petazzoni #include <linux/io.h> 1506763c74SThomas Petazzoni #include <linux/module.h> 1606763c74SThomas Petazzoni #include <linux/bitops.h> 1706763c74SThomas Petazzoni #include <linux/platform_device.h> 1806763c74SThomas Petazzoni #include <linux/clk.h> 1906763c74SThomas Petazzoni #include <linux/of.h> 2006763c74SThomas Petazzoni #include <linux/of_device.h> 2106763c74SThomas Petazzoni #include <linux/pinctrl/pinctrl.h> 2206763c74SThomas Petazzoni 2306763c74SThomas Petazzoni #include "pinctrl-mvebu.h" 2406763c74SThomas Petazzoni 2578f9f3b1SSebastian Hesselbarth #define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000) 2678f9f3b1SSebastian Hesselbarth #define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200) 2706763c74SThomas Petazzoni #define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10) 2806763c74SThomas Petazzoni #define DOVE_AU0_AC97_SEL BIT(16) 29bbd7b275SSebastian Hesselbarth #define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C) 30bbd7b275SSebastian Hesselbarth #define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030) 31bbd7b275SSebastian Hesselbarth #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C) 3278f9f3b1SSebastian Hesselbarth #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C) 3306763c74SThomas Petazzoni #define DOVE_TWSI_ENABLE_OPTION1 BIT(7) 3478f9f3b1SSebastian Hesselbarth #define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE + 0xe8030) 3506763c74SThomas Petazzoni #define DOVE_TWSI_ENABLE_OPTION2 BIT(20) 3606763c74SThomas Petazzoni #define DOVE_TWSI_ENABLE_OPTION3 BIT(21) 3706763c74SThomas Petazzoni #define DOVE_TWSI_OPTION3_GPIO BIT(22) 3878f9f3b1SSebastian Hesselbarth #define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE + 0xe8034) 3906763c74SThomas Petazzoni #define DOVE_SSP_ON_AU1 BIT(0) 4078f9f3b1SSebastian Hesselbarth #define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe803c) 4106763c74SThomas Petazzoni #define DOVE_AU1_SPDIFO_GPIO_EN BIT(1) 4206763c74SThomas Petazzoni #define DOVE_NAND_GPIO_EN BIT(0) 4378f9f3b1SSebastian Hesselbarth #define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0400) 4406763c74SThomas Petazzoni #define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40) 4506763c74SThomas Petazzoni #define DOVE_SPI_GPIO_SEL BIT(5) 4606763c74SThomas Petazzoni #define DOVE_UART1_GPIO_SEL BIT(4) 4706763c74SThomas Petazzoni #define DOVE_AU1_GPIO_SEL BIT(3) 4806763c74SThomas Petazzoni #define DOVE_CAM_GPIO_SEL BIT(2) 4906763c74SThomas Petazzoni #define DOVE_SD1_GPIO_SEL BIT(1) 5006763c74SThomas Petazzoni #define DOVE_SD0_GPIO_SEL BIT(0) 5106763c74SThomas Petazzoni 5206763c74SThomas Petazzoni #define MPPS_PER_REG 8 5306763c74SThomas Petazzoni #define MPP_BITS 4 5406763c74SThomas Petazzoni #define MPP_MASK 0xf 5506763c74SThomas Petazzoni 5606763c74SThomas Petazzoni #define CONFIG_PMU BIT(4) 5706763c74SThomas Petazzoni 58*2035d39dSSebastian Hesselbarth static int dove_pmu_mpp_ctrl_get(unsigned pid, unsigned long *config) 5906763c74SThomas Petazzoni { 60*2035d39dSSebastian Hesselbarth unsigned off = (pid / MPPS_PER_REG) * MPP_BITS; 61*2035d39dSSebastian Hesselbarth unsigned shift = (pid % MPPS_PER_REG) * MPP_BITS; 6206763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 63bbd7b275SSebastian Hesselbarth unsigned long func; 6406763c74SThomas Petazzoni 65*2035d39dSSebastian Hesselbarth if (pmu & (1 << pid)) { 66bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 67bbd7b275SSebastian Hesselbarth *config = (func >> shift) & MPP_MASK; 68bbd7b275SSebastian Hesselbarth *config |= CONFIG_PMU; 69bbd7b275SSebastian Hesselbarth } else { 70bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 71bbd7b275SSebastian Hesselbarth *config = (func >> shift) & MPP_MASK; 72bbd7b275SSebastian Hesselbarth } 7306763c74SThomas Petazzoni return 0; 7406763c74SThomas Petazzoni } 7506763c74SThomas Petazzoni 76*2035d39dSSebastian Hesselbarth static int dove_pmu_mpp_ctrl_set(unsigned pid, unsigned long config) 7706763c74SThomas Petazzoni { 78*2035d39dSSebastian Hesselbarth unsigned off = (pid / MPPS_PER_REG) * MPP_BITS; 79*2035d39dSSebastian Hesselbarth unsigned shift = (pid % MPPS_PER_REG) * MPP_BITS; 8006763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 81bbd7b275SSebastian Hesselbarth unsigned long func; 8206763c74SThomas Petazzoni 83bbd7b275SSebastian Hesselbarth if (config & CONFIG_PMU) { 84*2035d39dSSebastian Hesselbarth writel(pmu | (1 << pid), DOVE_PMU_MPP_GENERAL_CTRL); 85bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 86bbd7b275SSebastian Hesselbarth func &= ~(MPP_MASK << shift); 87bbd7b275SSebastian Hesselbarth func |= (config & MPP_MASK) << shift; 88bbd7b275SSebastian Hesselbarth writel(func, DOVE_PMU_SIGNAL_SELECT_0 + off); 89bbd7b275SSebastian Hesselbarth } else { 90*2035d39dSSebastian Hesselbarth writel(pmu & ~(1 << pid), DOVE_PMU_MPP_GENERAL_CTRL); 91bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 92bbd7b275SSebastian Hesselbarth func &= ~(MPP_MASK << shift); 93bbd7b275SSebastian Hesselbarth func |= (config & MPP_MASK) << shift; 94bbd7b275SSebastian Hesselbarth writel(func, DOVE_MPP_VIRT_BASE + off); 9506763c74SThomas Petazzoni } 9606763c74SThomas Petazzoni return 0; 9706763c74SThomas Petazzoni } 9806763c74SThomas Petazzoni 99*2035d39dSSebastian Hesselbarth static int dove_mpp4_ctrl_get(unsigned pid, unsigned long *config) 10006763c74SThomas Petazzoni { 10106763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 10206763c74SThomas Petazzoni unsigned long mask; 10306763c74SThomas Petazzoni 104*2035d39dSSebastian Hesselbarth switch (pid) { 10506763c74SThomas Petazzoni case 24: /* mpp_camera */ 10606763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 10706763c74SThomas Petazzoni break; 10806763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 10906763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 11006763c74SThomas Petazzoni break; 11106763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 11206763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 11306763c74SThomas Petazzoni break; 11406763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 11506763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 11606763c74SThomas Petazzoni break; 11706763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 11806763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 11906763c74SThomas Petazzoni break; 12006763c74SThomas Petazzoni default: 12106763c74SThomas Petazzoni return -EINVAL; 12206763c74SThomas Petazzoni } 12306763c74SThomas Petazzoni 12406763c74SThomas Petazzoni *config = ((mpp4 & mask) != 0); 12506763c74SThomas Petazzoni 12606763c74SThomas Petazzoni return 0; 12706763c74SThomas Petazzoni } 12806763c74SThomas Petazzoni 129*2035d39dSSebastian Hesselbarth static int dove_mpp4_ctrl_set(unsigned pid, unsigned long config) 13006763c74SThomas Petazzoni { 13106763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 13206763c74SThomas Petazzoni unsigned long mask; 13306763c74SThomas Petazzoni 134*2035d39dSSebastian Hesselbarth switch (pid) { 13506763c74SThomas Petazzoni case 24: /* mpp_camera */ 13606763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 13706763c74SThomas Petazzoni break; 13806763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 13906763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 14006763c74SThomas Petazzoni break; 14106763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 14206763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 14306763c74SThomas Petazzoni break; 14406763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 14506763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 14606763c74SThomas Petazzoni break; 14706763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 14806763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 14906763c74SThomas Petazzoni break; 15006763c74SThomas Petazzoni default: 15106763c74SThomas Petazzoni return -EINVAL; 15206763c74SThomas Petazzoni } 15306763c74SThomas Petazzoni 15406763c74SThomas Petazzoni mpp4 &= ~mask; 15506763c74SThomas Petazzoni if (config) 15606763c74SThomas Petazzoni mpp4 |= mask; 15706763c74SThomas Petazzoni 15806763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 15906763c74SThomas Petazzoni 16006763c74SThomas Petazzoni return 0; 16106763c74SThomas Petazzoni } 16206763c74SThomas Petazzoni 163*2035d39dSSebastian Hesselbarth static int dove_nand_ctrl_get(unsigned pid, unsigned long *config) 16406763c74SThomas Petazzoni { 16506763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 16606763c74SThomas Petazzoni 16706763c74SThomas Petazzoni *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0); 16806763c74SThomas Petazzoni 16906763c74SThomas Petazzoni return 0; 17006763c74SThomas Petazzoni } 17106763c74SThomas Petazzoni 172*2035d39dSSebastian Hesselbarth static int dove_nand_ctrl_set(unsigned pid, unsigned long config) 17306763c74SThomas Petazzoni { 17406763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 17506763c74SThomas Petazzoni 17606763c74SThomas Petazzoni gmpp &= ~DOVE_NAND_GPIO_EN; 17706763c74SThomas Petazzoni if (config) 17806763c74SThomas Petazzoni gmpp |= DOVE_NAND_GPIO_EN; 17906763c74SThomas Petazzoni 18006763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 18106763c74SThomas Petazzoni 18206763c74SThomas Petazzoni return 0; 18306763c74SThomas Petazzoni } 18406763c74SThomas Petazzoni 185*2035d39dSSebastian Hesselbarth static int dove_audio0_ctrl_get(unsigned pid, unsigned long *config) 18606763c74SThomas Petazzoni { 18706763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 18806763c74SThomas Petazzoni 18906763c74SThomas Petazzoni *config = ((pmu & DOVE_AU0_AC97_SEL) != 0); 19006763c74SThomas Petazzoni 19106763c74SThomas Petazzoni return 0; 19206763c74SThomas Petazzoni } 19306763c74SThomas Petazzoni 194*2035d39dSSebastian Hesselbarth static int dove_audio0_ctrl_set(unsigned pid, unsigned long config) 19506763c74SThomas Petazzoni { 19606763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 19706763c74SThomas Petazzoni 19806763c74SThomas Petazzoni pmu &= ~DOVE_AU0_AC97_SEL; 19906763c74SThomas Petazzoni if (config) 20006763c74SThomas Petazzoni pmu |= DOVE_AU0_AC97_SEL; 20106763c74SThomas Petazzoni writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL); 20206763c74SThomas Petazzoni 20306763c74SThomas Petazzoni return 0; 20406763c74SThomas Petazzoni } 20506763c74SThomas Petazzoni 206*2035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_get(unsigned pid, unsigned long *config) 20706763c74SThomas Petazzoni { 20806763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 20906763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 21006763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 21106763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 21206763c74SThomas Petazzoni 21306763c74SThomas Petazzoni *config = 0; 21406763c74SThomas Petazzoni if (mpp4 & DOVE_AU1_GPIO_SEL) 21506763c74SThomas Petazzoni *config |= BIT(3); 21606763c74SThomas Petazzoni if (sspc1 & DOVE_SSP_ON_AU1) 21706763c74SThomas Petazzoni *config |= BIT(2); 21806763c74SThomas Petazzoni if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN) 21906763c74SThomas Petazzoni *config |= BIT(1); 22006763c74SThomas Petazzoni if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) 22106763c74SThomas Petazzoni *config |= BIT(0); 22206763c74SThomas Petazzoni 22306763c74SThomas Petazzoni /* SSP/TWSI only if I2S1 not set*/ 22406763c74SThomas Petazzoni if ((*config & BIT(3)) == 0) 22506763c74SThomas Petazzoni *config &= ~(BIT(2) | BIT(0)); 22606763c74SThomas Petazzoni /* TWSI only if SPDIFO not set*/ 22706763c74SThomas Petazzoni if ((*config & BIT(1)) == 0) 22806763c74SThomas Petazzoni *config &= ~BIT(0); 22906763c74SThomas Petazzoni return 0; 23006763c74SThomas Petazzoni } 23106763c74SThomas Petazzoni 232*2035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_set(unsigned pid, unsigned long config) 23306763c74SThomas Petazzoni { 23406763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 23506763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 23606763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 23706763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 23806763c74SThomas Petazzoni 23963ace077SAxel Lin /* 24063ace077SAxel Lin * clear all audio1 related bits before configure 24163ace077SAxel Lin */ 24263ace077SAxel Lin gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO; 24363ace077SAxel Lin gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN; 24463ace077SAxel Lin sspc1 &= ~DOVE_SSP_ON_AU1; 24563ace077SAxel Lin mpp4 &= ~DOVE_AU1_GPIO_SEL; 24663ace077SAxel Lin 24706763c74SThomas Petazzoni if (config & BIT(0)) 24806763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_OPTION3_GPIO; 24906763c74SThomas Petazzoni if (config & BIT(1)) 25006763c74SThomas Petazzoni gmpp |= DOVE_AU1_SPDIFO_GPIO_EN; 25106763c74SThomas Petazzoni if (config & BIT(2)) 25206763c74SThomas Petazzoni sspc1 |= DOVE_SSP_ON_AU1; 25306763c74SThomas Petazzoni if (config & BIT(3)) 25406763c74SThomas Petazzoni mpp4 |= DOVE_AU1_GPIO_SEL; 25506763c74SThomas Petazzoni 25606763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 25706763c74SThomas Petazzoni writel(sspc1, DOVE_SSP_CTRL_STATUS_1); 25806763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 25906763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 26006763c74SThomas Petazzoni 26106763c74SThomas Petazzoni return 0; 26206763c74SThomas Petazzoni } 26306763c74SThomas Petazzoni 26406763c74SThomas Petazzoni /* mpp[52:57] gpio pins depend heavily on current config; 26506763c74SThomas Petazzoni * gpio_req does not try to mux in gpio capabilities to not 26606763c74SThomas Petazzoni * break other functions. If you require all mpps as gpio 26706763c74SThomas Petazzoni * enforce gpio setting by pinctrl mapping. 26806763c74SThomas Petazzoni */ 269*2035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_gpio_req(unsigned pid) 27006763c74SThomas Petazzoni { 27106763c74SThomas Petazzoni unsigned long config; 27206763c74SThomas Petazzoni 273*2035d39dSSebastian Hesselbarth dove_audio1_ctrl_get(pid, &config); 27406763c74SThomas Petazzoni 27506763c74SThomas Petazzoni switch (config) { 27606763c74SThomas Petazzoni case 0x02: /* i2s1 : gpio[56:57] */ 27706763c74SThomas Petazzoni case 0x0e: /* ssp : gpio[56:57] */ 27806763c74SThomas Petazzoni if (pid >= 56) 27906763c74SThomas Petazzoni return 0; 28006763c74SThomas Petazzoni return -ENOTSUPP; 28106763c74SThomas Petazzoni case 0x08: /* spdifo : gpio[52:55] */ 28206763c74SThomas Petazzoni case 0x0b: /* twsi : gpio[52:55] */ 28306763c74SThomas Petazzoni if (pid <= 55) 28406763c74SThomas Petazzoni return 0; 28506763c74SThomas Petazzoni return -ENOTSUPP; 28606763c74SThomas Petazzoni case 0x0a: /* all gpio */ 28706763c74SThomas Petazzoni return 0; 28806763c74SThomas Petazzoni /* 0x00 : i2s1/spdifo : no gpio */ 28906763c74SThomas Petazzoni /* 0x0c : ssp/spdifo : no gpio */ 29006763c74SThomas Petazzoni /* 0x0f : ssp/twsi : no gpio */ 29106763c74SThomas Petazzoni } 29206763c74SThomas Petazzoni return -ENOTSUPP; 29306763c74SThomas Petazzoni } 29406763c74SThomas Petazzoni 29506763c74SThomas Petazzoni /* mpp[52:57] has gpio pins capable of in and out */ 296*2035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_gpio_dir(unsigned pid, bool input) 29706763c74SThomas Petazzoni { 29806763c74SThomas Petazzoni if (pid < 52 || pid > 57) 29906763c74SThomas Petazzoni return -ENOTSUPP; 30006763c74SThomas Petazzoni return 0; 30106763c74SThomas Petazzoni } 30206763c74SThomas Petazzoni 303*2035d39dSSebastian Hesselbarth static int dove_twsi_ctrl_get(unsigned pid, unsigned long *config) 30406763c74SThomas Petazzoni { 30506763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 30606763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 30706763c74SThomas Petazzoni 30806763c74SThomas Petazzoni *config = 0; 30906763c74SThomas Petazzoni if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1) 31006763c74SThomas Petazzoni *config = 1; 31106763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2) 31206763c74SThomas Petazzoni *config = 2; 31306763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3) 31406763c74SThomas Petazzoni *config = 3; 31506763c74SThomas Petazzoni 31606763c74SThomas Petazzoni return 0; 31706763c74SThomas Petazzoni } 31806763c74SThomas Petazzoni 319*2035d39dSSebastian Hesselbarth static int dove_twsi_ctrl_set(unsigned pid, unsigned long config) 32006763c74SThomas Petazzoni { 32106763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 32206763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 32306763c74SThomas Petazzoni 32406763c74SThomas Petazzoni gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; 3256d0a4ed2SRoel Kluin gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION3); 32606763c74SThomas Petazzoni 32706763c74SThomas Petazzoni switch (config) { 32806763c74SThomas Petazzoni case 1: 32906763c74SThomas Petazzoni gcfg1 |= DOVE_TWSI_ENABLE_OPTION1; 33006763c74SThomas Petazzoni break; 33106763c74SThomas Petazzoni case 2: 33206763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION2; 33306763c74SThomas Petazzoni break; 33406763c74SThomas Petazzoni case 3: 33506763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION3; 33606763c74SThomas Petazzoni break; 33706763c74SThomas Petazzoni } 33806763c74SThomas Petazzoni 33906763c74SThomas Petazzoni writel(gcfg1, DOVE_GLOBAL_CONFIG_1); 34006763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 34106763c74SThomas Petazzoni 34206763c74SThomas Petazzoni return 0; 34306763c74SThomas Petazzoni } 34406763c74SThomas Petazzoni 34506763c74SThomas Petazzoni static struct mvebu_mpp_ctrl dove_mpp_controls[] = { 34606763c74SThomas Petazzoni MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl), 34706763c74SThomas Petazzoni MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl), 34806763c74SThomas Petazzoni MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl), 34906763c74SThomas Petazzoni MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl), 35006763c74SThomas Petazzoni MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl), 35106763c74SThomas Petazzoni MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl), 35206763c74SThomas Petazzoni MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl), 35306763c74SThomas Petazzoni MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl), 35406763c74SThomas Petazzoni MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl), 35506763c74SThomas Petazzoni MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl), 35606763c74SThomas Petazzoni MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl), 35706763c74SThomas Petazzoni MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl), 35806763c74SThomas Petazzoni MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl), 35906763c74SThomas Petazzoni MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), 36006763c74SThomas Petazzoni MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), 36106763c74SThomas Petazzoni MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), 36206763c74SThomas Petazzoni MPP_REG_CTRL(16, 23), 36306763c74SThomas Petazzoni MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), 36406763c74SThomas Petazzoni MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), 36506763c74SThomas Petazzoni MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), 36606763c74SThomas Petazzoni MPP_FUNC_GPIO_CTRL(52, 57, "mpp_audio1", dove_audio1_ctrl), 36706763c74SThomas Petazzoni MPP_FUNC_CTRL(58, 61, "mpp_spi0", dove_mpp4_ctrl), 36806763c74SThomas Petazzoni MPP_FUNC_CTRL(62, 63, "mpp_uart1", dove_mpp4_ctrl), 36906763c74SThomas Petazzoni MPP_FUNC_CTRL(64, 71, "mpp_nand", dove_nand_ctrl), 37006763c74SThomas Petazzoni MPP_FUNC_CTRL(72, 72, "audio0", dove_audio0_ctrl), 37106763c74SThomas Petazzoni MPP_FUNC_CTRL(73, 73, "twsi", dove_twsi_ctrl), 37206763c74SThomas Petazzoni }; 37306763c74SThomas Petazzoni 37406763c74SThomas Petazzoni static struct mvebu_mpp_mode dove_mpp_modes[] = { 37506763c74SThomas Petazzoni MPP_MODE(0, 37606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 37706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 37806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 37906763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd0", "pwm"), 380bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 381bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 382bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 383bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 384bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 385bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 386bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 387bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 388bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 389bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 390bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 391bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 39206763c74SThomas Petazzoni MPP_MODE(1, 39306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 39406763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 39506763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 39606763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd1", "pwm"), 397bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 398bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 399bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 400bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 401bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 402bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 403bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 404bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 405bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 406bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 407bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 408bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 40906763c74SThomas Petazzoni MPP_MODE(2, 41006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 41106763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 41206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 41306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 41406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "rts"), 415bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 416bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 417bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 418bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 419bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 420bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 421bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 422bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 423bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 424bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 425bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 426bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 42706763c74SThomas Petazzoni MPP_MODE(3, 42806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 42906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 43006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 43106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 43206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "cts"), 43306763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd-spi", "cs1"), 434bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 435bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 436bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 437bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 438bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 439bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 440bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 441bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 442bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 443bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 444bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 445bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 44606763c74SThomas Petazzoni MPP_MODE(4, 44706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 44806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 44906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 45006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "miso"), 451bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 452bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 453bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 454bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 455bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 456bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 457bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 458bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 459bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 460bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 461bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 462bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 46306763c74SThomas Petazzoni MPP_MODE(5, 46406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 46506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 46606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 46706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "cs"), 468bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 469bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 470bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 471bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 472bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 473bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 474bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 475bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 476bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 477bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 478bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 479bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 48006763c74SThomas Petazzoni MPP_MODE(6, 48106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 48206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 48306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 48406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "mosi"), 485bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 486bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 487bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 488bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 489bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 490bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 491bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 492bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 493bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 494bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 495bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 496bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 49706763c74SThomas Petazzoni MPP_MODE(7, 49806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 49906763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 50006763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 50106763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "sck"), 502bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 503bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 504bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 505bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 506bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 507bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 508bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 509bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 510bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 511bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 512bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 513bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 51406763c74SThomas Petazzoni MPP_MODE(8, 51506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 51606763c74SThomas Petazzoni MPP_FUNCTION(0x01, "watchdog", "rstout"), 517bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 518bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 519bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 520bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 521bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 522bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 523bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 524bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 525bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 526bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 527bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 528bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 52906763c74SThomas Petazzoni MPP_MODE(9, 53006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 53106763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex1", "clkreq"), 532bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 533bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 534bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 535bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 536bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 537bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 538bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 539bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 540bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 541bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 542bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 543bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 54406763c74SThomas Petazzoni MPP_MODE(10, 54506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 54606763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sclk"), 547bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 548bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 549bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 550bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 551bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 552bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 553bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 554bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 555bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 556bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 557bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 558bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 55906763c74SThomas Petazzoni MPP_MODE(11, 56006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 56106763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 56206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "sata-1", "act"), 56306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 56406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 56506763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex0", "clkreq"), 566bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 567bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 568bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 569bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 570bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 571bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 572bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 573bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 574bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 575bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 576bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 577bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 57806763c74SThomas Petazzoni MPP_MODE(12, 57906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 58006763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 58106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 58206763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio0", "extclk"), 58306763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "cd"), 584bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 585bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 586bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 587bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 588bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 589bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 590bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 591bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 592bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 593bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 594bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 595bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 59606763c74SThomas Petazzoni MPP_MODE(13, 59706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 59806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 59906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio1", "extclk"), 60006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "wp"), 60106763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "extclk"), 602bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 603bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 604bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 605bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 606bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 607bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 608bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 609bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 610bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 611bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 612bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 613bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 61406763c74SThomas Petazzoni MPP_MODE(14, 61506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 61606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 61706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "buspwr"), 61806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "rxd"), 619bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 620bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 621bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 622bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 623bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 624bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 625bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 626bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 627bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 628bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 629bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 630bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 63106763c74SThomas Petazzoni MPP_MODE(15, 63206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 63306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 63406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 63506763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sfrm"), 636bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 637bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 638bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 639bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 640bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 641bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 642bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 643bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 644bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 645bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 646bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 647bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 64806763c74SThomas Petazzoni MPP_MODE(16, 64906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 65006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 65106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 65206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd-spi", "cs1"), 65306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi1")), 65406763c74SThomas Petazzoni MPP_MODE(17, 65506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 65606763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97-1", "sysclko"), 65706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 65806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 65906763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sda"), 66006763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi2")), 66106763c74SThomas Petazzoni MPP_MODE(18, 66206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 66306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 66406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 66506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd0", "pwm"), 66606763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi3")), 66706763c74SThomas Petazzoni MPP_MODE(19, 66806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 66906763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 67006763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 67106763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sck")), 67206763c74SThomas Petazzoni MPP_MODE(20, 67306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 67406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", "sysclko"), 67506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "miso"), 67606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 67706763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "cd"), 67806763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "miso")), 67906763c74SThomas Petazzoni MPP_MODE(21, 68006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68106763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "rts"), 68206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "cs0"), 68306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 68406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sfrm"), 68506763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "wp"), 68606763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "cs")), 68706763c74SThomas Petazzoni MPP_MODE(22, 68806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "cts"), 69006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "mosi"), 69106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 69206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "txd"), 69306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "buspwr"), 69406763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "mosi")), 69506763c74SThomas Petazzoni MPP_MODE(23, 69606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 69706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "sck"), 69806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 69906763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sclk"), 70006763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "ledctrl"), 70106763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "sck")), 70206763c74SThomas Petazzoni MPP_MODE(24, 70306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "camera", NULL), 70406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 70506763c74SThomas Petazzoni MPP_MODE(40, 70606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio0", NULL), 70706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 70806763c74SThomas Petazzoni MPP_MODE(46, 70906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio1", NULL), 71006763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 71106763c74SThomas Petazzoni MPP_MODE(52, 71206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s1/spdifo", NULL), 71306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "i2s1", NULL), 71406763c74SThomas Petazzoni MPP_FUNCTION(0x08, "spdifo", NULL), 71506763c74SThomas Petazzoni MPP_FUNCTION(0x0a, "gpio", NULL), 71606763c74SThomas Petazzoni MPP_FUNCTION(0x0b, "twsi", NULL), 71706763c74SThomas Petazzoni MPP_FUNCTION(0x0c, "ssp/spdifo", NULL), 71806763c74SThomas Petazzoni MPP_FUNCTION(0x0e, "ssp", NULL), 71906763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "ssp/twsi", NULL)), 72006763c74SThomas Petazzoni MPP_MODE(58, 72106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "spi0", NULL), 72206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 72306763c74SThomas Petazzoni MPP_MODE(62, 72406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "uart1", NULL), 72506763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 72606763c74SThomas Petazzoni MPP_MODE(64, 72706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "nand", NULL), 72806763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpo", NULL)), 72906763c74SThomas Petazzoni MPP_MODE(72, 73006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s", NULL), 73106763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", NULL)), 73206763c74SThomas Petazzoni MPP_MODE(73, 73306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "twsi-none", NULL), 73406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "twsi-opt1", NULL), 73506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "twsi-opt2", NULL), 73606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "twsi-opt3", NULL)), 73706763c74SThomas Petazzoni }; 73806763c74SThomas Petazzoni 73906763c74SThomas Petazzoni static struct pinctrl_gpio_range dove_mpp_gpio_ranges[] = { 74006763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 74106763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 74206763c74SThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 8), 74306763c74SThomas Petazzoni }; 74406763c74SThomas Petazzoni 74506763c74SThomas Petazzoni static struct mvebu_pinctrl_soc_info dove_pinctrl_info = { 74606763c74SThomas Petazzoni .controls = dove_mpp_controls, 74706763c74SThomas Petazzoni .ncontrols = ARRAY_SIZE(dove_mpp_controls), 74806763c74SThomas Petazzoni .modes = dove_mpp_modes, 74906763c74SThomas Petazzoni .nmodes = ARRAY_SIZE(dove_mpp_modes), 75006763c74SThomas Petazzoni .gpioranges = dove_mpp_gpio_ranges, 75106763c74SThomas Petazzoni .ngpioranges = ARRAY_SIZE(dove_mpp_gpio_ranges), 75206763c74SThomas Petazzoni .variant = 0, 75306763c74SThomas Petazzoni }; 75406763c74SThomas Petazzoni 75506763c74SThomas Petazzoni static struct clk *clk; 75606763c74SThomas Petazzoni 757150632b0SGreg Kroah-Hartman static struct of_device_id dove_pinctrl_of_match[] = { 75806763c74SThomas Petazzoni { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info }, 75906763c74SThomas Petazzoni { } 76006763c74SThomas Petazzoni }; 76106763c74SThomas Petazzoni 762150632b0SGreg Kroah-Hartman static int dove_pinctrl_probe(struct platform_device *pdev) 76306763c74SThomas Petazzoni { 76406763c74SThomas Petazzoni const struct of_device_id *match = 76506763c74SThomas Petazzoni of_match_device(dove_pinctrl_of_match, &pdev->dev); 76616fa36beSAndrew Lunn pdev->dev.platform_data = (void *)match->data; 76706763c74SThomas Petazzoni 76806763c74SThomas Petazzoni /* 76906763c74SThomas Petazzoni * General MPP Configuration Register is part of pdma registers. 77006763c74SThomas Petazzoni * grab clk to make sure it is ticking. 77106763c74SThomas Petazzoni */ 77206763c74SThomas Petazzoni clk = devm_clk_get(&pdev->dev, NULL); 773ba607b62SSebastian Hesselbarth if (IS_ERR(clk)) { 774ba607b62SSebastian Hesselbarth dev_err(&pdev->dev, "Unable to get pdma clock"); 7755795c6acSRusty Russell return PTR_ERR(clk); 776ba607b62SSebastian Hesselbarth } 77706763c74SThomas Petazzoni clk_prepare_enable(clk); 77806763c74SThomas Petazzoni 77906763c74SThomas Petazzoni return mvebu_pinctrl_probe(pdev); 78006763c74SThomas Petazzoni } 78106763c74SThomas Petazzoni 782150632b0SGreg Kroah-Hartman static int dove_pinctrl_remove(struct platform_device *pdev) 78306763c74SThomas Petazzoni { 78406763c74SThomas Petazzoni int ret; 78506763c74SThomas Petazzoni 78606763c74SThomas Petazzoni ret = mvebu_pinctrl_remove(pdev); 78706763c74SThomas Petazzoni if (!IS_ERR(clk)) 78806763c74SThomas Petazzoni clk_disable_unprepare(clk); 78906763c74SThomas Petazzoni return ret; 79006763c74SThomas Petazzoni } 79106763c74SThomas Petazzoni 79206763c74SThomas Petazzoni static struct platform_driver dove_pinctrl_driver = { 79306763c74SThomas Petazzoni .driver = { 79406763c74SThomas Petazzoni .name = "dove-pinctrl", 79506763c74SThomas Petazzoni .owner = THIS_MODULE, 796f2e9394dSSachin Kamat .of_match_table = dove_pinctrl_of_match, 79706763c74SThomas Petazzoni }, 79806763c74SThomas Petazzoni .probe = dove_pinctrl_probe, 799150632b0SGreg Kroah-Hartman .remove = dove_pinctrl_remove, 80006763c74SThomas Petazzoni }; 80106763c74SThomas Petazzoni 80206763c74SThomas Petazzoni module_platform_driver(dove_pinctrl_driver); 80306763c74SThomas Petazzoni 80406763c74SThomas Petazzoni MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); 80506763c74SThomas Petazzoni MODULE_DESCRIPTION("Marvell Dove pinctrl driver"); 80606763c74SThomas Petazzoni MODULE_LICENSE("GPL v2"); 807