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 CONFIG_PMU BIT(4) 5306763c74SThomas Petazzoni 5417bdec67SSebastian Hesselbarth static void __iomem *mpp_base; 5517bdec67SSebastian Hesselbarth 5617bdec67SSebastian Hesselbarth static int dove_mpp_ctrl_get(unsigned pid, unsigned long *config) 5717bdec67SSebastian Hesselbarth { 5817bdec67SSebastian Hesselbarth return default_mpp_ctrl_get(mpp_base, pid, config); 5917bdec67SSebastian Hesselbarth } 6017bdec67SSebastian Hesselbarth 6117bdec67SSebastian Hesselbarth static int dove_mpp_ctrl_set(unsigned pid, unsigned long config) 6217bdec67SSebastian Hesselbarth { 6317bdec67SSebastian Hesselbarth return default_mpp_ctrl_set(mpp_base, pid, config); 6417bdec67SSebastian Hesselbarth } 6517bdec67SSebastian Hesselbarth 662035d39dSSebastian Hesselbarth static int dove_pmu_mpp_ctrl_get(unsigned pid, unsigned long *config) 6706763c74SThomas Petazzoni { 6817bdec67SSebastian Hesselbarth unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 6917bdec67SSebastian Hesselbarth unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 7006763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 71bbd7b275SSebastian Hesselbarth unsigned long func; 7206763c74SThomas Petazzoni 732035d39dSSebastian Hesselbarth if (pmu & (1 << pid)) { 74bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 7517bdec67SSebastian Hesselbarth *config = (func >> shift) & MVEBU_MPP_MASK; 76bbd7b275SSebastian Hesselbarth *config |= CONFIG_PMU; 77bbd7b275SSebastian Hesselbarth } else { 78bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 7917bdec67SSebastian Hesselbarth *config = (func >> shift) & MVEBU_MPP_MASK; 80bbd7b275SSebastian Hesselbarth } 8106763c74SThomas Petazzoni return 0; 8206763c74SThomas Petazzoni } 8306763c74SThomas Petazzoni 842035d39dSSebastian Hesselbarth static int dove_pmu_mpp_ctrl_set(unsigned pid, unsigned long config) 8506763c74SThomas Petazzoni { 8617bdec67SSebastian Hesselbarth unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 8717bdec67SSebastian Hesselbarth unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 8806763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 89bbd7b275SSebastian Hesselbarth unsigned long func; 9006763c74SThomas Petazzoni 91bbd7b275SSebastian Hesselbarth if (config & CONFIG_PMU) { 922035d39dSSebastian Hesselbarth writel(pmu | (1 << pid), DOVE_PMU_MPP_GENERAL_CTRL); 93bbd7b275SSebastian Hesselbarth func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 9417bdec67SSebastian Hesselbarth func &= ~(MVEBU_MPP_MASK << shift); 9517bdec67SSebastian Hesselbarth func |= (config & MVEBU_MPP_MASK) << shift; 96bbd7b275SSebastian Hesselbarth writel(func, DOVE_PMU_SIGNAL_SELECT_0 + off); 97bbd7b275SSebastian Hesselbarth } else { 982035d39dSSebastian Hesselbarth writel(pmu & ~(1 << pid), DOVE_PMU_MPP_GENERAL_CTRL); 99bbd7b275SSebastian Hesselbarth func = readl(DOVE_MPP_VIRT_BASE + off); 10017bdec67SSebastian Hesselbarth func &= ~(MVEBU_MPP_MASK << shift); 10117bdec67SSebastian Hesselbarth func |= (config & MVEBU_MPP_MASK) << shift; 102bbd7b275SSebastian Hesselbarth writel(func, DOVE_MPP_VIRT_BASE + off); 10306763c74SThomas Petazzoni } 10406763c74SThomas Petazzoni return 0; 10506763c74SThomas Petazzoni } 10606763c74SThomas Petazzoni 1072035d39dSSebastian Hesselbarth static int dove_mpp4_ctrl_get(unsigned pid, unsigned long *config) 10806763c74SThomas Petazzoni { 10906763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 11006763c74SThomas Petazzoni unsigned long mask; 11106763c74SThomas Petazzoni 1122035d39dSSebastian Hesselbarth switch (pid) { 11306763c74SThomas Petazzoni case 24: /* mpp_camera */ 11406763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 11506763c74SThomas Petazzoni break; 11606763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 11706763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 11806763c74SThomas Petazzoni break; 11906763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 12006763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 12106763c74SThomas Petazzoni break; 12206763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 12306763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 12406763c74SThomas Petazzoni break; 12506763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 12606763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 12706763c74SThomas Petazzoni break; 12806763c74SThomas Petazzoni default: 12906763c74SThomas Petazzoni return -EINVAL; 13006763c74SThomas Petazzoni } 13106763c74SThomas Petazzoni 13206763c74SThomas Petazzoni *config = ((mpp4 & mask) != 0); 13306763c74SThomas Petazzoni 13406763c74SThomas Petazzoni return 0; 13506763c74SThomas Petazzoni } 13606763c74SThomas Petazzoni 1372035d39dSSebastian Hesselbarth static int dove_mpp4_ctrl_set(unsigned pid, unsigned long config) 13806763c74SThomas Petazzoni { 13906763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 14006763c74SThomas Petazzoni unsigned long mask; 14106763c74SThomas Petazzoni 1422035d39dSSebastian Hesselbarth switch (pid) { 14306763c74SThomas Petazzoni case 24: /* mpp_camera */ 14406763c74SThomas Petazzoni mask = DOVE_CAM_GPIO_SEL; 14506763c74SThomas Petazzoni break; 14606763c74SThomas Petazzoni case 40: /* mpp_sdio0 */ 14706763c74SThomas Petazzoni mask = DOVE_SD0_GPIO_SEL; 14806763c74SThomas Petazzoni break; 14906763c74SThomas Petazzoni case 46: /* mpp_sdio1 */ 15006763c74SThomas Petazzoni mask = DOVE_SD1_GPIO_SEL; 15106763c74SThomas Petazzoni break; 15206763c74SThomas Petazzoni case 58: /* mpp_spi0 */ 15306763c74SThomas Petazzoni mask = DOVE_SPI_GPIO_SEL; 15406763c74SThomas Petazzoni break; 15506763c74SThomas Petazzoni case 62: /* mpp_uart1 */ 15606763c74SThomas Petazzoni mask = DOVE_UART1_GPIO_SEL; 15706763c74SThomas Petazzoni break; 15806763c74SThomas Petazzoni default: 15906763c74SThomas Petazzoni return -EINVAL; 16006763c74SThomas Petazzoni } 16106763c74SThomas Petazzoni 16206763c74SThomas Petazzoni mpp4 &= ~mask; 16306763c74SThomas Petazzoni if (config) 16406763c74SThomas Petazzoni mpp4 |= mask; 16506763c74SThomas Petazzoni 16606763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 16706763c74SThomas Petazzoni 16806763c74SThomas Petazzoni return 0; 16906763c74SThomas Petazzoni } 17006763c74SThomas Petazzoni 1712035d39dSSebastian Hesselbarth static int dove_nand_ctrl_get(unsigned pid, unsigned long *config) 17206763c74SThomas Petazzoni { 17306763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 17406763c74SThomas Petazzoni 17506763c74SThomas Petazzoni *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0); 17606763c74SThomas Petazzoni 17706763c74SThomas Petazzoni return 0; 17806763c74SThomas Petazzoni } 17906763c74SThomas Petazzoni 1802035d39dSSebastian Hesselbarth static int dove_nand_ctrl_set(unsigned pid, unsigned long config) 18106763c74SThomas Petazzoni { 18206763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 18306763c74SThomas Petazzoni 18406763c74SThomas Petazzoni gmpp &= ~DOVE_NAND_GPIO_EN; 18506763c74SThomas Petazzoni if (config) 18606763c74SThomas Petazzoni gmpp |= DOVE_NAND_GPIO_EN; 18706763c74SThomas Petazzoni 18806763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 18906763c74SThomas Petazzoni 19006763c74SThomas Petazzoni return 0; 19106763c74SThomas Petazzoni } 19206763c74SThomas Petazzoni 1932035d39dSSebastian Hesselbarth static int dove_audio0_ctrl_get(unsigned pid, unsigned long *config) 19406763c74SThomas Petazzoni { 19506763c74SThomas Petazzoni unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 19606763c74SThomas Petazzoni 19706763c74SThomas Petazzoni *config = ((pmu & DOVE_AU0_AC97_SEL) != 0); 19806763c74SThomas Petazzoni 19906763c74SThomas Petazzoni return 0; 20006763c74SThomas Petazzoni } 20106763c74SThomas Petazzoni 2022035d39dSSebastian Hesselbarth static int dove_audio0_ctrl_set(unsigned pid, 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 2142035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_get(unsigned pid, unsigned long *config) 21506763c74SThomas Petazzoni { 21606763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 21706763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 21806763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 21906763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 22006763c74SThomas Petazzoni 22106763c74SThomas Petazzoni *config = 0; 22206763c74SThomas Petazzoni if (mpp4 & DOVE_AU1_GPIO_SEL) 22306763c74SThomas Petazzoni *config |= BIT(3); 22406763c74SThomas Petazzoni if (sspc1 & DOVE_SSP_ON_AU1) 22506763c74SThomas Petazzoni *config |= BIT(2); 22606763c74SThomas Petazzoni if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN) 22706763c74SThomas Petazzoni *config |= BIT(1); 22806763c74SThomas Petazzoni if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) 22906763c74SThomas Petazzoni *config |= BIT(0); 23006763c74SThomas Petazzoni 23106763c74SThomas Petazzoni /* SSP/TWSI only if I2S1 not set*/ 23206763c74SThomas Petazzoni if ((*config & BIT(3)) == 0) 23306763c74SThomas Petazzoni *config &= ~(BIT(2) | BIT(0)); 23406763c74SThomas Petazzoni /* TWSI only if SPDIFO not set*/ 23506763c74SThomas Petazzoni if ((*config & BIT(1)) == 0) 23606763c74SThomas Petazzoni *config &= ~BIT(0); 23706763c74SThomas Petazzoni return 0; 23806763c74SThomas Petazzoni } 23906763c74SThomas Petazzoni 2402035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_set(unsigned pid, unsigned long config) 24106763c74SThomas Petazzoni { 24206763c74SThomas Petazzoni unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 24306763c74SThomas Petazzoni unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 24406763c74SThomas Petazzoni unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 24506763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 24606763c74SThomas Petazzoni 24763ace077SAxel Lin /* 24863ace077SAxel Lin * clear all audio1 related bits before configure 24963ace077SAxel Lin */ 25063ace077SAxel Lin gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO; 25163ace077SAxel Lin gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN; 25263ace077SAxel Lin sspc1 &= ~DOVE_SSP_ON_AU1; 25363ace077SAxel Lin mpp4 &= ~DOVE_AU1_GPIO_SEL; 25463ace077SAxel Lin 25506763c74SThomas Petazzoni if (config & BIT(0)) 25606763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_OPTION3_GPIO; 25706763c74SThomas Petazzoni if (config & BIT(1)) 25806763c74SThomas Petazzoni gmpp |= DOVE_AU1_SPDIFO_GPIO_EN; 25906763c74SThomas Petazzoni if (config & BIT(2)) 26006763c74SThomas Petazzoni sspc1 |= DOVE_SSP_ON_AU1; 26106763c74SThomas Petazzoni if (config & BIT(3)) 26206763c74SThomas Petazzoni mpp4 |= DOVE_AU1_GPIO_SEL; 26306763c74SThomas Petazzoni 26406763c74SThomas Petazzoni writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 26506763c74SThomas Petazzoni writel(sspc1, DOVE_SSP_CTRL_STATUS_1); 26606763c74SThomas Petazzoni writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 26706763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 26806763c74SThomas Petazzoni 26906763c74SThomas Petazzoni return 0; 27006763c74SThomas Petazzoni } 27106763c74SThomas Petazzoni 27206763c74SThomas Petazzoni /* mpp[52:57] gpio pins depend heavily on current config; 27306763c74SThomas Petazzoni * gpio_req does not try to mux in gpio capabilities to not 27406763c74SThomas Petazzoni * break other functions. If you require all mpps as gpio 27506763c74SThomas Petazzoni * enforce gpio setting by pinctrl mapping. 27606763c74SThomas Petazzoni */ 2772035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_gpio_req(unsigned pid) 27806763c74SThomas Petazzoni { 27906763c74SThomas Petazzoni unsigned long config; 28006763c74SThomas Petazzoni 2812035d39dSSebastian Hesselbarth dove_audio1_ctrl_get(pid, &config); 28206763c74SThomas Petazzoni 28306763c74SThomas Petazzoni switch (config) { 28406763c74SThomas Petazzoni case 0x02: /* i2s1 : gpio[56:57] */ 28506763c74SThomas Petazzoni case 0x0e: /* ssp : gpio[56:57] */ 28606763c74SThomas Petazzoni if (pid >= 56) 28706763c74SThomas Petazzoni return 0; 28806763c74SThomas Petazzoni return -ENOTSUPP; 28906763c74SThomas Petazzoni case 0x08: /* spdifo : gpio[52:55] */ 29006763c74SThomas Petazzoni case 0x0b: /* twsi : gpio[52:55] */ 29106763c74SThomas Petazzoni if (pid <= 55) 29206763c74SThomas Petazzoni return 0; 29306763c74SThomas Petazzoni return -ENOTSUPP; 29406763c74SThomas Petazzoni case 0x0a: /* all gpio */ 29506763c74SThomas Petazzoni return 0; 29606763c74SThomas Petazzoni /* 0x00 : i2s1/spdifo : no gpio */ 29706763c74SThomas Petazzoni /* 0x0c : ssp/spdifo : no gpio */ 29806763c74SThomas Petazzoni /* 0x0f : ssp/twsi : no gpio */ 29906763c74SThomas Petazzoni } 30006763c74SThomas Petazzoni return -ENOTSUPP; 30106763c74SThomas Petazzoni } 30206763c74SThomas Petazzoni 30306763c74SThomas Petazzoni /* mpp[52:57] has gpio pins capable of in and out */ 3042035d39dSSebastian Hesselbarth static int dove_audio1_ctrl_gpio_dir(unsigned pid, bool input) 30506763c74SThomas Petazzoni { 30606763c74SThomas Petazzoni if (pid < 52 || pid > 57) 30706763c74SThomas Petazzoni return -ENOTSUPP; 30806763c74SThomas Petazzoni return 0; 30906763c74SThomas Petazzoni } 31006763c74SThomas Petazzoni 3112035d39dSSebastian Hesselbarth static int dove_twsi_ctrl_get(unsigned pid, unsigned long *config) 31206763c74SThomas Petazzoni { 31306763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 31406763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 31506763c74SThomas Petazzoni 31606763c74SThomas Petazzoni *config = 0; 31706763c74SThomas Petazzoni if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1) 31806763c74SThomas Petazzoni *config = 1; 31906763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2) 32006763c74SThomas Petazzoni *config = 2; 32106763c74SThomas Petazzoni else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3) 32206763c74SThomas Petazzoni *config = 3; 32306763c74SThomas Petazzoni 32406763c74SThomas Petazzoni return 0; 32506763c74SThomas Petazzoni } 32606763c74SThomas Petazzoni 3272035d39dSSebastian Hesselbarth static int dove_twsi_ctrl_set(unsigned pid, unsigned long config) 32806763c74SThomas Petazzoni { 32906763c74SThomas Petazzoni unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 33006763c74SThomas Petazzoni unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 33106763c74SThomas Petazzoni 33206763c74SThomas Petazzoni gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; 3336d0a4ed2SRoel Kluin gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION3); 33406763c74SThomas Petazzoni 33506763c74SThomas Petazzoni switch (config) { 33606763c74SThomas Petazzoni case 1: 33706763c74SThomas Petazzoni gcfg1 |= DOVE_TWSI_ENABLE_OPTION1; 33806763c74SThomas Petazzoni break; 33906763c74SThomas Petazzoni case 2: 34006763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION2; 34106763c74SThomas Petazzoni break; 34206763c74SThomas Petazzoni case 3: 34306763c74SThomas Petazzoni gcfg2 |= DOVE_TWSI_ENABLE_OPTION3; 34406763c74SThomas Petazzoni break; 34506763c74SThomas Petazzoni } 34606763c74SThomas Petazzoni 34706763c74SThomas Petazzoni writel(gcfg1, DOVE_GLOBAL_CONFIG_1); 34806763c74SThomas Petazzoni writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 34906763c74SThomas Petazzoni 35006763c74SThomas Petazzoni return 0; 35106763c74SThomas Petazzoni } 35206763c74SThomas Petazzoni 35306763c74SThomas Petazzoni static struct mvebu_mpp_ctrl dove_mpp_controls[] = { 35406763c74SThomas Petazzoni MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl), 35506763c74SThomas Petazzoni MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl), 35606763c74SThomas Petazzoni MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl), 35706763c74SThomas Petazzoni MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl), 35806763c74SThomas Petazzoni MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl), 35906763c74SThomas Petazzoni MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl), 36006763c74SThomas Petazzoni MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl), 36106763c74SThomas Petazzoni MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl), 36206763c74SThomas Petazzoni MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl), 36306763c74SThomas Petazzoni MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl), 36406763c74SThomas Petazzoni MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl), 36506763c74SThomas Petazzoni MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl), 36606763c74SThomas Petazzoni MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl), 36706763c74SThomas Petazzoni MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), 36806763c74SThomas Petazzoni MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), 36906763c74SThomas Petazzoni MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), 370*1217b790SSebastian Hesselbarth MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), 37106763c74SThomas Petazzoni MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), 37206763c74SThomas Petazzoni MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), 37306763c74SThomas Petazzoni MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), 37406763c74SThomas Petazzoni MPP_FUNC_GPIO_CTRL(52, 57, "mpp_audio1", dove_audio1_ctrl), 37506763c74SThomas Petazzoni MPP_FUNC_CTRL(58, 61, "mpp_spi0", dove_mpp4_ctrl), 37606763c74SThomas Petazzoni MPP_FUNC_CTRL(62, 63, "mpp_uart1", dove_mpp4_ctrl), 37706763c74SThomas Petazzoni MPP_FUNC_CTRL(64, 71, "mpp_nand", dove_nand_ctrl), 37806763c74SThomas Petazzoni MPP_FUNC_CTRL(72, 72, "audio0", dove_audio0_ctrl), 37906763c74SThomas Petazzoni MPP_FUNC_CTRL(73, 73, "twsi", dove_twsi_ctrl), 38006763c74SThomas Petazzoni }; 38106763c74SThomas Petazzoni 38206763c74SThomas Petazzoni static struct mvebu_mpp_mode dove_mpp_modes[] = { 38306763c74SThomas Petazzoni MPP_MODE(0, 38406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 38506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 38606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 38706763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd0", "pwm"), 388bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 389bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 390bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 391bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 392bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 393bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 394bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 395bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 396bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 397bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 398bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 399bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 40006763c74SThomas Petazzoni MPP_MODE(1, 40106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 40206763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 40306763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 40406763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd1", "pwm"), 405bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 406bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 407bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 408bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 409bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 410bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 411bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 412bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 413bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 414bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 415bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 416bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 41706763c74SThomas Petazzoni MPP_MODE(2, 41806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 41906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 42006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 42106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 42206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "rts"), 423bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 424bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 425bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 426bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 427bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 428bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 429bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 430bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 431bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 432bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 433bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 434bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 43506763c74SThomas Petazzoni MPP_MODE(3, 43606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 43706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 43806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 43906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 44006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "uart1", "cts"), 44106763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "lcd-spi", "cs1"), 442bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 443bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 444bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 445bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 446bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 447bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 448bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 449bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 450bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 451bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 452bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 453bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 45406763c74SThomas Petazzoni MPP_MODE(4, 45506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 45606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 45706763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 45806763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "miso"), 459bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 460bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 461bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 462bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 463bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 464bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 465bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 466bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 467bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 468bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 469bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 470bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 47106763c74SThomas Petazzoni MPP_MODE(5, 47206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 47306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 47406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 47506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "cs"), 476bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 477bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 478bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 479bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 480bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 481bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 482bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 483bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 484bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 485bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 486bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 487bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 48806763c74SThomas Petazzoni MPP_MODE(6, 48906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 49006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 49106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 49206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "mosi"), 493bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 494bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 495bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 496bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 497bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 498bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 499bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 500bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 501bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 502bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 503bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 504bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 50506763c74SThomas Petazzoni MPP_MODE(7, 50606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 50706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 50806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 50906763c74SThomas Petazzoni MPP_FUNCTION(0x04, "spi1", "sck"), 510bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 511bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 512bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 513bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 514bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 515bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 516bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL), 517bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 518bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 519bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 520bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 521bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 52206763c74SThomas Petazzoni MPP_MODE(8, 52306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 52406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "watchdog", "rstout"), 525bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 526bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 527bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 528bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 529bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 530bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 531bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 532bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 533bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 534bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 535bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 536bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 53706763c74SThomas Petazzoni MPP_MODE(9, 53806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 53906763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex1", "clkreq"), 540bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 541bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 542bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 543bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 544bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 545bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 546bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 547bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 548bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 549bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 550bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 551bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 55206763c74SThomas Petazzoni MPP_MODE(10, 55306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 55406763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sclk"), 555bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 556bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 557bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 558bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 559bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 560bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 561bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 562bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 563bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 564bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 565bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 566bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 56706763c74SThomas Petazzoni MPP_MODE(11, 56806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 56906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "prsnt"), 57006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "sata-1", "act"), 57106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 57206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 57306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "pex0", "clkreq"), 574bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 575bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 576bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 577bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 578bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 579bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 580bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 581bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 582bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 583bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 584bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 585bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 58606763c74SThomas Petazzoni MPP_MODE(12, 58706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 58806763c74SThomas Petazzoni MPP_FUNCTION(0x01, "sata", "act"), 58906763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rts"), 59006763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio0", "extclk"), 59106763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "cd"), 592bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 593bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 594bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 595bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 596bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 597bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 598bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 599bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 600bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 601bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 602bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 603bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 60406763c74SThomas Petazzoni MPP_MODE(13, 60506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 60606763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "cts"), 60706763c74SThomas Petazzoni MPP_FUNCTION(0x03, "audio1", "extclk"), 60806763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "wp"), 60906763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "extclk"), 610bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 611bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 612bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 613bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 614bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 615bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 616bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 617bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 618bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 619bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 620bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 621bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 62206763c74SThomas Petazzoni MPP_MODE(14, 62306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 62406763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "txd"), 62506763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "buspwr"), 62606763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "rxd"), 627bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 628bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 629bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 630bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 631bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 632bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 633bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 634bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 635bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 636bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 637bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 638bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 63906763c74SThomas Petazzoni MPP_MODE(15, 64006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 64106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart2", "rxd"), 64206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "sdio1", "ledctrl"), 64306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ssp", "sfrm"), 644bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL), 645bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL), 646bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL), 647bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"), 648bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL), 649bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL), 650bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL), 651bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL), 652bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL), 653bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL), 654bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL), 655bbd7b275SSebastian Hesselbarth MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)), 65606763c74SThomas Petazzoni MPP_MODE(16, 65706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 65806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rts"), 65906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "cd"), 66006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd-spi", "cs1"), 66106763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi1")), 66206763c74SThomas Petazzoni MPP_MODE(17, 66306763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 66406763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97-1", "sysclko"), 66506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "cts"), 66606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "wp"), 66706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sda"), 66806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi2")), 66906763c74SThomas Petazzoni MPP_MODE(18, 67006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 67106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "txd"), 67206763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "buspwr"), 67306763c74SThomas Petazzoni MPP_FUNCTION(0x04, "lcd0", "pwm"), 67406763c74SThomas Petazzoni MPP_FUNCTION(0x05, "ac97", "sdi3")), 67506763c74SThomas Petazzoni MPP_MODE(19, 67606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 67706763c74SThomas Petazzoni MPP_FUNCTION(0x02, "uart3", "rxd"), 67806763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio0", "ledctrl"), 67906763c74SThomas Petazzoni MPP_FUNCTION(0x04, "twsi", "sck")), 68006763c74SThomas Petazzoni MPP_MODE(20, 68106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", "sysclko"), 68306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "miso"), 68406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "cd"), 68506763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "cd"), 68606763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "miso")), 68706763c74SThomas Petazzoni MPP_MODE(21, 68806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 68906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "rts"), 69006763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "cs0"), 69106763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "wp"), 69206763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sfrm"), 69306763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "wp"), 69406763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "cs")), 69506763c74SThomas Petazzoni MPP_MODE(22, 69606763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 69706763c74SThomas Petazzoni MPP_FUNCTION(0x01, "uart1", "cts"), 69806763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "mosi"), 69906763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "buspwr"), 70006763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "txd"), 70106763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "buspwr"), 70206763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "mosi")), 70306763c74SThomas Petazzoni MPP_MODE(23, 70406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "gpio", NULL), 70506763c74SThomas Petazzoni MPP_FUNCTION(0x02, "lcd-spi", "sck"), 70606763c74SThomas Petazzoni MPP_FUNCTION(0x03, "sdio1", "ledctrl"), 70706763c74SThomas Petazzoni MPP_FUNCTION(0x04, "ssp", "sclk"), 70806763c74SThomas Petazzoni MPP_FUNCTION(0x05, "sdio0", "ledctrl"), 70906763c74SThomas Petazzoni MPP_FUNCTION(0x06, "spi1", "sck")), 71006763c74SThomas Petazzoni MPP_MODE(24, 71106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "camera", NULL), 71206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 71306763c74SThomas Petazzoni MPP_MODE(40, 71406763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio0", NULL), 71506763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 71606763c74SThomas Petazzoni MPP_MODE(46, 71706763c74SThomas Petazzoni MPP_FUNCTION(0x00, "sdio1", NULL), 71806763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 71906763c74SThomas Petazzoni MPP_MODE(52, 72006763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s1/spdifo", NULL), 72106763c74SThomas Petazzoni MPP_FUNCTION(0x02, "i2s1", NULL), 72206763c74SThomas Petazzoni MPP_FUNCTION(0x08, "spdifo", NULL), 72306763c74SThomas Petazzoni MPP_FUNCTION(0x0a, "gpio", NULL), 72406763c74SThomas Petazzoni MPP_FUNCTION(0x0b, "twsi", NULL), 72506763c74SThomas Petazzoni MPP_FUNCTION(0x0c, "ssp/spdifo", NULL), 72606763c74SThomas Petazzoni MPP_FUNCTION(0x0e, "ssp", NULL), 72706763c74SThomas Petazzoni MPP_FUNCTION(0x0f, "ssp/twsi", NULL)), 72806763c74SThomas Petazzoni MPP_MODE(58, 72906763c74SThomas Petazzoni MPP_FUNCTION(0x00, "spi0", NULL), 73006763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 73106763c74SThomas Petazzoni MPP_MODE(62, 73206763c74SThomas Petazzoni MPP_FUNCTION(0x00, "uart1", NULL), 73306763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpio", NULL)), 73406763c74SThomas Petazzoni MPP_MODE(64, 73506763c74SThomas Petazzoni MPP_FUNCTION(0x00, "nand", NULL), 73606763c74SThomas Petazzoni MPP_FUNCTION(0x01, "gpo", NULL)), 73706763c74SThomas Petazzoni MPP_MODE(72, 73806763c74SThomas Petazzoni MPP_FUNCTION(0x00, "i2s", NULL), 73906763c74SThomas Petazzoni MPP_FUNCTION(0x01, "ac97", NULL)), 74006763c74SThomas Petazzoni MPP_MODE(73, 74106763c74SThomas Petazzoni MPP_FUNCTION(0x00, "twsi-none", NULL), 74206763c74SThomas Petazzoni MPP_FUNCTION(0x01, "twsi-opt1", NULL), 74306763c74SThomas Petazzoni MPP_FUNCTION(0x02, "twsi-opt2", NULL), 74406763c74SThomas Petazzoni MPP_FUNCTION(0x03, "twsi-opt3", NULL)), 74506763c74SThomas Petazzoni }; 74606763c74SThomas Petazzoni 74706763c74SThomas Petazzoni static struct pinctrl_gpio_range dove_mpp_gpio_ranges[] = { 74806763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 74906763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 75006763c74SThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 8), 75106763c74SThomas Petazzoni }; 75206763c74SThomas Petazzoni 75306763c74SThomas Petazzoni static struct mvebu_pinctrl_soc_info dove_pinctrl_info = { 75406763c74SThomas Petazzoni .controls = dove_mpp_controls, 75506763c74SThomas Petazzoni .ncontrols = ARRAY_SIZE(dove_mpp_controls), 75606763c74SThomas Petazzoni .modes = dove_mpp_modes, 75706763c74SThomas Petazzoni .nmodes = ARRAY_SIZE(dove_mpp_modes), 75806763c74SThomas Petazzoni .gpioranges = dove_mpp_gpio_ranges, 75906763c74SThomas Petazzoni .ngpioranges = ARRAY_SIZE(dove_mpp_gpio_ranges), 76006763c74SThomas Petazzoni .variant = 0, 76106763c74SThomas Petazzoni }; 76206763c74SThomas Petazzoni 76306763c74SThomas Petazzoni static struct clk *clk; 76406763c74SThomas Petazzoni 765150632b0SGreg Kroah-Hartman static struct of_device_id dove_pinctrl_of_match[] = { 76606763c74SThomas Petazzoni { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info }, 76706763c74SThomas Petazzoni { } 76806763c74SThomas Petazzoni }; 76906763c74SThomas Petazzoni 770150632b0SGreg Kroah-Hartman static int dove_pinctrl_probe(struct platform_device *pdev) 77106763c74SThomas Petazzoni { 772*1217b790SSebastian Hesselbarth struct resource *res; 77306763c74SThomas Petazzoni const struct of_device_id *match = 77406763c74SThomas Petazzoni of_match_device(dove_pinctrl_of_match, &pdev->dev); 77516fa36beSAndrew Lunn pdev->dev.platform_data = (void *)match->data; 77606763c74SThomas Petazzoni 77706763c74SThomas Petazzoni /* 77806763c74SThomas Petazzoni * General MPP Configuration Register is part of pdma registers. 77906763c74SThomas Petazzoni * grab clk to make sure it is ticking. 78006763c74SThomas Petazzoni */ 78106763c74SThomas Petazzoni clk = devm_clk_get(&pdev->dev, NULL); 782ba607b62SSebastian Hesselbarth if (IS_ERR(clk)) { 783ba607b62SSebastian Hesselbarth dev_err(&pdev->dev, "Unable to get pdma clock"); 7845795c6acSRusty Russell return PTR_ERR(clk); 785ba607b62SSebastian Hesselbarth } 78606763c74SThomas Petazzoni clk_prepare_enable(clk); 78706763c74SThomas Petazzoni 788*1217b790SSebastian Hesselbarth res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 789*1217b790SSebastian Hesselbarth mpp_base = devm_ioremap_resource(&pdev->dev, res); 790*1217b790SSebastian Hesselbarth if (IS_ERR(mpp_base)) 791*1217b790SSebastian Hesselbarth return PTR_ERR(mpp_base); 792*1217b790SSebastian Hesselbarth 79306763c74SThomas Petazzoni return mvebu_pinctrl_probe(pdev); 79406763c74SThomas Petazzoni } 79506763c74SThomas Petazzoni 796150632b0SGreg Kroah-Hartman static int dove_pinctrl_remove(struct platform_device *pdev) 79706763c74SThomas Petazzoni { 79806763c74SThomas Petazzoni int ret; 79906763c74SThomas Petazzoni 80006763c74SThomas Petazzoni ret = mvebu_pinctrl_remove(pdev); 80106763c74SThomas Petazzoni if (!IS_ERR(clk)) 80206763c74SThomas Petazzoni clk_disable_unprepare(clk); 80306763c74SThomas Petazzoni return ret; 80406763c74SThomas Petazzoni } 80506763c74SThomas Petazzoni 80606763c74SThomas Petazzoni static struct platform_driver dove_pinctrl_driver = { 80706763c74SThomas Petazzoni .driver = { 80806763c74SThomas Petazzoni .name = "dove-pinctrl", 80906763c74SThomas Petazzoni .owner = THIS_MODULE, 810f2e9394dSSachin Kamat .of_match_table = dove_pinctrl_of_match, 81106763c74SThomas Petazzoni }, 81206763c74SThomas Petazzoni .probe = dove_pinctrl_probe, 813150632b0SGreg Kroah-Hartman .remove = dove_pinctrl_remove, 81406763c74SThomas Petazzoni }; 81506763c74SThomas Petazzoni 81606763c74SThomas Petazzoni module_platform_driver(dove_pinctrl_driver); 81706763c74SThomas Petazzoni 81806763c74SThomas Petazzoni MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>"); 81906763c74SThomas Petazzoni MODULE_DESCRIPTION("Marvell Dove pinctrl driver"); 82006763c74SThomas Petazzoni MODULE_LICENSE("GPL v2"); 821