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) 29*bbd7b275SSebastian Hesselbarth #define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C) 30*bbd7b275SSebastian Hesselbarth #define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030) 31*bbd7b275SSebastian 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 5806763c74SThomas Petazzoni static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 5906763c74SThomas Petazzoni unsigned long *config) 6006763c74SThomas Petazzoni { 6106763c74SThomas Petazzoni unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; 6206763c74SThomas Petazzoni unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; 6306763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 64*bbd7b275SSebastian Hesselbarth unsigned long func; 6506763c74SThomas Petazzoni 66*bbd7b275SSebastian Hesselbarth if (pmu & (1 << ctrl->pid)) { 67*bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 68*bbd7b275SSebastian Hesselbarth *config = (func >> shift) & MPP_MASK; 69*bbd7b275SSebastian Hesselbarth *config |= CONFIG_PMU; 70*bbd7b275SSebastian Hesselbarth } else { 71*bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 72*bbd7b275SSebastian Hesselbarth *config = (func >> shift) & MPP_MASK; 73*bbd7b275SSebastian Hesselbarth } 7406763c74SThomas Petazzoni return 0; 7506763c74SThomas Petazzoni } 7606763c74SThomas Petazzoni 7706763c74SThomas Petazzoni static int dove_pmu_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 7806763c74SThomas Petazzoni unsigned long config) 7906763c74SThomas Petazzoni { 8006763c74SThomas Petazzoni unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; 8106763c74SThomas Petazzoni unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; 8206763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 83*bbd7b275SSebastian Hesselbarth unsigned long func; 8406763c74SThomas Petazzoni 85*bbd7b275SSebastian Hesselbarth if (config & CONFIG_PMU) { 8606763c74SThomas Petazzoni writel(pmu | (1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); 87*bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 88*bbd7b275SSebastian Hesselbarth func &= ~(MPP_MASK << shift); 89*bbd7b275SSebastian Hesselbarth func |= (config & MPP_MASK) << shift; 90*bbd7b275SSebastian Hesselbarth writel(func, DOVE_PMU_SIGNAL_SELECT_0 + off); 91*bbd7b275SSebastian Hesselbarth } else { 9206763c74SThomas Petazzoni writel(pmu & ~(1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); 93*bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 94*bbd7b275SSebastian Hesselbarth func &= ~(MPP_MASK << shift); 95*bbd7b275SSebastian Hesselbarth func |= (config & MPP_MASK) << shift; 96*bbd7b275SSebastian Hesselbarth writel(func, DOVE_MPP_VIRT_BASE + off); 9706763c74SThomas Petazzoni } 9806763c74SThomas Petazzoni return 0; 9906763c74SThomas Petazzoni } 10006763c74SThomas Petazzoni 10106763c74SThomas Petazzoni static int dove_mpp4_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 10206763c74SThomas Petazzoni unsigned long *config) 10306763c74SThomas Petazzoni { 10406763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 10506763c74SThomas Petazzoni unsigned long mask; 10606763c74SThomas Petazzoni 10706763c74SThomas Petazzoni switch (ctrl->pid) { 10806763c74SThomas Petazzoni case 24: /* mpp_camera */ 10906763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 11006763c74SThomas Petazzoni break; 11106763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 11206763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 11306763c74SThomas Petazzoni break; 11406763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 11506763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 11606763c74SThomas Petazzoni break; 11706763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 11806763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 11906763c74SThomas Petazzoni break; 12006763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 12106763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 12206763c74SThomas Petazzoni break; 12306763c74SThomas Petazzoni default: 12406763c74SThomas Petazzoni return -EINVAL; 12506763c74SThomas Petazzoni } 12606763c74SThomas Petazzoni 12706763c74SThomas Petazzoni *config = ((mpp4 & mask) != 0); 12806763c74SThomas Petazzoni 12906763c74SThomas Petazzoni return 0; 13006763c74SThomas Petazzoni } 13106763c74SThomas Petazzoni 13206763c74SThomas Petazzoni static int dove_mpp4_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 13306763c74SThomas Petazzoni unsigned long config) 13406763c74SThomas Petazzoni { 13506763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 13606763c74SThomas Petazzoni unsigned long mask; 13706763c74SThomas Petazzoni 13806763c74SThomas Petazzoni switch (ctrl->pid) { 13906763c74SThomas Petazzoni case 24: /* mpp_camera */ 14006763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 14106763c74SThomas Petazzoni break; 14206763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 14306763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 14406763c74SThomas Petazzoni break; 14506763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 14606763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 14706763c74SThomas Petazzoni break; 14806763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 14906763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 15006763c74SThomas Petazzoni break; 15106763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 15206763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 15306763c74SThomas Petazzoni break; 15406763c74SThomas Petazzoni default: 15506763c74SThomas Petazzoni return -EINVAL; 15606763c74SThomas Petazzoni } 15706763c74SThomas Petazzoni 15806763c74SThomas Petazzoni mpp4 &= ~mask; 15906763c74SThomas Petazzoni if (config) 16006763c74SThomas Petazzoni mpp4 |= mask; 16106763c74SThomas Petazzoni 16206763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 16306763c74SThomas Petazzoni 16406763c74SThomas Petazzoni return 0; 16506763c74SThomas Petazzoni } 16606763c74SThomas Petazzoni 16706763c74SThomas Petazzoni static int dove_nand_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 16806763c74SThomas Petazzoni unsigned long *config) 16906763c74SThomas Petazzoni { 17006763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 17106763c74SThomas Petazzoni 17206763c74SThomas Petazzoni *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0); 17306763c74SThomas Petazzoni 17406763c74SThomas Petazzoni return 0; 17506763c74SThomas Petazzoni } 17606763c74SThomas Petazzoni 17706763c74SThomas Petazzoni static int dove_nand_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 17806763c74SThomas Petazzoni unsigned long config) 17906763c74SThomas Petazzoni { 18006763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 18106763c74SThomas Petazzoni 18206763c74SThomas Petazzoni gmpp &= ~DOVE_NAND_GPIO_EN; 18306763c74SThomas Petazzoni if (config) 18406763c74SThomas Petazzoni gmpp |= DOVE_NAND_GPIO_EN; 18506763c74SThomas Petazzoni 18606763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 18706763c74SThomas Petazzoni 18806763c74SThomas Petazzoni return 0; 18906763c74SThomas Petazzoni } 19006763c74SThomas Petazzoni 19106763c74SThomas Petazzoni static int dove_audio0_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 19206763c74SThomas Petazzoni unsigned long *config) 19306763c74SThomas Petazzoni { 19406763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 19506763c74SThomas Petazzoni 19606763c74SThomas Petazzoni *config = ((pmu & DOVE_AU0_AC97_SEL) != 0); 19706763c74SThomas Petazzoni 19806763c74SThomas Petazzoni return 0; 19906763c74SThomas Petazzoni } 20006763c74SThomas Petazzoni 20106763c74SThomas Petazzoni static int dove_audio0_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 20206763c74SThomas Petazzoni unsigned long config) 20306763c74SThomas Petazzoni { 20406763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 20506763c74SThomas Petazzoni 20606763c74SThomas Petazzoni pmu &= ~DOVE_AU0_AC97_SEL; 20706763c74SThomas Petazzoni if (config) 20806763c74SThomas Petazzoni pmu |= DOVE_AU0_AC97_SEL; 20906763c74SThomas Petazzoni writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL); 21006763c74SThomas Petazzoni 21106763c74SThomas Petazzoni return 0; 21206763c74SThomas Petazzoni } 21306763c74SThomas Petazzoni 21406763c74SThomas Petazzoni static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 21506763c74SThomas Petazzoni unsigned long *config) 21606763c74SThomas Petazzoni { 21706763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 21806763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 21906763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 22006763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 22106763c74SThomas Petazzoni 22206763c74SThomas Petazzoni *config = 0; 22306763c74SThomas Petazzoni if (mpp4 & DOVE_AU1_GPIO_SEL) 22406763c74SThomas Petazzoni *config |= BIT(3); 22506763c74SThomas Petazzoni if (sspc1 & DOVE_SSP_ON_AU1) 22606763c74SThomas Petazzoni *config |= BIT(2); 22706763c74SThomas Petazzoni if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN) 22806763c74SThomas Petazzoni *config |= BIT(1); 22906763c74SThomas Petazzoni if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) 23006763c74SThomas Petazzoni *config |= BIT(0); 23106763c74SThomas Petazzoni 23206763c74SThomas Petazzoni /* SSP/TWSI only if I2S1 not set*/ 23306763c74SThomas Petazzoni if ((*config & BIT(3)) == 0) 23406763c74SThomas Petazzoni *config &= ~(BIT(2) | BIT(0)); 23506763c74SThomas Petazzoni /* TWSI only if SPDIFO not set*/ 23606763c74SThomas Petazzoni if ((*config & BIT(1)) == 0) 23706763c74SThomas Petazzoni *config &= ~BIT(0); 23806763c74SThomas Petazzoni return 0; 23906763c74SThomas Petazzoni } 24006763c74SThomas Petazzoni 24106763c74SThomas Petazzoni static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 24206763c74SThomas Petazzoni unsigned long config) 24306763c74SThomas Petazzoni { 24406763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 24506763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 24606763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 24706763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 24806763c74SThomas Petazzoni 24963ace077SAxel Lin /* 25063ace077SAxel Lin * clear all audio1 related bits before configure 25163ace077SAxel Lin */ 25263ace077SAxel Lin gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO; 25363ace077SAxel Lin gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN; 25463ace077SAxel Lin sspc1 &= ~DOVE_SSP_ON_AU1; 25563ace077SAxel Lin mpp4 &= ~DOVE_AU1_GPIO_SEL; 25663ace077SAxel Lin 25706763c74SThomas Petazzoni if (config & BIT(0)) 25806763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_OPTION3_GPIO; 25906763c74SThomas Petazzoni if (config & BIT(1)) 26006763c74SThomas Petazzoni gmpp |= DOVE_AU1_SPDIFO_GPIO_EN; 26106763c74SThomas Petazzoni if (config & BIT(2)) 26206763c74SThomas Petazzoni sspc1 |= DOVE_SSP_ON_AU1; 26306763c74SThomas Petazzoni if (config & BIT(3)) 26406763c74SThomas Petazzoni mpp4 |= DOVE_AU1_GPIO_SEL; 26506763c74SThomas Petazzoni 26606763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 26706763c74SThomas Petazzoni writel(sspc1, DOVE_SSP_CTRL_STATUS_1); 26806763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 26906763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 27006763c74SThomas Petazzoni 27106763c74SThomas Petazzoni return 0; 27206763c74SThomas Petazzoni } 27306763c74SThomas Petazzoni 27406763c74SThomas Petazzoni /* mpp[52:57] gpio pins depend heavily on current config; 27506763c74SThomas Petazzoni * gpio_req does not try to mux in gpio capabilities to not 27606763c74SThomas Petazzoni * break other functions. If you require all mpps as gpio 27706763c74SThomas Petazzoni * enforce gpio setting by pinctrl mapping. 27806763c74SThomas Petazzoni */ 27906763c74SThomas Petazzoni static int dove_audio1_ctrl_gpio_req(struct mvebu_mpp_ctrl *ctrl, u8 pid) 28006763c74SThomas Petazzoni { 28106763c74SThomas Petazzoni unsigned long config; 28206763c74SThomas Petazzoni 28306763c74SThomas Petazzoni dove_audio1_ctrl_get(ctrl, &config); 28406763c74SThomas Petazzoni 28506763c74SThomas Petazzoni switch (config) { 28606763c74SThomas Petazzoni case 0x02: /* i2s1 : gpio[56:57] */ 28706763c74SThomas Petazzoni case 0x0e: /* ssp : gpio[56:57] */ 28806763c74SThomas Petazzoni if (pid >= 56) 28906763c74SThomas Petazzoni return 0; 29006763c74SThomas Petazzoni return -ENOTSUPP; 29106763c74SThomas Petazzoni case 0x08: /* spdifo : gpio[52:55] */ 29206763c74SThomas Petazzoni case 0x0b: /* twsi : gpio[52:55] */ 29306763c74SThomas Petazzoni if (pid <= 55) 29406763c74SThomas Petazzoni return 0; 29506763c74SThomas Petazzoni return -ENOTSUPP; 29606763c74SThomas Petazzoni case 0x0a: /* all gpio */ 29706763c74SThomas Petazzoni return 0; 29806763c74SThomas Petazzoni /* 0x00 : i2s1/spdifo : no gpio */ 29906763c74SThomas Petazzoni /* 0x0c : ssp/spdifo : no gpio */ 30006763c74SThomas Petazzoni /* 0x0f : ssp/twsi : no gpio */ 30106763c74SThomas Petazzoni } 30206763c74SThomas Petazzoni return -ENOTSUPP; 30306763c74SThomas Petazzoni } 30406763c74SThomas Petazzoni 30506763c74SThomas Petazzoni /* mpp[52:57] has gpio pins capable of in and out */ 30606763c74SThomas Petazzoni static int dove_audio1_ctrl_gpio_dir(struct mvebu_mpp_ctrl *ctrl, u8 pid, 30706763c74SThomas Petazzoni bool input) 30806763c74SThomas Petazzoni { 30906763c74SThomas Petazzoni if (pid < 52 || pid > 57) 31006763c74SThomas Petazzoni return -ENOTSUPP; 31106763c74SThomas Petazzoni return 0; 31206763c74SThomas Petazzoni } 31306763c74SThomas Petazzoni 31406763c74SThomas Petazzoni static int dove_twsi_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 31506763c74SThomas Petazzoni unsigned long *config) 31606763c74SThomas Petazzoni { 31706763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 31806763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 31906763c74SThomas Petazzoni 32006763c74SThomas Petazzoni *config = 0; 32106763c74SThomas Petazzoni if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1) 32206763c74SThomas Petazzoni *config = 1; 32306763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2) 32406763c74SThomas Petazzoni *config = 2; 32506763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3) 32606763c74SThomas Petazzoni *config = 3; 32706763c74SThomas Petazzoni 32806763c74SThomas Petazzoni return 0; 32906763c74SThomas Petazzoni } 33006763c74SThomas Petazzoni 33106763c74SThomas Petazzoni static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 33206763c74SThomas Petazzoni unsigned long config) 33306763c74SThomas Petazzoni { 33406763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 33506763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 33606763c74SThomas Petazzoni 33706763c74SThomas Petazzoni gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; 33806763c74SThomas Petazzoni gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION2); 33906763c74SThomas Petazzoni 34006763c74SThomas Petazzoni switch (config) { 34106763c74SThomas Petazzoni case 1: 34206763c74SThomas Petazzoni gcfg1 |= DOVE_TWSI_ENABLE_OPTION1; 34306763c74SThomas Petazzoni break; 34406763c74SThomas Petazzoni case 2: 34506763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION2; 34606763c74SThomas Petazzoni break; 34706763c74SThomas Petazzoni case 3: 34806763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION3; 34906763c74SThomas Petazzoni break; 35006763c74SThomas Petazzoni } 35106763c74SThomas Petazzoni 35206763c74SThomas Petazzoni writel(gcfg1, DOVE_GLOBAL_CONFIG_1); 35306763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 35406763c74SThomas Petazzoni 35506763c74SThomas Petazzoni return 0; 35606763c74SThomas Petazzoni } 35706763c74SThomas Petazzoni 35806763c74SThomas Petazzoni static struct mvebu_mpp_ctrl dove_mpp_controls[] = { 35906763c74SThomas Petazzoni MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl), 36006763c74SThomas Petazzoni MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl), 36106763c74SThomas Petazzoni MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl), 36206763c74SThomas Petazzoni MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl), 36306763c74SThomas Petazzoni MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl), 36406763c74SThomas Petazzoni MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl), 36506763c74SThomas Petazzoni MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl), 36606763c74SThomas Petazzoni MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl), 36706763c74SThomas Petazzoni MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl), 36806763c74SThomas Petazzoni MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl), 36906763c74SThomas Petazzoni MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl), 37006763c74SThomas Petazzoni MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl), 37106763c74SThomas Petazzoni MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl), 37206763c74SThomas Petazzoni MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), 37306763c74SThomas Petazzoni MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), 37406763c74SThomas Petazzoni MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), 37506763c74SThomas Petazzoni MPP_REG_CTRL(16, 23), 37606763c74SThomas Petazzoni MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), 37706763c74SThomas Petazzoni MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), 37806763c74SThomas Petazzoni MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), 37906763c74SThomas Petazzoni MPP_FUNC_GPIO_CTRL(52, 57, "mpp_audio1", dove_audio1_ctrl), 38006763c74SThomas Petazzoni MPP_FUNC_CTRL(58, 61, "mpp_spi0", dove_mpp4_ctrl), 38106763c74SThomas Petazzoni MPP_FUNC_CTRL(62, 63, "mpp_uart1", dove_mpp4_ctrl), 38206763c74SThomas Petazzoni MPP_FUNC_CTRL(64, 71, "mpp_nand", dove_nand_ctrl), 38306763c74SThomas Petazzoni MPP_FUNC_CTRL(72, 72, "audio0", dove_audio0_ctrl), 38406763c74SThomas Petazzoni MPP_FUNC_CTRL(73, 73, "twsi", dove_twsi_ctrl), 38506763c74SThomas Petazzoni }; 38606763c74SThomas Petazzoni 38706763c74SThomas Petazzoni static struct mvebu_mpp_mode dove_mpp_modes[] = { 38806763c74SThomas Petazzoni MPP_MODE(0, 38906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 39006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 39106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 39206763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd0", "pwm"), 393*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 394*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 395*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 396*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 397*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 398*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 399*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 400*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 401*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 402*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 403*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 404*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 40506763c74SThomas Petazzoni MPP_MODE(1, 40606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 40706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 40806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 40906763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd1", "pwm"), 410*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 411*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 412*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 413*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 414*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 415*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 416*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 417*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 418*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 419*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 420*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 421*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 42206763c74SThomas Petazzoni MPP_MODE(2, 42306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 42406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 42506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 42606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 42706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "rts"), 428*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 429*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 430*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 431*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 432*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 433*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 434*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 435*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 436*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 437*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 438*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 439*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 44006763c74SThomas Petazzoni MPP_MODE(3, 44106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 44206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 44306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 44406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 44506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "cts"), 44606763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd-spi", "cs1"), 447*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 448*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 449*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 450*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 451*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 452*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 453*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 454*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 455*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 456*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 457*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 458*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 45906763c74SThomas Petazzoni MPP_MODE(4, 46006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 46106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 46206763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 46306763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "miso"), 464*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 465*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 466*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 467*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 468*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 469*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 470*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 471*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 472*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 473*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 474*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 475*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 47606763c74SThomas Petazzoni MPP_MODE(5, 47706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 47806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 47906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 48006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "cs"), 481*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 482*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 483*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 484*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 485*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 486*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 487*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 488*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 489*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 490*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 491*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 492*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 49306763c74SThomas Petazzoni MPP_MODE(6, 49406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 49506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 49606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 49706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "mosi"), 498*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 499*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 500*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 501*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 502*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 503*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 504*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 505*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 506*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 507*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 508*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 509*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 51006763c74SThomas Petazzoni MPP_MODE(7, 51106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 51206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 51306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 51406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "sck"), 515*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 516*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 517*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 518*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 519*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 520*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 521*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 522*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 523*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 524*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 525*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 526*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 52706763c74SThomas Petazzoni MPP_MODE(8, 52806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 52906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "watchdog", "rstout"), 530*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 531*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 532*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 533*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 534*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 535*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 536*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 537*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 538*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 539*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 540*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 541*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 54206763c74SThomas Petazzoni MPP_MODE(9, 54306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 54406763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex1", "clkreq"), 545*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 546*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 547*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 548*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 549*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 550*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 551*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 552*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 553*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 554*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 555*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 556*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 55706763c74SThomas Petazzoni MPP_MODE(10, 55806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 55906763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sclk"), 560*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 561*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 562*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 563*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 564*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 565*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 566*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 567*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 568*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 569*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 570*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 571*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 57206763c74SThomas Petazzoni MPP_MODE(11, 57306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 57406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 57506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "sata-1", "act"), 57606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 57706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 57806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex0", "clkreq"), 579*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 580*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 581*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 582*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 583*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 584*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 585*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 586*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 587*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 588*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 589*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 590*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 59106763c74SThomas Petazzoni MPP_MODE(12, 59206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 59306763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 59406763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 59506763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio0", "extclk"), 59606763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "cd"), 597*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 598*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 599*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 600*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 601*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 602*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 603*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 604*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 605*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 606*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 607*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 608*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 60906763c74SThomas Petazzoni MPP_MODE(13, 61006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 61106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 61206763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio1", "extclk"), 61306763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "wp"), 61406763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "extclk"), 615*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 616*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 617*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 618*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 619*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 620*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 621*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 622*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 623*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 624*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 625*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 626*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 62706763c74SThomas Petazzoni MPP_MODE(14, 62806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 62906763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 63006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "buspwr"), 63106763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "rxd"), 632*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 633*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 634*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 635*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 636*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 637*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 638*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 639*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 640*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 641*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 642*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 643*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 64406763c74SThomas Petazzoni MPP_MODE(15, 64506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 64606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 64706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 64806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sfrm"), 649*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 650*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 651*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 652*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 653*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 654*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 655*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 656*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 657*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 658*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 659*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 660*bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 66106763c74SThomas Petazzoni MPP_MODE(16, 66206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 66306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 66406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 66506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd-spi", "cs1"), 66606763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi1")), 66706763c74SThomas Petazzoni MPP_MODE(17, 66806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 66906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97-1", "sysclko"), 67006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 67106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 67206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sda"), 67306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi2")), 67406763c74SThomas Petazzoni MPP_MODE(18, 67506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 67606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 67706763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 67806763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd0", "pwm"), 67906763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi3")), 68006763c74SThomas Petazzoni MPP_MODE(19, 68106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 68306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 68406763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sck")), 68506763c74SThomas Petazzoni MPP_MODE(20, 68606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", "sysclko"), 68806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "miso"), 68906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 69006763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "cd"), 69106763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "miso")), 69206763c74SThomas Petazzoni MPP_MODE(21, 69306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 69406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "rts"), 69506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "cs0"), 69606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 69706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sfrm"), 69806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "wp"), 69906763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "cs")), 70006763c74SThomas Petazzoni MPP_MODE(22, 70106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 70206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "cts"), 70306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "mosi"), 70406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 70506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "txd"), 70606763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "buspwr"), 70706763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "mosi")), 70806763c74SThomas Petazzoni MPP_MODE(23, 70906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 71006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "sck"), 71106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 71206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sclk"), 71306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "ledctrl"), 71406763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "sck")), 71506763c74SThomas Petazzoni MPP_MODE(24, 71606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "camera", NULL), 71706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 71806763c74SThomas Petazzoni MPP_MODE(40, 71906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio0", NULL), 72006763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 72106763c74SThomas Petazzoni MPP_MODE(46, 72206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio1", NULL), 72306763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 72406763c74SThomas Petazzoni MPP_MODE(52, 72506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s1/spdifo", NULL), 72606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "i2s1", NULL), 72706763c74SThomas Petazzoni MPP_FUNCTION(0x08, "spdifo", NULL), 72806763c74SThomas Petazzoni MPP_FUNCTION(0x0a, "gpio", NULL), 72906763c74SThomas Petazzoni MPP_FUNCTION(0x0b, "twsi", NULL), 73006763c74SThomas Petazzoni MPP_FUNCTION(0x0c, "ssp/spdifo", NULL), 73106763c74SThomas Petazzoni MPP_FUNCTION(0x0e, "ssp", NULL), 73206763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "ssp/twsi", NULL)), 73306763c74SThomas Petazzoni MPP_MODE(58, 73406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "spi0", NULL), 73506763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 73606763c74SThomas Petazzoni MPP_MODE(62, 73706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "uart1", NULL), 73806763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 73906763c74SThomas Petazzoni MPP_MODE(64, 74006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "nand", NULL), 74106763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpo", NULL)), 74206763c74SThomas Petazzoni MPP_MODE(72, 74306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s", NULL), 74406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", NULL)), 74506763c74SThomas Petazzoni MPP_MODE(73, 74606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "twsi-none", NULL), 74706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "twsi-opt1", NULL), 74806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "twsi-opt2", NULL), 74906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "twsi-opt3", NULL)), 75006763c74SThomas Petazzoni }; 75106763c74SThomas Petazzoni 75206763c74SThomas Petazzoni static struct pinctrl_gpio_range dove_mpp_gpio_ranges[] = { 75306763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 75406763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 75506763c74SThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 8), 75606763c74SThomas Petazzoni }; 75706763c74SThomas Petazzoni 75806763c74SThomas Petazzoni static struct mvebu_pinctrl_soc_info dove_pinctrl_info = { 75906763c74SThomas Petazzoni .controls = dove_mpp_controls, 76006763c74SThomas Petazzoni .ncontrols = ARRAY_SIZE(dove_mpp_controls), 76106763c74SThomas Petazzoni .modes = dove_mpp_modes, 76206763c74SThomas Petazzoni .nmodes = ARRAY_SIZE(dove_mpp_modes), 76306763c74SThomas Petazzoni .gpioranges = dove_mpp_gpio_ranges, 76406763c74SThomas Petazzoni .ngpioranges = ARRAY_SIZE(dove_mpp_gpio_ranges), 76506763c74SThomas Petazzoni .variant = 0, 76606763c74SThomas Petazzoni }; 76706763c74SThomas Petazzoni 76806763c74SThomas Petazzoni static struct clk *clk; 76906763c74SThomas Petazzoni 770150632b0SGreg Kroah-Hartman static struct of_device_id dove_pinctrl_of_match[] = { 77106763c74SThomas Petazzoni { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info }, 77206763c74SThomas Petazzoni { } 77306763c74SThomas Petazzoni }; 77406763c74SThomas Petazzoni 775150632b0SGreg Kroah-Hartman static int dove_pinctrl_probe(struct platform_device *pdev) 77606763c74SThomas Petazzoni { 77706763c74SThomas Petazzoni const struct of_device_id *match = 77806763c74SThomas Petazzoni of_match_device(dove_pinctrl_of_match, &pdev->dev); 77916fa36beSAndrew Lunn pdev->dev.platform_data = (void *)match->data; 78006763c74SThomas Petazzoni 78106763c74SThomas Petazzoni /* 78206763c74SThomas Petazzoni * General MPP Configuration Register is part of pdma registers. 78306763c74SThomas Petazzoni * grab clk to make sure it is ticking. 78406763c74SThomas Petazzoni */ 78506763c74SThomas Petazzoni clk = devm_clk_get(&pdev->dev, NULL); 786ba607b62SSebastian Hesselbarth if (IS_ERR(clk)) { 787ba607b62SSebastian Hesselbarth dev_err(&pdev->dev, "Unable to get pdma clock"); 788ba607b62SSebastian Hesselbarth return PTR_RET(clk); 789ba607b62SSebastian Hesselbarth } 79006763c74SThomas Petazzoni clk_prepare_enable(clk); 79106763c74SThomas Petazzoni 79206763c74SThomas Petazzoni return mvebu_pinctrl_probe(pdev); 79306763c74SThomas Petazzoni } 79406763c74SThomas Petazzoni 795150632b0SGreg Kroah-Hartman static int dove_pinctrl_remove(struct platform_device *pdev) 79606763c74SThomas Petazzoni { 79706763c74SThomas Petazzoni int ret; 79806763c74SThomas Petazzoni 79906763c74SThomas Petazzoni ret = mvebu_pinctrl_remove(pdev); 80006763c74SThomas Petazzoni if (!IS_ERR(clk)) 80106763c74SThomas Petazzoni clk_disable_unprepare(clk); 80206763c74SThomas Petazzoni return ret; 80306763c74SThomas Petazzoni } 80406763c74SThomas Petazzoni 80506763c74SThomas Petazzoni static struct platform_driver dove_pinctrl_driver = { 80606763c74SThomas Petazzoni .driver = { 80706763c74SThomas Petazzoni .name = "dove-pinctrl", 80806763c74SThomas Petazzoni .owner = THIS_MODULE, 80906763c74SThomas Petazzoni .of_match_table = of_match_ptr(dove_pinctrl_of_match), 81006763c74SThomas Petazzoni }, 81106763c74SThomas Petazzoni .probe = dove_pinctrl_probe, 812150632b0SGreg Kroah-Hartman .remove = dove_pinctrl_remove, 81306763c74SThomas Petazzoni }; 81406763c74SThomas Petazzoni 81506763c74SThomas Petazzoni module_platform_driver(dove_pinctrl_driver); 81606763c74SThomas Petazzoni 81706763c74SThomas Petazzoni MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); 81806763c74SThomas Petazzoni MODULE_DESCRIPTION("Marvell Dove pinctrl driver"); 81906763c74SThomas Petazzoni MODULE_LICENSE("GPL v2"); 820