root/drivers/pinctrl/berlin/berlin-bg2cd.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. berlin2cd_pinctrl_probe

   1 // SPDX-License-Identifier: GPL-2.0
   2 /*
   3  * Marvell Berlin BG2CD pinctrl driver.
   4  *
   5  * Copyright (C) 2014 Marvell Technology Group Ltd.
   6  *
   7  * Antoine Ténart <antoine.tenart@free-electrons.com>
   8  */
   9 
  10 #include <linux/init.h>
  11 #include <linux/of_device.h>
  12 #include <linux/platform_device.h>
  13 #include <linux/regmap.h>
  14 
  15 #include "berlin.h"
  16 
  17 static const struct berlin_desc_group berlin2cd_soc_pinctrl_groups[] = {
  18         /* G */
  19         BERLIN_PINCTRL_GROUP("G0", 0x00, 0x3, 0x00,
  20                 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
  21                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
  22                 BERLIN_PINCTRL_FUNCTION(0x2, "led"),
  23                 BERLIN_PINCTRL_FUNCTION(0x3, "pwm")),
  24         BERLIN_PINCTRL_GROUP("G1", 0x00, 0x3, 0x03,
  25                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  26                 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  27                 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  28                 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  29         BERLIN_PINCTRL_GROUP("G2", 0x00, 0x3, 0x06,
  30                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  31                 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  32                 BERLIN_PINCTRL_FUNCTION(0x2, "fe"),
  33                 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
  34                 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  35                 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  36         BERLIN_PINCTRL_GROUP("G3", 0x00, 0x3, 0x09,
  37                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  38                 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  39                 BERLIN_PINCTRL_FUNCTION(0x2, "twsi2"),
  40                 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
  41                 BERLIN_PINCTRL_FUNCTION(0x4, "fe"),
  42                 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  43                 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  44         BERLIN_PINCTRL_GROUP("G4", 0x00, 0x3, 0x0c,
  45                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  46                 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  47                 BERLIN_PINCTRL_FUNCTION(0x2, "twsi3"),
  48                 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
  49                 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
  50                 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  51                 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  52         BERLIN_PINCTRL_GROUP("G5", 0x00, 0x3, 0x0f,
  53                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  54                 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  55                 BERLIN_PINCTRL_FUNCTION(0x2, "twsi3"),
  56                 BERLIN_PINCTRL_FUNCTION(0x3, "arc"),
  57                 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
  58                 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  59                 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  60         BERLIN_PINCTRL_GROUP("G6", 0x00, 0x3, 0x12,
  61                 BERLIN_PINCTRL_FUNCTION(0x0, "uart0"),  /* RX/TX */
  62                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  63         BERLIN_PINCTRL_GROUP("G7", 0x00, 0x3, 0x15,
  64                 BERLIN_PINCTRL_FUNCTION(0x0, "eddc"),
  65                 BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
  66                 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  67         BERLIN_PINCTRL_GROUP("G8", 0x00, 0x3, 0x18,
  68                 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */
  69                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  70         BERLIN_PINCTRL_GROUP("G9", 0x00, 0x3, 0x1b,
  71                 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  72                 BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS1n/SS2n */
  73                 BERLIN_PINCTRL_FUNCTION(0x3, "twsi0")),
  74         BERLIN_PINCTRL_GROUP("G10", 0x00, 0x2, 0x1e,
  75                 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK */
  76                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  77         BERLIN_PINCTRL_GROUP("G11", 0x04, 0x2, 0x00,
  78                 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDI/SDO */
  79                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  80         BERLIN_PINCTRL_GROUP("G12", 0x04, 0x3, 0x02,
  81                 BERLIN_PINCTRL_FUNCTION(0x0, "usb1"),
  82                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  83         BERLIN_PINCTRL_GROUP("G13", 0x04, 0x3, 0x05,
  84                 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
  85                 BERLIN_PINCTRL_FUNCTION(0x1, "usb0_dbg"),
  86                 BERLIN_PINCTRL_FUNCTION(0x2, "usb1_dbg")),
  87         BERLIN_PINCTRL_GROUP("G14", 0x04, 0x1, 0x08,
  88                 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
  89                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  90         BERLIN_PINCTRL_GROUP("G15", 0x04, 0x3, 0x09,
  91                 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
  92                 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  93         BERLIN_PINCTRL_GROUP("G16", 0x04, 0x3, 0x0c,
  94                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
  95         BERLIN_PINCTRL_GROUP("G17", 0x04, 0x3, 0x0f,
  96                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
  97         BERLIN_PINCTRL_GROUP("G18", 0x04, 0x2, 0x12,
  98                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
  99         BERLIN_PINCTRL_GROUP("G19", 0x04, 0x2, 0x14,
 100                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 101         BERLIN_PINCTRL_GROUP("G20", 0x04, 0x2, 0x16,
 102                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 103         BERLIN_PINCTRL_GROUP("G21", 0x04, 0x3, 0x18,
 104                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 105         BERLIN_PINCTRL_GROUP("G22", 0x04, 0x3, 0x1b,
 106                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 107         BERLIN_PINCTRL_GROUP("G23", 0x08, 0x3, 0x00,
 108                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 109         BERLIN_PINCTRL_GROUP("G24", 0x08, 0x2, 0x03,
 110                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 111         BERLIN_PINCTRL_GROUP("G25", 0x08, 0x2, 0x05,
 112                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 113         BERLIN_PINCTRL_GROUP("G26", 0x08, 0x1, 0x07,
 114                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 115         BERLIN_PINCTRL_GROUP("G27", 0x08, 0x2, 0x08,
 116                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 117         BERLIN_PINCTRL_GROUP("G28", 0x08, 0x3, 0x0a,
 118                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 119         BERLIN_PINCTRL_GROUP("G29", 0x08, 0x3, 0x0d,
 120                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 121 };
 122 
 123 static const struct berlin_desc_group berlin2cd_sysmgr_pinctrl_groups[] = {
 124         /* GSM */
 125         BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
 126                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 127         BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
 128                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 129         BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
 130                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 131         BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
 132                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 133         BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x2, 0x08,
 134                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 135         BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x2, 0x0a,
 136                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 137         BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x2, 0x0c,
 138                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 139         BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0e,
 140                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 141         BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0f,
 142                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 143         BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x10,
 144                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 145         BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x11,
 146                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 147         BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x12,
 148                 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
 149 };
 150 
 151 static const struct berlin_pinctrl_desc berlin2cd_soc_pinctrl_data = {
 152         .groups = berlin2cd_soc_pinctrl_groups,
 153         .ngroups = ARRAY_SIZE(berlin2cd_soc_pinctrl_groups),
 154 };
 155 
 156 static const struct berlin_pinctrl_desc berlin2cd_sysmgr_pinctrl_data = {
 157         .groups = berlin2cd_sysmgr_pinctrl_groups,
 158         .ngroups = ARRAY_SIZE(berlin2cd_sysmgr_pinctrl_groups),
 159 };
 160 
 161 static const struct of_device_id berlin2cd_pinctrl_match[] = {
 162         {
 163                 .compatible = "marvell,berlin2cd-soc-pinctrl",
 164                 .data = &berlin2cd_soc_pinctrl_data
 165         },
 166         {
 167                 .compatible = "marvell,berlin2cd-system-pinctrl",
 168                 .data = &berlin2cd_sysmgr_pinctrl_data
 169         },
 170         {}
 171 };
 172 
 173 static int berlin2cd_pinctrl_probe(struct platform_device *pdev)
 174 {
 175         const struct of_device_id *match =
 176                 of_match_device(berlin2cd_pinctrl_match, &pdev->dev);
 177 
 178         return berlin_pinctrl_probe(pdev, match->data);
 179 }
 180 
 181 static struct platform_driver berlin2cd_pinctrl_driver = {
 182         .probe  = berlin2cd_pinctrl_probe,
 183         .driver = {
 184                 .name = "berlin-bg2cd-pinctrl",
 185                 .of_match_table = berlin2cd_pinctrl_match,
 186         },
 187 };
 188 builtin_platform_driver(berlin2cd_pinctrl_driver);

/* [<][>][^][v][top][bottom][index][help] */