The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/mediatek/mtk_pinctrl.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2016 Stanislav Galabov.
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice unmodified, this list of conditions, and the following
   10  *    disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/12.0/sys/mips/mediatek/mtk_pinctrl.h 325231 2017-10-31 11:29:16Z mizhka $
   28  */
   29 
   30 #ifndef _MTK_PINCTRL_H_
   31 #define _MTK_PINCTRL_H_
   32 
   33 struct mtk_pin_function {
   34         const char              *name;
   35         uint32_t                value;
   36 };
   37 
   38 struct mtk_pin_group {
   39         const char              *name;
   40         uint32_t                sysc_reg;
   41         uint32_t                offset;
   42         uint32_t                mask;
   43         struct mtk_pin_function *functions;
   44         uint32_t                funcnum;
   45 };
   46 
   47 #define FUNC(_name, _value)                     \
   48     { .name = (_name), .value = (_value) }
   49 
   50 #define GROUP(_name, _reg, _off, _mask, _funcs) \
   51     { .name = (_name), .sysc_reg = (_reg), .offset = (_off),            \
   52     .mask = (_mask), .functions = (_funcs), .funcnum = nitems(_funcs) }
   53 
   54 #define GROUP_END       { NULL, 0, 0, 0, NULL, 0 }
   55 
   56 #define DECL_FUNC(_name)        \
   57     static struct mtk_pin_function _name[]
   58 #define DECL_TABLE(_name)       \
   59     static struct mtk_pin_group _name[]
   60 
   61 /* Pin function declarations */
   62 DECL_FUNC(i2c_func) = {
   63         FUNC("i2c", 0), FUNC("gpio", 1)
   64 };
   65 
   66 DECL_FUNC(spi_func) = {
   67         FUNC("spi", 0), FUNC("gpio", 1)
   68 };
   69 
   70 DECL_FUNC(uartf_func) = {
   71         FUNC("uartf", 0), FUNC("pcm uartf", 1), FUNC("pcm i2s", 2),
   72         FUNC("i2s uartf", 3), FUNC("pcm gpio", 4), FUNC("gpio uartf", 5),
   73         FUNC("gpio i2s", 6), FUNC("gpio", 7)
   74 };
   75 
   76 DECL_FUNC(wdt_func) = {
   77         FUNC("wdt rst", 0), FUNC("wdt", 0), FUNC("wdt refclk", 1),
   78         FUNC("gpio", 2)
   79 };
   80 
   81 DECL_FUNC(uartlite_func) = {
   82         FUNC("uartlite", 0), FUNC("gpio", 1)
   83 };
   84 
   85 DECL_FUNC(jtag_func) = {
   86         FUNC("jtag", 0), FUNC("gpio", 1)
   87 };
   88 
   89 DECL_FUNC(mdio_func) = {
   90         FUNC("mdio", 0), FUNC("gpio", 1)
   91 };
   92 
   93 DECL_FUNC(led_func) = {
   94         FUNC("led", 0), FUNC("gpio", 1), FUNC("bt", 2)
   95 };
   96 
   97 DECL_FUNC(cs1_func) = {
   98         FUNC("spi_cs1", 0), FUNC("wdt_cs1", 1), FUNC("gpio", 2)
   99 };
  100 
  101 DECL_FUNC(sdram_func) = {
  102         FUNC("sdram", 0), FUNC("gpio", 1)
  103 };
  104 
  105 DECL_FUNC(rgmii_func) = {
  106         FUNC("rgmii", 0), FUNC("rgmii1", 0), FUNC("rgmii2", 0), FUNC("gpio", 1)
  107 };
  108 
  109 DECL_FUNC(lna_func) = {
  110         FUNC("lna", 0), FUNC("gpio", 1)
  111 };
  112 
  113 DECL_FUNC(pa_func) = {
  114         FUNC("pa", 0), FUNC("gpio", 1)
  115 };
  116 
  117 DECL_FUNC(gex_func) = {
  118         FUNC("ge1", 0), FUNC("ge2", 0), FUNC("gpio", 1)
  119 };
  120 
  121 DECL_FUNC(rt2880_uartf_func) = {
  122         FUNC("uartf", 0), FUNC("gpio", 1)
  123 };
  124 
  125 DECL_FUNC(rt2880_pci_func) = {
  126         FUNC("pci", 0), FUNC("gpio", 1)
  127 };
  128 
  129 DECL_FUNC(rt3883_pci_func) = {
  130         FUNC("pci-dev", 0), FUNC("pci-host2", 1), FUNC("pci-host1", 2),
  131         FUNC("pci-fnc", 3), FUNC("gpio", 7)
  132 };
  133 
  134 DECL_FUNC(mt7620_pcie_func) = {
  135         FUNC("pcie rst", 0), FUNC("pcie refclk", 1), FUNC("gpio", 2)
  136 };
  137 
  138 DECL_FUNC(lna_a_func) = {
  139         FUNC("lna a", 0), FUNC("lna g", 0), FUNC("codec", 2), FUNC("gpio", 3)
  140 };
  141 
  142 DECL_FUNC(nd_sd_func) = {
  143         FUNC("nand", 0), FUNC("sd", 1), FUNC("gpio", 2)
  144 };
  145 
  146 DECL_FUNC(mt7620_mdio_func) = {
  147         FUNC("mdio", 0), FUNC("mdio refclk", 1), FUNC("gpio", 2)
  148 };
  149 
  150 DECL_FUNC(spi_refclk_func) = {
  151         FUNC("spi refclk", 0), FUNC("gpio", 1)
  152 };
  153 
  154 DECL_FUNC(wled_func) = {
  155         FUNC("wled", 0), FUNC("gpio", 1)
  156 };
  157 
  158 DECL_FUNC(ephy_func) = {
  159         FUNC("ephy", 0), FUNC("gpio", 1)
  160 };
  161 
  162 DECL_FUNC(mt7628_gpio_func) = {
  163         FUNC("gpio", 0), FUNC("gpio", 1), FUNC("refclk", 2), FUNC("pcie", 3)
  164 };
  165 
  166 DECL_FUNC(mt7628_spis_func) = {
  167         FUNC("spis", 0), FUNC("gpio", 1), FUNC("utif", 2), FUNC("pwm", 3)
  168 };
  169 
  170 DECL_FUNC(mt7628_spi_cs1_func) = {
  171         FUNC("spi", 0), FUNC("gpio", 1), FUNC("refclk", 2), FUNC("-", 3)
  172 };
  173 
  174 DECL_FUNC(mt7628_i2s_func) = {
  175         FUNC("i2s", 0), FUNC("gpio", 1), FUNC("pcm", 2), FUNC("anttenna", 3)
  176 };
  177 
  178 DECL_FUNC(mt7628_uart0_func) = {
  179         FUNC("uart0", 0), FUNC("gpio", 1), FUNC("-", 2), FUNC("-", 3)
  180 };
  181 
  182 DECL_FUNC(mt7628_sd_func) = {
  183         FUNC("sdxc", 0), FUNC("gpio", 1), FUNC("utif", 2), FUNC("jtag", 3)
  184 };
  185 
  186 DECL_FUNC(mt7628_perst_func) = {
  187         FUNC("perst", 0), FUNC("gpio", 1)
  188 };
  189 
  190 DECL_FUNC(mt7628_refclk_func) = {
  191         FUNC("refclk", 0), FUNC("gpio", 1)
  192 };
  193 
  194 DECL_FUNC(mt7628_i2c_func) = {
  195         FUNC("i2c", 0), FUNC("gpio", 1), FUNC("debug", 2), FUNC("-", 3)
  196 };
  197 
  198 DECL_FUNC(mt7628_uart1_func) = {
  199         FUNC("uart1", 0), FUNC("gpio", 1), FUNC("pwm", 2), FUNC("sw r", 3)
  200 };
  201 
  202 DECL_FUNC(mt7628_uart2_func) = {
  203         FUNC("uart2", 0), FUNC("gpio", 1), FUNC("pwm", 2), FUNC("sdxc", 3)
  204 };
  205 
  206 DECL_FUNC(mt7628_pwm0_func) = {
  207         FUNC("pwm", 0), FUNC("gpio", 1), FUNC("utif", 2), FUNC("sdxc", 3)
  208 };
  209 
  210 DECL_FUNC(mt7621_uart1_func) = {
  211         FUNC("uart1", 0), FUNC("gpio", 1)
  212 };
  213 
  214 DECL_FUNC(mt7621_i2c_func) = {
  215         FUNC("i2c", 0), FUNC("gpio", 1)
  216 };
  217 
  218 DECL_FUNC(mt7621_uart3_func) = {
  219         FUNC("uart3", 0), FUNC("gpio", 1), FUNC("i2s", 2), FUNC("spdif3", 3)
  220 };
  221 
  222 DECL_FUNC(mt7621_uart2_func) = {
  223         FUNC("uart2", 0), FUNC("gpio", 1), FUNC("pcm", 2), FUNC("spdif2", 3)
  224 };
  225 
  226 DECL_FUNC(mt7621_jtag_func) = {
  227         FUNC("jtag", 0), FUNC("gpio", 1)
  228 };
  229 
  230 DECL_FUNC(mt7621_wdt_func) = {
  231         FUNC("wdt rst", 0), FUNC("gpio", 1), FUNC("wdt refclk", 2), FUNC("-", 3)
  232 };
  233 
  234 DECL_FUNC(mt7621_pcie_func) = {
  235         FUNC("pcie rst", 0), FUNC("gpio", 1), FUNC("pcie refclk", 2),
  236         FUNC("-", 3)
  237 };
  238 
  239 DECL_FUNC(mt7621_mdio_func) = {
  240         FUNC("mdio", 0), FUNC("gpio", 1), FUNC("-", 2), FUNC("-", 3)
  241 };
  242 
  243 DECL_FUNC(mt7621_rgmii_func) = {
  244         FUNC("rgmii1", 0), FUNC("rgmii2", 0), FUNC("gpio", 1)
  245 };
  246 
  247 DECL_FUNC(mt7621_spi_func) = {
  248         FUNC("spi", 0), FUNC("gpio", 1), FUNC("nand1", 2), FUNC("-", 3)
  249 };
  250 
  251 DECL_FUNC(mt7621_sdhci_func) = {
  252         FUNC("sdhci", 0), FUNC("gpio", 1), FUNC("nand1", 2), FUNC("-", 3)
  253 };
  254 
  255 /* Pin groups declarations */
  256 DECL_TABLE(mt7628_pintable) = {
  257         GROUP("gpio", SYSCTL_GPIOMODE, 0, 3, mt7628_gpio_func),
  258         GROUP("spis", SYSCTL_GPIOMODE, 2, 3, mt7628_spis_func),
  259         GROUP("spi cs1", SYSCTL_GPIOMODE, 4, 3, mt7628_spi_cs1_func),
  260         GROUP("i2s", SYSCTL_GPIOMODE, 6, 3, mt7628_i2s_func),
  261         GROUP("uart0", SYSCTL_GPIOMODE, 8, 3, mt7628_uart0_func),
  262         GROUP("sdmode", SYSCTL_GPIOMODE, 10, 3, mt7628_sd_func),
  263         GROUP("spi", SYSCTL_GPIOMODE, 12, 1, spi_func),
  264         GROUP("wdt", SYSCTL_GPIOMODE, 14, 1, wdt_func),
  265         GROUP("perst", SYSCTL_GPIOMODE, 16, 1, mt7628_perst_func),
  266         GROUP("refclk", SYSCTL_GPIOMODE, 18, 1, mt7628_refclk_func),
  267         GROUP("i2c", SYSCTL_GPIOMODE, 20, 3, mt7628_i2c_func),
  268         GROUP("uart1", SYSCTL_GPIOMODE, 24, 3, mt7628_uart1_func),
  269         GROUP("uart2", SYSCTL_GPIOMODE, 26, 3, mt7628_uart2_func),
  270         GROUP("pwm0", SYSCTL_GPIOMODE, 28, 3, mt7628_pwm0_func),
  271         GROUP("pwm1", SYSCTL_GPIOMODE, 30, 3, mt7628_pwm0_func),
  272         GROUP_END
  273 };
  274 
  275 DECL_TABLE(mt7621_pintable) = {
  276         GROUP("uart1", SYSCTL_GPIOMODE, 1, 1, mt7621_uart1_func),
  277         GROUP("i2c", SYSCTL_GPIOMODE, 2, 1, mt7621_i2c_func),
  278         GROUP("uart3", SYSCTL_GPIOMODE, 3, 3, mt7621_uart3_func),
  279         GROUP("uart2", SYSCTL_GPIOMODE, 5, 3, mt7621_uart2_func),
  280         GROUP("jtag", SYSCTL_GPIOMODE, 7, 1, mt7621_jtag_func),
  281         GROUP("wdt", SYSCTL_GPIOMODE, 8, 3, mt7621_wdt_func),
  282         GROUP("pcie", SYSCTL_GPIOMODE, 10, 3, mt7621_pcie_func),
  283         GROUP("mdio", SYSCTL_GPIOMODE, 12, 3, mt7621_mdio_func),
  284         GROUP("rgmii2", SYSCTL_GPIOMODE, 15, 1, mt7621_rgmii_func),
  285         GROUP("spi", SYSCTL_GPIOMODE, 16, 3, mt7621_spi_func),
  286         GROUP("sdhci", SYSCTL_GPIOMODE, 18, 3, mt7621_sdhci_func),
  287         GROUP("rgmii1", SYSCTL_GPIOMODE, 14, 1, mt7621_rgmii_func),
  288         GROUP_END
  289 };
  290 
  291 DECL_TABLE(mt7620_pintable) = {
  292         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  293         GROUP("uartf", SYSCTL_GPIOMODE, 2, 7, uartf_func),
  294         GROUP("uartlite", SYSCTL_GPIOMODE, 5, 1, uartlite_func),
  295         GROUP("mdio", SYSCTL_GPIOMODE, 7, 3, mt7620_mdio_func),
  296         GROUP("rgmii1", SYSCTL_GPIOMODE, 9, 1, rgmii_func),
  297         GROUP("rgmii2", SYSCTL_GPIOMODE, 10, 1, rgmii_func),
  298         GROUP("spi", SYSCTL_GPIOMODE, 11, 1, spi_func),
  299         GROUP("spi refclk", SYSCTL_GPIOMODE, 12, 1, spi_refclk_func),
  300         GROUP("wled", SYSCTL_GPIOMODE, 13, 1, wled_func),
  301         GROUP("ephy", SYSCTL_GPIOMODE, 15, 1, ephy_func),
  302         GROUP("pcie", SYSCTL_GPIOMODE, 16, 3, mt7620_pcie_func),
  303         GROUP("nd_sd", SYSCTL_GPIOMODE, 18, 3, nd_sd_func),
  304         GROUP("pa", SYSCTL_GPIOMODE, 20, 1, pa_func),
  305         GROUP("wdt", SYSCTL_GPIOMODE, 21, 3, wdt_func),
  306         GROUP_END
  307 };
  308 
  309 DECL_TABLE(rt2880_pintable) = {
  310         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  311         GROUP("uartf", SYSCTL_GPIOMODE, 1, 1, rt2880_uartf_func),
  312         GROUP("spi", SYSCTL_GPIOMODE, 2, 1, spi_func),
  313         GROUP("uartlite", SYSCTL_GPIOMODE, 3, 1, uartlite_func),
  314         GROUP("jtag", SYSCTL_GPIOMODE, 4, 1, jtag_func),
  315         GROUP("mdio", SYSCTL_GPIOMODE, 5, 1, mdio_func),
  316         GROUP("sdram", SYSCTL_GPIOMODE, 6, 1, sdram_func),
  317         GROUP("pci", SYSCTL_GPIOMODE, 7, 1, rt2880_pci_func),
  318         GROUP_END
  319 };
  320 
  321 DECL_TABLE(rt3050_pintable) = {
  322         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  323         GROUP("spi", SYSCTL_GPIOMODE, 1, 1, spi_func),
  324         GROUP("uartf", SYSCTL_GPIOMODE, 2, 7, uartf_func),
  325         GROUP("uartlite", SYSCTL_GPIOMODE, 5, 1, uartlite_func),
  326         GROUP("jtag", SYSCTL_GPIOMODE, 6, 1, jtag_func),
  327         GROUP("mdio", SYSCTL_GPIOMODE, 7, 1, mdio_func),
  328         GROUP("sdram", SYSCTL_GPIOMODE, 8, 1, sdram_func),
  329         GROUP("rgmii", SYSCTL_GPIOMODE, 9, 1, rgmii_func),
  330         GROUP_END
  331 };
  332 
  333 DECL_TABLE(rt3352_pintable) = {
  334         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  335         GROUP("spi", SYSCTL_GPIOMODE, 1, 1, i2c_func),
  336         GROUP("uartf", SYSCTL_GPIOMODE, 2, 7, uartf_func),
  337         GROUP("uartlite", SYSCTL_GPIOMODE, 5, 1, uartlite_func),
  338         GROUP("jtag", SYSCTL_GPIOMODE, 6, 1, jtag_func),
  339         GROUP("mdio", SYSCTL_GPIOMODE, 7, 1, mdio_func),
  340         GROUP("rgmii", SYSCTL_GPIOMODE, 9, 1, rgmii_func),
  341         GROUP("led", SYSCTL_GPIOMODE, 14, 3, led_func),
  342         GROUP("lna", SYSCTL_GPIOMODE, 18, 1, lna_func),
  343         GROUP("pa", SYSCTL_GPIOMODE, 20, 1, pa_func),
  344         GROUP("spi_cs1", SYSCTL_GPIOMODE, 21, 3, cs1_func),
  345         GROUP_END
  346 };
  347 
  348 DECL_TABLE(rt3883_pintable) = {
  349         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  350         GROUP("spi", SYSCTL_GPIOMODE, 1, 1, spi_func),
  351         GROUP("uartf", SYSCTL_GPIOMODE, 2, 7, uartf_func),
  352         GROUP("uartlite", SYSCTL_GPIOMODE, 5, 1, uartlite_func),
  353         GROUP("jtag", SYSCTL_GPIOMODE, 6, 1, jtag_func),
  354         GROUP("mdio", SYSCTL_GPIOMODE, 7, 1, mdio_func),
  355         GROUP("lna a", SYSCTL_GPIOMODE, 16, 3, lna_a_func),
  356         GROUP("lna g", SYSCTL_GPIOMODE, 18, 3, lna_a_func),
  357         GROUP("pci", SYSCTL_GPIOMODE, 11, 7, rt3883_pci_func),
  358         GROUP("ge1", SYSCTL_GPIOMODE, 9, 1, gex_func),
  359         GROUP("ge2", SYSCTL_GPIOMODE, 10, 1, gex_func),
  360         GROUP_END
  361 };
  362 
  363 DECL_TABLE(rt5350_pintable) = {
  364         GROUP("i2c", SYSCTL_GPIOMODE, 0, 1, i2c_func),
  365         GROUP("spi", SYSCTL_GPIOMODE, 1, 1, spi_func),
  366         GROUP("uartf", SYSCTL_GPIOMODE, 2, 7, uartf_func),
  367         GROUP("uartlite", SYSCTL_GPIOMODE, 5, 1, uartlite_func),
  368         GROUP("jtag", SYSCTL_GPIOMODE, 6, 1, jtag_func),
  369         GROUP("led", SYSCTL_GPIOMODE, 14, 3, led_func),
  370         GROUP("spi_cs1", SYSCTL_GPIOMODE, 21, 3, cs1_func),
  371         GROUP_END
  372 };
  373 
  374 #endif /* _MTK_PINCTRL_H_ */

Cache object: e1ec944490dc8d355b6aab39bdbe51e9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.