Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Pin Control driver for SuperH Pin Function Controller. |
| 4 | * |
| 5 | * Authors: Magnus Damm, Paul Mundt, Laurent Pinchart |
| 6 | * |
| 7 | * Copyright (C) 2008 Magnus Damm |
| 8 | * Copyright (C) 2009 - 2012 Paul Mundt |
| 9 | * Copyright (C) 2017 Marek Vasut |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #define DRV_NAME "sh-pfc" |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <dm.h> |
| 16 | #include <errno.h> |
Simon Glass | 9bc1564 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 17 | #include <dm/device_compat.h> |
Simon Glass | d66c5f7 | 2020-02-03 07:36:15 -0700 | [diff] [blame] | 18 | #include <dm/devres.h> |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 19 | #include <dm/pinctrl.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 20 | #include <linux/bitops.h> |
Simon Glass | c06c1be | 2020-05-10 11:40:08 -0600 | [diff] [blame] | 21 | #include <linux/bug.h> |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 22 | #include <linux/io.h> |
| 23 | #include <linux/sizes.h> |
| 24 | |
| 25 | #include "sh_pfc.h" |
| 26 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 27 | enum sh_pfc_model { |
Marek Vasut | c40f2d6 | 2018-01-17 22:18:59 +0100 | [diff] [blame] | 28 | SH_PFC_R8A7790 = 0, |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 29 | SH_PFC_R8A7791, |
Marek Vasut | 1ef3930 | 2018-01-17 22:29:50 +0100 | [diff] [blame] | 30 | SH_PFC_R8A7792, |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 31 | SH_PFC_R8A7793, |
Marek Vasut | 4dd88d5 | 2018-01-17 22:33:59 +0100 | [diff] [blame] | 32 | SH_PFC_R8A7794, |
Marek Vasut | c40f2d6 | 2018-01-17 22:18:59 +0100 | [diff] [blame] | 33 | SH_PFC_R8A7795, |
Marek Vasut | d0f9c7b | 2023-01-26 21:01:41 +0100 | [diff] [blame] | 34 | SH_PFC_R8A77960, |
| 35 | SH_PFC_R8A77961, |
Adam Ford | 96980fb | 2020-06-30 09:30:09 -0500 | [diff] [blame] | 36 | SH_PFC_R8A774A1, |
Biju Das | d1d7888 | 2020-10-28 10:34:21 +0000 | [diff] [blame] | 37 | SH_PFC_R8A774B1, |
Lad Prabhakar | 53b88b9 | 2021-03-15 22:24:04 +0000 | [diff] [blame] | 38 | SH_PFC_R8A774C0, |
Biju Das | 121bd00 | 2020-10-28 10:34:22 +0000 | [diff] [blame] | 39 | SH_PFC_R8A774E1, |
Marek Vasut | 72269e0 | 2019-03-04 01:32:44 +0100 | [diff] [blame] | 40 | SH_PFC_R8A77965, |
Marek Vasut | a0e11e5 | 2017-10-09 20:57:29 +0200 | [diff] [blame] | 41 | SH_PFC_R8A77970, |
Marek Vasut | a6a7f48 | 2019-07-29 19:59:44 +0200 | [diff] [blame] | 42 | SH_PFC_R8A77980, |
Marek Vasut | 68a7704 | 2018-04-26 13:09:20 +0200 | [diff] [blame] | 43 | SH_PFC_R8A77990, |
Marek Vasut | 7d35e64 | 2017-10-08 20:57:37 +0200 | [diff] [blame] | 44 | SH_PFC_R8A77995, |
Marek Vasut | 4dbc653 | 2021-04-27 01:55:54 +0200 | [diff] [blame] | 45 | SH_PFC_R8A779A0, |
LUU HOAI | 9b68f5d | 2023-02-28 22:34:40 +0100 | [diff] [blame^] | 46 | SH_PFC_R8A779F0, |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | struct sh_pfc_pin_config { |
| 50 | u32 type; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 51 | const char *name; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | struct sh_pfc_pinctrl { |
| 55 | struct sh_pfc *pfc; |
| 56 | |
| 57 | struct sh_pfc_pin_config *configs; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | struct sh_pfc_pin_range { |
| 61 | u16 start; |
| 62 | u16 end; |
| 63 | }; |
| 64 | |
| 65 | struct sh_pfc_pinctrl_priv { |
| 66 | struct sh_pfc pfc; |
| 67 | struct sh_pfc_pinctrl pmx; |
| 68 | }; |
| 69 | |
| 70 | int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin) |
| 71 | { |
| 72 | unsigned int offset; |
| 73 | unsigned int i; |
| 74 | |
| 75 | for (i = 0, offset = 0; i < pfc->nr_ranges; ++i) { |
| 76 | const struct sh_pfc_pin_range *range = &pfc->ranges[i]; |
| 77 | |
| 78 | if (pin <= range->end) |
| 79 | return pin >= range->start |
| 80 | ? offset + pin - range->start : -1; |
| 81 | |
| 82 | offset += range->end - range->start + 1; |
| 83 | } |
| 84 | |
| 85 | return -EINVAL; |
| 86 | } |
| 87 | |
| 88 | static int sh_pfc_enum_in_range(u16 enum_id, const struct pinmux_range *r) |
| 89 | { |
| 90 | if (enum_id < r->begin) |
| 91 | return 0; |
| 92 | |
| 93 | if (enum_id > r->end) |
| 94 | return 0; |
| 95 | |
| 96 | return 1; |
| 97 | } |
| 98 | |
| 99 | u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned int reg_width) |
| 100 | { |
| 101 | switch (reg_width) { |
| 102 | case 8: |
| 103 | return readb(mapped_reg); |
| 104 | case 16: |
| 105 | return readw(mapped_reg); |
| 106 | case 32: |
| 107 | return readl(mapped_reg); |
| 108 | } |
| 109 | |
| 110 | BUG(); |
| 111 | return 0; |
| 112 | } |
| 113 | |
| 114 | void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width, |
| 115 | u32 data) |
| 116 | { |
| 117 | switch (reg_width) { |
| 118 | case 8: |
| 119 | writeb(data, mapped_reg); |
| 120 | return; |
| 121 | case 16: |
| 122 | writew(data, mapped_reg); |
| 123 | return; |
| 124 | case 32: |
| 125 | writel(data, mapped_reg); |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | BUG(); |
| 130 | } |
| 131 | |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 132 | u32 sh_pfc_read(struct sh_pfc *pfc, u32 reg) |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 133 | { |
Marek Vasut | 068a90b | 2018-06-19 06:13:42 +0200 | [diff] [blame] | 134 | return sh_pfc_read_raw_reg((void __iomem *)(uintptr_t)reg, 32); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 135 | } |
| 136 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 137 | static void sh_pfc_unlock_reg(struct sh_pfc *pfc, u32 reg, u32 data) |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 138 | { |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 139 | u32 unlock; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 140 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 141 | if (!pfc->info->unlock_reg) |
| 142 | return; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 143 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 144 | if (pfc->info->unlock_reg >= 0x80000000UL) |
| 145 | unlock = pfc->info->unlock_reg; |
| 146 | else |
| 147 | /* unlock_reg is a mask */ |
| 148 | unlock = reg & ~pfc->info->unlock_reg; |
| 149 | |
| 150 | sh_pfc_write_raw_reg((void __iomem *)(uintptr_t)unlock, 32, ~data); |
| 151 | } |
| 152 | |
| 153 | void sh_pfc_write(struct sh_pfc *pfc, u32 reg, u32 data) |
| 154 | { |
| 155 | sh_pfc_unlock_reg(pfc, reg, data); |
Marek Vasut | 068a90b | 2018-06-19 06:13:42 +0200 | [diff] [blame] | 156 | sh_pfc_write_raw_reg((void __iomem *)(uintptr_t)reg, 32, data); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, |
| 160 | const struct pinmux_cfg_reg *crp, |
| 161 | unsigned int in_pos, |
| 162 | void __iomem **mapped_regp, u32 *maskp, |
| 163 | unsigned int *posp) |
| 164 | { |
| 165 | unsigned int k; |
| 166 | |
| 167 | *mapped_regp = (void __iomem *)(uintptr_t)crp->reg; |
| 168 | |
| 169 | if (crp->field_width) { |
| 170 | *maskp = (1 << crp->field_width) - 1; |
| 171 | *posp = crp->reg_width - ((in_pos + 1) * crp->field_width); |
| 172 | } else { |
| 173 | *maskp = (1 << crp->var_field_width[in_pos]) - 1; |
| 174 | *posp = crp->reg_width; |
| 175 | for (k = 0; k <= in_pos; k++) |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 176 | *posp -= abs(crp->var_field_width[k]); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 177 | } |
| 178 | } |
| 179 | |
| 180 | static void sh_pfc_write_config_reg(struct sh_pfc *pfc, |
| 181 | const struct pinmux_cfg_reg *crp, |
| 182 | unsigned int field, u32 value) |
| 183 | { |
| 184 | void __iomem *mapped_reg; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 185 | unsigned int pos; |
| 186 | u32 mask, data; |
| 187 | |
| 188 | sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); |
| 189 | |
| 190 | dev_dbg(pfc->dev, "write_reg addr = %x, value = 0x%x, field = %u, " |
| 191 | "r_width = %u, f_width = %u\n", |
| 192 | crp->reg, value, field, crp->reg_width, crp->field_width); |
| 193 | |
| 194 | mask = ~(mask << pos); |
| 195 | value = value << pos; |
| 196 | |
| 197 | data = sh_pfc_read_raw_reg(mapped_reg, crp->reg_width); |
| 198 | data &= mask; |
| 199 | data |= value; |
| 200 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 201 | sh_pfc_unlock_reg(pfc, crp->reg, data); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 202 | sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data); |
| 203 | } |
| 204 | |
| 205 | static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id, |
| 206 | const struct pinmux_cfg_reg **crp, |
| 207 | unsigned int *fieldp, u32 *valuep) |
| 208 | { |
| 209 | unsigned int k = 0; |
| 210 | |
| 211 | while (1) { |
| 212 | const struct pinmux_cfg_reg *config_reg = |
| 213 | pfc->info->cfg_regs + k; |
| 214 | unsigned int r_width = config_reg->reg_width; |
| 215 | unsigned int f_width = config_reg->field_width; |
| 216 | unsigned int curr_width; |
| 217 | unsigned int bit_pos; |
| 218 | unsigned int pos = 0; |
| 219 | unsigned int m = 0; |
| 220 | |
| 221 | if (!r_width) |
| 222 | break; |
| 223 | |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 224 | for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width, m++) { |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 225 | u32 ncomb; |
| 226 | u32 n; |
| 227 | |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 228 | if (f_width) { |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 229 | curr_width = f_width; |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 230 | } else { |
| 231 | curr_width = abs(config_reg->var_field_width[m]); |
| 232 | if (config_reg->var_field_width[m] < 0) |
| 233 | continue; |
| 234 | } |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 235 | |
| 236 | ncomb = 1 << curr_width; |
| 237 | for (n = 0; n < ncomb; n++) { |
| 238 | if (config_reg->enum_ids[pos + n] == enum_id) { |
| 239 | *crp = config_reg; |
| 240 | *fieldp = m; |
| 241 | *valuep = n; |
| 242 | return 0; |
| 243 | } |
| 244 | } |
| 245 | pos += ncomb; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 246 | } |
| 247 | k++; |
| 248 | } |
| 249 | |
| 250 | return -EINVAL; |
| 251 | } |
| 252 | |
| 253 | static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, u16 mark, int pos, |
| 254 | u16 *enum_idp) |
| 255 | { |
| 256 | const u16 *data = pfc->info->pinmux_data; |
| 257 | unsigned int k; |
| 258 | |
| 259 | if (pos) { |
| 260 | *enum_idp = data[pos + 1]; |
| 261 | return pos + 1; |
| 262 | } |
| 263 | |
| 264 | for (k = 0; k < pfc->info->pinmux_data_size; k++) { |
| 265 | if (data[k] == mark) { |
| 266 | *enum_idp = data[k + 1]; |
| 267 | return k + 1; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n", |
| 272 | mark); |
| 273 | return -EINVAL; |
| 274 | } |
| 275 | |
| 276 | int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) |
| 277 | { |
| 278 | const struct pinmux_range *range; |
| 279 | int pos = 0; |
| 280 | |
| 281 | switch (pinmux_type) { |
| 282 | case PINMUX_TYPE_GPIO: |
| 283 | case PINMUX_TYPE_FUNCTION: |
| 284 | range = NULL; |
| 285 | break; |
| 286 | |
| 287 | case PINMUX_TYPE_OUTPUT: |
| 288 | range = &pfc->info->output; |
| 289 | break; |
| 290 | |
| 291 | case PINMUX_TYPE_INPUT: |
| 292 | range = &pfc->info->input; |
| 293 | break; |
| 294 | |
| 295 | default: |
| 296 | return -EINVAL; |
| 297 | } |
| 298 | |
| 299 | /* Iterate over all the configuration fields we need to update. */ |
| 300 | while (1) { |
| 301 | const struct pinmux_cfg_reg *cr; |
| 302 | unsigned int field; |
| 303 | u16 enum_id; |
| 304 | u32 value; |
| 305 | int in_range; |
| 306 | int ret; |
| 307 | |
| 308 | pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); |
| 309 | if (pos < 0) |
| 310 | return pos; |
| 311 | |
| 312 | if (!enum_id) |
| 313 | break; |
| 314 | |
| 315 | /* Check if the configuration field selects a function. If it |
| 316 | * doesn't, skip the field if it's not applicable to the |
| 317 | * requested pinmux type. |
| 318 | */ |
| 319 | in_range = sh_pfc_enum_in_range(enum_id, &pfc->info->function); |
| 320 | if (!in_range) { |
| 321 | if (pinmux_type == PINMUX_TYPE_FUNCTION) { |
| 322 | /* Functions are allowed to modify all |
| 323 | * fields. |
| 324 | */ |
| 325 | in_range = 1; |
| 326 | } else if (pinmux_type != PINMUX_TYPE_GPIO) { |
| 327 | /* Input/output types can only modify fields |
| 328 | * that correspond to their respective ranges. |
| 329 | */ |
| 330 | in_range = sh_pfc_enum_in_range(enum_id, range); |
| 331 | |
| 332 | /* |
| 333 | * special case pass through for fixed |
| 334 | * input-only or output-only pins without |
| 335 | * function enum register association. |
| 336 | */ |
| 337 | if (in_range && enum_id == range->force) |
| 338 | continue; |
| 339 | } |
| 340 | /* GPIOs are only allowed to modify function fields. */ |
| 341 | } |
| 342 | |
| 343 | if (!in_range) |
| 344 | continue; |
| 345 | |
| 346 | ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value); |
| 347 | if (ret < 0) |
| 348 | return ret; |
| 349 | |
| 350 | sh_pfc_write_config_reg(pfc, cr, field, value); |
| 351 | } |
| 352 | |
| 353 | return 0; |
| 354 | } |
| 355 | |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 356 | const struct pinmux_bias_reg * |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 357 | rcar_pin_to_bias_reg(const struct sh_pfc_soc_info *info, unsigned int pin, |
| 358 | unsigned int *bit) |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 359 | { |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 360 | unsigned int i, j; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 361 | |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 362 | for (i = 0; info->bias_regs[i].puen || info->bias_regs[i].pud; i++) { |
| 363 | for (j = 0; j < ARRAY_SIZE(info->bias_regs[i].pins); j++) { |
| 364 | if (info->bias_regs[i].pins[j] == pin) { |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 365 | *bit = j; |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 366 | return &info->bias_regs[i]; |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 367 | } |
| 368 | } |
| 369 | } |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 370 | |
Marek Vasut | eb13e0f | 2018-06-10 16:05:48 +0200 | [diff] [blame] | 371 | WARN_ONCE(1, "Pin %u is not in bias info list\n", pin); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 372 | |
| 373 | return NULL; |
| 374 | } |
| 375 | |
Marek Vasut | d1bc932 | 2023-01-26 21:01:35 +0100 | [diff] [blame] | 376 | unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) |
| 377 | { |
| 378 | const struct pinmux_bias_reg *reg; |
| 379 | unsigned int bit; |
| 380 | |
| 381 | reg = rcar_pin_to_bias_reg(pfc->info, pin, &bit); |
| 382 | if (!reg) |
| 383 | return PIN_CONFIG_BIAS_DISABLE; |
| 384 | |
| 385 | if (reg->puen) { |
| 386 | if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit))) |
| 387 | return PIN_CONFIG_BIAS_DISABLE; |
| 388 | else if (!reg->pud || (sh_pfc_read(pfc, reg->pud) & BIT(bit))) |
| 389 | return PIN_CONFIG_BIAS_PULL_UP; |
| 390 | else |
| 391 | return PIN_CONFIG_BIAS_PULL_DOWN; |
| 392 | } else { |
| 393 | if (sh_pfc_read(pfc, reg->pud) & BIT(bit)) |
| 394 | return PIN_CONFIG_BIAS_PULL_DOWN; |
| 395 | else |
| 396 | return PIN_CONFIG_BIAS_DISABLE; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, |
| 401 | unsigned int bias) |
| 402 | { |
| 403 | const struct pinmux_bias_reg *reg; |
| 404 | u32 enable, updown; |
| 405 | unsigned int bit; |
| 406 | |
| 407 | reg = rcar_pin_to_bias_reg(pfc->info, pin, &bit); |
| 408 | if (!reg) |
| 409 | return; |
| 410 | |
| 411 | if (reg->puen) { |
| 412 | enable = sh_pfc_read(pfc, reg->puen) & ~BIT(bit); |
| 413 | if (bias != PIN_CONFIG_BIAS_DISABLE) { |
| 414 | enable |= BIT(bit); |
| 415 | |
| 416 | if (reg->pud) { |
| 417 | updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); |
| 418 | if (bias == PIN_CONFIG_BIAS_PULL_UP) |
| 419 | updown |= BIT(bit); |
| 420 | |
| 421 | sh_pfc_write(pfc, reg->pud, updown); |
| 422 | } |
| 423 | } |
| 424 | sh_pfc_write(pfc, reg->puen, enable); |
| 425 | } else { |
| 426 | enable = sh_pfc_read(pfc, reg->pud) & ~BIT(bit); |
| 427 | if (bias == PIN_CONFIG_BIAS_PULL_DOWN) |
| 428 | enable |= BIT(bit); |
| 429 | |
| 430 | sh_pfc_write(pfc, reg->pud, enable); |
| 431 | } |
| 432 | } |
| 433 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 434 | static int sh_pfc_init_ranges(struct sh_pfc *pfc) |
| 435 | { |
| 436 | struct sh_pfc_pin_range *range; |
| 437 | unsigned int nr_ranges; |
| 438 | unsigned int i; |
| 439 | |
| 440 | if (pfc->info->pins[0].pin == (u16)-1) { |
| 441 | /* Pin number -1 denotes that the SoC doesn't report pin numbers |
| 442 | * in its pin arrays yet. Consider the pin numbers range as |
| 443 | * continuous and allocate a single range. |
| 444 | */ |
| 445 | pfc->nr_ranges = 1; |
| 446 | pfc->ranges = kzalloc(sizeof(*pfc->ranges), GFP_KERNEL); |
| 447 | if (pfc->ranges == NULL) |
| 448 | return -ENOMEM; |
| 449 | |
| 450 | pfc->ranges->start = 0; |
| 451 | pfc->ranges->end = pfc->info->nr_pins - 1; |
| 452 | pfc->nr_gpio_pins = pfc->info->nr_pins; |
| 453 | |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | /* Count, allocate and fill the ranges. The PFC SoC data pins array must |
| 458 | * be sorted by pin numbers, and pins without a GPIO port must come |
| 459 | * last. |
| 460 | */ |
| 461 | for (i = 1, nr_ranges = 1; i < pfc->info->nr_pins; ++i) { |
| 462 | if (pfc->info->pins[i-1].pin != pfc->info->pins[i].pin - 1) |
| 463 | nr_ranges++; |
| 464 | } |
| 465 | |
| 466 | pfc->nr_ranges = nr_ranges; |
| 467 | pfc->ranges = kzalloc(sizeof(*pfc->ranges) * nr_ranges, GFP_KERNEL); |
| 468 | if (pfc->ranges == NULL) |
| 469 | return -ENOMEM; |
| 470 | |
| 471 | range = pfc->ranges; |
| 472 | range->start = pfc->info->pins[0].pin; |
| 473 | |
| 474 | for (i = 1; i < pfc->info->nr_pins; ++i) { |
| 475 | if (pfc->info->pins[i-1].pin == pfc->info->pins[i].pin - 1) |
| 476 | continue; |
| 477 | |
| 478 | range->end = pfc->info->pins[i-1].pin; |
| 479 | if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO)) |
| 480 | pfc->nr_gpio_pins = range->end + 1; |
| 481 | |
| 482 | range++; |
| 483 | range->start = pfc->info->pins[i].pin; |
| 484 | } |
| 485 | |
| 486 | range->end = pfc->info->pins[i-1].pin; |
| 487 | if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO)) |
| 488 | pfc->nr_gpio_pins = range->end + 1; |
| 489 | |
| 490 | return 0; |
| 491 | } |
| 492 | |
| 493 | static int sh_pfc_pinctrl_get_pins_count(struct udevice *dev) |
| 494 | { |
| 495 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 496 | |
| 497 | return priv->pfc.info->nr_pins; |
| 498 | } |
| 499 | |
| 500 | static const char *sh_pfc_pinctrl_get_pin_name(struct udevice *dev, |
| 501 | unsigned selector) |
| 502 | { |
| 503 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 504 | |
| 505 | return priv->pfc.info->pins[selector].name; |
| 506 | } |
| 507 | |
| 508 | static int sh_pfc_pinctrl_get_groups_count(struct udevice *dev) |
| 509 | { |
| 510 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 511 | |
| 512 | return priv->pfc.info->nr_groups; |
| 513 | } |
| 514 | |
| 515 | static const char *sh_pfc_pinctrl_get_group_name(struct udevice *dev, |
| 516 | unsigned selector) |
| 517 | { |
| 518 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 519 | |
| 520 | return priv->pfc.info->groups[selector].name; |
| 521 | } |
| 522 | |
Lad Prabhakar | 23ea9b4 | 2020-11-28 13:13:09 +0000 | [diff] [blame] | 523 | static int sh_pfc_pinctrl_get_pin_muxing(struct udevice *dev, |
| 524 | unsigned int selector, |
| 525 | char *buf, int size) |
| 526 | { |
| 527 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 528 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 529 | struct sh_pfc *pfc = &priv->pfc; |
| 530 | struct sh_pfc_pin_config *cfg; |
| 531 | const struct sh_pfc_pin *pin; |
| 532 | int idx; |
| 533 | |
| 534 | pin = &priv->pfc.info->pins[selector]; |
| 535 | if (!pin) { |
| 536 | snprintf(buf, size, "Unknown"); |
| 537 | return -EINVAL; |
| 538 | } |
| 539 | |
| 540 | idx = sh_pfc_get_pin_index(pfc, pin->pin); |
| 541 | cfg = &pmx->configs[idx]; |
| 542 | snprintf(buf, size, "%s", cfg->name); |
| 543 | |
| 544 | return 0; |
| 545 | } |
| 546 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 547 | static int sh_pfc_pinctrl_get_functions_count(struct udevice *dev) |
| 548 | { |
| 549 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 550 | |
| 551 | return priv->pfc.info->nr_functions; |
| 552 | } |
| 553 | |
| 554 | static const char *sh_pfc_pinctrl_get_function_name(struct udevice *dev, |
| 555 | unsigned selector) |
| 556 | { |
| 557 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 558 | |
| 559 | return priv->pfc.info->functions[selector].name; |
| 560 | } |
| 561 | |
Marek Vasut | 02d34f0 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 562 | static int sh_pfc_gpio_request_enable(struct udevice *dev, |
| 563 | unsigned pin_selector) |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 564 | { |
| 565 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 566 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 567 | struct sh_pfc *pfc = &priv->pfc; |
| 568 | struct sh_pfc_pin_config *cfg; |
| 569 | const struct sh_pfc_pin *pin = NULL; |
Marek Vasut | 0cc1936 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 570 | int i, ret, idx; |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 571 | |
titron | 09bf498 | 2019-07-22 17:45:37 +0800 | [diff] [blame] | 572 | for (i = 0; i < pfc->info->nr_pins; i++) { |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 573 | if (priv->pfc.info->pins[i].pin != pin_selector) |
| 574 | continue; |
| 575 | |
| 576 | pin = &priv->pfc.info->pins[i]; |
| 577 | break; |
| 578 | } |
| 579 | |
| 580 | if (!pin) |
| 581 | return -EINVAL; |
| 582 | |
| 583 | idx = sh_pfc_get_pin_index(pfc, pin->pin); |
| 584 | cfg = &pmx->configs[idx]; |
| 585 | |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 586 | if (cfg->type != PINMUX_TYPE_NONE) { |
| 587 | if (!strcmp(cfg->name, pin->name)) |
| 588 | return 0; |
| 589 | |
| 590 | dev_err(pfc->dev, "Pin already used as %s\n", |
| 591 | cfg->name); |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 592 | return -EBUSY; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 593 | } |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 594 | |
Marek Vasut | 0cc1936 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 595 | ret = sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_GPIO); |
| 596 | if (ret) |
| 597 | return ret; |
| 598 | |
| 599 | cfg->type = PINMUX_TYPE_GPIO; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 600 | cfg->name = "gpio"; |
Marek Vasut | 0cc1936 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 601 | |
| 602 | return 0; |
Marek Vasut | 489d79c | 2017-11-26 18:07:29 +0100 | [diff] [blame] | 603 | } |
| 604 | |
Marek Vasut | 02d34f0 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 605 | static int sh_pfc_gpio_disable_free(struct udevice *dev, |
| 606 | unsigned pin_selector) |
| 607 | { |
| 608 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 609 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 610 | struct sh_pfc *pfc = &priv->pfc; |
| 611 | struct sh_pfc_pin_config *cfg; |
| 612 | const struct sh_pfc_pin *pin = NULL; |
| 613 | int i, idx; |
| 614 | |
titron | 09bf498 | 2019-07-22 17:45:37 +0800 | [diff] [blame] | 615 | for (i = 0; i < pfc->info->nr_pins; i++) { |
Marek Vasut | 02d34f0 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 616 | if (priv->pfc.info->pins[i].pin != pin_selector) |
| 617 | continue; |
| 618 | |
| 619 | pin = &priv->pfc.info->pins[i]; |
| 620 | break; |
| 621 | } |
| 622 | |
| 623 | if (!pin) |
| 624 | return -EINVAL; |
| 625 | |
| 626 | idx = sh_pfc_get_pin_index(pfc, pin->pin); |
| 627 | cfg = &pmx->configs[idx]; |
| 628 | |
| 629 | cfg->type = PINMUX_TYPE_NONE; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 630 | cfg->name = "none"; |
Marek Vasut | 02d34f0 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 631 | |
| 632 | return 0; |
| 633 | } |
| 634 | |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 635 | static int sh_pfc_pinctrl_pin_set(struct udevice *dev, unsigned pin_selector, |
| 636 | unsigned func_selector) |
| 637 | { |
| 638 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 639 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 640 | struct sh_pfc *pfc = &priv->pfc; |
| 641 | const struct sh_pfc_pin *pin = &priv->pfc.info->pins[pin_selector]; |
| 642 | int idx = sh_pfc_get_pin_index(pfc, pin->pin); |
| 643 | struct sh_pfc_pin_config *cfg = &pmx->configs[idx]; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 644 | int ret; |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 645 | |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 646 | if (cfg->type != PINMUX_TYPE_NONE) { |
| 647 | if (!strcmp(cfg->name, pin->name)) |
| 648 | return 0; |
| 649 | |
| 650 | dev_err(pfc->dev, "Pin already used as %s\n", |
| 651 | cfg->name); |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 652 | return -EBUSY; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | ret = sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_FUNCTION); |
| 656 | if (ret) |
| 657 | return ret; |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 658 | |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 659 | cfg->type = PINMUX_TYPE_FUNCTION; |
| 660 | cfg->name = "function"; |
| 661 | |
| 662 | return 0; |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 663 | } |
| 664 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 665 | static int sh_pfc_pinctrl_group_set(struct udevice *dev, unsigned group_selector, |
| 666 | unsigned func_selector) |
| 667 | { |
| 668 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 669 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 670 | struct sh_pfc *pfc = &priv->pfc; |
| 671 | const struct sh_pfc_pin_group *grp = &priv->pfc.info->groups[group_selector]; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 672 | bool grp_pins_configured = true; |
| 673 | struct sh_pfc_pin_config *cfg; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 674 | unsigned int i; |
| 675 | int ret = 0; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 676 | int idx; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 677 | |
| 678 | for (i = 0; i < grp->nr_pins; ++i) { |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 679 | idx = sh_pfc_get_pin_index(pfc, grp->pins[i]); |
| 680 | cfg = &pmx->configs[idx]; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 681 | |
| 682 | if (cfg->type != PINMUX_TYPE_NONE) { |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 683 | if (!strcmp(cfg->name, grp->name)) |
| 684 | continue; |
| 685 | |
| 686 | dev_err(pfc->dev, "Pin already used as %s\n", |
| 687 | cfg->name); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 688 | ret = -EBUSY; |
| 689 | goto done; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 690 | } else { |
| 691 | grp_pins_configured = false; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 692 | } |
| 693 | } |
| 694 | |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 695 | if (grp_pins_configured) |
| 696 | return 0; |
| 697 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 698 | for (i = 0; i < grp->nr_pins; ++i) { |
| 699 | ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); |
| 700 | if (ret < 0) |
| 701 | break; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 702 | |
| 703 | idx = sh_pfc_get_pin_index(pfc, grp->pins[i]); |
| 704 | cfg = &pmx->configs[idx]; |
| 705 | cfg->type = PINMUX_TYPE_FUNCTION; |
| 706 | cfg->name = priv->pfc.info->groups[group_selector].name; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | done: |
| 710 | return ret; |
| 711 | } |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 712 | #if CONFIG_IS_ENABLED(PINCONF) |
| 713 | static const struct pinconf_param sh_pfc_pinconf_params[] = { |
| 714 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, |
| 715 | { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 1 }, |
| 716 | { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 1 }, |
| 717 | { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 }, |
| 718 | { "power-source", PIN_CONFIG_POWER_SOURCE, 3300 }, |
| 719 | }; |
| 720 | |
| 721 | static void __iomem * |
| 722 | sh_pfc_pinconf_find_drive_strength_reg(struct sh_pfc *pfc, unsigned int pin, |
| 723 | unsigned int *offset, unsigned int *size) |
| 724 | { |
| 725 | const struct pinmux_drive_reg_field *field; |
| 726 | const struct pinmux_drive_reg *reg; |
| 727 | unsigned int i; |
| 728 | |
| 729 | for (reg = pfc->info->drive_regs; reg->reg; ++reg) { |
| 730 | for (i = 0; i < ARRAY_SIZE(reg->fields); ++i) { |
| 731 | field = ®->fields[i]; |
| 732 | |
| 733 | if (field->size && field->pin == pin) { |
| 734 | *offset = field->offset; |
| 735 | *size = field->size; |
| 736 | |
| 737 | return (void __iomem *)(uintptr_t)reg->reg; |
| 738 | } |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | return NULL; |
| 743 | } |
| 744 | |
| 745 | static int sh_pfc_pinconf_set_drive_strength(struct sh_pfc *pfc, |
| 746 | unsigned int pin, u16 strength) |
| 747 | { |
| 748 | unsigned int offset; |
| 749 | unsigned int size; |
| 750 | unsigned int step; |
| 751 | void __iomem *reg; |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 752 | u32 val; |
| 753 | |
| 754 | reg = sh_pfc_pinconf_find_drive_strength_reg(pfc, pin, &offset, &size); |
| 755 | if (!reg) |
| 756 | return -EINVAL; |
| 757 | |
| 758 | step = size == 2 ? 6 : 3; |
| 759 | |
| 760 | if (strength < step || strength > 24) |
| 761 | return -EINVAL; |
| 762 | |
| 763 | /* Convert the value from mA based on a full drive strength value of |
| 764 | * 24mA. We can make the full value configurable later if needed. |
| 765 | */ |
| 766 | strength = strength / step - 1; |
| 767 | |
| 768 | val = sh_pfc_read_raw_reg(reg, 32); |
Marek Vasut | 0d9c810 | 2018-06-13 08:02:55 +0200 | [diff] [blame] | 769 | val &= ~GENMASK(offset + 4 - 1, offset); |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 770 | val |= strength << offset; |
| 771 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 772 | sh_pfc_unlock_reg(pfc, (uintptr_t)reg, val); |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 773 | sh_pfc_write_raw_reg(reg, 32, val); |
| 774 | |
| 775 | return 0; |
| 776 | } |
| 777 | |
| 778 | /* Check whether the requested parameter is supported for a pin. */ |
| 779 | static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin, |
| 780 | unsigned int param) |
| 781 | { |
| 782 | int idx = sh_pfc_get_pin_index(pfc, _pin); |
| 783 | const struct sh_pfc_pin *pin = &pfc->info->pins[idx]; |
| 784 | |
| 785 | switch (param) { |
| 786 | case PIN_CONFIG_BIAS_DISABLE: |
| 787 | return pin->configs & |
| 788 | (SH_PFC_PIN_CFG_PULL_UP | SH_PFC_PIN_CFG_PULL_DOWN); |
| 789 | |
| 790 | case PIN_CONFIG_BIAS_PULL_UP: |
| 791 | return pin->configs & SH_PFC_PIN_CFG_PULL_UP; |
| 792 | |
| 793 | case PIN_CONFIG_BIAS_PULL_DOWN: |
| 794 | return pin->configs & SH_PFC_PIN_CFG_PULL_DOWN; |
| 795 | |
| 796 | case PIN_CONFIG_DRIVE_STRENGTH: |
| 797 | return pin->configs & SH_PFC_PIN_CFG_DRIVE_STRENGTH; |
| 798 | |
| 799 | case PIN_CONFIG_POWER_SOURCE: |
| 800 | return pin->configs & SH_PFC_PIN_CFG_IO_VOLTAGE; |
| 801 | |
| 802 | default: |
| 803 | return false; |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | static int sh_pfc_pinconf_set(struct sh_pfc_pinctrl *pmx, unsigned _pin, |
| 808 | unsigned int param, unsigned int arg) |
| 809 | { |
| 810 | struct sh_pfc *pfc = pmx->pfc; |
| 811 | void __iomem *pocctrl; |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 812 | u32 addr, val; |
| 813 | int bit, ret; |
| 814 | |
| 815 | if (!sh_pfc_pinconf_validate(pfc, _pin, param)) |
| 816 | return -ENOTSUPP; |
| 817 | |
| 818 | switch (param) { |
| 819 | case PIN_CONFIG_BIAS_PULL_UP: |
| 820 | case PIN_CONFIG_BIAS_PULL_DOWN: |
| 821 | case PIN_CONFIG_BIAS_DISABLE: |
| 822 | if (!pfc->info->ops || !pfc->info->ops->set_bias) |
| 823 | return -ENOTSUPP; |
| 824 | |
| 825 | pfc->info->ops->set_bias(pfc, _pin, param); |
| 826 | |
| 827 | break; |
| 828 | |
| 829 | case PIN_CONFIG_DRIVE_STRENGTH: |
| 830 | ret = sh_pfc_pinconf_set_drive_strength(pfc, _pin, arg); |
| 831 | if (ret < 0) |
| 832 | return ret; |
| 833 | |
| 834 | break; |
| 835 | |
| 836 | case PIN_CONFIG_POWER_SOURCE: |
| 837 | if (!pfc->info->ops || !pfc->info->ops->pin_to_pocctrl) |
| 838 | return -ENOTSUPP; |
| 839 | |
Marek Vasut | c02d50a | 2023-01-26 21:01:40 +0100 | [diff] [blame] | 840 | bit = pfc->info->ops->pin_to_pocctrl(_pin, &addr); |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 841 | if (bit < 0) { |
| 842 | printf("invalid pin %#x", _pin); |
| 843 | return bit; |
| 844 | } |
| 845 | |
| 846 | if (arg != 1800 && arg != 3300) |
| 847 | return -EINVAL; |
| 848 | |
| 849 | pocctrl = (void __iomem *)(uintptr_t)addr; |
| 850 | |
| 851 | val = sh_pfc_read_raw_reg(pocctrl, 32); |
| 852 | if (arg == 3300) |
| 853 | val |= BIT(bit); |
| 854 | else |
| 855 | val &= ~BIT(bit); |
| 856 | |
Marek Vasut | 651d5a7 | 2021-04-27 22:03:38 +0200 | [diff] [blame] | 857 | sh_pfc_unlock_reg(pfc, addr, val); |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 858 | sh_pfc_write_raw_reg(pocctrl, 32, val); |
| 859 | |
| 860 | break; |
| 861 | |
| 862 | default: |
| 863 | return -ENOTSUPP; |
| 864 | } |
| 865 | |
| 866 | return 0; |
| 867 | } |
| 868 | |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 869 | static int sh_pfc_pinconf_pin_set(struct udevice *dev, |
| 870 | unsigned int pin_selector, |
| 871 | unsigned int param, unsigned int arg) |
| 872 | { |
| 873 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 874 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 875 | struct sh_pfc *pfc = &priv->pfc; |
| 876 | const struct sh_pfc_pin *pin = &pfc->info->pins[pin_selector]; |
| 877 | |
| 878 | sh_pfc_pinconf_set(pmx, pin->pin, param, arg); |
| 879 | |
| 880 | return 0; |
| 881 | } |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 882 | |
| 883 | static int sh_pfc_pinconf_group_set(struct udevice *dev, |
| 884 | unsigned int group_selector, |
| 885 | unsigned int param, unsigned int arg) |
| 886 | { |
| 887 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 888 | struct sh_pfc_pinctrl *pmx = &priv->pmx; |
| 889 | struct sh_pfc *pfc = &priv->pfc; |
| 890 | const struct sh_pfc_pin_group *grp = &pfc->info->groups[group_selector]; |
| 891 | unsigned int i; |
| 892 | |
| 893 | for (i = 0; i < grp->nr_pins; i++) |
| 894 | sh_pfc_pinconf_set(pmx, grp->pins[i], param, arg); |
| 895 | |
| 896 | return 0; |
| 897 | } |
| 898 | #endif |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 899 | |
| 900 | static struct pinctrl_ops sh_pfc_pinctrl_ops = { |
| 901 | .get_pins_count = sh_pfc_pinctrl_get_pins_count, |
| 902 | .get_pin_name = sh_pfc_pinctrl_get_pin_name, |
| 903 | .get_groups_count = sh_pfc_pinctrl_get_groups_count, |
| 904 | .get_group_name = sh_pfc_pinctrl_get_group_name, |
Lad Prabhakar | 23ea9b4 | 2020-11-28 13:13:09 +0000 | [diff] [blame] | 905 | .get_pin_muxing = sh_pfc_pinctrl_get_pin_muxing, |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 906 | .get_functions_count = sh_pfc_pinctrl_get_functions_count, |
| 907 | .get_function_name = sh_pfc_pinctrl_get_function_name, |
| 908 | |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 909 | #if CONFIG_IS_ENABLED(PINCONF) |
| 910 | .pinconf_num_params = ARRAY_SIZE(sh_pfc_pinconf_params), |
| 911 | .pinconf_params = sh_pfc_pinconf_params, |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 912 | .pinconf_set = sh_pfc_pinconf_pin_set, |
Marek Vasut | c9dd9ae | 2017-09-28 00:56:24 +0200 | [diff] [blame] | 913 | .pinconf_group_set = sh_pfc_pinconf_group_set, |
| 914 | #endif |
Marek Vasut | 5e6db84 | 2017-11-26 17:42:16 +0100 | [diff] [blame] | 915 | .pinmux_set = sh_pfc_pinctrl_pin_set, |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 916 | .pinmux_group_set = sh_pfc_pinctrl_group_set, |
| 917 | .set_state = pinctrl_generic_set_state, |
Marek Vasut | 02d34f0 | 2019-04-21 22:46:25 +0200 | [diff] [blame] | 918 | |
| 919 | .gpio_request_enable = sh_pfc_gpio_request_enable, |
| 920 | .gpio_disable_free = sh_pfc_gpio_disable_free, |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 921 | }; |
| 922 | |
| 923 | static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) |
| 924 | { |
| 925 | unsigned int i; |
| 926 | |
| 927 | /* Allocate and initialize the pins and configs arrays. */ |
| 928 | pmx->configs = kzalloc(sizeof(*pmx->configs) * pfc->info->nr_pins, |
| 929 | GFP_KERNEL); |
| 930 | if (unlikely(!pmx->configs)) |
| 931 | return -ENOMEM; |
| 932 | |
| 933 | for (i = 0; i < pfc->info->nr_pins; ++i) { |
| 934 | struct sh_pfc_pin_config *cfg = &pmx->configs[i]; |
| 935 | cfg->type = PINMUX_TYPE_NONE; |
Lad Prabhakar | 13ed8d5 | 2020-11-28 13:13:08 +0000 | [diff] [blame] | 936 | cfg->name = "none"; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | return 0; |
| 940 | } |
| 941 | |
| 942 | |
| 943 | static int sh_pfc_pinctrl_probe(struct udevice *dev) |
| 944 | { |
| 945 | struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); |
| 946 | enum sh_pfc_model model = dev_get_driver_data(dev); |
| 947 | fdt_addr_t base; |
| 948 | |
Masahiro Yamada | a89b4de | 2020-07-17 14:36:48 +0900 | [diff] [blame] | 949 | base = dev_read_addr(dev); |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 950 | if (base == FDT_ADDR_T_NONE) |
| 951 | return -EINVAL; |
| 952 | |
| 953 | priv->pfc.regs = devm_ioremap(dev, base, SZ_2K); |
| 954 | if (!priv->pfc.regs) |
| 955 | return -ENOMEM; |
| 956 | |
Marek Vasut | c40f2d6 | 2018-01-17 22:18:59 +0100 | [diff] [blame] | 957 | #ifdef CONFIG_PINCTRL_PFC_R8A7790 |
| 958 | if (model == SH_PFC_R8A7790) |
| 959 | priv->pfc.info = &r8a7790_pinmux_info; |
| 960 | #endif |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 961 | #ifdef CONFIG_PINCTRL_PFC_R8A7791 |
| 962 | if (model == SH_PFC_R8A7791) |
| 963 | priv->pfc.info = &r8a7791_pinmux_info; |
| 964 | #endif |
Marek Vasut | 1ef3930 | 2018-01-17 22:29:50 +0100 | [diff] [blame] | 965 | #ifdef CONFIG_PINCTRL_PFC_R8A7792 |
| 966 | if (model == SH_PFC_R8A7792) |
| 967 | priv->pfc.info = &r8a7792_pinmux_info; |
| 968 | #endif |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 969 | #ifdef CONFIG_PINCTRL_PFC_R8A7793 |
| 970 | if (model == SH_PFC_R8A7793) |
| 971 | priv->pfc.info = &r8a7793_pinmux_info; |
| 972 | #endif |
Marek Vasut | 4dd88d5 | 2018-01-17 22:33:59 +0100 | [diff] [blame] | 973 | #ifdef CONFIG_PINCTRL_PFC_R8A7794 |
| 974 | if (model == SH_PFC_R8A7794) |
| 975 | priv->pfc.info = &r8a7794_pinmux_info; |
| 976 | #endif |
Marek Vasut | c02d50a | 2023-01-26 21:01:40 +0100 | [diff] [blame] | 977 | #ifdef CONFIG_PINCTRL_PFC_R8A77951 |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 978 | if (model == SH_PFC_R8A7795) |
Marek Vasut | c02d50a | 2023-01-26 21:01:40 +0100 | [diff] [blame] | 979 | priv->pfc.info = &r8a77951_pinmux_info; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 980 | #endif |
Marek Vasut | d0f9c7b | 2023-01-26 21:01:41 +0100 | [diff] [blame] | 981 | #ifdef CONFIG_PINCTRL_PFC_R8A77960 |
| 982 | if (model == SH_PFC_R8A77960) |
| 983 | priv->pfc.info = &r8a77960_pinmux_info; |
| 984 | #endif |
| 985 | #ifdef CONFIG_PINCTRL_PFC_R8A77961 |
| 986 | if (model == SH_PFC_R8A77961) |
| 987 | priv->pfc.info = &r8a77961_pinmux_info; |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 988 | #endif |
Adam Ford | 96980fb | 2020-06-30 09:30:09 -0500 | [diff] [blame] | 989 | #ifdef CONFIG_PINCTRL_PFC_R8A774A1 |
| 990 | if (model == SH_PFC_R8A774A1) |
| 991 | priv->pfc.info = &r8a774a1_pinmux_info; |
| 992 | #endif |
Biju Das | d1d7888 | 2020-10-28 10:34:21 +0000 | [diff] [blame] | 993 | #ifdef CONFIG_PINCTRL_PFC_R8A774B1 |
| 994 | if (model == SH_PFC_R8A774B1) |
| 995 | priv->pfc.info = &r8a774b1_pinmux_info; |
| 996 | #endif |
Lad Prabhakar | 53b88b9 | 2021-03-15 22:24:04 +0000 | [diff] [blame] | 997 | #ifdef CONFIG_PINCTRL_PFC_R8A774C0 |
| 998 | if (model == SH_PFC_R8A774C0) |
| 999 | priv->pfc.info = &r8a774c0_pinmux_info; |
| 1000 | #endif |
Biju Das | 121bd00 | 2020-10-28 10:34:22 +0000 | [diff] [blame] | 1001 | #ifdef CONFIG_PINCTRL_PFC_R8A774E1 |
| 1002 | if (model == SH_PFC_R8A774E1) |
| 1003 | priv->pfc.info = &r8a774e1_pinmux_info; |
| 1004 | #endif |
Marek Vasut | 72269e0 | 2019-03-04 01:32:44 +0100 | [diff] [blame] | 1005 | #ifdef CONFIG_PINCTRL_PFC_R8A77965 |
| 1006 | if (model == SH_PFC_R8A77965) |
| 1007 | priv->pfc.info = &r8a77965_pinmux_info; |
| 1008 | #endif |
Marek Vasut | a0e11e5 | 2017-10-09 20:57:29 +0200 | [diff] [blame] | 1009 | #ifdef CONFIG_PINCTRL_PFC_R8A77970 |
| 1010 | if (model == SH_PFC_R8A77970) |
| 1011 | priv->pfc.info = &r8a77970_pinmux_info; |
| 1012 | #endif |
Marek Vasut | a6a7f48 | 2019-07-29 19:59:44 +0200 | [diff] [blame] | 1013 | #ifdef CONFIG_PINCTRL_PFC_R8A77980 |
| 1014 | if (model == SH_PFC_R8A77980) |
| 1015 | priv->pfc.info = &r8a77980_pinmux_info; |
| 1016 | #endif |
Marek Vasut | 68a7704 | 2018-04-26 13:09:20 +0200 | [diff] [blame] | 1017 | #ifdef CONFIG_PINCTRL_PFC_R8A77990 |
| 1018 | if (model == SH_PFC_R8A77990) |
| 1019 | priv->pfc.info = &r8a77990_pinmux_info; |
| 1020 | #endif |
Marek Vasut | 7d35e64 | 2017-10-08 20:57:37 +0200 | [diff] [blame] | 1021 | #ifdef CONFIG_PINCTRL_PFC_R8A77995 |
| 1022 | if (model == SH_PFC_R8A77995) |
| 1023 | priv->pfc.info = &r8a77995_pinmux_info; |
| 1024 | #endif |
Marek Vasut | 4dbc653 | 2021-04-27 01:55:54 +0200 | [diff] [blame] | 1025 | #ifdef CONFIG_PINCTRL_PFC_R8A779A0 |
| 1026 | if (model == SH_PFC_R8A779A0) |
| 1027 | priv->pfc.info = &r8a779a0_pinmux_info; |
| 1028 | #endif |
LUU HOAI | 9b68f5d | 2023-02-28 22:34:40 +0100 | [diff] [blame^] | 1029 | #ifdef CONFIG_PINCTRL_PFC_R8A779F0 |
| 1030 | if (model == SH_PFC_R8A779F0) |
| 1031 | priv->pfc.info = &r8a779f0_pinmux_info; |
| 1032 | #endif |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1033 | |
| 1034 | priv->pmx.pfc = &priv->pfc; |
| 1035 | sh_pfc_init_ranges(&priv->pfc); |
| 1036 | sh_pfc_map_pins(&priv->pfc, &priv->pmx); |
| 1037 | |
| 1038 | return 0; |
| 1039 | } |
| 1040 | |
| 1041 | static const struct udevice_id sh_pfc_pinctrl_ids[] = { |
Marek Vasut | c40f2d6 | 2018-01-17 22:18:59 +0100 | [diff] [blame] | 1042 | #ifdef CONFIG_PINCTRL_PFC_R8A7790 |
| 1043 | { |
| 1044 | .compatible = "renesas,pfc-r8a7790", |
| 1045 | .data = SH_PFC_R8A7790, |
| 1046 | }, |
| 1047 | #endif |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 1048 | #ifdef CONFIG_PINCTRL_PFC_R8A7791 |
| 1049 | { |
| 1050 | .compatible = "renesas,pfc-r8a7791", |
| 1051 | .data = SH_PFC_R8A7791, |
| 1052 | }, |
| 1053 | #endif |
Marek Vasut | 1ef3930 | 2018-01-17 22:29:50 +0100 | [diff] [blame] | 1054 | #ifdef CONFIG_PINCTRL_PFC_R8A7792 |
| 1055 | { |
| 1056 | .compatible = "renesas,pfc-r8a7792", |
| 1057 | .data = SH_PFC_R8A7792, |
| 1058 | }, |
| 1059 | #endif |
Marek Vasut | 06ef9e8 | 2018-01-17 17:14:45 +0100 | [diff] [blame] | 1060 | #ifdef CONFIG_PINCTRL_PFC_R8A7793 |
| 1061 | { |
| 1062 | .compatible = "renesas,pfc-r8a7793", |
| 1063 | .data = SH_PFC_R8A7793, |
| 1064 | }, |
| 1065 | #endif |
Marek Vasut | 4dd88d5 | 2018-01-17 22:33:59 +0100 | [diff] [blame] | 1066 | #ifdef CONFIG_PINCTRL_PFC_R8A7794 |
| 1067 | { |
| 1068 | .compatible = "renesas,pfc-r8a7794", |
| 1069 | .data = SH_PFC_R8A7794, |
| 1070 | }, |
| 1071 | #endif |
Marek Vasut | c02d50a | 2023-01-26 21:01:40 +0100 | [diff] [blame] | 1072 | #ifdef CONFIG_PINCTRL_PFC_R8A77951 |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1073 | { |
| 1074 | .compatible = "renesas,pfc-r8a7795", |
| 1075 | .data = SH_PFC_R8A7795, |
| 1076 | }, |
| 1077 | #endif |
Marek Vasut | d0f9c7b | 2023-01-26 21:01:41 +0100 | [diff] [blame] | 1078 | #ifdef CONFIG_PINCTRL_PFC_R8A77960 |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1079 | { |
| 1080 | .compatible = "renesas,pfc-r8a7796", |
Marek Vasut | d0f9c7b | 2023-01-26 21:01:41 +0100 | [diff] [blame] | 1081 | .data = SH_PFC_R8A77960, |
| 1082 | }, |
| 1083 | #endif |
| 1084 | #ifdef CONFIG_PINCTRL_PFC_R8A77961 |
| 1085 | { |
| 1086 | .compatible = "renesas,pfc-r8a77961", |
| 1087 | .data = SH_PFC_R8A77961, |
Marek Vasut | 72269e0 | 2019-03-04 01:32:44 +0100 | [diff] [blame] | 1088 | }, |
| 1089 | #endif |
Adam Ford | 96980fb | 2020-06-30 09:30:09 -0500 | [diff] [blame] | 1090 | #ifdef CONFIG_PINCTRL_PFC_R8A774A1 |
| 1091 | { |
| 1092 | .compatible = "renesas,pfc-r8a774a1", |
| 1093 | .data = SH_PFC_R8A774A1, |
| 1094 | }, |
| 1095 | #endif |
Biju Das | d1d7888 | 2020-10-28 10:34:21 +0000 | [diff] [blame] | 1096 | #ifdef CONFIG_PINCTRL_PFC_R8A774B1 |
| 1097 | { |
| 1098 | .compatible = "renesas,pfc-r8a774b1", |
| 1099 | .data = SH_PFC_R8A774B1, |
| 1100 | }, |
| 1101 | #endif |
Lad Prabhakar | 53b88b9 | 2021-03-15 22:24:04 +0000 | [diff] [blame] | 1102 | #ifdef CONFIG_PINCTRL_PFC_R8A774C0 |
| 1103 | { |
| 1104 | .compatible = "renesas,pfc-r8a774c0", |
| 1105 | .data = SH_PFC_R8A774C0, |
| 1106 | }, |
| 1107 | #endif |
Biju Das | 121bd00 | 2020-10-28 10:34:22 +0000 | [diff] [blame] | 1108 | #ifdef CONFIG_PINCTRL_PFC_R8A774E1 |
| 1109 | { |
| 1110 | .compatible = "renesas,pfc-r8a774e1", |
| 1111 | .data = SH_PFC_R8A774E1, |
| 1112 | }, |
| 1113 | #endif |
Marek Vasut | 72269e0 | 2019-03-04 01:32:44 +0100 | [diff] [blame] | 1114 | #ifdef CONFIG_PINCTRL_PFC_R8A77965 |
| 1115 | { |
Marek Vasut | 20d721e | 2018-02-26 10:35:15 +0100 | [diff] [blame] | 1116 | .compatible = "renesas,pfc-r8a77965", |
Marek Vasut | 72269e0 | 2019-03-04 01:32:44 +0100 | [diff] [blame] | 1117 | .data = SH_PFC_R8A77965, |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1118 | }, |
| 1119 | #endif |
Marek Vasut | a0e11e5 | 2017-10-09 20:57:29 +0200 | [diff] [blame] | 1120 | #ifdef CONFIG_PINCTRL_PFC_R8A77970 |
| 1121 | { |
| 1122 | .compatible = "renesas,pfc-r8a77970", |
| 1123 | .data = SH_PFC_R8A77970, |
| 1124 | }, |
| 1125 | #endif |
Marek Vasut | a6a7f48 | 2019-07-29 19:59:44 +0200 | [diff] [blame] | 1126 | #ifdef CONFIG_PINCTRL_PFC_R8A77980 |
| 1127 | { |
| 1128 | .compatible = "renesas,pfc-r8a77980", |
| 1129 | .data = SH_PFC_R8A77980, |
| 1130 | }, |
| 1131 | #endif |
Marek Vasut | 68a7704 | 2018-04-26 13:09:20 +0200 | [diff] [blame] | 1132 | #ifdef CONFIG_PINCTRL_PFC_R8A77990 |
| 1133 | { |
| 1134 | .compatible = "renesas,pfc-r8a77990", |
| 1135 | .data = SH_PFC_R8A77990, |
| 1136 | }, |
| 1137 | #endif |
Marek Vasut | 7d35e64 | 2017-10-08 20:57:37 +0200 | [diff] [blame] | 1138 | #ifdef CONFIG_PINCTRL_PFC_R8A77995 |
| 1139 | { |
| 1140 | .compatible = "renesas,pfc-r8a77995", |
| 1141 | .data = SH_PFC_R8A77995, |
| 1142 | }, |
| 1143 | #endif |
Marek Vasut | 4dbc653 | 2021-04-27 01:55:54 +0200 | [diff] [blame] | 1144 | #ifdef CONFIG_PINCTRL_PFC_R8A779A0 |
| 1145 | { |
| 1146 | .compatible = "renesas,pfc-r8a779a0", |
| 1147 | .data = SH_PFC_R8A779A0, |
| 1148 | }, |
| 1149 | #endif |
LUU HOAI | 9b68f5d | 2023-02-28 22:34:40 +0100 | [diff] [blame^] | 1150 | #ifdef CONFIG_PINCTRL_PFC_R8A779F0 |
| 1151 | { |
| 1152 | .compatible = "renesas,pfc-r8a779f0", |
| 1153 | .data = SH_PFC_R8A779F0, |
| 1154 | }, |
| 1155 | #endif |
Marek Vasut | 4dbc653 | 2021-04-27 01:55:54 +0200 | [diff] [blame] | 1156 | |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1157 | { }, |
| 1158 | }; |
| 1159 | |
| 1160 | U_BOOT_DRIVER(pinctrl_sh_pfc) = { |
| 1161 | .name = "sh_pfc_pinctrl", |
| 1162 | .id = UCLASS_PINCTRL, |
| 1163 | .of_match = sh_pfc_pinctrl_ids, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 1164 | .priv_auto = sizeof(struct sh_pfc_pinctrl_priv), |
Marek Vasut | 3066a06 | 2017-09-15 21:13:55 +0200 | [diff] [blame] | 1165 | .ops = &sh_pfc_pinctrl_ops, |
| 1166 | .probe = sh_pfc_pinctrl_probe, |
| 1167 | }; |