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

Merge branch 'pinctrl-mvebu' into devel

+1487 -298
+22
Documentation/devicetree/bindings/arm/marvell,dove.txt
··· 1 + Marvell Dove Platforms Device Tree Bindings 2 + ----------------------------------------------- 3 + 4 + Boards with a Marvell Dove SoC shall have the following properties: 5 + 6 + Required root node property: 7 + - compatible: must contain "marvell,dove"; 8 + 9 + * Global Configuration registers 10 + 11 + Global Configuration registers of Dove SoC are shared by a syscon node. 12 + 13 + Required properties: 14 + - compatible: must contain "marvell,dove-global-config" and "syscon". 15 + - reg: base address and size of the Global Configuration registers. 16 + 17 + Example: 18 + 19 + gconf: global-config@e802c { 20 + compatible = "marvell,dove-global-config", "syscon"; 21 + reg = <0xe802c 0x14>; 22 + };
+1
Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt
··· 5 5 6 6 Required properties: 7 7 - compatible: "marvell,88f6710-pinctrl" 8 + - reg: register specifier of MPP registers 8 9 9 10 Available mpp pins/groups and functions: 10 11 Note: brackets (x) are not part of the mpp name for marvell,function and given
+82
Documentation/devicetree/bindings/pinctrl/marvell,armada-375-pinctrl.txt
··· 1 + * Marvell Armada 375 SoC pinctrl driver for mpp 2 + 3 + Please refer to marvell,mvebu-pinctrl.txt in this directory for common binding 4 + part and usage. 5 + 6 + Required properties: 7 + - compatible: "marvell,88f6720-pinctrl" 8 + - reg: register specifier of MPP registers 9 + 10 + Available mpp pins/groups and functions: 11 + Note: brackets (x) are not part of the mpp name for marvell,function and given 12 + only for more detailed description in this document. 13 + 14 + name pins functions 15 + ================================================================================ 16 + mpp0 0 gpio, dev(ad2), spi0(cs1), spi1(cs1) 17 + mpp1 1 gpio, dev(ad3), spi0(mosi), spi1(mosi) 18 + mpp2 2 gpio, dev(ad4), ptp(eventreq), led(c0), audio(sdi) 19 + mpp3 3 gpio, dev(ad5), ptp(triggen), led(p3), audio(mclk) 20 + mpp4 4 gpio, dev(ad6), spi0(miso), spi1(miso) 21 + mpp5 5 gpio, dev(ad7), spi0(cs2), spi1(cs2) 22 + mpp6 6 gpio, dev(ad0), led(p1), audio(rclk) 23 + mpp7 7 gpio, dev(ad1), ptp(clk), led(p2), audio(extclk) 24 + mpp8 8 gpio, dev (bootcs), spi0(cs0), spi1(cs0) 25 + mpp9 9 gpio, nf(wen), spi0(sck), spi1(sck) 26 + mpp10 10 gpio, nf(ren), dram(vttctrl), led(c1) 27 + mpp11 11 gpio, dev(a0), led(c2), audio(sdo) 28 + mpp12 12 gpio, dev(a1), audio(bclk) 29 + mpp13 13 gpio, dev(readyn), pcie0(rstoutn), pcie1(rstoutn) 30 + mpp14 14 gpio, i2c0(sda), uart1(txd) 31 + mpp15 15 gpio, i2c0(sck), uart1(rxd) 32 + mpp16 16 gpio, uart0(txd) 33 + mpp17 17 gpio, uart0(rxd) 34 + mpp18 18 gpio, tdm(intn) 35 + mpp19 19 gpio, tdm(rstn) 36 + mpp20 20 gpio, tdm(pclk) 37 + mpp21 21 gpio, tdm(fsync) 38 + mpp22 22 gpio, tdm(drx) 39 + mpp23 23 gpio, tdm(dtx) 40 + mpp24 24 gpio, led(p0), ge1(rxd0), sd(cmd), uart0(rts) 41 + mpp25 25 gpio, led(p2), ge1(rxd1), sd(d0), uart0(cts) 42 + mpp26 26 gpio, pcie0(clkreq), ge1(rxd2), sd(d2), uart1(rts) 43 + mpp27 27 gpio, pcie1(clkreq), ge1(rxd3), sd(d1), uart1(cts) 44 + mpp28 28 gpio, led(p3), ge1(txctl), sd(clk) 45 + mpp29 29 gpio, pcie1(clkreq), ge1(rxclk), sd(d3) 46 + mpp30 30 gpio, ge1(txd0), spi1(cs0) 47 + mpp31 31 gpio, ge1(txd1), spi1(mosi) 48 + mpp32 32 gpio, ge1(txd2), spi1(sck), ptp(triggen) 49 + mpp33 33 gpio, ge1(txd3), spi1(miso) 50 + mpp34 34 gpio, ge1(txclkout), spi1(sck) 51 + mpp35 35 gpio, ge1(rxctl), spi1(cs1), spi0(cs2) 52 + mpp36 36 gpio, pcie0(clkreq) 53 + mpp37 37 gpio, pcie0(clkreq), tdm(intn), ge(mdc) 54 + mpp38 38 gpio, pcie1(clkreq), ge(mdio) 55 + mpp39 39 gpio, ref(clkout) 56 + mpp40 40 gpio, uart1(txd) 57 + mpp41 41 gpio, uart1(rxd) 58 + mpp42 42 gpio, spi1(cs2), led(c0) 59 + mpp43 43 gpio, sata0(prsnt), dram(vttctrl) 60 + mpp44 44 gpio, sata0(prsnt) 61 + mpp45 45 gpio, spi0(cs2), pcie0(rstoutn) 62 + mpp46 46 gpio, led(p0), ge0(txd0), ge1(txd0) 63 + mpp47 47 gpio, led(p1), ge0(txd1), ge1(txd1) 64 + mpp48 48 gpio, led(p2), ge0(txd2), ge1(txd2) 65 + mpp49 49 gpio, led(p3), ge0(txd3), ge1(txd3) 66 + mpp50 50 gpio, led(c0), ge0(rxd0), ge1(rxd0) 67 + mpp51 51 gpio, led(c1), ge0(rxd1), ge1(rxd1) 68 + mpp52 52 gpio, led(c2), ge0(rxd2), ge1(rxd2) 69 + mpp53 53 gpio, pcie1(rstoutn), ge0(rxd3), ge1(rxd3) 70 + mpp54 54 gpio, pcie0(rstoutn), ge0(rxctl), ge1(rxctl) 71 + mpp55 55 gpio, ge0(rxclk), ge1(rxclk) 72 + mpp56 56 gpio, ge0(txclkout), ge1(txclkout) 73 + mpp57 57 gpio, ge0(txctl), ge1(txctl) 74 + mpp58 58 gpio, led(c0) 75 + mpp59 59 gpio, led(c1) 76 + mpp60 60 gpio, uart1(txd), led(c2) 77 + mpp61 61 gpio, i2c1(sda), uart1(rxd), spi1(cs2), led(p0) 78 + mpp62 62 gpio, i2c1(sck), led(p1) 79 + mpp63 63 gpio, ptp(triggen), led(p2) 80 + mpp64 64 gpio, dram(vttctrl), led(p3) 81 + mpp65 65 gpio, sata1(prsnt) 82 + mpp66 66 gpio, ptp(eventreq), spi1(cs3)
+80
Documentation/devicetree/bindings/pinctrl/marvell,armada-38x-pinctrl.txt
··· 1 + * Marvell Armada 380/385 SoC pinctrl driver for mpp 2 + 3 + Please refer to marvell,mvebu-pinctrl.txt in this directory for common binding 4 + part and usage. 5 + 6 + Required properties: 7 + - compatible: "marvell,88f6810-pinctrl", "marvell,88f6820-pinctrl" or 8 + "marvell,88f6828-pinctrl" depending on the specific variant of the 9 + SoC being used. 10 + - reg: register specifier of MPP registers 11 + 12 + Available mpp pins/groups and functions: 13 + Note: brackets (x) are not part of the mpp name for marvell,function and given 14 + only for more detailed description in this document. 15 + 16 + name pins functions 17 + ================================================================================ 18 + mpp0 0 gpio, ua0(rxd) 19 + mpp1 1 gpio, ua0(txd) 20 + mpp2 2 gpio, i2c0(sck) 21 + mpp3 3 gpio, i2c0(sda) 22 + mpp4 4 gpio, ge(mdc), ua1(txd), ua0(rts) 23 + mpp5 5 gpio, ge(mdio), ua1(rxd), ua0(cts) 24 + mpp6 6 gpio, ge0(txclkout), ge0(crs), dev(cs3) 25 + mpp7 7 gpio, ge0(txd0), dev(ad9) 26 + mpp8 8 gpio, ge0(txd1), dev(ad10) 27 + mpp9 9 gpio, ge0(txd2), dev(ad11) 28 + mpp10 10 gpio, ge0(txd3), dev(ad12) 29 + mpp11 11 gpio, ge0(txctl), dev(ad13) 30 + mpp12 12 gpio, ge0(rxd0), pcie0(rstout), pcie1(rstout) [1], spi0(cs1), dev(ad14) 31 + mpp13 13 gpio, ge0(rxd1), pcie0(clkreq), pcie1(clkreq) [1], spi0(cs2), dev(ad15) 32 + mpp14 14 gpio, ge0(rxd2), ptp(clk), m(vtt_ctrl), spi0(cs3), dev(wen1) 33 + mpp15 15 gpio, ge0(rxd3), ge(mdc slave), pcie0(rstout), spi0(mosi), pcie1(rstout) [1] 34 + mpp16 16 gpio, ge0(rxctl), ge(mdio slave), m(decc_err), spi0(miso), pcie0(clkreq) 35 + mpp17 17 gpio, ge0(rxclk), ptp(clk), ua1(rxd), spi0(sck), sata1(prsnt) 36 + mpp18 18 gpio, ge0(rxerr), ptp(trig_gen), ua1(txd), spi0(cs0), pcie1(rstout) [1] 37 + mpp19 19 gpio, ge0(col), ptp(event_req), pcie0(clkreq), sata1(prsnt), ua0(cts) 38 + mpp20 20 gpio, ge0(txclk), ptp(clk), pcie1(rstout) [1], sata0(prsnt), ua0(rts) 39 + mpp21 21 gpio, spi0(cs1), ge1(rxd0), sata0(prsnt), sd0(cmd), dev(bootcs) 40 + mpp22 22 gpio, spi0(mosi), dev(ad0) 41 + mpp23 23 gpio, spi0(sck), dev(ad2) 42 + mpp24 24 gpio, spi0(miso), ua0(cts), ua1(rxd), sd0(d4), dev(ready) 43 + mpp25 25 gpio, spi0(cs0), ua0(rts), ua1(txd), sd0(d5), dev(cs0) 44 + mpp26 26 gpio, spi0(cs2), i2c1(sck), sd0(d6), dev(cs1) 45 + mpp27 27 gpio, spi0(cs3), ge1(txclkout), i2c1(sda), sd0(d7), dev(cs2) 46 + mpp28 28 gpio, ge1(txd0), sd0(clk), dev(ad5) 47 + mpp29 29 gpio, ge1(txd1), dev(ale0) 48 + mpp30 30 gpio, ge1(txd2), dev(oen) 49 + mpp31 31 gpio, ge1(txd3), dev(ale1) 50 + mpp32 32 gpio, ge1(txctl), dev(wen0) 51 + mpp33 33 gpio, m(decc_err), dev(ad3) 52 + mpp34 34 gpio, dev(ad1) 53 + mpp35 35 gpio, ref(clk_out1), dev(a1) 54 + mpp36 36 gpio, ptp(trig_gen), dev(a0) 55 + mpp37 37 gpio, ptp(clk), ge1(rxclk), sd0(d3), dev(ad8) 56 + mpp38 38 gpio, ptp(event_req), ge1(rxd1), ref(clk_out0), sd0(d0), dev(ad4) 57 + mpp39 39 gpio, i2c1(sck), ge1(rxd2), ua0(cts), sd0(d1), dev(a2) 58 + mpp40 40 gpio, i2c1(sda), ge1(rxd3), ua0(rts), sd0(d2), dev(ad6) 59 + mpp41 41 gpio, ua1(rxd), ge1(rxctl), ua0(cts), spi1(cs3), dev(burst/last) 60 + mpp42 42 gpio, ua1(txd), ua0(rts), dev(ad7) 61 + mpp43 43 gpio, pcie0(clkreq), m(vtt_ctrl), m(decc_err), pcie0(rstout), dev(clkout) 62 + mpp44 44 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], sata3(prsnt) [3], pcie0(rstout) 63 + mpp45 45 gpio, ref(clk_out0), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) 64 + mpp46 46 gpio, ref(clk_out1), pcie0(rstout), pcie1(rstout) [1], pcie2(rstout), pcie3(rstout) 65 + mpp47 47 gpio, sata0(prsnt), sata1(prsnt), sata2(prsnt) [2], spi1(cs2), sata3(prsnt) [2] 66 + mpp48 48 gpio, sata0(prsnt), m(vtt_ctrl), tdm2c(pclk), audio(mclk), sd0(d4) 67 + mpp49 49 gpio, sata2(prsnt) [2], sata3(prsnt) [2], tdm2c(fsync), audio(lrclk), sd0(d5) 68 + mpp50 50 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(drx), audio(extclk), sd0(cmd) 69 + mpp51 51 gpio, tdm2c(dtx), audio(sdo), m(decc_err) 70 + mpp52 52 gpio, pcie0(rstout), pcie1(rstout) [1], tdm2c(intn), audio(sdi), sd0(d6) 71 + mpp53 53 gpio, sata1(prsnt), sata0(prsnt), tdm2c(rstn), audio(bclk), sd0(d7) 72 + mpp54 54 gpio, sata0(prsnt), sata1(prsnt), pcie0(rstout), pcie1(rstout) [1], sd0(d3) 73 + mpp55 55 gpio, ua1(cts), ge(mdio), pcie1(clkreq) [1], spi1(cs1), sd0(d0) 74 + mpp56 56 gpio, ua1(rts), ge(mdc), m(decc_err), spi1(mosi) 75 + mpp57 57 gpio, spi1(sck), sd0(clk) 76 + mpp58 58 gpio, pcie1(clkreq) [1], i2c1(sck), pcie2(clkreq), spi1(miso), sd0(d1) 77 + mpp59 59 gpio, pcie0(rstout), i2c1(sda), pcie1(rstout) [1], spi1(cs0), sd0(d2) 78 + 79 + [1]: only available on 88F6820 and 88F6828 80 + [2]: only available on 88F6828
+1
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt
··· 6 6 Required properties: 7 7 - compatible: "marvell,mv78230-pinctrl", "marvell,mv78260-pinctrl", 8 8 "marvell,mv78460-pinctrl" 9 + - reg: register specifier of MPP registers 9 10 10 11 This driver supports all Armada XP variants, i.e. mv78230, mv78260, and mv78460. 11 12
+1
Documentation/devicetree/bindings/pinctrl/marvell,dove-pinctrl.txt
··· 6 6 Required properties: 7 7 - compatible: "marvell,dove-pinctrl" 8 8 - clocks: (optional) phandle of pdma clock 9 + - reg: register specifiers of MPP, MPP4, and PMU MPP registers 9 10 10 11 Available mpp pins/groups and functions: 11 12 Note: brackets (x) are not part of the mpp name for marvell,function and given
+1
Documentation/devicetree/bindings/pinctrl/marvell,kirkwood-pinctrl.txt
··· 8 8 "marvell,88f6190-pinctrl", "marvell,88f6192-pinctrl", 9 9 "marvell,88f6281-pinctrl", "marvell,88f6282-pinctrl" 10 10 "marvell,98dx4122-pinctrl" 11 + - reg: register specifier of MPP registers 11 12 12 13 This driver supports all kirkwood variants, i.e. 88f6180, 88f619x, and 88f628x. 13 14 It also support the 88f6281-based variant in the 98dx412x Bobcat SoCs.
+1 -1
Documentation/devicetree/bindings/pinctrl/marvell,mvebu-pinctrl.txt
··· 37 37 38 38 pinctrl: pinctrl@d0200 { 39 39 compatible = "marvell,dove-pinctrl"; 40 - reg = <0xd0200 0x20>; 40 + reg = <0xd0200 0x14>, <0xd0440 0x04>, <0xd802c 0x08>; 41 41 42 42 pmx_uart1_sw: pmx-uart1-sw { 43 43 marvell,pins = "mpp_uart1";
+9
drivers/pinctrl/mvebu/Kconfig
··· 8 8 config PINCTRL_DOVE 9 9 bool 10 10 select PINCTRL_MVEBU 11 + select MFD_SYSCON 11 12 12 13 config PINCTRL_KIRKWOOD 13 14 bool 14 15 select PINCTRL_MVEBU 15 16 16 17 config PINCTRL_ARMADA_370 18 + bool 19 + select PINCTRL_MVEBU 20 + 21 + config PINCTRL_ARMADA_375 22 + bool 23 + select PINCTRL_MVEBU 24 + 25 + config PINCTRL_ARMADA_38X 17 26 bool 18 27 select PINCTRL_MVEBU 19 28
+2
drivers/pinctrl/mvebu/Makefile
··· 2 2 obj-$(CONFIG_PINCTRL_DOVE) += pinctrl-dove.o 3 3 obj-$(CONFIG_PINCTRL_KIRKWOOD) += pinctrl-kirkwood.o 4 4 obj-$(CONFIG_PINCTRL_ARMADA_370) += pinctrl-armada-370.o 5 + obj-$(CONFIG_PINCTRL_ARMADA_375) += pinctrl-armada-375.o 6 + obj-$(CONFIG_PINCTRL_ARMADA_38X) += pinctrl-armada-38x.o 5 7 obj-$(CONFIG_PINCTRL_ARMADA_XP) += pinctrl-armada-xp.o
+19 -1
drivers/pinctrl/mvebu/pinctrl-armada-370.c
··· 23 23 24 24 #include "pinctrl-mvebu.h" 25 25 26 + static void __iomem *mpp_base; 27 + 28 + static int armada_370_mpp_ctrl_get(unsigned pid, unsigned long *config) 29 + { 30 + return default_mpp_ctrl_get(mpp_base, pid, config); 31 + } 32 + 33 + static int armada_370_mpp_ctrl_set(unsigned pid, unsigned long config) 34 + { 35 + return default_mpp_ctrl_set(mpp_base, pid, config); 36 + } 37 + 26 38 static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = { 27 39 MPP_MODE(0, 28 40 MPP_FUNCTION(0x0, "gpio", NULL), ··· 385 373 }; 386 374 387 375 static struct mvebu_mpp_ctrl mv88f6710_mpp_controls[] = { 388 - MPP_REG_CTRL(0, 65), 376 + MPP_FUNC_CTRL(0, 65, NULL, armada_370_mpp_ctrl), 389 377 }; 390 378 391 379 static struct pinctrl_gpio_range mv88f6710_mpp_gpio_ranges[] = { ··· 397 385 static int armada_370_pinctrl_probe(struct platform_device *pdev) 398 386 { 399 387 struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info; 388 + struct resource *res; 389 + 390 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 391 + mpp_base = devm_ioremap_resource(&pdev->dev, res); 392 + if (IS_ERR(mpp_base)) 393 + return PTR_ERR(mpp_base); 400 394 401 395 soc->variant = 0; /* no variants for Armada 370 */ 402 396 soc->controls = mv88f6710_mpp_controls;
+459
drivers/pinctrl/mvebu/pinctrl-armada-375.c
··· 1 + /* 2 + * Marvell Armada 375 pinctrl driver based on mvebu pinctrl core 3 + * 4 + * Copyright (C) 2012 Marvell 5 + * 6 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; either version 2 of the License, or 11 + * (at your option) any later version. 12 + */ 13 + 14 + #include <linux/err.h> 15 + #include <linux/init.h> 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/platform_device.h> 19 + #include <linux/clk.h> 20 + #include <linux/of.h> 21 + #include <linux/of_device.h> 22 + #include <linux/pinctrl/pinctrl.h> 23 + 24 + #include "pinctrl-mvebu.h" 25 + 26 + static void __iomem *mpp_base; 27 + 28 + static int armada_375_mpp_ctrl_get(unsigned pid, unsigned long *config) 29 + { 30 + return default_mpp_ctrl_get(mpp_base, pid, config); 31 + } 32 + 33 + static int armada_375_mpp_ctrl_set(unsigned pid, unsigned long config) 34 + { 35 + return default_mpp_ctrl_set(mpp_base, pid, config); 36 + } 37 + 38 + static struct mvebu_mpp_mode mv88f6720_mpp_modes[] = { 39 + MPP_MODE(0, 40 + MPP_FUNCTION(0x0, "gpio", NULL), 41 + MPP_FUNCTION(0x1, "dev", "ad2"), 42 + MPP_FUNCTION(0x2, "spi0", "cs1"), 43 + MPP_FUNCTION(0x3, "spi1", "cs1"), 44 + MPP_FUNCTION(0x5, "nand", "io2")), 45 + MPP_MODE(1, 46 + MPP_FUNCTION(0x0, "gpio", NULL), 47 + MPP_FUNCTION(0x1, "dev", "ad3"), 48 + MPP_FUNCTION(0x2, "spi0", "mosi"), 49 + MPP_FUNCTION(0x3, "spi1", "mosi"), 50 + MPP_FUNCTION(0x5, "nand", "io3")), 51 + MPP_MODE(2, 52 + MPP_FUNCTION(0x0, "gpio", NULL), 53 + MPP_FUNCTION(0x1, "dev", "ad4"), 54 + MPP_FUNCTION(0x2, "ptp", "eventreq"), 55 + MPP_FUNCTION(0x3, "led", "c0"), 56 + MPP_FUNCTION(0x4, "audio", "sdi"), 57 + MPP_FUNCTION(0x5, "nand", "io4"), 58 + MPP_FUNCTION(0x6, "spi1", "mosi")), 59 + MPP_MODE(3, 60 + MPP_FUNCTION(0x0, "gpio", NULL), 61 + MPP_FUNCTION(0x1, "dev", "ad5"), 62 + MPP_FUNCTION(0x2, "ptp", "triggen"), 63 + MPP_FUNCTION(0x3, "led", "p3"), 64 + MPP_FUNCTION(0x4, "audio", "mclk"), 65 + MPP_FUNCTION(0x5, "nand", "io5"), 66 + MPP_FUNCTION(0x6, "spi1", "miso")), 67 + MPP_MODE(4, 68 + MPP_FUNCTION(0x0, "gpio", NULL), 69 + MPP_FUNCTION(0x1, "dev", "ad6"), 70 + MPP_FUNCTION(0x2, "spi0", "miso"), 71 + MPP_FUNCTION(0x3, "spi1", "miso"), 72 + MPP_FUNCTION(0x5, "nand", "io6")), 73 + MPP_MODE(5, 74 + MPP_FUNCTION(0x0, "gpio", NULL), 75 + MPP_FUNCTION(0x1, "dev", "ad7"), 76 + MPP_FUNCTION(0x2, "spi0", "cs2"), 77 + MPP_FUNCTION(0x3, "spi1", "cs2"), 78 + MPP_FUNCTION(0x5, "nand", "io7"), 79 + MPP_FUNCTION(0x6, "spi1", "miso")), 80 + MPP_MODE(6, 81 + MPP_FUNCTION(0x0, "gpio", NULL), 82 + MPP_FUNCTION(0x1, "dev", "ad0"), 83 + MPP_FUNCTION(0x3, "led", "p1"), 84 + MPP_FUNCTION(0x4, "audio", "rclk"), 85 + MPP_FUNCTION(0x5, "nand", "io0")), 86 + MPP_MODE(7, 87 + MPP_FUNCTION(0x0, "gpio", NULL), 88 + MPP_FUNCTION(0x1, "dev", "ad1"), 89 + MPP_FUNCTION(0x2, "ptp", "clk"), 90 + MPP_FUNCTION(0x3, "led", "p2"), 91 + MPP_FUNCTION(0x4, "audio", "extclk"), 92 + MPP_FUNCTION(0x5, "nand", "io1")), 93 + MPP_MODE(8, 94 + MPP_FUNCTION(0x0, "gpio", NULL), 95 + MPP_FUNCTION(0x1, "dev ", "bootcs"), 96 + MPP_FUNCTION(0x2, "spi0", "cs0"), 97 + MPP_FUNCTION(0x3, "spi1", "cs0"), 98 + MPP_FUNCTION(0x5, "nand", "ce")), 99 + MPP_MODE(9, 100 + MPP_FUNCTION(0x0, "gpio", NULL), 101 + MPP_FUNCTION(0x1, "nf", "wen"), 102 + MPP_FUNCTION(0x2, "spi0", "sck"), 103 + MPP_FUNCTION(0x3, "spi1", "sck"), 104 + MPP_FUNCTION(0x5, "nand", "we")), 105 + MPP_MODE(10, 106 + MPP_FUNCTION(0x0, "gpio", NULL), 107 + MPP_FUNCTION(0x1, "nf", "ren"), 108 + MPP_FUNCTION(0x2, "dram", "vttctrl"), 109 + MPP_FUNCTION(0x3, "led", "c1"), 110 + MPP_FUNCTION(0x5, "nand", "re"), 111 + MPP_FUNCTION(0x6, "spi1", "sck")), 112 + MPP_MODE(11, 113 + MPP_FUNCTION(0x0, "gpio", NULL), 114 + MPP_FUNCTION(0x1, "dev", "a0"), 115 + MPP_FUNCTION(0x3, "led", "c2"), 116 + MPP_FUNCTION(0x4, "audio", "sdo"), 117 + MPP_FUNCTION(0x5, "nand", "cle")), 118 + MPP_MODE(12, 119 + MPP_FUNCTION(0x0, "gpio", NULL), 120 + MPP_FUNCTION(0x1, "dev", "a1"), 121 + MPP_FUNCTION(0x4, "audio", "bclk"), 122 + MPP_FUNCTION(0x5, "nand", "ale")), 123 + MPP_MODE(13, 124 + MPP_FUNCTION(0x0, "gpio", NULL), 125 + MPP_FUNCTION(0x1, "dev", "readyn"), 126 + MPP_FUNCTION(0x2, "pcie0", "rstoutn"), 127 + MPP_FUNCTION(0x3, "pcie1", "rstoutn"), 128 + MPP_FUNCTION(0x5, "nand", "rb"), 129 + MPP_FUNCTION(0x6, "spi1", "mosi")), 130 + MPP_MODE(14, 131 + MPP_FUNCTION(0x0, "gpio", NULL), 132 + MPP_FUNCTION(0x2, "i2c0", "sda"), 133 + MPP_FUNCTION(0x3, "uart1", "txd")), 134 + MPP_MODE(15, 135 + MPP_FUNCTION(0x0, "gpio", NULL), 136 + MPP_FUNCTION(0x2, "i2c0", "sck"), 137 + MPP_FUNCTION(0x3, "uart1", "rxd")), 138 + MPP_MODE(16, 139 + MPP_FUNCTION(0x0, "gpio", NULL), 140 + MPP_FUNCTION(0x2, "uart0", "txd")), 141 + MPP_MODE(17, 142 + MPP_FUNCTION(0x0, "gpio", NULL), 143 + MPP_FUNCTION(0x2, "uart0", "rxd")), 144 + MPP_MODE(18, 145 + MPP_FUNCTION(0x0, "gpio", NULL), 146 + MPP_FUNCTION(0x2, "tdm", "intn")), 147 + MPP_MODE(19, 148 + MPP_FUNCTION(0x0, "gpio", NULL), 149 + MPP_FUNCTION(0x2, "tdm", "rstn")), 150 + MPP_MODE(20, 151 + MPP_FUNCTION(0x0, "gpio", NULL), 152 + MPP_FUNCTION(0x2, "tdm", "pclk")), 153 + MPP_MODE(21, 154 + MPP_FUNCTION(0x0, "gpio", NULL), 155 + MPP_FUNCTION(0x2, "tdm", "fsync")), 156 + MPP_MODE(22, 157 + MPP_FUNCTION(0x0, "gpio", NULL), 158 + MPP_FUNCTION(0x2, "tdm", "drx")), 159 + MPP_MODE(23, 160 + MPP_FUNCTION(0x0, "gpio", NULL), 161 + MPP_FUNCTION(0x2, "tdm", "dtx")), 162 + MPP_MODE(24, 163 + MPP_FUNCTION(0x0, "gpio", NULL), 164 + MPP_FUNCTION(0x1, "led", "p0"), 165 + MPP_FUNCTION(0x2, "ge1", "rxd0"), 166 + MPP_FUNCTION(0x3, "sd", "cmd"), 167 + MPP_FUNCTION(0x4, "uart0", "rts"), 168 + MPP_FUNCTION(0x5, "spi0", "cs0"), 169 + MPP_FUNCTION(0x6, "dev", "cs1")), 170 + MPP_MODE(25, 171 + MPP_FUNCTION(0x0, "gpio", NULL), 172 + MPP_FUNCTION(0x1, "led", "p2"), 173 + MPP_FUNCTION(0x2, "ge1", "rxd1"), 174 + MPP_FUNCTION(0x3, "sd", "d0"), 175 + MPP_FUNCTION(0x4, "uart0", "cts"), 176 + MPP_FUNCTION(0x5, "spi0", "mosi"), 177 + MPP_FUNCTION(0x6, "dev", "cs2")), 178 + MPP_MODE(26, 179 + MPP_FUNCTION(0x0, "gpio", NULL), 180 + MPP_FUNCTION(0x1, "pcie0", "clkreq"), 181 + MPP_FUNCTION(0x2, "ge1", "rxd2"), 182 + MPP_FUNCTION(0x3, "sd", "d2"), 183 + MPP_FUNCTION(0x4, "uart1", "rts"), 184 + MPP_FUNCTION(0x5, "spi0", "cs1"), 185 + MPP_FUNCTION(0x6, "led", "c1")), 186 + MPP_MODE(27, 187 + MPP_FUNCTION(0x0, "gpio", NULL), 188 + MPP_FUNCTION(0x1, "pcie1", "clkreq"), 189 + MPP_FUNCTION(0x2, "ge1", "rxd3"), 190 + MPP_FUNCTION(0x3, "sd", "d1"), 191 + MPP_FUNCTION(0x4, "uart1", "cts"), 192 + MPP_FUNCTION(0x5, "spi0", "miso"), 193 + MPP_FUNCTION(0x6, "led", "c2")), 194 + MPP_MODE(28, 195 + MPP_FUNCTION(0x0, "gpio", NULL), 196 + MPP_FUNCTION(0x1, "led", "p3"), 197 + MPP_FUNCTION(0x2, "ge1", "txctl"), 198 + MPP_FUNCTION(0x3, "sd", "clk"), 199 + MPP_FUNCTION(0x5, "dram", "vttctrl")), 200 + MPP_MODE(29, 201 + MPP_FUNCTION(0x0, "gpio", NULL), 202 + MPP_FUNCTION(0x1, "pcie1", "clkreq"), 203 + MPP_FUNCTION(0x2, "ge1", "rxclk"), 204 + MPP_FUNCTION(0x3, "sd", "d3"), 205 + MPP_FUNCTION(0x5, "spi0", "sck"), 206 + MPP_FUNCTION(0x6, "pcie0", "rstoutn")), 207 + MPP_MODE(30, 208 + MPP_FUNCTION(0x0, "gpio", NULL), 209 + MPP_FUNCTION(0x2, "ge1", "txd0"), 210 + MPP_FUNCTION(0x3, "spi1", "cs0"), 211 + MPP_FUNCTION(0x5, "led", "p3"), 212 + MPP_FUNCTION(0x6, "ptp", "eventreq")), 213 + MPP_MODE(31, 214 + MPP_FUNCTION(0x0, "gpio", NULL), 215 + MPP_FUNCTION(0x2, "ge1", "txd1"), 216 + MPP_FUNCTION(0x3, "spi1", "mosi"), 217 + MPP_FUNCTION(0x5, "led", "p0")), 218 + MPP_MODE(32, 219 + MPP_FUNCTION(0x0, "gpio", NULL), 220 + MPP_FUNCTION(0x2, "ge1", "txd2"), 221 + MPP_FUNCTION(0x3, "spi1", "sck"), 222 + MPP_FUNCTION(0x4, "ptp", "triggen"), 223 + MPP_FUNCTION(0x5, "led", "c0")), 224 + MPP_MODE(33, 225 + MPP_FUNCTION(0x0, "gpio", NULL), 226 + MPP_FUNCTION(0x2, "ge1", "txd3"), 227 + MPP_FUNCTION(0x3, "spi1", "miso"), 228 + MPP_FUNCTION(0x5, "led", "p2")), 229 + MPP_MODE(34, 230 + MPP_FUNCTION(0x0, "gpio", NULL), 231 + MPP_FUNCTION(0x2, "ge1", "txclkout"), 232 + MPP_FUNCTION(0x3, "spi1", "sck"), 233 + MPP_FUNCTION(0x5, "led", "c1")), 234 + MPP_MODE(35, 235 + MPP_FUNCTION(0x0, "gpio", NULL), 236 + MPP_FUNCTION(0x2, "ge1", "rxctl"), 237 + MPP_FUNCTION(0x3, "spi1", "cs1"), 238 + MPP_FUNCTION(0x4, "spi0", "cs2"), 239 + MPP_FUNCTION(0x5, "led", "p1")), 240 + MPP_MODE(36, 241 + MPP_FUNCTION(0x0, "gpio", NULL), 242 + MPP_FUNCTION(0x1, "pcie0", "clkreq"), 243 + MPP_FUNCTION(0x5, "led", "c2")), 244 + MPP_MODE(37, 245 + MPP_FUNCTION(0x0, "gpio", NULL), 246 + MPP_FUNCTION(0x1, "pcie0", "clkreq"), 247 + MPP_FUNCTION(0x2, "tdm", "intn"), 248 + MPP_FUNCTION(0x4, "ge", "mdc")), 249 + MPP_MODE(38, 250 + MPP_FUNCTION(0x0, "gpio", NULL), 251 + MPP_FUNCTION(0x1, "pcie1", "clkreq"), 252 + MPP_FUNCTION(0x4, "ge", "mdio")), 253 + MPP_MODE(39, 254 + MPP_FUNCTION(0x0, "gpio", NULL), 255 + MPP_FUNCTION(0x4, "ref", "clkout"), 256 + MPP_FUNCTION(0x5, "led", "p3")), 257 + MPP_MODE(40, 258 + MPP_FUNCTION(0x0, "gpio", NULL), 259 + MPP_FUNCTION(0x4, "uart1", "txd"), 260 + MPP_FUNCTION(0x5, "led", "p0")), 261 + MPP_MODE(41, 262 + MPP_FUNCTION(0x0, "gpio", NULL), 263 + MPP_FUNCTION(0x4, "uart1", "rxd"), 264 + MPP_FUNCTION(0x5, "led", "p1")), 265 + MPP_MODE(42, 266 + MPP_FUNCTION(0x0, "gpio", NULL), 267 + MPP_FUNCTION(0x3, "spi1", "cs2"), 268 + MPP_FUNCTION(0x4, "led", "c0"), 269 + MPP_FUNCTION(0x6, "ptp", "clk")), 270 + MPP_MODE(43, 271 + MPP_FUNCTION(0x0, "gpio", NULL), 272 + MPP_FUNCTION(0x2, "sata0", "prsnt"), 273 + MPP_FUNCTION(0x4, "dram", "vttctrl"), 274 + MPP_FUNCTION(0x5, "led", "c1")), 275 + MPP_MODE(44, 276 + MPP_FUNCTION(0x0, "gpio", NULL), 277 + MPP_FUNCTION(0x4, "sata0", "prsnt")), 278 + MPP_MODE(45, 279 + MPP_FUNCTION(0x0, "gpio", NULL), 280 + MPP_FUNCTION(0x2, "spi0", "cs2"), 281 + MPP_FUNCTION(0x4, "pcie0", "rstoutn"), 282 + MPP_FUNCTION(0x5, "led", "c2"), 283 + MPP_FUNCTION(0x6, "spi1", "cs2")), 284 + MPP_MODE(46, 285 + MPP_FUNCTION(0x0, "gpio", NULL), 286 + MPP_FUNCTION(0x1, "led", "p0"), 287 + MPP_FUNCTION(0x2, "ge0", "txd0"), 288 + MPP_FUNCTION(0x3, "ge1", "txd0"), 289 + MPP_FUNCTION(0x6, "dev", "wen1")), 290 + MPP_MODE(47, 291 + MPP_FUNCTION(0x0, "gpio", NULL), 292 + MPP_FUNCTION(0x1, "led", "p1"), 293 + MPP_FUNCTION(0x2, "ge0", "txd1"), 294 + MPP_FUNCTION(0x3, "ge1", "txd1"), 295 + MPP_FUNCTION(0x5, "ptp", "triggen"), 296 + MPP_FUNCTION(0x6, "dev", "ale0")), 297 + MPP_MODE(48, 298 + MPP_FUNCTION(0x0, "gpio", NULL), 299 + MPP_FUNCTION(0x1, "led", "p2"), 300 + MPP_FUNCTION(0x2, "ge0", "txd2"), 301 + MPP_FUNCTION(0x3, "ge1", "txd2"), 302 + MPP_FUNCTION(0x6, "dev", "ale1")), 303 + MPP_MODE(49, 304 + MPP_FUNCTION(0x0, "gpio", NULL), 305 + MPP_FUNCTION(0x1, "led", "p3"), 306 + MPP_FUNCTION(0x2, "ge0", "txd3"), 307 + MPP_FUNCTION(0x3, "ge1", "txd3"), 308 + MPP_FUNCTION(0x6, "dev", "a2")), 309 + MPP_MODE(50, 310 + MPP_FUNCTION(0x0, "gpio", NULL), 311 + MPP_FUNCTION(0x1, "led", "c0"), 312 + MPP_FUNCTION(0x2, "ge0", "rxd0"), 313 + MPP_FUNCTION(0x3, "ge1", "rxd0"), 314 + MPP_FUNCTION(0x5, "ptp", "eventreq"), 315 + MPP_FUNCTION(0x6, "dev", "ad12")), 316 + MPP_MODE(51, 317 + MPP_FUNCTION(0x0, "gpio", NULL), 318 + MPP_FUNCTION(0x1, "led", "c1"), 319 + MPP_FUNCTION(0x2, "ge0", "rxd1"), 320 + MPP_FUNCTION(0x3, "ge1", "rxd1"), 321 + MPP_FUNCTION(0x6, "dev", "ad8")), 322 + MPP_MODE(52, 323 + MPP_FUNCTION(0x0, "gpio", NULL), 324 + MPP_FUNCTION(0x1, "led", "c2"), 325 + MPP_FUNCTION(0x2, "ge0", "rxd2"), 326 + MPP_FUNCTION(0x3, "ge1", "rxd2"), 327 + MPP_FUNCTION(0x5, "i2c0", "sda"), 328 + MPP_FUNCTION(0x6, "dev", "ad9")), 329 + MPP_MODE(53, 330 + MPP_FUNCTION(0x0, "gpio", NULL), 331 + MPP_FUNCTION(0x1, "pcie1", "rstoutn"), 332 + MPP_FUNCTION(0x2, "ge0", "rxd3"), 333 + MPP_FUNCTION(0x3, "ge1", "rxd3"), 334 + MPP_FUNCTION(0x5, "i2c0", "sck"), 335 + MPP_FUNCTION(0x6, "dev", "ad10")), 336 + MPP_MODE(54, 337 + MPP_FUNCTION(0x0, "gpio", NULL), 338 + MPP_FUNCTION(0x1, "pcie0", "rstoutn"), 339 + MPP_FUNCTION(0x2, "ge0", "rxctl"), 340 + MPP_FUNCTION(0x3, "ge1", "rxctl"), 341 + MPP_FUNCTION(0x6, "dev", "ad11")), 342 + MPP_MODE(55, 343 + MPP_FUNCTION(0x0, "gpio", NULL), 344 + MPP_FUNCTION(0x2, "ge0", "rxclk"), 345 + MPP_FUNCTION(0x3, "ge1", "rxclk"), 346 + MPP_FUNCTION(0x6, "dev", "cs0")), 347 + MPP_MODE(56, 348 + MPP_FUNCTION(0x0, "gpio", NULL), 349 + MPP_FUNCTION(0x2, "ge0", "txclkout"), 350 + MPP_FUNCTION(0x3, "ge1", "txclkout"), 351 + MPP_FUNCTION(0x6, "dev", "oe")), 352 + MPP_MODE(57, 353 + MPP_FUNCTION(0x0, "gpio", NULL), 354 + MPP_FUNCTION(0x2, "ge0", "txctl"), 355 + MPP_FUNCTION(0x3, "ge1", "txctl"), 356 + MPP_FUNCTION(0x6, "dev", "wen0")), 357 + MPP_MODE(58, 358 + MPP_FUNCTION(0x0, "gpio", NULL), 359 + MPP_FUNCTION(0x4, "led", "c0")), 360 + MPP_MODE(59, 361 + MPP_FUNCTION(0x0, "gpio", NULL), 362 + MPP_FUNCTION(0x4, "led", "c1")), 363 + MPP_MODE(60, 364 + MPP_FUNCTION(0x0, "gpio", NULL), 365 + MPP_FUNCTION(0x2, "uart1", "txd"), 366 + MPP_FUNCTION(0x4, "led", "c2"), 367 + MPP_FUNCTION(0x6, "dev", "ad13")), 368 + MPP_MODE(61, 369 + MPP_FUNCTION(0x0, "gpio", NULL), 370 + MPP_FUNCTION(0x1, "i2c1", "sda"), 371 + MPP_FUNCTION(0x2, "uart1", "rxd"), 372 + MPP_FUNCTION(0x3, "spi1", "cs2"), 373 + MPP_FUNCTION(0x4, "led", "p0"), 374 + MPP_FUNCTION(0x6, "dev", "ad14")), 375 + MPP_MODE(62, 376 + MPP_FUNCTION(0x0, "gpio", NULL), 377 + MPP_FUNCTION(0x1, "i2c1", "sck"), 378 + MPP_FUNCTION(0x4, "led", "p1"), 379 + MPP_FUNCTION(0x6, "dev", "ad15")), 380 + MPP_MODE(63, 381 + MPP_FUNCTION(0x0, "gpio", NULL), 382 + MPP_FUNCTION(0x2, "ptp", "triggen"), 383 + MPP_FUNCTION(0x4, "led", "p2"), 384 + MPP_FUNCTION(0x6, "dev", "burst")), 385 + MPP_MODE(64, 386 + MPP_FUNCTION(0x0, "gpio", NULL), 387 + MPP_FUNCTION(0x2, "dram", "vttctrl"), 388 + MPP_FUNCTION(0x4, "led", "p3")), 389 + MPP_MODE(65, 390 + MPP_FUNCTION(0x0, "gpio", NULL), 391 + MPP_FUNCTION(0x1, "sata1", "prsnt")), 392 + MPP_MODE(66, 393 + MPP_FUNCTION(0x0, "gpio", NULL), 394 + MPP_FUNCTION(0x2, "ptp", "eventreq"), 395 + MPP_FUNCTION(0x4, "spi1", "cs3"), 396 + MPP_FUNCTION(0x5, "pcie0", "rstoutn"), 397 + MPP_FUNCTION(0x6, "dev", "cs3")), 398 + }; 399 + 400 + static struct mvebu_pinctrl_soc_info armada_375_pinctrl_info; 401 + 402 + static struct of_device_id armada_375_pinctrl_of_match[] = { 403 + { .compatible = "marvell,mv88f6720-pinctrl" }, 404 + { }, 405 + }; 406 + 407 + static struct mvebu_mpp_ctrl mv88f6720_mpp_controls[] = { 408 + MPP_FUNC_CTRL(0, 69, NULL, armada_375_mpp_ctrl), 409 + }; 410 + 411 + static struct pinctrl_gpio_range mv88f6720_mpp_gpio_ranges[] = { 412 + MPP_GPIO_RANGE(0, 0, 0, 32), 413 + MPP_GPIO_RANGE(1, 32, 32, 32), 414 + MPP_GPIO_RANGE(2, 64, 64, 3), 415 + }; 416 + 417 + static int armada_375_pinctrl_probe(struct platform_device *pdev) 418 + { 419 + struct mvebu_pinctrl_soc_info *soc = &armada_375_pinctrl_info; 420 + struct resource *res; 421 + 422 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 423 + mpp_base = devm_ioremap_resource(&pdev->dev, res); 424 + if (IS_ERR(mpp_base)) 425 + return PTR_ERR(mpp_base); 426 + 427 + soc->variant = 0; /* no variants for Armada 375 */ 428 + soc->controls = mv88f6720_mpp_controls; 429 + soc->ncontrols = ARRAY_SIZE(mv88f6720_mpp_controls); 430 + soc->modes = mv88f6720_mpp_modes; 431 + soc->nmodes = ARRAY_SIZE(mv88f6720_mpp_modes); 432 + soc->gpioranges = mv88f6720_mpp_gpio_ranges; 433 + soc->ngpioranges = ARRAY_SIZE(mv88f6720_mpp_gpio_ranges); 434 + 435 + pdev->dev.platform_data = soc; 436 + 437 + return mvebu_pinctrl_probe(pdev); 438 + } 439 + 440 + static int armada_375_pinctrl_remove(struct platform_device *pdev) 441 + { 442 + return mvebu_pinctrl_remove(pdev); 443 + } 444 + 445 + static struct platform_driver armada_375_pinctrl_driver = { 446 + .driver = { 447 + .name = "armada-375-pinctrl", 448 + .owner = THIS_MODULE, 449 + .of_match_table = of_match_ptr(armada_375_pinctrl_of_match), 450 + }, 451 + .probe = armada_375_pinctrl_probe, 452 + .remove = armada_375_pinctrl_remove, 453 + }; 454 + 455 + module_platform_driver(armada_375_pinctrl_driver); 456 + 457 + MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 458 + MODULE_DESCRIPTION("Marvell Armada 375 pinctrl driver"); 459 + MODULE_LICENSE("GPL v2");
+462
drivers/pinctrl/mvebu/pinctrl-armada-38x.c
··· 1 + /* 2 + * Marvell Armada 380/385 pinctrl driver based on mvebu pinctrl core 3 + * 4 + * Copyright (C) 2013 Marvell 5 + * 6 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; either version 2 of the License, or 11 + * (at your option) any later version. 12 + */ 13 + 14 + #include <linux/err.h> 15 + #include <linux/init.h> 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/platform_device.h> 19 + #include <linux/of.h> 20 + #include <linux/of_device.h> 21 + #include <linux/pinctrl/pinctrl.h> 22 + 23 + #include "pinctrl-mvebu.h" 24 + 25 + static void __iomem *mpp_base; 26 + 27 + static int armada_38x_mpp_ctrl_get(unsigned pid, unsigned long *config) 28 + { 29 + return default_mpp_ctrl_get(mpp_base, pid, config); 30 + } 31 + 32 + static int armada_38x_mpp_ctrl_set(unsigned pid, unsigned long config) 33 + { 34 + return default_mpp_ctrl_set(mpp_base, pid, config); 35 + } 36 + 37 + enum { 38 + V_88F6810 = BIT(0), 39 + V_88F6820 = BIT(1), 40 + V_88F6828 = BIT(2), 41 + V_88F6810_PLUS = (V_88F6810 | V_88F6820 | V_88F6828), 42 + V_88F6820_PLUS = (V_88F6820 | V_88F6828), 43 + }; 44 + 45 + static struct mvebu_mpp_mode armada_38x_mpp_modes[] = { 46 + MPP_MODE(0, 47 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 48 + MPP_VAR_FUNCTION(1, "ua0", "rxd", V_88F6810_PLUS)), 49 + MPP_MODE(1, 50 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 51 + MPP_VAR_FUNCTION(1, "ua0", "txd", V_88F6810_PLUS)), 52 + MPP_MODE(2, 53 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 54 + MPP_VAR_FUNCTION(1, "i2c0", "sck", V_88F6810_PLUS)), 55 + MPP_MODE(3, 56 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 57 + MPP_VAR_FUNCTION(1, "i2c0", "sda", V_88F6810_PLUS)), 58 + MPP_MODE(4, 59 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 60 + MPP_VAR_FUNCTION(1, "ge", "mdc", V_88F6810_PLUS), 61 + MPP_VAR_FUNCTION(2, "ua1", "txd", V_88F6810_PLUS), 62 + MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6810_PLUS)), 63 + MPP_MODE(5, 64 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 65 + MPP_VAR_FUNCTION(1, "ge", "mdio", V_88F6810_PLUS), 66 + MPP_VAR_FUNCTION(2, "ua1", "rxd", V_88F6810_PLUS), 67 + MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6810_PLUS)), 68 + MPP_MODE(6, 69 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 70 + MPP_VAR_FUNCTION(1, "ge0", "txclkout", V_88F6810_PLUS), 71 + MPP_VAR_FUNCTION(2, "ge0", "crs", V_88F6810_PLUS), 72 + MPP_VAR_FUNCTION(5, "dev", "cs3", V_88F6810_PLUS)), 73 + MPP_MODE(7, 74 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 75 + MPP_VAR_FUNCTION(1, "ge0", "txd0", V_88F6810_PLUS), 76 + MPP_VAR_FUNCTION(5, "dev", "ad9", V_88F6810_PLUS)), 77 + MPP_MODE(8, 78 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 79 + MPP_VAR_FUNCTION(1, "ge0", "txd1", V_88F6810_PLUS), 80 + MPP_VAR_FUNCTION(5, "dev", "ad10", V_88F6810_PLUS)), 81 + MPP_MODE(9, 82 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 83 + MPP_VAR_FUNCTION(1, "ge0", "txd2", V_88F6810_PLUS), 84 + MPP_VAR_FUNCTION(5, "dev", "ad11", V_88F6810_PLUS)), 85 + MPP_MODE(10, 86 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 87 + MPP_VAR_FUNCTION(1, "ge0", "txd3", V_88F6810_PLUS), 88 + MPP_VAR_FUNCTION(5, "dev", "ad12", V_88F6810_PLUS)), 89 + MPP_MODE(11, 90 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 91 + MPP_VAR_FUNCTION(1, "ge0", "txctl", V_88F6810_PLUS), 92 + MPP_VAR_FUNCTION(5, "dev", "ad13", V_88F6810_PLUS)), 93 + MPP_MODE(12, 94 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 95 + MPP_VAR_FUNCTION(1, "ge0", "rxd0", V_88F6810_PLUS), 96 + MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), 97 + MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), 98 + MPP_VAR_FUNCTION(4, "spi0", "cs1", V_88F6810_PLUS), 99 + MPP_VAR_FUNCTION(5, "dev", "ad14", V_88F6810_PLUS)), 100 + MPP_MODE(13, 101 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 102 + MPP_VAR_FUNCTION(1, "ge0", "rxd1", V_88F6810_PLUS), 103 + MPP_VAR_FUNCTION(2, "pcie0", "clkreq", V_88F6810_PLUS), 104 + MPP_VAR_FUNCTION(3, "pcie1", "clkreq", V_88F6820_PLUS), 105 + MPP_VAR_FUNCTION(4, "spi0", "cs2", V_88F6810_PLUS), 106 + MPP_VAR_FUNCTION(5, "dev", "ad15", V_88F6810_PLUS)), 107 + MPP_MODE(14, 108 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 109 + MPP_VAR_FUNCTION(1, "ge0", "rxd2", V_88F6810_PLUS), 110 + MPP_VAR_FUNCTION(2, "ptp", "clk", V_88F6810_PLUS), 111 + MPP_VAR_FUNCTION(3, "m", "vtt_ctrl", V_88F6810_PLUS), 112 + MPP_VAR_FUNCTION(4, "spi0", "cs3", V_88F6810_PLUS), 113 + MPP_VAR_FUNCTION(5, "dev", "wen1", V_88F6810_PLUS)), 114 + MPP_MODE(15, 115 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 116 + MPP_VAR_FUNCTION(1, "ge0", "rxd3", V_88F6810_PLUS), 117 + MPP_VAR_FUNCTION(2, "ge", "mdc slave", V_88F6810_PLUS), 118 + MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6810_PLUS), 119 + MPP_VAR_FUNCTION(4, "spi0", "mosi", V_88F6810_PLUS), 120 + MPP_VAR_FUNCTION(5, "pcie1", "rstout", V_88F6820_PLUS)), 121 + MPP_MODE(16, 122 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 123 + MPP_VAR_FUNCTION(1, "ge0", "rxctl", V_88F6810_PLUS), 124 + MPP_VAR_FUNCTION(2, "ge", "mdio slave", V_88F6810_PLUS), 125 + MPP_VAR_FUNCTION(3, "m", "decc_err", V_88F6810_PLUS), 126 + MPP_VAR_FUNCTION(4, "spi0", "miso", V_88F6810_PLUS), 127 + MPP_VAR_FUNCTION(5, "pcie0", "clkreq", V_88F6810_PLUS)), 128 + MPP_MODE(17, 129 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 130 + MPP_VAR_FUNCTION(1, "ge0", "rxclk", V_88F6810_PLUS), 131 + MPP_VAR_FUNCTION(2, "ptp", "clk", V_88F6810_PLUS), 132 + MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6810_PLUS), 133 + MPP_VAR_FUNCTION(4, "spi0", "sck", V_88F6810_PLUS), 134 + MPP_VAR_FUNCTION(5, "sata1", "prsnt", V_88F6810_PLUS)), 135 + MPP_MODE(18, 136 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 137 + MPP_VAR_FUNCTION(1, "ge0", "rxerr", V_88F6810_PLUS), 138 + MPP_VAR_FUNCTION(2, "ptp", "trig_gen", V_88F6810_PLUS), 139 + MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6810_PLUS), 140 + MPP_VAR_FUNCTION(4, "spi0", "cs0", V_88F6810_PLUS), 141 + MPP_VAR_FUNCTION(5, "pcie1", "rstout", V_88F6820_PLUS)), 142 + MPP_MODE(19, 143 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 144 + MPP_VAR_FUNCTION(1, "ge0", "col", V_88F6810_PLUS), 145 + MPP_VAR_FUNCTION(2, "ptp", "event_req", V_88F6810_PLUS), 146 + MPP_VAR_FUNCTION(3, "pcie0", "clkreq", V_88F6810_PLUS), 147 + MPP_VAR_FUNCTION(4, "sata1", "prsnt", V_88F6810_PLUS), 148 + MPP_VAR_FUNCTION(5, "ua0", "cts", V_88F6810_PLUS)), 149 + MPP_MODE(20, 150 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 151 + MPP_VAR_FUNCTION(1, "ge0", "txclk", V_88F6810_PLUS), 152 + MPP_VAR_FUNCTION(2, "ptp", "clk", V_88F6810_PLUS), 153 + MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), 154 + MPP_VAR_FUNCTION(4, "sata0", "prsnt", V_88F6810_PLUS), 155 + MPP_VAR_FUNCTION(5, "ua0", "rts", V_88F6810_PLUS)), 156 + MPP_MODE(21, 157 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 158 + MPP_VAR_FUNCTION(1, "spi0", "cs1", V_88F6810_PLUS), 159 + MPP_VAR_FUNCTION(2, "ge1", "rxd0", V_88F6810_PLUS), 160 + MPP_VAR_FUNCTION(3, "sata0", "prsnt", V_88F6810_PLUS), 161 + MPP_VAR_FUNCTION(4, "sd0", "cmd", V_88F6810_PLUS), 162 + MPP_VAR_FUNCTION(5, "dev", "bootcs", V_88F6810_PLUS)), 163 + MPP_MODE(22, 164 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 165 + MPP_VAR_FUNCTION(1, "spi0", "mosi", V_88F6810_PLUS), 166 + MPP_VAR_FUNCTION(5, "dev", "ad0", V_88F6810_PLUS)), 167 + MPP_MODE(23, 168 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 169 + MPP_VAR_FUNCTION(1, "spi0", "sck", V_88F6810_PLUS), 170 + MPP_VAR_FUNCTION(5, "dev", "ad2", V_88F6810_PLUS)), 171 + MPP_MODE(24, 172 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 173 + MPP_VAR_FUNCTION(1, "spi0", "miso", V_88F6810_PLUS), 174 + MPP_VAR_FUNCTION(2, "ua0", "cts", V_88F6810_PLUS), 175 + MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6810_PLUS), 176 + MPP_VAR_FUNCTION(4, "sd0", "d4", V_88F6810_PLUS), 177 + MPP_VAR_FUNCTION(5, "dev", "ready", V_88F6810_PLUS)), 178 + MPP_MODE(25, 179 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 180 + MPP_VAR_FUNCTION(1, "spi0", "cs0", V_88F6810_PLUS), 181 + MPP_VAR_FUNCTION(2, "ua0", "rts", V_88F6810_PLUS), 182 + MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6810_PLUS), 183 + MPP_VAR_FUNCTION(4, "sd0", "d5", V_88F6810_PLUS), 184 + MPP_VAR_FUNCTION(5, "dev", "cs0", V_88F6810_PLUS)), 185 + MPP_MODE(26, 186 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 187 + MPP_VAR_FUNCTION(1, "spi0", "cs2", V_88F6810_PLUS), 188 + MPP_VAR_FUNCTION(3, "i2c1", "sck", V_88F6810_PLUS), 189 + MPP_VAR_FUNCTION(4, "sd0", "d6", V_88F6810_PLUS), 190 + MPP_VAR_FUNCTION(5, "dev", "cs1", V_88F6810_PLUS)), 191 + MPP_MODE(27, 192 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 193 + MPP_VAR_FUNCTION(1, "spi0", "cs3", V_88F6810_PLUS), 194 + MPP_VAR_FUNCTION(2, "ge1", "txclkout", V_88F6810_PLUS), 195 + MPP_VAR_FUNCTION(3, "i2c1", "sda", V_88F6810_PLUS), 196 + MPP_VAR_FUNCTION(4, "sd0", "d7", V_88F6810_PLUS), 197 + MPP_VAR_FUNCTION(5, "dev", "cs2", V_88F6810_PLUS)), 198 + MPP_MODE(28, 199 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 200 + MPP_VAR_FUNCTION(2, "ge1", "txd0", V_88F6810_PLUS), 201 + MPP_VAR_FUNCTION(4, "sd0", "clk", V_88F6810_PLUS), 202 + MPP_VAR_FUNCTION(5, "dev", "ad5", V_88F6810_PLUS)), 203 + MPP_MODE(29, 204 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 205 + MPP_VAR_FUNCTION(2, "ge1", "txd1", V_88F6810_PLUS), 206 + MPP_VAR_FUNCTION(5, "dev", "ale0", V_88F6810_PLUS)), 207 + MPP_MODE(30, 208 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 209 + MPP_VAR_FUNCTION(2, "ge1", "txd2", V_88F6810_PLUS), 210 + MPP_VAR_FUNCTION(5, "dev", "oen", V_88F6810_PLUS)), 211 + MPP_MODE(31, 212 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 213 + MPP_VAR_FUNCTION(2, "ge1", "txd3", V_88F6810_PLUS), 214 + MPP_VAR_FUNCTION(5, "dev", "ale1", V_88F6810_PLUS)), 215 + MPP_MODE(32, 216 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 217 + MPP_VAR_FUNCTION(2, "ge1", "txctl", V_88F6810_PLUS), 218 + MPP_VAR_FUNCTION(5, "dev", "wen0", V_88F6810_PLUS)), 219 + MPP_MODE(33, 220 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 221 + MPP_VAR_FUNCTION(1, "m", "decc_err", V_88F6810_PLUS), 222 + MPP_VAR_FUNCTION(5, "dev", "ad3", V_88F6810_PLUS)), 223 + MPP_MODE(34, 224 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 225 + MPP_VAR_FUNCTION(5, "dev", "ad1", V_88F6810_PLUS)), 226 + MPP_MODE(35, 227 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 228 + MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6810_PLUS), 229 + MPP_VAR_FUNCTION(5, "dev", "a1", V_88F6810_PLUS)), 230 + MPP_MODE(36, 231 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 232 + MPP_VAR_FUNCTION(1, "ptp", "trig_gen", V_88F6810_PLUS), 233 + MPP_VAR_FUNCTION(5, "dev", "a0", V_88F6810_PLUS)), 234 + MPP_MODE(37, 235 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 236 + MPP_VAR_FUNCTION(1, "ptp", "clk", V_88F6810_PLUS), 237 + MPP_VAR_FUNCTION(2, "ge1", "rxclk", V_88F6810_PLUS), 238 + MPP_VAR_FUNCTION(4, "sd0", "d3", V_88F6810_PLUS), 239 + MPP_VAR_FUNCTION(5, "dev", "ad8", V_88F6810_PLUS)), 240 + MPP_MODE(38, 241 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 242 + MPP_VAR_FUNCTION(1, "ptp", "event_req", V_88F6810_PLUS), 243 + MPP_VAR_FUNCTION(2, "ge1", "rxd1", V_88F6810_PLUS), 244 + MPP_VAR_FUNCTION(3, "ref", "clk_out0", V_88F6810_PLUS), 245 + MPP_VAR_FUNCTION(4, "sd0", "d0", V_88F6810_PLUS), 246 + MPP_VAR_FUNCTION(5, "dev", "ad4", V_88F6810_PLUS)), 247 + MPP_MODE(39, 248 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 249 + MPP_VAR_FUNCTION(1, "i2c1", "sck", V_88F6810_PLUS), 250 + MPP_VAR_FUNCTION(2, "ge1", "rxd2", V_88F6810_PLUS), 251 + MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6810_PLUS), 252 + MPP_VAR_FUNCTION(4, "sd0", "d1", V_88F6810_PLUS), 253 + MPP_VAR_FUNCTION(5, "dev", "a2", V_88F6810_PLUS)), 254 + MPP_MODE(40, 255 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 256 + MPP_VAR_FUNCTION(1, "i2c1", "sda", V_88F6810_PLUS), 257 + MPP_VAR_FUNCTION(2, "ge1", "rxd3", V_88F6810_PLUS), 258 + MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6810_PLUS), 259 + MPP_VAR_FUNCTION(4, "sd0", "d2", V_88F6810_PLUS), 260 + MPP_VAR_FUNCTION(5, "dev", "ad6", V_88F6810_PLUS)), 261 + MPP_MODE(41, 262 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 263 + MPP_VAR_FUNCTION(1, "ua1", "rxd", V_88F6810_PLUS), 264 + MPP_VAR_FUNCTION(2, "ge1", "rxctl", V_88F6810_PLUS), 265 + MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6810_PLUS), 266 + MPP_VAR_FUNCTION(4, "spi1", "cs3", V_88F6810_PLUS), 267 + MPP_VAR_FUNCTION(5, "dev", "burst/last", V_88F6810_PLUS)), 268 + MPP_MODE(42, 269 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 270 + MPP_VAR_FUNCTION(1, "ua1", "txd", V_88F6810_PLUS), 271 + MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6810_PLUS), 272 + MPP_VAR_FUNCTION(5, "dev", "ad7", V_88F6810_PLUS)), 273 + MPP_MODE(43, 274 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 275 + MPP_VAR_FUNCTION(1, "pcie0", "clkreq", V_88F6810_PLUS), 276 + MPP_VAR_FUNCTION(2, "m", "vtt_ctrl", V_88F6810_PLUS), 277 + MPP_VAR_FUNCTION(3, "m", "decc_err", V_88F6810_PLUS), 278 + MPP_VAR_FUNCTION(4, "pcie0", "rstout", V_88F6810_PLUS), 279 + MPP_VAR_FUNCTION(5, "dev", "clkout", V_88F6810_PLUS)), 280 + MPP_MODE(44, 281 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 282 + MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), 283 + MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), 284 + MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6828), 285 + MPP_VAR_FUNCTION(4, "sata3", "prsnt", V_88F6828), 286 + MPP_VAR_FUNCTION(5, "pcie0", "rstout", V_88F6810_PLUS)), 287 + MPP_MODE(45, 288 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 289 + MPP_VAR_FUNCTION(1, "ref", "clk_out0", V_88F6810_PLUS), 290 + MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), 291 + MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), 292 + MPP_VAR_FUNCTION(4, "pcie2", "rstout", V_88F6810_PLUS), 293 + MPP_VAR_FUNCTION(5, "pcie3", "rstout", V_88F6810_PLUS)), 294 + MPP_MODE(46, 295 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 296 + MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6810_PLUS), 297 + MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6810_PLUS), 298 + MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), 299 + MPP_VAR_FUNCTION(4, "pcie2", "rstout", V_88F6810_PLUS), 300 + MPP_VAR_FUNCTION(5, "pcie3", "rstout", V_88F6810_PLUS)), 301 + MPP_MODE(47, 302 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 303 + MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), 304 + MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), 305 + MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6828), 306 + MPP_VAR_FUNCTION(4, "spi1", "cs2", V_88F6810_PLUS), 307 + MPP_VAR_FUNCTION(5, "sata3", "prsnt", V_88F6828)), 308 + MPP_MODE(48, 309 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 310 + MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), 311 + MPP_VAR_FUNCTION(2, "m", "vtt_ctrl", V_88F6810_PLUS), 312 + MPP_VAR_FUNCTION(3, "tdm2c", "pclk", V_88F6810_PLUS), 313 + MPP_VAR_FUNCTION(4, "audio", "mclk", V_88F6810_PLUS), 314 + MPP_VAR_FUNCTION(5, "sd0", "d4", V_88F6810_PLUS)), 315 + MPP_MODE(49, 316 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 317 + MPP_VAR_FUNCTION(1, "sata2", "prsnt", V_88F6828), 318 + MPP_VAR_FUNCTION(2, "sata3", "prsnt", V_88F6828), 319 + MPP_VAR_FUNCTION(3, "tdm2c", "fsync", V_88F6810_PLUS), 320 + MPP_VAR_FUNCTION(4, "audio", "lrclk", V_88F6810_PLUS), 321 + MPP_VAR_FUNCTION(5, "sd0", "d5", V_88F6810_PLUS)), 322 + MPP_MODE(50, 323 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 324 + MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), 325 + MPP_VAR_FUNCTION(2, "pcie1", "rstout", V_88F6820_PLUS), 326 + MPP_VAR_FUNCTION(3, "tdm2c", "drx", V_88F6810_PLUS), 327 + MPP_VAR_FUNCTION(4, "audio", "extclk", V_88F6810_PLUS), 328 + MPP_VAR_FUNCTION(5, "sd0", "cmd", V_88F6810_PLUS)), 329 + MPP_MODE(51, 330 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 331 + MPP_VAR_FUNCTION(3, "tdm2c", "dtx", V_88F6810_PLUS), 332 + MPP_VAR_FUNCTION(4, "audio", "sdo", V_88F6810_PLUS), 333 + MPP_VAR_FUNCTION(5, "m", "decc_err", V_88F6810_PLUS)), 334 + MPP_MODE(52, 335 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 336 + MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), 337 + MPP_VAR_FUNCTION(2, "pcie1", "rstout", V_88F6820_PLUS), 338 + MPP_VAR_FUNCTION(3, "tdm2c", "intn", V_88F6810_PLUS), 339 + MPP_VAR_FUNCTION(4, "audio", "sdi", V_88F6810_PLUS), 340 + MPP_VAR_FUNCTION(5, "sd0", "d6", V_88F6810_PLUS)), 341 + MPP_MODE(53, 342 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 343 + MPP_VAR_FUNCTION(1, "sata1", "prsnt", V_88F6810_PLUS), 344 + MPP_VAR_FUNCTION(2, "sata0", "prsnt", V_88F6810_PLUS), 345 + MPP_VAR_FUNCTION(3, "tdm2c", "rstn", V_88F6810_PLUS), 346 + MPP_VAR_FUNCTION(4, "audio", "bclk", V_88F6810_PLUS), 347 + MPP_VAR_FUNCTION(5, "sd0", "d7", V_88F6810_PLUS)), 348 + MPP_MODE(54, 349 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 350 + MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6810_PLUS), 351 + MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6810_PLUS), 352 + MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6810_PLUS), 353 + MPP_VAR_FUNCTION(4, "pcie1", "rstout", V_88F6820_PLUS), 354 + MPP_VAR_FUNCTION(5, "sd0", "d3", V_88F6810_PLUS)), 355 + MPP_MODE(55, 356 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 357 + MPP_VAR_FUNCTION(1, "ua1", "cts", V_88F6810_PLUS), 358 + MPP_VAR_FUNCTION(2, "ge", "mdio", V_88F6810_PLUS), 359 + MPP_VAR_FUNCTION(3, "pcie1", "clkreq", V_88F6820_PLUS), 360 + MPP_VAR_FUNCTION(4, "spi1", "cs1", V_88F6810_PLUS), 361 + MPP_VAR_FUNCTION(5, "sd0", "d0", V_88F6810_PLUS)), 362 + MPP_MODE(56, 363 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 364 + MPP_VAR_FUNCTION(1, "ua1", "rts", V_88F6810_PLUS), 365 + MPP_VAR_FUNCTION(2, "ge", "mdc", V_88F6810_PLUS), 366 + MPP_VAR_FUNCTION(3, "m", "decc_err", V_88F6810_PLUS), 367 + MPP_VAR_FUNCTION(4, "spi1", "mosi", V_88F6810_PLUS)), 368 + MPP_MODE(57, 369 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 370 + MPP_VAR_FUNCTION(4, "spi1", "sck", V_88F6810_PLUS), 371 + MPP_VAR_FUNCTION(5, "sd0", "clk", V_88F6810_PLUS)), 372 + MPP_MODE(58, 373 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 374 + MPP_VAR_FUNCTION(1, "pcie1", "clkreq", V_88F6820_PLUS), 375 + MPP_VAR_FUNCTION(2, "i2c1", "sck", V_88F6810_PLUS), 376 + MPP_VAR_FUNCTION(3, "pcie2", "clkreq", V_88F6810_PLUS), 377 + MPP_VAR_FUNCTION(4, "spi1", "miso", V_88F6810_PLUS), 378 + MPP_VAR_FUNCTION(5, "sd0", "d1", V_88F6810_PLUS)), 379 + MPP_MODE(59, 380 + MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6810_PLUS), 381 + MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6810_PLUS), 382 + MPP_VAR_FUNCTION(2, "i2c1", "sda", V_88F6810_PLUS), 383 + MPP_VAR_FUNCTION(3, "pcie1", "rstout", V_88F6820_PLUS), 384 + MPP_VAR_FUNCTION(4, "spi1", "cs0", V_88F6810_PLUS), 385 + MPP_VAR_FUNCTION(5, "sd0", "d2", V_88F6810_PLUS)), 386 + }; 387 + 388 + static struct mvebu_pinctrl_soc_info armada_38x_pinctrl_info; 389 + 390 + static struct of_device_id armada_38x_pinctrl_of_match[] = { 391 + { 392 + .compatible = "marvell,mv88f6810-pinctrl", 393 + .data = (void *) V_88F6810, 394 + }, 395 + { 396 + .compatible = "marvell,mv88f6820-pinctrl", 397 + .data = (void *) V_88F6820, 398 + }, 399 + { 400 + .compatible = "marvell,mv88f6828-pinctrl", 401 + .data = (void *) V_88F6828, 402 + }, 403 + { }, 404 + }; 405 + 406 + static struct mvebu_mpp_ctrl armada_38x_mpp_controls[] = { 407 + MPP_FUNC_CTRL(0, 59, NULL, armada_38x_mpp_ctrl), 408 + }; 409 + 410 + static struct pinctrl_gpio_range armada_38x_mpp_gpio_ranges[] = { 411 + MPP_GPIO_RANGE(0, 0, 0, 32), 412 + MPP_GPIO_RANGE(1, 32, 32, 27), 413 + }; 414 + 415 + static int armada_38x_pinctrl_probe(struct platform_device *pdev) 416 + { 417 + struct mvebu_pinctrl_soc_info *soc = &armada_38x_pinctrl_info; 418 + const struct of_device_id *match = 419 + of_match_device(armada_38x_pinctrl_of_match, &pdev->dev); 420 + struct resource *res; 421 + 422 + if (!match) 423 + return -ENODEV; 424 + 425 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 426 + mpp_base = devm_ioremap_resource(&pdev->dev, res); 427 + if (IS_ERR(mpp_base)) 428 + return PTR_ERR(mpp_base); 429 + 430 + soc->variant = (unsigned) match->data & 0xff; 431 + soc->controls = armada_38x_mpp_controls; 432 + soc->ncontrols = ARRAY_SIZE(armada_38x_mpp_controls); 433 + soc->gpioranges = armada_38x_mpp_gpio_ranges; 434 + soc->ngpioranges = ARRAY_SIZE(armada_38x_mpp_gpio_ranges); 435 + soc->modes = armada_38x_mpp_modes; 436 + soc->nmodes = armada_38x_mpp_controls[0].npins; 437 + 438 + pdev->dev.platform_data = soc; 439 + 440 + return mvebu_pinctrl_probe(pdev); 441 + } 442 + 443 + static int armada_38x_pinctrl_remove(struct platform_device *pdev) 444 + { 445 + return mvebu_pinctrl_remove(pdev); 446 + } 447 + 448 + static struct platform_driver armada_38x_pinctrl_driver = { 449 + .driver = { 450 + .name = "armada-38x-pinctrl", 451 + .owner = THIS_MODULE, 452 + .of_match_table = of_match_ptr(armada_38x_pinctrl_of_match), 453 + }, 454 + .probe = armada_38x_pinctrl_probe, 455 + .remove = armada_38x_pinctrl_remove, 456 + }; 457 + 458 + module_platform_driver(armada_38x_pinctrl_driver); 459 + 460 + MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 461 + MODULE_DESCRIPTION("Marvell Armada 38x pinctrl driver"); 462 + MODULE_LICENSE("GPL v2");
+21 -3
drivers/pinctrl/mvebu/pinctrl-armada-xp.c
··· 33 33 34 34 #include "pinctrl-mvebu.h" 35 35 36 + static void __iomem *mpp_base; 37 + 38 + static int armada_xp_mpp_ctrl_get(unsigned pid, unsigned long *config) 39 + { 40 + return default_mpp_ctrl_get(mpp_base, pid, config); 41 + } 42 + 43 + static int armada_xp_mpp_ctrl_set(unsigned pid, unsigned long config) 44 + { 45 + return default_mpp_ctrl_set(mpp_base, pid, config); 46 + } 47 + 36 48 enum armada_xp_variant { 37 49 V_MV78230 = BIT(0), 38 50 V_MV78260 = BIT(1), ··· 378 366 }; 379 367 380 368 static struct mvebu_mpp_ctrl mv78230_mpp_controls[] = { 381 - MPP_REG_CTRL(0, 48), 369 + MPP_FUNC_CTRL(0, 48, NULL, armada_xp_mpp_ctrl), 382 370 }; 383 371 384 372 static struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = { ··· 387 375 }; 388 376 389 377 static struct mvebu_mpp_ctrl mv78260_mpp_controls[] = { 390 - MPP_REG_CTRL(0, 66), 378 + MPP_FUNC_CTRL(0, 66, NULL, armada_xp_mpp_ctrl), 391 379 }; 392 380 393 381 static struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = { ··· 397 385 }; 398 386 399 387 static struct mvebu_mpp_ctrl mv78460_mpp_controls[] = { 400 - MPP_REG_CTRL(0, 66), 388 + MPP_FUNC_CTRL(0, 66, NULL, armada_xp_mpp_ctrl), 401 389 }; 402 390 403 391 static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = { ··· 411 399 struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; 412 400 const struct of_device_id *match = 413 401 of_match_device(armada_xp_pinctrl_of_match, &pdev->dev); 402 + struct resource *res; 414 403 415 404 if (!match) 416 405 return -ENODEV; 406 + 407 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 408 + mpp_base = devm_ioremap_resource(&pdev->dev, res); 409 + if (IS_ERR(mpp_base)) 410 + return PTR_ERR(mpp_base); 417 411 418 412 soc->variant = (unsigned) match->data & 0xff; 419 413
+231 -186
drivers/pinctrl/mvebu/pinctrl-dove.c
··· 18 18 #include <linux/clk.h> 19 19 #include <linux/of.h> 20 20 #include <linux/of_device.h> 21 + #include <linux/mfd/syscon.h> 21 22 #include <linux/pinctrl/pinctrl.h> 23 + #include <linux/regmap.h> 22 24 23 25 #include "pinctrl-mvebu.h" 24 26 25 - #define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000) 26 - #define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200) 27 - #define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10) 28 - #define DOVE_AU0_AC97_SEL BIT(16) 29 - #define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C) 30 - #define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030) 31 - #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C) 32 - #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C) 33 - #define DOVE_TWSI_ENABLE_OPTION1 BIT(7) 34 - #define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE + 0xe8030) 35 - #define DOVE_TWSI_ENABLE_OPTION2 BIT(20) 36 - #define DOVE_TWSI_ENABLE_OPTION3 BIT(21) 37 - #define DOVE_TWSI_OPTION3_GPIO BIT(22) 38 - #define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE + 0xe8034) 39 - #define DOVE_SSP_ON_AU1 BIT(0) 40 - #define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe803c) 41 - #define DOVE_AU1_SPDIFO_GPIO_EN BIT(1) 42 - #define DOVE_NAND_GPIO_EN BIT(0) 43 - #define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0400) 44 - #define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40) 45 - #define DOVE_SPI_GPIO_SEL BIT(5) 46 - #define DOVE_UART1_GPIO_SEL BIT(4) 47 - #define DOVE_AU1_GPIO_SEL BIT(3) 48 - #define DOVE_CAM_GPIO_SEL BIT(2) 49 - #define DOVE_SD1_GPIO_SEL BIT(1) 50 - #define DOVE_SD0_GPIO_SEL BIT(0) 27 + /* Internal registers can be configured at any 1 MiB aligned address */ 28 + #define INT_REGS_MASK ~(SZ_1M - 1) 29 + #define MPP4_REGS_OFFS 0xd0440 30 + #define PMU_REGS_OFFS 0xd802c 31 + #define GC_REGS_OFFS 0xe802c 51 32 52 - #define MPPS_PER_REG 8 53 - #define MPP_BITS 4 54 - #define MPP_MASK 0xf 33 + /* MPP Base registers */ 34 + #define PMU_MPP_GENERAL_CTRL 0x10 35 + #define AU0_AC97_SEL BIT(16) 36 + 37 + /* MPP Control 4 register */ 38 + #define SPI_GPIO_SEL BIT(5) 39 + #define UART1_GPIO_SEL BIT(4) 40 + #define AU1_GPIO_SEL BIT(3) 41 + #define CAM_GPIO_SEL BIT(2) 42 + #define SD1_GPIO_SEL BIT(1) 43 + #define SD0_GPIO_SEL BIT(0) 44 + 45 + /* PMU Signal Select registers */ 46 + #define PMU_SIGNAL_SELECT_0 0x00 47 + #define PMU_SIGNAL_SELECT_1 0x04 48 + 49 + /* Global Config regmap registers */ 50 + #define GLOBAL_CONFIG_1 0x00 51 + #define TWSI_ENABLE_OPTION1 BIT(7) 52 + #define GLOBAL_CONFIG_2 0x04 53 + #define TWSI_ENABLE_OPTION2 BIT(20) 54 + #define TWSI_ENABLE_OPTION3 BIT(21) 55 + #define TWSI_OPTION3_GPIO BIT(22) 56 + #define SSP_CTRL_STATUS_1 0x08 57 + #define SSP_ON_AU1 BIT(0) 58 + #define MPP_GENERAL_CONFIG 0x10 59 + #define AU1_SPDIFO_GPIO_EN BIT(1) 60 + #define NAND_GPIO_EN BIT(0) 55 61 56 62 #define CONFIG_PMU BIT(4) 57 63 58 - static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 59 - unsigned long *config) 64 + static void __iomem *mpp_base; 65 + static void __iomem *mpp4_base; 66 + static void __iomem *pmu_base; 67 + static struct regmap *gconfmap; 68 + 69 + static int dove_mpp_ctrl_get(unsigned pid, unsigned long *config) 60 70 { 61 - unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; 62 - unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; 63 - unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 71 + return default_mpp_ctrl_get(mpp_base, pid, config); 72 + } 73 + 74 + static int dove_mpp_ctrl_set(unsigned pid, unsigned long config) 75 + { 76 + return default_mpp_ctrl_set(mpp_base, pid, config); 77 + } 78 + 79 + static int dove_pmu_mpp_ctrl_get(unsigned pid, unsigned long *config) 80 + { 81 + unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 82 + unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 83 + unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL); 64 84 unsigned long func; 65 85 66 - if (pmu & (1 << ctrl->pid)) { 67 - func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 68 - *config = (func >> shift) & MPP_MASK; 69 - *config |= CONFIG_PMU; 70 - } else { 71 - func = readl(DOVE_MPP_VIRT_BASE + off); 72 - *config = (func >> shift) & MPP_MASK; 73 - } 86 + if ((pmu & BIT(pid)) == 0) 87 + return default_mpp_ctrl_get(mpp_base, pid, config); 88 + 89 + func = readl(pmu_base + PMU_SIGNAL_SELECT_0 + off); 90 + *config = (func >> shift) & MVEBU_MPP_MASK; 91 + *config |= CONFIG_PMU; 92 + 74 93 return 0; 75 94 } 76 95 77 - static int dove_pmu_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 78 - unsigned long config) 96 + static int dove_pmu_mpp_ctrl_set(unsigned pid, unsigned long config) 79 97 { 80 - unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS; 81 - unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS; 82 - unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 98 + unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 99 + unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 100 + unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL); 83 101 unsigned long func; 84 102 85 - if (config & CONFIG_PMU) { 86 - writel(pmu | (1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); 87 - func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off); 88 - func &= ~(MPP_MASK << shift); 89 - func |= (config & MPP_MASK) << shift; 90 - writel(func, DOVE_PMU_SIGNAL_SELECT_0 + off); 91 - } else { 92 - writel(pmu & ~(1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL); 93 - func = readl(DOVE_MPP_VIRT_BASE + off); 94 - func &= ~(MPP_MASK << shift); 95 - func |= (config & MPP_MASK) << shift; 96 - writel(func, DOVE_MPP_VIRT_BASE + off); 103 + if ((config & CONFIG_PMU) == 0) { 104 + writel(pmu & ~BIT(pid), mpp_base + PMU_MPP_GENERAL_CTRL); 105 + return default_mpp_ctrl_set(mpp_base, pid, config); 97 106 } 107 + 108 + writel(pmu | BIT(pid), mpp_base + PMU_MPP_GENERAL_CTRL); 109 + func = readl(pmu_base + PMU_SIGNAL_SELECT_0 + off); 110 + func &= ~(MVEBU_MPP_MASK << shift); 111 + func |= (config & MVEBU_MPP_MASK) << shift; 112 + writel(func, pmu_base + PMU_SIGNAL_SELECT_0 + off); 113 + 98 114 return 0; 99 115 } 100 116 101 - static int dove_mpp4_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 102 - unsigned long *config) 117 + static int dove_mpp4_ctrl_get(unsigned pid, unsigned long *config) 103 118 { 104 - unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 119 + unsigned long mpp4 = readl(mpp4_base); 105 120 unsigned long mask; 106 121 107 - switch (ctrl->pid) { 122 + switch (pid) { 108 123 case 24: /* mpp_camera */ 109 - mask = DOVE_CAM_GPIO_SEL; 124 + mask = CAM_GPIO_SEL; 110 125 break; 111 126 case 40: /* mpp_sdio0 */ 112 - mask = DOVE_SD0_GPIO_SEL; 127 + mask = SD0_GPIO_SEL; 113 128 break; 114 129 case 46: /* mpp_sdio1 */ 115 - mask = DOVE_SD1_GPIO_SEL; 130 + mask = SD1_GPIO_SEL; 116 131 break; 117 132 case 58: /* mpp_spi0 */ 118 - mask = DOVE_SPI_GPIO_SEL; 133 + mask = SPI_GPIO_SEL; 119 134 break; 120 135 case 62: /* mpp_uart1 */ 121 - mask = DOVE_UART1_GPIO_SEL; 136 + mask = UART1_GPIO_SEL; 122 137 break; 123 138 default: 124 139 return -EINVAL; ··· 144 129 return 0; 145 130 } 146 131 147 - static int dove_mpp4_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 148 - unsigned long config) 132 + static int dove_mpp4_ctrl_set(unsigned pid, unsigned long config) 149 133 { 150 - unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 134 + unsigned long mpp4 = readl(mpp4_base); 151 135 unsigned long mask; 152 136 153 - switch (ctrl->pid) { 137 + switch (pid) { 154 138 case 24: /* mpp_camera */ 155 - mask = DOVE_CAM_GPIO_SEL; 139 + mask = CAM_GPIO_SEL; 156 140 break; 157 141 case 40: /* mpp_sdio0 */ 158 - mask = DOVE_SD0_GPIO_SEL; 142 + mask = SD0_GPIO_SEL; 159 143 break; 160 144 case 46: /* mpp_sdio1 */ 161 - mask = DOVE_SD1_GPIO_SEL; 145 + mask = SD1_GPIO_SEL; 162 146 break; 163 147 case 58: /* mpp_spi0 */ 164 - mask = DOVE_SPI_GPIO_SEL; 148 + mask = SPI_GPIO_SEL; 165 149 break; 166 150 case 62: /* mpp_uart1 */ 167 - mask = DOVE_UART1_GPIO_SEL; 151 + mask = UART1_GPIO_SEL; 168 152 break; 169 153 default: 170 154 return -EINVAL; ··· 173 159 if (config) 174 160 mpp4 |= mask; 175 161 176 - writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 162 + writel(mpp4, mpp4_base); 177 163 178 164 return 0; 179 165 } 180 166 181 - static int dove_nand_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 182 - unsigned long *config) 167 + static int dove_nand_ctrl_get(unsigned pid, unsigned long *config) 183 168 { 184 - unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 169 + unsigned int gmpp; 185 170 186 - *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0); 171 + regmap_read(gconfmap, MPP_GENERAL_CONFIG, &gmpp); 172 + *config = ((gmpp & NAND_GPIO_EN) != 0); 187 173 188 174 return 0; 189 175 } 190 176 191 - static int dove_nand_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 192 - unsigned long config) 177 + static int dove_nand_ctrl_set(unsigned pid, unsigned long config) 193 178 { 194 - unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 179 + regmap_update_bits(gconfmap, MPP_GENERAL_CONFIG, 180 + NAND_GPIO_EN, 181 + (config) ? NAND_GPIO_EN : 0); 182 + return 0; 183 + } 195 184 196 - gmpp &= ~DOVE_NAND_GPIO_EN; 185 + static int dove_audio0_ctrl_get(unsigned pid, unsigned long *config) 186 + { 187 + unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL); 188 + 189 + *config = ((pmu & AU0_AC97_SEL) != 0); 190 + 191 + return 0; 192 + } 193 + 194 + static int dove_audio0_ctrl_set(unsigned pid, unsigned long config) 195 + { 196 + unsigned long pmu = readl(mpp_base + PMU_MPP_GENERAL_CTRL); 197 + 198 + pmu &= ~AU0_AC97_SEL; 197 199 if (config) 198 - gmpp |= DOVE_NAND_GPIO_EN; 199 - 200 - writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 201 - 202 - return 0; 203 - } 204 - 205 - static int dove_audio0_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 206 - unsigned long *config) 207 - { 208 - unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 209 - 210 - *config = ((pmu & DOVE_AU0_AC97_SEL) != 0); 200 + pmu |= AU0_AC97_SEL; 201 + writel(pmu, mpp_base + PMU_MPP_GENERAL_CTRL); 211 202 212 203 return 0; 213 204 } 214 205 215 - static int dove_audio0_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 216 - unsigned long config) 206 + static int dove_audio1_ctrl_get(unsigned pid, unsigned long *config) 217 207 { 218 - unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL); 208 + unsigned int mpp4 = readl(mpp4_base); 209 + unsigned int sspc1; 210 + unsigned int gmpp; 211 + unsigned int gcfg2; 219 212 220 - pmu &= ~DOVE_AU0_AC97_SEL; 221 - if (config) 222 - pmu |= DOVE_AU0_AC97_SEL; 223 - writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL); 224 - 225 - return 0; 226 - } 227 - 228 - static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 229 - unsigned long *config) 230 - { 231 - unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 232 - unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 233 - unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 234 - unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 213 + regmap_read(gconfmap, SSP_CTRL_STATUS_1, &sspc1); 214 + regmap_read(gconfmap, MPP_GENERAL_CONFIG, &gmpp); 215 + regmap_read(gconfmap, GLOBAL_CONFIG_2, &gcfg2); 235 216 236 217 *config = 0; 237 - if (mpp4 & DOVE_AU1_GPIO_SEL) 218 + if (mpp4 & AU1_GPIO_SEL) 238 219 *config |= BIT(3); 239 - if (sspc1 & DOVE_SSP_ON_AU1) 220 + if (sspc1 & SSP_ON_AU1) 240 221 *config |= BIT(2); 241 - if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN) 222 + if (gmpp & AU1_SPDIFO_GPIO_EN) 242 223 *config |= BIT(1); 243 - if (gcfg2 & DOVE_TWSI_OPTION3_GPIO) 224 + if (gcfg2 & TWSI_OPTION3_GPIO) 244 225 *config |= BIT(0); 245 226 246 227 /* SSP/TWSI only if I2S1 not set*/ ··· 247 238 return 0; 248 239 } 249 240 250 - static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 251 - unsigned long config) 241 + static int dove_audio1_ctrl_set(unsigned pid, unsigned long config) 252 242 { 253 - unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 254 - unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1); 255 - unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE); 256 - unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 243 + unsigned int mpp4 = readl(mpp4_base); 257 244 258 - /* 259 - * clear all audio1 related bits before configure 260 - */ 261 - gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO; 262 - gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN; 263 - sspc1 &= ~DOVE_SSP_ON_AU1; 264 - mpp4 &= ~DOVE_AU1_GPIO_SEL; 265 - 266 - if (config & BIT(0)) 267 - gcfg2 |= DOVE_TWSI_OPTION3_GPIO; 268 - if (config & BIT(1)) 269 - gmpp |= DOVE_AU1_SPDIFO_GPIO_EN; 270 - if (config & BIT(2)) 271 - sspc1 |= DOVE_SSP_ON_AU1; 245 + mpp4 &= ~AU1_GPIO_SEL; 272 246 if (config & BIT(3)) 273 - mpp4 |= DOVE_AU1_GPIO_SEL; 247 + mpp4 |= AU1_GPIO_SEL; 248 + writel(mpp4, mpp4_base); 274 249 275 - writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE); 276 - writel(sspc1, DOVE_SSP_CTRL_STATUS_1); 277 - writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE); 278 - writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 250 + regmap_update_bits(gconfmap, SSP_CTRL_STATUS_1, 251 + SSP_ON_AU1, 252 + (config & BIT(2)) ? SSP_ON_AU1 : 0); 253 + regmap_update_bits(gconfmap, MPP_GENERAL_CONFIG, 254 + AU1_SPDIFO_GPIO_EN, 255 + (config & BIT(1)) ? AU1_SPDIFO_GPIO_EN : 0); 256 + regmap_update_bits(gconfmap, GLOBAL_CONFIG_2, 257 + TWSI_OPTION3_GPIO, 258 + (config & BIT(0)) ? TWSI_OPTION3_GPIO : 0); 279 259 280 260 return 0; 281 261 } ··· 274 276 * break other functions. If you require all mpps as gpio 275 277 * enforce gpio setting by pinctrl mapping. 276 278 */ 277 - static int dove_audio1_ctrl_gpio_req(struct mvebu_mpp_ctrl *ctrl, u8 pid) 279 + static int dove_audio1_ctrl_gpio_req(unsigned pid) 278 280 { 279 281 unsigned long config; 280 282 281 - dove_audio1_ctrl_get(ctrl, &config); 283 + dove_audio1_ctrl_get(pid, &config); 282 284 283 285 switch (config) { 284 286 case 0x02: /* i2s1 : gpio[56:57] */ ··· 301 303 } 302 304 303 305 /* mpp[52:57] has gpio pins capable of in and out */ 304 - static int dove_audio1_ctrl_gpio_dir(struct mvebu_mpp_ctrl *ctrl, u8 pid, 305 - bool input) 306 + static int dove_audio1_ctrl_gpio_dir(unsigned pid, bool input) 306 307 { 307 308 if (pid < 52 || pid > 57) 308 309 return -ENOTSUPP; 309 310 return 0; 310 311 } 311 312 312 - static int dove_twsi_ctrl_get(struct mvebu_mpp_ctrl *ctrl, 313 - unsigned long *config) 313 + static int dove_twsi_ctrl_get(unsigned pid, unsigned long *config) 314 314 { 315 - unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 316 - unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 315 + unsigned int gcfg1; 316 + unsigned int gcfg2; 317 + 318 + regmap_read(gconfmap, GLOBAL_CONFIG_1, &gcfg1); 319 + regmap_read(gconfmap, GLOBAL_CONFIG_2, &gcfg2); 317 320 318 321 *config = 0; 319 - if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1) 322 + if (gcfg1 & TWSI_ENABLE_OPTION1) 320 323 *config = 1; 321 - else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2) 324 + else if (gcfg2 & TWSI_ENABLE_OPTION2) 322 325 *config = 2; 323 - else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3) 326 + else if (gcfg2 & TWSI_ENABLE_OPTION3) 324 327 *config = 3; 325 328 326 329 return 0; 327 330 } 328 331 329 - static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl, 330 - unsigned long config) 332 + static int dove_twsi_ctrl_set(unsigned pid, unsigned long config) 331 333 { 332 - unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1); 333 - unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); 334 - 335 - gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; 336 - gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION3); 334 + unsigned int gcfg1 = 0; 335 + unsigned int gcfg2 = 0; 337 336 338 337 switch (config) { 339 338 case 1: 340 - gcfg1 |= DOVE_TWSI_ENABLE_OPTION1; 339 + gcfg1 = TWSI_ENABLE_OPTION1; 341 340 break; 342 341 case 2: 343 - gcfg2 |= DOVE_TWSI_ENABLE_OPTION2; 342 + gcfg2 = TWSI_ENABLE_OPTION2; 344 343 break; 345 344 case 3: 346 - gcfg2 |= DOVE_TWSI_ENABLE_OPTION3; 345 + gcfg2 = TWSI_ENABLE_OPTION3; 347 346 break; 348 347 } 349 348 350 - writel(gcfg1, DOVE_GLOBAL_CONFIG_1); 351 - writel(gcfg2, DOVE_GLOBAL_CONFIG_2); 349 + regmap_update_bits(gconfmap, GLOBAL_CONFIG_1, 350 + TWSI_ENABLE_OPTION1, 351 + gcfg1); 352 + regmap_update_bits(gconfmap, GLOBAL_CONFIG_2, 353 + TWSI_ENABLE_OPTION2 | TWSI_ENABLE_OPTION3, 354 + gcfg2); 352 355 353 356 return 0; 354 357 } 355 358 356 359 static struct mvebu_mpp_ctrl dove_mpp_controls[] = { 357 - MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl), 358 - MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl), 359 - MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl), 360 - MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl), 361 - MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl), 362 - MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl), 363 - MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl), 364 - MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl), 365 - MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl), 366 - MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl), 367 - MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl), 368 - MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl), 369 - MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl), 370 - MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), 371 - MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), 372 - MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), 373 - MPP_REG_CTRL(16, 23), 360 + MPP_FUNC_CTRL(0, 15, NULL, dove_pmu_mpp_ctrl), 361 + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), 374 362 MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), 375 363 MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), 376 364 MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), ··· 756 772 { } 757 773 }; 758 774 775 + static struct regmap_config gc_regmap_config = { 776 + .reg_bits = 32, 777 + .val_bits = 32, 778 + .reg_stride = 4, 779 + .max_register = 5, 780 + }; 781 + 759 782 static int dove_pinctrl_probe(struct platform_device *pdev) 760 783 { 784 + struct resource *res, *mpp_res; 785 + struct resource fb_res; 761 786 const struct of_device_id *match = 762 787 of_match_device(dove_pinctrl_of_match, &pdev->dev); 763 788 pdev->dev.platform_data = (void *)match->data; ··· 781 788 return PTR_ERR(clk); 782 789 } 783 790 clk_prepare_enable(clk); 791 + 792 + mpp_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 793 + mpp_base = devm_ioremap_resource(&pdev->dev, mpp_res); 794 + if (IS_ERR(mpp_base)) 795 + return PTR_ERR(mpp_base); 796 + 797 + /* prepare fallback resource */ 798 + memcpy(&fb_res, mpp_res, sizeof(struct resource)); 799 + fb_res.start = 0; 800 + 801 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 802 + if (!res) { 803 + dev_warn(&pdev->dev, "falling back to hardcoded MPP4 resource\n"); 804 + adjust_resource(&fb_res, 805 + (mpp_res->start & INT_REGS_MASK) + MPP4_REGS_OFFS, 0x4); 806 + res = &fb_res; 807 + } 808 + 809 + mpp4_base = devm_ioremap_resource(&pdev->dev, res); 810 + if (IS_ERR(mpp4_base)) 811 + return PTR_ERR(mpp4_base); 812 + 813 + res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 814 + if (!res) { 815 + dev_warn(&pdev->dev, "falling back to hardcoded PMU resource\n"); 816 + adjust_resource(&fb_res, 817 + (mpp_res->start & INT_REGS_MASK) + PMU_REGS_OFFS, 0x8); 818 + res = &fb_res; 819 + } 820 + 821 + pmu_base = devm_ioremap_resource(&pdev->dev, res); 822 + if (IS_ERR(pmu_base)) 823 + return PTR_ERR(pmu_base); 824 + 825 + gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config"); 826 + if (IS_ERR(gconfmap)) { 827 + void __iomem *gc_base; 828 + 829 + dev_warn(&pdev->dev, "falling back to hardcoded global registers\n"); 830 + adjust_resource(&fb_res, 831 + (mpp_res->start & INT_REGS_MASK) + GC_REGS_OFFS, 0x14); 832 + gc_base = devm_ioremap_resource(&pdev->dev, &fb_res); 833 + if (IS_ERR(gc_base)) 834 + return PTR_ERR(gc_base); 835 + gconfmap = devm_regmap_init_mmio(&pdev->dev, 836 + gc_base, &gc_regmap_config); 837 + if (IS_ERR(gconfmap)) 838 + return PTR_ERR(gconfmap); 839 + } 840 + 841 + /* Warn on any missing DT resource */ 842 + WARN(fb_res.start, FW_BUG "Missing pinctrl regs in DTB. Please update your firmware.\n"); 784 843 785 844 return mvebu_pinctrl_probe(pdev); 786 845 }
+22 -3
drivers/pinctrl/mvebu/pinctrl-kirkwood.c
··· 21 21 22 22 #include "pinctrl-mvebu.h" 23 23 24 + static void __iomem *mpp_base; 25 + 26 + static int kirkwood_mpp_ctrl_get(unsigned pid, unsigned long *config) 27 + { 28 + return default_mpp_ctrl_get(mpp_base, pid, config); 29 + } 30 + 31 + static int kirkwood_mpp_ctrl_set(unsigned pid, unsigned long config) 32 + { 33 + return default_mpp_ctrl_set(mpp_base, pid, config); 34 + } 35 + 24 36 #define V(f6180, f6190, f6192, f6281, f6282, dx4122) \ 25 37 ((f6180 << 0) | (f6190 << 1) | (f6192 << 2) | \ 26 38 (f6281 << 3) | (f6282 << 4) | (dx4122 << 5)) ··· 371 359 }; 372 360 373 361 static struct mvebu_mpp_ctrl mv88f6180_mpp_controls[] = { 374 - MPP_REG_CTRL(0, 29), 362 + MPP_FUNC_CTRL(0, 29, NULL, kirkwood_mpp_ctrl), 375 363 }; 376 364 377 365 static struct pinctrl_gpio_range mv88f6180_gpio_ranges[] = { ··· 379 367 }; 380 368 381 369 static struct mvebu_mpp_ctrl mv88f619x_mpp_controls[] = { 382 - MPP_REG_CTRL(0, 35), 370 + MPP_FUNC_CTRL(0, 35, NULL, kirkwood_mpp_ctrl), 383 371 }; 384 372 385 373 static struct pinctrl_gpio_range mv88f619x_gpio_ranges[] = { ··· 388 376 }; 389 377 390 378 static struct mvebu_mpp_ctrl mv88f628x_mpp_controls[] = { 391 - MPP_REG_CTRL(0, 49), 379 + MPP_FUNC_CTRL(0, 49, NULL, kirkwood_mpp_ctrl), 392 380 }; 393 381 394 382 static struct pinctrl_gpio_range mv88f628x_gpio_ranges[] = { ··· 468 456 469 457 static int kirkwood_pinctrl_probe(struct platform_device *pdev) 470 458 { 459 + struct resource *res; 471 460 const struct of_device_id *match = 472 461 of_match_device(kirkwood_pinctrl_of_match, &pdev->dev); 473 462 pdev->dev.platform_data = (void *)match->data; 463 + 464 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 465 + mpp_base = devm_ioremap_resource(&pdev->dev, res); 466 + if (IS_ERR(mpp_base)) 467 + return PTR_ERR(mpp_base); 468 + 474 469 return mvebu_pinctrl_probe(pdev); 475 470 } 476 471
+38 -84
drivers/pinctrl/mvebu/pinctrl-mvebu.c
··· 50 50 struct device *dev; 51 51 struct pinctrl_dev *pctldev; 52 52 struct pinctrl_desc desc; 53 - void __iomem *base; 54 53 struct mvebu_pinctrl_group *groups; 55 54 unsigned num_groups; 56 55 struct mvebu_pinctrl_function *functions; ··· 137 138 return NULL; 138 139 } 139 140 140 - /* 141 - * Common mpp pin configuration registers on MVEBU are 142 - * registers of eight 4-bit values for each mpp setting. 143 - * Register offset and bit mask are calculated accordingly below. 144 - */ 145 - static int mvebu_common_mpp_get(struct mvebu_pinctrl *pctl, 146 - struct mvebu_pinctrl_group *grp, 147 - unsigned long *config) 148 - { 149 - unsigned pin = grp->gid; 150 - unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; 151 - unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; 152 - 153 - *config = readl(pctl->base + off); 154 - *config >>= shift; 155 - *config &= MPP_MASK; 156 - 157 - return 0; 158 - } 159 - 160 - static int mvebu_common_mpp_set(struct mvebu_pinctrl *pctl, 161 - struct mvebu_pinctrl_group *grp, 162 - unsigned long config) 163 - { 164 - unsigned pin = grp->gid; 165 - unsigned off = (pin / MPPS_PER_REG) * MPP_BITS; 166 - unsigned shift = (pin % MPPS_PER_REG) * MPP_BITS; 167 - unsigned long reg; 168 - 169 - reg = readl(pctl->base + off); 170 - reg &= ~(MPP_MASK << shift); 171 - reg |= (config << shift); 172 - writel(reg, pctl->base + off); 173 - 174 - return 0; 175 - } 176 - 177 141 static int mvebu_pinconf_group_get(struct pinctrl_dev *pctldev, 178 142 unsigned gid, unsigned long *config) 179 143 { ··· 146 184 if (!grp->ctrl) 147 185 return -EINVAL; 148 186 149 - if (grp->ctrl->mpp_get) 150 - return grp->ctrl->mpp_get(grp->ctrl, config); 151 - 152 - return mvebu_common_mpp_get(pctl, grp, config); 187 + return grp->ctrl->mpp_get(grp->pins[0], config); 153 188 } 154 189 155 190 static int mvebu_pinconf_group_set(struct pinctrl_dev *pctldev, ··· 161 202 return -EINVAL; 162 203 163 204 for (i = 0; i < num_configs; i++) { 164 - if (grp->ctrl->mpp_set) 165 - ret = grp->ctrl->mpp_set(grp->ctrl, configs[i]); 166 - else 167 - ret = mvebu_common_mpp_set(pctl, grp, configs[i]); 168 - 205 + ret = grp->ctrl->mpp_set(grp->pins[0], configs[i]); 169 206 if (ret) 170 207 return ret; 171 208 } /* for each config */ ··· 302 347 return -EINVAL; 303 348 304 349 if (grp->ctrl->mpp_gpio_req) 305 - return grp->ctrl->mpp_gpio_req(grp->ctrl, offset); 350 + return grp->ctrl->mpp_gpio_req(offset); 306 351 307 352 setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); 308 353 if (!setting) ··· 325 370 return -EINVAL; 326 371 327 372 if (grp->ctrl->mpp_gpio_dir) 328 - return grp->ctrl->mpp_gpio_dir(grp->ctrl, offset, input); 373 + return grp->ctrl->mpp_gpio_dir(offset, input); 329 374 330 375 setting = mvebu_pinctrl_find_gpio_setting(pctl, grp); 331 376 if (!setting) ··· 548 593 int mvebu_pinctrl_probe(struct platform_device *pdev) 549 594 { 550 595 struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); 551 - struct resource *res; 552 596 struct mvebu_pinctrl *pctl; 553 - void __iomem *base; 554 597 struct pinctrl_pin_desc *pdesc; 555 598 unsigned gid, n, k; 599 + unsigned size, noname = 0; 600 + char *noname_buf; 601 + void *p; 556 602 int ret; 557 603 558 604 if (!soc || !soc->controls || !soc->modes) { 559 605 dev_err(&pdev->dev, "wrong pinctrl soc info\n"); 560 606 return -EINVAL; 561 607 } 562 - 563 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 564 - base = devm_ioremap_resource(&pdev->dev, res); 565 - if (IS_ERR(base)) 566 - return PTR_ERR(base); 567 608 568 609 pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), 569 610 GFP_KERNEL); ··· 574 623 pctl->desc.pmxops = &mvebu_pinmux_ops; 575 624 pctl->desc.confops = &mvebu_pinconf_ops; 576 625 pctl->variant = soc->variant; 577 - pctl->base = base; 578 626 pctl->dev = &pdev->dev; 579 627 platform_set_drvdata(pdev, pctl); 580 628 ··· 583 633 pctl->desc.npins = 0; 584 634 for (n = 0; n < soc->ncontrols; n++) { 585 635 struct mvebu_mpp_ctrl *ctrl = &soc->controls[n]; 586 - char *names; 587 636 588 637 pctl->desc.npins += ctrl->npins; 589 - /* initial control pins */ 638 + /* initialize control's pins[] array */ 590 639 for (k = 0; k < ctrl->npins; k++) 591 640 ctrl->pins[k] = ctrl->pid + k; 592 641 593 - /* special soc specific control */ 594 - if (ctrl->mpp_get || ctrl->mpp_set) { 595 - if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) { 596 - dev_err(&pdev->dev, "wrong soc control info\n"); 597 - return -EINVAL; 598 - } 642 + /* 643 + * We allow to pass controls with NULL name that we treat 644 + * as a range of one-pin groups with generic mvebu register 645 + * controls. 646 + */ 647 + if (!ctrl->name) { 648 + pctl->num_groups += ctrl->npins; 649 + noname += ctrl->npins; 650 + } else { 599 651 pctl->num_groups += 1; 600 - continue; 601 652 } 602 - 603 - /* generic mvebu register control */ 604 - names = devm_kzalloc(&pdev->dev, ctrl->npins * 8, GFP_KERNEL); 605 - if (!names) { 606 - dev_err(&pdev->dev, "failed to alloc mpp names\n"); 607 - return -ENOMEM; 608 - } 609 - for (k = 0; k < ctrl->npins; k++) 610 - sprintf(names + 8*k, "mpp%d", ctrl->pid+k); 611 - ctrl->name = names; 612 - pctl->num_groups += ctrl->npins; 613 653 } 614 654 615 655 pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins * ··· 613 673 pdesc[n].number = n; 614 674 pctl->desc.pins = pdesc; 615 675 616 - pctl->groups = devm_kzalloc(&pdev->dev, pctl->num_groups * 617 - sizeof(struct mvebu_pinctrl_group), GFP_KERNEL); 618 - if (!pctl->groups) { 619 - dev_err(&pdev->dev, "failed to alloc pinctrl groups\n"); 676 + /* 677 + * allocate groups and name buffers for unnamed groups. 678 + */ 679 + size = pctl->num_groups * sizeof(*pctl->groups) + noname * 8; 680 + p = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); 681 + if (!p) { 682 + dev_err(&pdev->dev, "failed to alloc group data\n"); 620 683 return -ENOMEM; 621 684 } 685 + pctl->groups = p; 686 + noname_buf = p + pctl->num_groups * sizeof(*pctl->groups); 622 687 623 688 /* assign mpp controls to groups */ 624 689 gid = 0; ··· 635 690 pctl->groups[gid].pins = ctrl->pins; 636 691 pctl->groups[gid].npins = ctrl->npins; 637 692 638 - /* generic mvebu register control maps to a number of groups */ 639 - if (!ctrl->mpp_get && !ctrl->mpp_set) { 693 + /* 694 + * We treat unnamed controls as a range of one-pin groups 695 + * with generic mvebu register controls. Use one group for 696 + * each in this range and assign a default group name. 697 + */ 698 + if (!ctrl->name) { 699 + pctl->groups[gid].name = noname_buf; 640 700 pctl->groups[gid].npins = 1; 701 + sprintf(noname_buf, "mpp%d", ctrl->pid+0); 702 + noname_buf += 8; 641 703 642 704 for (k = 1; k < ctrl->npins; k++) { 643 705 gid++; 644 706 pctl->groups[gid].gid = gid; 645 707 pctl->groups[gid].ctrl = ctrl; 646 - pctl->groups[gid].name = &ctrl->name[8*k]; 708 + pctl->groups[gid].name = noname_buf; 647 709 pctl->groups[gid].pins = &ctrl->pins[k]; 648 710 pctl->groups[gid].npins = 1; 711 + sprintf(noname_buf, "mpp%d", ctrl->pid+k); 712 + noname_buf += 8; 649 713 } 650 714 } 651 715 gid++;
+35 -20
drivers/pinctrl/mvebu/pinctrl-mvebu.h
··· 28 28 * between two or more different settings, e.g. assign mpp pin 13 to 29 29 * uart1 or sata. 30 30 * 31 - * If optional mpp_get/_set functions are set these are used to get/set 32 - * a specific mode. Otherwise it is assumed that the mpp control is based 33 - * on 4-bit groups in subsequent registers. The optional mpp_gpio_req/_dir 34 - * functions can be used to allow pin settings with varying gpio pins. 31 + * The mpp_get/_set functions are mandatory and are used to get/set a 32 + * specific mode. The optional mpp_gpio_req/_dir functions can be used 33 + * to allow pin settings with varying gpio pins. 35 34 */ 36 35 struct mvebu_mpp_ctrl { 37 36 const char *name; 38 37 u8 pid; 39 38 u8 npins; 40 39 unsigned *pins; 41 - int (*mpp_get)(struct mvebu_mpp_ctrl *ctrl, unsigned long *config); 42 - int (*mpp_set)(struct mvebu_mpp_ctrl *ctrl, unsigned long config); 43 - int (*mpp_gpio_req)(struct mvebu_mpp_ctrl *ctrl, u8 pid); 44 - int (*mpp_gpio_dir)(struct mvebu_mpp_ctrl *ctrl, u8 pid, bool input); 40 + int (*mpp_get)(unsigned pid, unsigned long *config); 41 + int (*mpp_set)(unsigned pid, unsigned long config); 42 + int (*mpp_gpio_req)(unsigned pid); 43 + int (*mpp_gpio_dir)(unsigned pid, bool input); 45 44 }; 46 45 47 46 /** ··· 113 114 int ngpioranges; 114 115 }; 115 116 116 - #define MPP_REG_CTRL(_idl, _idh) \ 117 - { \ 118 - .name = NULL, \ 119 - .pid = _idl, \ 120 - .npins = _idh - _idl + 1, \ 121 - .pins = (unsigned[_idh - _idl + 1]) { }, \ 122 - .mpp_get = NULL, \ 123 - .mpp_set = NULL, \ 124 - .mpp_gpio_req = NULL, \ 125 - .mpp_gpio_dir = NULL, \ 126 - } 127 - 128 117 #define MPP_FUNC_CTRL(_idl, _idh, _name, _func) \ 129 118 { \ 130 119 .name = _name, \ ··· 172 185 .base = _gpiobase, \ 173 186 .npins = _npins, \ 174 187 } 188 + 189 + #define MVEBU_MPPS_PER_REG 8 190 + #define MVEBU_MPP_BITS 4 191 + #define MVEBU_MPP_MASK 0xf 192 + 193 + static inline int default_mpp_ctrl_get(void __iomem *base, unsigned int pid, 194 + unsigned long *config) 195 + { 196 + unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 197 + unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 198 + 199 + *config = (readl(base + off) >> shift) & MVEBU_MPP_MASK; 200 + 201 + return 0; 202 + } 203 + 204 + static inline int default_mpp_ctrl_set(void __iomem *base, unsigned int pid, 205 + unsigned long config) 206 + { 207 + unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 208 + unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 209 + unsigned long reg; 210 + 211 + reg = readl(base + off) & ~(MVEBU_MPP_MASK << shift); 212 + writel(reg | (config << shift), base + off); 213 + 214 + return 0; 215 + } 175 216 176 217 int mvebu_pinctrl_probe(struct platform_device *pdev); 177 218 int mvebu_pinctrl_remove(struct platform_device *pdev);