1910df4d0SMarek Vasut /* 2910df4d0SMarek Vasut * Pin Control driver for SuperH Pin Function Controller. 3910df4d0SMarek Vasut * 4910df4d0SMarek Vasut * Authors: Magnus Damm, Paul Mundt, Laurent Pinchart 5910df4d0SMarek Vasut * 6910df4d0SMarek Vasut * Copyright (C) 2008 Magnus Damm 7910df4d0SMarek Vasut * Copyright (C) 2009 - 2012 Paul Mundt 8910df4d0SMarek Vasut * Copyright (C) 2017 Marek Vasut 9910df4d0SMarek Vasut * 10910df4d0SMarek Vasut * SPDX-License-Identifier: GPL-2.0 11910df4d0SMarek Vasut */ 12910df4d0SMarek Vasut 13910df4d0SMarek Vasut #define DRV_NAME "sh-pfc" 14910df4d0SMarek Vasut 15910df4d0SMarek Vasut #include <common.h> 16910df4d0SMarek Vasut #include <dm.h> 17910df4d0SMarek Vasut #include <errno.h> 18910df4d0SMarek Vasut #include <dm/pinctrl.h> 19910df4d0SMarek Vasut #include <linux/io.h> 20910df4d0SMarek Vasut #include <linux/sizes.h> 21910df4d0SMarek Vasut 22910df4d0SMarek Vasut #include "sh_pfc.h" 23910df4d0SMarek Vasut 24910df4d0SMarek Vasut DECLARE_GLOBAL_DATA_PTR; 25910df4d0SMarek Vasut 26910df4d0SMarek Vasut enum sh_pfc_model { 27910df4d0SMarek Vasut SH_PFC_R8A7795 = 0, 28910df4d0SMarek Vasut SH_PFC_R8A7796, 29910df4d0SMarek Vasut }; 30910df4d0SMarek Vasut 31910df4d0SMarek Vasut struct sh_pfc_pin_config { 32910df4d0SMarek Vasut u32 type; 33910df4d0SMarek Vasut }; 34910df4d0SMarek Vasut 35910df4d0SMarek Vasut struct sh_pfc_pinctrl { 36910df4d0SMarek Vasut struct sh_pfc *pfc; 37910df4d0SMarek Vasut 38910df4d0SMarek Vasut struct sh_pfc_pin_config *configs; 39910df4d0SMarek Vasut 40910df4d0SMarek Vasut const char *func_prop_name; 41910df4d0SMarek Vasut const char *groups_prop_name; 42910df4d0SMarek Vasut const char *pins_prop_name; 43910df4d0SMarek Vasut }; 44910df4d0SMarek Vasut 45910df4d0SMarek Vasut struct sh_pfc_pin_range { 46910df4d0SMarek Vasut u16 start; 47910df4d0SMarek Vasut u16 end; 48910df4d0SMarek Vasut }; 49910df4d0SMarek Vasut 50910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv { 51910df4d0SMarek Vasut struct sh_pfc pfc; 52910df4d0SMarek Vasut struct sh_pfc_pinctrl pmx; 53910df4d0SMarek Vasut }; 54910df4d0SMarek Vasut 55910df4d0SMarek Vasut int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin) 56910df4d0SMarek Vasut { 57910df4d0SMarek Vasut unsigned int offset; 58910df4d0SMarek Vasut unsigned int i; 59910df4d0SMarek Vasut 60910df4d0SMarek Vasut for (i = 0, offset = 0; i < pfc->nr_ranges; ++i) { 61910df4d0SMarek Vasut const struct sh_pfc_pin_range *range = &pfc->ranges[i]; 62910df4d0SMarek Vasut 63910df4d0SMarek Vasut if (pin <= range->end) 64910df4d0SMarek Vasut return pin >= range->start 65910df4d0SMarek Vasut ? offset + pin - range->start : -1; 66910df4d0SMarek Vasut 67910df4d0SMarek Vasut offset += range->end - range->start + 1; 68910df4d0SMarek Vasut } 69910df4d0SMarek Vasut 70910df4d0SMarek Vasut return -EINVAL; 71910df4d0SMarek Vasut } 72910df4d0SMarek Vasut 73910df4d0SMarek Vasut static int sh_pfc_enum_in_range(u16 enum_id, const struct pinmux_range *r) 74910df4d0SMarek Vasut { 75910df4d0SMarek Vasut if (enum_id < r->begin) 76910df4d0SMarek Vasut return 0; 77910df4d0SMarek Vasut 78910df4d0SMarek Vasut if (enum_id > r->end) 79910df4d0SMarek Vasut return 0; 80910df4d0SMarek Vasut 81910df4d0SMarek Vasut return 1; 82910df4d0SMarek Vasut } 83910df4d0SMarek Vasut 84910df4d0SMarek Vasut u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned int reg_width) 85910df4d0SMarek Vasut { 86910df4d0SMarek Vasut switch (reg_width) { 87910df4d0SMarek Vasut case 8: 88910df4d0SMarek Vasut return readb(mapped_reg); 89910df4d0SMarek Vasut case 16: 90910df4d0SMarek Vasut return readw(mapped_reg); 91910df4d0SMarek Vasut case 32: 92910df4d0SMarek Vasut return readl(mapped_reg); 93910df4d0SMarek Vasut } 94910df4d0SMarek Vasut 95910df4d0SMarek Vasut BUG(); 96910df4d0SMarek Vasut return 0; 97910df4d0SMarek Vasut } 98910df4d0SMarek Vasut 99910df4d0SMarek Vasut void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width, 100910df4d0SMarek Vasut u32 data) 101910df4d0SMarek Vasut { 102910df4d0SMarek Vasut switch (reg_width) { 103910df4d0SMarek Vasut case 8: 104910df4d0SMarek Vasut writeb(data, mapped_reg); 105910df4d0SMarek Vasut return; 106910df4d0SMarek Vasut case 16: 107910df4d0SMarek Vasut writew(data, mapped_reg); 108910df4d0SMarek Vasut return; 109910df4d0SMarek Vasut case 32: 110910df4d0SMarek Vasut writel(data, mapped_reg); 111910df4d0SMarek Vasut return; 112910df4d0SMarek Vasut } 113910df4d0SMarek Vasut 114910df4d0SMarek Vasut BUG(); 115910df4d0SMarek Vasut } 116910df4d0SMarek Vasut 117910df4d0SMarek Vasut u32 sh_pfc_read_reg(struct sh_pfc *pfc, u32 reg, unsigned int width) 118910df4d0SMarek Vasut { 119910df4d0SMarek Vasut return sh_pfc_read_raw_reg(pfc->regs + reg, width); 120910df4d0SMarek Vasut } 121910df4d0SMarek Vasut 122910df4d0SMarek Vasut void sh_pfc_write_reg(struct sh_pfc *pfc, u32 reg, unsigned int width, u32 data) 123910df4d0SMarek Vasut { 124910df4d0SMarek Vasut void __iomem *unlock_reg = 125910df4d0SMarek Vasut (void __iomem *)(uintptr_t)pfc->info->unlock_reg; 126910df4d0SMarek Vasut 127910df4d0SMarek Vasut if (pfc->info->unlock_reg) 128910df4d0SMarek Vasut sh_pfc_write_raw_reg(unlock_reg, 32, ~data); 129910df4d0SMarek Vasut 130910df4d0SMarek Vasut sh_pfc_write_raw_reg(pfc->regs + reg, width, data); 131910df4d0SMarek Vasut } 132910df4d0SMarek Vasut 133910df4d0SMarek Vasut static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, 134910df4d0SMarek Vasut const struct pinmux_cfg_reg *crp, 135910df4d0SMarek Vasut unsigned int in_pos, 136910df4d0SMarek Vasut void __iomem **mapped_regp, u32 *maskp, 137910df4d0SMarek Vasut unsigned int *posp) 138910df4d0SMarek Vasut { 139910df4d0SMarek Vasut unsigned int k; 140910df4d0SMarek Vasut 141910df4d0SMarek Vasut *mapped_regp = (void __iomem *)(uintptr_t)crp->reg; 142910df4d0SMarek Vasut 143910df4d0SMarek Vasut if (crp->field_width) { 144910df4d0SMarek Vasut *maskp = (1 << crp->field_width) - 1; 145910df4d0SMarek Vasut *posp = crp->reg_width - ((in_pos + 1) * crp->field_width); 146910df4d0SMarek Vasut } else { 147910df4d0SMarek Vasut *maskp = (1 << crp->var_field_width[in_pos]) - 1; 148910df4d0SMarek Vasut *posp = crp->reg_width; 149910df4d0SMarek Vasut for (k = 0; k <= in_pos; k++) 150910df4d0SMarek Vasut *posp -= crp->var_field_width[k]; 151910df4d0SMarek Vasut } 152910df4d0SMarek Vasut } 153910df4d0SMarek Vasut 154910df4d0SMarek Vasut static void sh_pfc_write_config_reg(struct sh_pfc *pfc, 155910df4d0SMarek Vasut const struct pinmux_cfg_reg *crp, 156910df4d0SMarek Vasut unsigned int field, u32 value) 157910df4d0SMarek Vasut { 158910df4d0SMarek Vasut void __iomem *mapped_reg; 159910df4d0SMarek Vasut void __iomem *unlock_reg = 160910df4d0SMarek Vasut (void __iomem *)(uintptr_t)pfc->info->unlock_reg; 161910df4d0SMarek Vasut unsigned int pos; 162910df4d0SMarek Vasut u32 mask, data; 163910df4d0SMarek Vasut 164910df4d0SMarek Vasut sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); 165910df4d0SMarek Vasut 166910df4d0SMarek Vasut dev_dbg(pfc->dev, "write_reg addr = %x, value = 0x%x, field = %u, " 167910df4d0SMarek Vasut "r_width = %u, f_width = %u\n", 168910df4d0SMarek Vasut crp->reg, value, field, crp->reg_width, crp->field_width); 169910df4d0SMarek Vasut 170910df4d0SMarek Vasut mask = ~(mask << pos); 171910df4d0SMarek Vasut value = value << pos; 172910df4d0SMarek Vasut 173910df4d0SMarek Vasut data = sh_pfc_read_raw_reg(mapped_reg, crp->reg_width); 174910df4d0SMarek Vasut data &= mask; 175910df4d0SMarek Vasut data |= value; 176910df4d0SMarek Vasut 177910df4d0SMarek Vasut if (pfc->info->unlock_reg) 178910df4d0SMarek Vasut sh_pfc_write_raw_reg(unlock_reg, 32, ~data); 179910df4d0SMarek Vasut 180910df4d0SMarek Vasut sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data); 181910df4d0SMarek Vasut } 182910df4d0SMarek Vasut 183910df4d0SMarek Vasut static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id, 184910df4d0SMarek Vasut const struct pinmux_cfg_reg **crp, 185910df4d0SMarek Vasut unsigned int *fieldp, u32 *valuep) 186910df4d0SMarek Vasut { 187910df4d0SMarek Vasut unsigned int k = 0; 188910df4d0SMarek Vasut 189910df4d0SMarek Vasut while (1) { 190910df4d0SMarek Vasut const struct pinmux_cfg_reg *config_reg = 191910df4d0SMarek Vasut pfc->info->cfg_regs + k; 192910df4d0SMarek Vasut unsigned int r_width = config_reg->reg_width; 193910df4d0SMarek Vasut unsigned int f_width = config_reg->field_width; 194910df4d0SMarek Vasut unsigned int curr_width; 195910df4d0SMarek Vasut unsigned int bit_pos; 196910df4d0SMarek Vasut unsigned int pos = 0; 197910df4d0SMarek Vasut unsigned int m = 0; 198910df4d0SMarek Vasut 199910df4d0SMarek Vasut if (!r_width) 200910df4d0SMarek Vasut break; 201910df4d0SMarek Vasut 202910df4d0SMarek Vasut for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width) { 203910df4d0SMarek Vasut u32 ncomb; 204910df4d0SMarek Vasut u32 n; 205910df4d0SMarek Vasut 206910df4d0SMarek Vasut if (f_width) 207910df4d0SMarek Vasut curr_width = f_width; 208910df4d0SMarek Vasut else 209910df4d0SMarek Vasut curr_width = config_reg->var_field_width[m]; 210910df4d0SMarek Vasut 211910df4d0SMarek Vasut ncomb = 1 << curr_width; 212910df4d0SMarek Vasut for (n = 0; n < ncomb; n++) { 213910df4d0SMarek Vasut if (config_reg->enum_ids[pos + n] == enum_id) { 214910df4d0SMarek Vasut *crp = config_reg; 215910df4d0SMarek Vasut *fieldp = m; 216910df4d0SMarek Vasut *valuep = n; 217910df4d0SMarek Vasut return 0; 218910df4d0SMarek Vasut } 219910df4d0SMarek Vasut } 220910df4d0SMarek Vasut pos += ncomb; 221910df4d0SMarek Vasut m++; 222910df4d0SMarek Vasut } 223910df4d0SMarek Vasut k++; 224910df4d0SMarek Vasut } 225910df4d0SMarek Vasut 226910df4d0SMarek Vasut return -EINVAL; 227910df4d0SMarek Vasut } 228910df4d0SMarek Vasut 229910df4d0SMarek Vasut static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, u16 mark, int pos, 230910df4d0SMarek Vasut u16 *enum_idp) 231910df4d0SMarek Vasut { 232910df4d0SMarek Vasut const u16 *data = pfc->info->pinmux_data; 233910df4d0SMarek Vasut unsigned int k; 234910df4d0SMarek Vasut 235910df4d0SMarek Vasut if (pos) { 236910df4d0SMarek Vasut *enum_idp = data[pos + 1]; 237910df4d0SMarek Vasut return pos + 1; 238910df4d0SMarek Vasut } 239910df4d0SMarek Vasut 240910df4d0SMarek Vasut for (k = 0; k < pfc->info->pinmux_data_size; k++) { 241910df4d0SMarek Vasut if (data[k] == mark) { 242910df4d0SMarek Vasut *enum_idp = data[k + 1]; 243910df4d0SMarek Vasut return k + 1; 244910df4d0SMarek Vasut } 245910df4d0SMarek Vasut } 246910df4d0SMarek Vasut 247910df4d0SMarek Vasut dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n", 248910df4d0SMarek Vasut mark); 249910df4d0SMarek Vasut return -EINVAL; 250910df4d0SMarek Vasut } 251910df4d0SMarek Vasut 252910df4d0SMarek Vasut int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) 253910df4d0SMarek Vasut { 254910df4d0SMarek Vasut const struct pinmux_range *range; 255910df4d0SMarek Vasut int pos = 0; 256910df4d0SMarek Vasut 257910df4d0SMarek Vasut switch (pinmux_type) { 258910df4d0SMarek Vasut case PINMUX_TYPE_GPIO: 259910df4d0SMarek Vasut case PINMUX_TYPE_FUNCTION: 260910df4d0SMarek Vasut range = NULL; 261910df4d0SMarek Vasut break; 262910df4d0SMarek Vasut 263910df4d0SMarek Vasut case PINMUX_TYPE_OUTPUT: 264910df4d0SMarek Vasut range = &pfc->info->output; 265910df4d0SMarek Vasut break; 266910df4d0SMarek Vasut 267910df4d0SMarek Vasut case PINMUX_TYPE_INPUT: 268910df4d0SMarek Vasut range = &pfc->info->input; 269910df4d0SMarek Vasut break; 270910df4d0SMarek Vasut 271910df4d0SMarek Vasut default: 272910df4d0SMarek Vasut return -EINVAL; 273910df4d0SMarek Vasut } 274910df4d0SMarek Vasut 275910df4d0SMarek Vasut /* Iterate over all the configuration fields we need to update. */ 276910df4d0SMarek Vasut while (1) { 277910df4d0SMarek Vasut const struct pinmux_cfg_reg *cr; 278910df4d0SMarek Vasut unsigned int field; 279910df4d0SMarek Vasut u16 enum_id; 280910df4d0SMarek Vasut u32 value; 281910df4d0SMarek Vasut int in_range; 282910df4d0SMarek Vasut int ret; 283910df4d0SMarek Vasut 284910df4d0SMarek Vasut pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); 285910df4d0SMarek Vasut if (pos < 0) 286910df4d0SMarek Vasut return pos; 287910df4d0SMarek Vasut 288910df4d0SMarek Vasut if (!enum_id) 289910df4d0SMarek Vasut break; 290910df4d0SMarek Vasut 291910df4d0SMarek Vasut /* Check if the configuration field selects a function. If it 292910df4d0SMarek Vasut * doesn't, skip the field if it's not applicable to the 293910df4d0SMarek Vasut * requested pinmux type. 294910df4d0SMarek Vasut */ 295910df4d0SMarek Vasut in_range = sh_pfc_enum_in_range(enum_id, &pfc->info->function); 296910df4d0SMarek Vasut if (!in_range) { 297910df4d0SMarek Vasut if (pinmux_type == PINMUX_TYPE_FUNCTION) { 298910df4d0SMarek Vasut /* Functions are allowed to modify all 299910df4d0SMarek Vasut * fields. 300910df4d0SMarek Vasut */ 301910df4d0SMarek Vasut in_range = 1; 302910df4d0SMarek Vasut } else if (pinmux_type != PINMUX_TYPE_GPIO) { 303910df4d0SMarek Vasut /* Input/output types can only modify fields 304910df4d0SMarek Vasut * that correspond to their respective ranges. 305910df4d0SMarek Vasut */ 306910df4d0SMarek Vasut in_range = sh_pfc_enum_in_range(enum_id, range); 307910df4d0SMarek Vasut 308910df4d0SMarek Vasut /* 309910df4d0SMarek Vasut * special case pass through for fixed 310910df4d0SMarek Vasut * input-only or output-only pins without 311910df4d0SMarek Vasut * function enum register association. 312910df4d0SMarek Vasut */ 313910df4d0SMarek Vasut if (in_range && enum_id == range->force) 314910df4d0SMarek Vasut continue; 315910df4d0SMarek Vasut } 316910df4d0SMarek Vasut /* GPIOs are only allowed to modify function fields. */ 317910df4d0SMarek Vasut } 318910df4d0SMarek Vasut 319910df4d0SMarek Vasut if (!in_range) 320910df4d0SMarek Vasut continue; 321910df4d0SMarek Vasut 322910df4d0SMarek Vasut ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value); 323910df4d0SMarek Vasut if (ret < 0) 324910df4d0SMarek Vasut return ret; 325910df4d0SMarek Vasut 326910df4d0SMarek Vasut sh_pfc_write_config_reg(pfc, cr, field, value); 327910df4d0SMarek Vasut } 328910df4d0SMarek Vasut 329910df4d0SMarek Vasut return 0; 330910df4d0SMarek Vasut } 331910df4d0SMarek Vasut 332910df4d0SMarek Vasut const struct sh_pfc_bias_info * 333910df4d0SMarek Vasut sh_pfc_pin_to_bias_info(const struct sh_pfc_bias_info *info, 334910df4d0SMarek Vasut unsigned int num, unsigned int pin) 335910df4d0SMarek Vasut { 336910df4d0SMarek Vasut unsigned int i; 337910df4d0SMarek Vasut 338910df4d0SMarek Vasut for (i = 0; i < num; i++) 339910df4d0SMarek Vasut if (info[i].pin == pin) 340910df4d0SMarek Vasut return &info[i]; 341910df4d0SMarek Vasut 342910df4d0SMarek Vasut printf("Pin %u is not in bias info list\n", pin); 343910df4d0SMarek Vasut 344910df4d0SMarek Vasut return NULL; 345910df4d0SMarek Vasut } 346910df4d0SMarek Vasut 347910df4d0SMarek Vasut static int sh_pfc_init_ranges(struct sh_pfc *pfc) 348910df4d0SMarek Vasut { 349910df4d0SMarek Vasut struct sh_pfc_pin_range *range; 350910df4d0SMarek Vasut unsigned int nr_ranges; 351910df4d0SMarek Vasut unsigned int i; 352910df4d0SMarek Vasut 353910df4d0SMarek Vasut if (pfc->info->pins[0].pin == (u16)-1) { 354910df4d0SMarek Vasut /* Pin number -1 denotes that the SoC doesn't report pin numbers 355910df4d0SMarek Vasut * in its pin arrays yet. Consider the pin numbers range as 356910df4d0SMarek Vasut * continuous and allocate a single range. 357910df4d0SMarek Vasut */ 358910df4d0SMarek Vasut pfc->nr_ranges = 1; 359910df4d0SMarek Vasut pfc->ranges = kzalloc(sizeof(*pfc->ranges), GFP_KERNEL); 360910df4d0SMarek Vasut if (pfc->ranges == NULL) 361910df4d0SMarek Vasut return -ENOMEM; 362910df4d0SMarek Vasut 363910df4d0SMarek Vasut pfc->ranges->start = 0; 364910df4d0SMarek Vasut pfc->ranges->end = pfc->info->nr_pins - 1; 365910df4d0SMarek Vasut pfc->nr_gpio_pins = pfc->info->nr_pins; 366910df4d0SMarek Vasut 367910df4d0SMarek Vasut return 0; 368910df4d0SMarek Vasut } 369910df4d0SMarek Vasut 370910df4d0SMarek Vasut /* Count, allocate and fill the ranges. The PFC SoC data pins array must 371910df4d0SMarek Vasut * be sorted by pin numbers, and pins without a GPIO port must come 372910df4d0SMarek Vasut * last. 373910df4d0SMarek Vasut */ 374910df4d0SMarek Vasut for (i = 1, nr_ranges = 1; i < pfc->info->nr_pins; ++i) { 375910df4d0SMarek Vasut if (pfc->info->pins[i-1].pin != pfc->info->pins[i].pin - 1) 376910df4d0SMarek Vasut nr_ranges++; 377910df4d0SMarek Vasut } 378910df4d0SMarek Vasut 379910df4d0SMarek Vasut pfc->nr_ranges = nr_ranges; 380910df4d0SMarek Vasut pfc->ranges = kzalloc(sizeof(*pfc->ranges) * nr_ranges, GFP_KERNEL); 381910df4d0SMarek Vasut if (pfc->ranges == NULL) 382910df4d0SMarek Vasut return -ENOMEM; 383910df4d0SMarek Vasut 384910df4d0SMarek Vasut range = pfc->ranges; 385910df4d0SMarek Vasut range->start = pfc->info->pins[0].pin; 386910df4d0SMarek Vasut 387910df4d0SMarek Vasut for (i = 1; i < pfc->info->nr_pins; ++i) { 388910df4d0SMarek Vasut if (pfc->info->pins[i-1].pin == pfc->info->pins[i].pin - 1) 389910df4d0SMarek Vasut continue; 390910df4d0SMarek Vasut 391910df4d0SMarek Vasut range->end = pfc->info->pins[i-1].pin; 392910df4d0SMarek Vasut if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO)) 393910df4d0SMarek Vasut pfc->nr_gpio_pins = range->end + 1; 394910df4d0SMarek Vasut 395910df4d0SMarek Vasut range++; 396910df4d0SMarek Vasut range->start = pfc->info->pins[i].pin; 397910df4d0SMarek Vasut } 398910df4d0SMarek Vasut 399910df4d0SMarek Vasut range->end = pfc->info->pins[i-1].pin; 400910df4d0SMarek Vasut if (!(pfc->info->pins[i-1].configs & SH_PFC_PIN_CFG_NO_GPIO)) 401910df4d0SMarek Vasut pfc->nr_gpio_pins = range->end + 1; 402910df4d0SMarek Vasut 403910df4d0SMarek Vasut return 0; 404910df4d0SMarek Vasut } 405910df4d0SMarek Vasut 406910df4d0SMarek Vasut static int sh_pfc_pinctrl_get_pins_count(struct udevice *dev) 407910df4d0SMarek Vasut { 408910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 409910df4d0SMarek Vasut 410910df4d0SMarek Vasut return priv->pfc.info->nr_pins; 411910df4d0SMarek Vasut } 412910df4d0SMarek Vasut 413910df4d0SMarek Vasut static const char *sh_pfc_pinctrl_get_pin_name(struct udevice *dev, 414910df4d0SMarek Vasut unsigned selector) 415910df4d0SMarek Vasut { 416910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 417910df4d0SMarek Vasut 418910df4d0SMarek Vasut return priv->pfc.info->pins[selector].name; 419910df4d0SMarek Vasut } 420910df4d0SMarek Vasut 421910df4d0SMarek Vasut static int sh_pfc_pinctrl_get_groups_count(struct udevice *dev) 422910df4d0SMarek Vasut { 423910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 424910df4d0SMarek Vasut 425910df4d0SMarek Vasut return priv->pfc.info->nr_groups; 426910df4d0SMarek Vasut } 427910df4d0SMarek Vasut 428910df4d0SMarek Vasut static const char *sh_pfc_pinctrl_get_group_name(struct udevice *dev, 429910df4d0SMarek Vasut unsigned selector) 430910df4d0SMarek Vasut { 431910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 432910df4d0SMarek Vasut 433910df4d0SMarek Vasut return priv->pfc.info->groups[selector].name; 434910df4d0SMarek Vasut } 435910df4d0SMarek Vasut 436910df4d0SMarek Vasut static int sh_pfc_pinctrl_get_functions_count(struct udevice *dev) 437910df4d0SMarek Vasut { 438910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 439910df4d0SMarek Vasut 440910df4d0SMarek Vasut return priv->pfc.info->nr_functions; 441910df4d0SMarek Vasut } 442910df4d0SMarek Vasut 443910df4d0SMarek Vasut static const char *sh_pfc_pinctrl_get_function_name(struct udevice *dev, 444910df4d0SMarek Vasut unsigned selector) 445910df4d0SMarek Vasut { 446910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 447910df4d0SMarek Vasut 448910df4d0SMarek Vasut return priv->pfc.info->functions[selector].name; 449910df4d0SMarek Vasut } 450910df4d0SMarek Vasut 451*2489bb54SMarek Vasut static int sh_pfc_pinctrl_pin_set(struct udevice *dev, unsigned pin_selector, 452*2489bb54SMarek Vasut unsigned func_selector) 453*2489bb54SMarek Vasut { 454*2489bb54SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 455*2489bb54SMarek Vasut struct sh_pfc_pinctrl *pmx = &priv->pmx; 456*2489bb54SMarek Vasut struct sh_pfc *pfc = &priv->pfc; 457*2489bb54SMarek Vasut const struct sh_pfc_pin *pin = &priv->pfc.info->pins[pin_selector]; 458*2489bb54SMarek Vasut int idx = sh_pfc_get_pin_index(pfc, pin->pin); 459*2489bb54SMarek Vasut struct sh_pfc_pin_config *cfg = &pmx->configs[idx]; 460*2489bb54SMarek Vasut 461*2489bb54SMarek Vasut if (cfg->type != PINMUX_TYPE_NONE) 462*2489bb54SMarek Vasut return -EBUSY; 463*2489bb54SMarek Vasut 464*2489bb54SMarek Vasut return sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_FUNCTION); 465*2489bb54SMarek Vasut } 466*2489bb54SMarek Vasut 467910df4d0SMarek Vasut static int sh_pfc_pinctrl_group_set(struct udevice *dev, unsigned group_selector, 468910df4d0SMarek Vasut unsigned func_selector) 469910df4d0SMarek Vasut { 470910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 471910df4d0SMarek Vasut struct sh_pfc_pinctrl *pmx = &priv->pmx; 472910df4d0SMarek Vasut struct sh_pfc *pfc = &priv->pfc; 473910df4d0SMarek Vasut const struct sh_pfc_pin_group *grp = &priv->pfc.info->groups[group_selector]; 474910df4d0SMarek Vasut unsigned int i; 475910df4d0SMarek Vasut int ret = 0; 476910df4d0SMarek Vasut 477910df4d0SMarek Vasut for (i = 0; i < grp->nr_pins; ++i) { 478910df4d0SMarek Vasut int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]); 479910df4d0SMarek Vasut struct sh_pfc_pin_config *cfg = &pmx->configs[idx]; 480910df4d0SMarek Vasut 481910df4d0SMarek Vasut if (cfg->type != PINMUX_TYPE_NONE) { 482910df4d0SMarek Vasut ret = -EBUSY; 483910df4d0SMarek Vasut goto done; 484910df4d0SMarek Vasut } 485910df4d0SMarek Vasut } 486910df4d0SMarek Vasut 487910df4d0SMarek Vasut for (i = 0; i < grp->nr_pins; ++i) { 488910df4d0SMarek Vasut ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); 489910df4d0SMarek Vasut if (ret < 0) 490910df4d0SMarek Vasut break; 491910df4d0SMarek Vasut } 492910df4d0SMarek Vasut 493910df4d0SMarek Vasut done: 494910df4d0SMarek Vasut return ret; 495910df4d0SMarek Vasut } 496d52132c3SMarek Vasut #if CONFIG_IS_ENABLED(PINCONF) 497d52132c3SMarek Vasut static const struct pinconf_param sh_pfc_pinconf_params[] = { 498d52132c3SMarek Vasut { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, 499d52132c3SMarek Vasut { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 1 }, 500d52132c3SMarek Vasut { "bias-pull-down", PIN_CONFIG_BIAS_PULL_DOWN, 1 }, 501d52132c3SMarek Vasut { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 0 }, 502d52132c3SMarek Vasut { "power-source", PIN_CONFIG_POWER_SOURCE, 3300 }, 503d52132c3SMarek Vasut }; 504d52132c3SMarek Vasut 505d52132c3SMarek Vasut static void __iomem * 506d52132c3SMarek Vasut sh_pfc_pinconf_find_drive_strength_reg(struct sh_pfc *pfc, unsigned int pin, 507d52132c3SMarek Vasut unsigned int *offset, unsigned int *size) 508d52132c3SMarek Vasut { 509d52132c3SMarek Vasut const struct pinmux_drive_reg_field *field; 510d52132c3SMarek Vasut const struct pinmux_drive_reg *reg; 511d52132c3SMarek Vasut unsigned int i; 512d52132c3SMarek Vasut 513d52132c3SMarek Vasut for (reg = pfc->info->drive_regs; reg->reg; ++reg) { 514d52132c3SMarek Vasut for (i = 0; i < ARRAY_SIZE(reg->fields); ++i) { 515d52132c3SMarek Vasut field = ®->fields[i]; 516d52132c3SMarek Vasut 517d52132c3SMarek Vasut if (field->size && field->pin == pin) { 518d52132c3SMarek Vasut *offset = field->offset; 519d52132c3SMarek Vasut *size = field->size; 520d52132c3SMarek Vasut 521d52132c3SMarek Vasut return (void __iomem *)(uintptr_t)reg->reg; 522d52132c3SMarek Vasut } 523d52132c3SMarek Vasut } 524d52132c3SMarek Vasut } 525d52132c3SMarek Vasut 526d52132c3SMarek Vasut return NULL; 527d52132c3SMarek Vasut } 528d52132c3SMarek Vasut 529d52132c3SMarek Vasut static int sh_pfc_pinconf_set_drive_strength(struct sh_pfc *pfc, 530d52132c3SMarek Vasut unsigned int pin, u16 strength) 531d52132c3SMarek Vasut { 532d52132c3SMarek Vasut unsigned int offset; 533d52132c3SMarek Vasut unsigned int size; 534d52132c3SMarek Vasut unsigned int step; 535d52132c3SMarek Vasut void __iomem *reg; 536d52132c3SMarek Vasut void __iomem *unlock_reg = 537d52132c3SMarek Vasut (void __iomem *)(uintptr_t)pfc->info->unlock_reg; 538d52132c3SMarek Vasut u32 val; 539d52132c3SMarek Vasut 540d52132c3SMarek Vasut reg = sh_pfc_pinconf_find_drive_strength_reg(pfc, pin, &offset, &size); 541d52132c3SMarek Vasut if (!reg) 542d52132c3SMarek Vasut return -EINVAL; 543d52132c3SMarek Vasut 544d52132c3SMarek Vasut step = size == 2 ? 6 : 3; 545d52132c3SMarek Vasut 546d52132c3SMarek Vasut if (strength < step || strength > 24) 547d52132c3SMarek Vasut return -EINVAL; 548d52132c3SMarek Vasut 549d52132c3SMarek Vasut /* Convert the value from mA based on a full drive strength value of 550d52132c3SMarek Vasut * 24mA. We can make the full value configurable later if needed. 551d52132c3SMarek Vasut */ 552d52132c3SMarek Vasut strength = strength / step - 1; 553d52132c3SMarek Vasut 554d52132c3SMarek Vasut val = sh_pfc_read_raw_reg(reg, 32); 555d52132c3SMarek Vasut val &= ~GENMASK(offset + size - 1, offset); 556d52132c3SMarek Vasut val |= strength << offset; 557d52132c3SMarek Vasut 558d52132c3SMarek Vasut if (unlock_reg) 559d52132c3SMarek Vasut sh_pfc_write_raw_reg(unlock_reg, 32, ~val); 560d52132c3SMarek Vasut 561d52132c3SMarek Vasut sh_pfc_write_raw_reg(reg, 32, val); 562d52132c3SMarek Vasut 563d52132c3SMarek Vasut return 0; 564d52132c3SMarek Vasut } 565d52132c3SMarek Vasut 566d52132c3SMarek Vasut /* Check whether the requested parameter is supported for a pin. */ 567d52132c3SMarek Vasut static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin, 568d52132c3SMarek Vasut unsigned int param) 569d52132c3SMarek Vasut { 570d52132c3SMarek Vasut int idx = sh_pfc_get_pin_index(pfc, _pin); 571d52132c3SMarek Vasut const struct sh_pfc_pin *pin = &pfc->info->pins[idx]; 572d52132c3SMarek Vasut 573d52132c3SMarek Vasut switch (param) { 574d52132c3SMarek Vasut case PIN_CONFIG_BIAS_DISABLE: 575d52132c3SMarek Vasut return pin->configs & 576d52132c3SMarek Vasut (SH_PFC_PIN_CFG_PULL_UP | SH_PFC_PIN_CFG_PULL_DOWN); 577d52132c3SMarek Vasut 578d52132c3SMarek Vasut case PIN_CONFIG_BIAS_PULL_UP: 579d52132c3SMarek Vasut return pin->configs & SH_PFC_PIN_CFG_PULL_UP; 580d52132c3SMarek Vasut 581d52132c3SMarek Vasut case PIN_CONFIG_BIAS_PULL_DOWN: 582d52132c3SMarek Vasut return pin->configs & SH_PFC_PIN_CFG_PULL_DOWN; 583d52132c3SMarek Vasut 584d52132c3SMarek Vasut case PIN_CONFIG_DRIVE_STRENGTH: 585d52132c3SMarek Vasut return pin->configs & SH_PFC_PIN_CFG_DRIVE_STRENGTH; 586d52132c3SMarek Vasut 587d52132c3SMarek Vasut case PIN_CONFIG_POWER_SOURCE: 588d52132c3SMarek Vasut return pin->configs & SH_PFC_PIN_CFG_IO_VOLTAGE; 589d52132c3SMarek Vasut 590d52132c3SMarek Vasut default: 591d52132c3SMarek Vasut return false; 592d52132c3SMarek Vasut } 593d52132c3SMarek Vasut } 594d52132c3SMarek Vasut 595d52132c3SMarek Vasut static int sh_pfc_pinconf_set(struct sh_pfc_pinctrl *pmx, unsigned _pin, 596d52132c3SMarek Vasut unsigned int param, unsigned int arg) 597d52132c3SMarek Vasut { 598d52132c3SMarek Vasut struct sh_pfc *pfc = pmx->pfc; 599d52132c3SMarek Vasut void __iomem *pocctrl; 600d52132c3SMarek Vasut void __iomem *unlock_reg = 601d52132c3SMarek Vasut (void __iomem *)(uintptr_t)pfc->info->unlock_reg; 602d52132c3SMarek Vasut u32 addr, val; 603d52132c3SMarek Vasut int bit, ret; 604d52132c3SMarek Vasut 605d52132c3SMarek Vasut if (!sh_pfc_pinconf_validate(pfc, _pin, param)) 606d52132c3SMarek Vasut return -ENOTSUPP; 607d52132c3SMarek Vasut 608d52132c3SMarek Vasut switch (param) { 609d52132c3SMarek Vasut case PIN_CONFIG_BIAS_PULL_UP: 610d52132c3SMarek Vasut case PIN_CONFIG_BIAS_PULL_DOWN: 611d52132c3SMarek Vasut case PIN_CONFIG_BIAS_DISABLE: 612d52132c3SMarek Vasut if (!pfc->info->ops || !pfc->info->ops->set_bias) 613d52132c3SMarek Vasut return -ENOTSUPP; 614d52132c3SMarek Vasut 615d52132c3SMarek Vasut pfc->info->ops->set_bias(pfc, _pin, param); 616d52132c3SMarek Vasut 617d52132c3SMarek Vasut break; 618d52132c3SMarek Vasut 619d52132c3SMarek Vasut case PIN_CONFIG_DRIVE_STRENGTH: 620d52132c3SMarek Vasut ret = sh_pfc_pinconf_set_drive_strength(pfc, _pin, arg); 621d52132c3SMarek Vasut if (ret < 0) 622d52132c3SMarek Vasut return ret; 623d52132c3SMarek Vasut 624d52132c3SMarek Vasut break; 625d52132c3SMarek Vasut 626d52132c3SMarek Vasut case PIN_CONFIG_POWER_SOURCE: 627d52132c3SMarek Vasut if (!pfc->info->ops || !pfc->info->ops->pin_to_pocctrl) 628d52132c3SMarek Vasut return -ENOTSUPP; 629d52132c3SMarek Vasut 630d52132c3SMarek Vasut bit = pfc->info->ops->pin_to_pocctrl(pfc, _pin, &addr); 631d52132c3SMarek Vasut if (bit < 0) { 632d52132c3SMarek Vasut printf("invalid pin %#x", _pin); 633d52132c3SMarek Vasut return bit; 634d52132c3SMarek Vasut } 635d52132c3SMarek Vasut 636d52132c3SMarek Vasut if (arg != 1800 && arg != 3300) 637d52132c3SMarek Vasut return -EINVAL; 638d52132c3SMarek Vasut 639d52132c3SMarek Vasut pocctrl = (void __iomem *)(uintptr_t)addr; 640d52132c3SMarek Vasut 641d52132c3SMarek Vasut val = sh_pfc_read_raw_reg(pocctrl, 32); 642d52132c3SMarek Vasut if (arg == 3300) 643d52132c3SMarek Vasut val |= BIT(bit); 644d52132c3SMarek Vasut else 645d52132c3SMarek Vasut val &= ~BIT(bit); 646d52132c3SMarek Vasut 647d52132c3SMarek Vasut if (unlock_reg) 648d52132c3SMarek Vasut sh_pfc_write_raw_reg(unlock_reg, 32, ~val); 649d52132c3SMarek Vasut 650d52132c3SMarek Vasut sh_pfc_write_raw_reg(pocctrl, 32, val); 651d52132c3SMarek Vasut 652d52132c3SMarek Vasut break; 653d52132c3SMarek Vasut 654d52132c3SMarek Vasut default: 655d52132c3SMarek Vasut return -ENOTSUPP; 656d52132c3SMarek Vasut } 657d52132c3SMarek Vasut 658d52132c3SMarek Vasut return 0; 659d52132c3SMarek Vasut } 660d52132c3SMarek Vasut 661*2489bb54SMarek Vasut static int sh_pfc_pinconf_pin_set(struct udevice *dev, 662*2489bb54SMarek Vasut unsigned int pin_selector, 663*2489bb54SMarek Vasut unsigned int param, unsigned int arg) 664*2489bb54SMarek Vasut { 665*2489bb54SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 666*2489bb54SMarek Vasut struct sh_pfc_pinctrl *pmx = &priv->pmx; 667*2489bb54SMarek Vasut struct sh_pfc *pfc = &priv->pfc; 668*2489bb54SMarek Vasut const struct sh_pfc_pin *pin = &pfc->info->pins[pin_selector]; 669*2489bb54SMarek Vasut 670*2489bb54SMarek Vasut sh_pfc_pinconf_set(pmx, pin->pin, param, arg); 671*2489bb54SMarek Vasut 672*2489bb54SMarek Vasut return 0; 673*2489bb54SMarek Vasut } 674d52132c3SMarek Vasut 675d52132c3SMarek Vasut static int sh_pfc_pinconf_group_set(struct udevice *dev, 676d52132c3SMarek Vasut unsigned int group_selector, 677d52132c3SMarek Vasut unsigned int param, unsigned int arg) 678d52132c3SMarek Vasut { 679d52132c3SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 680d52132c3SMarek Vasut struct sh_pfc_pinctrl *pmx = &priv->pmx; 681d52132c3SMarek Vasut struct sh_pfc *pfc = &priv->pfc; 682d52132c3SMarek Vasut const struct sh_pfc_pin_group *grp = &pfc->info->groups[group_selector]; 683d52132c3SMarek Vasut unsigned int i; 684d52132c3SMarek Vasut 685d52132c3SMarek Vasut for (i = 0; i < grp->nr_pins; i++) 686d52132c3SMarek Vasut sh_pfc_pinconf_set(pmx, grp->pins[i], param, arg); 687d52132c3SMarek Vasut 688d52132c3SMarek Vasut return 0; 689d52132c3SMarek Vasut } 690d52132c3SMarek Vasut #endif 691910df4d0SMarek Vasut 692910df4d0SMarek Vasut static struct pinctrl_ops sh_pfc_pinctrl_ops = { 693910df4d0SMarek Vasut .get_pins_count = sh_pfc_pinctrl_get_pins_count, 694910df4d0SMarek Vasut .get_pin_name = sh_pfc_pinctrl_get_pin_name, 695910df4d0SMarek Vasut .get_groups_count = sh_pfc_pinctrl_get_groups_count, 696910df4d0SMarek Vasut .get_group_name = sh_pfc_pinctrl_get_group_name, 697910df4d0SMarek Vasut .get_functions_count = sh_pfc_pinctrl_get_functions_count, 698910df4d0SMarek Vasut .get_function_name = sh_pfc_pinctrl_get_function_name, 699910df4d0SMarek Vasut 700d52132c3SMarek Vasut #if CONFIG_IS_ENABLED(PINCONF) 701d52132c3SMarek Vasut .pinconf_num_params = ARRAY_SIZE(sh_pfc_pinconf_params), 702d52132c3SMarek Vasut .pinconf_params = sh_pfc_pinconf_params, 703*2489bb54SMarek Vasut .pinconf_set = sh_pfc_pinconf_pin_set, 704d52132c3SMarek Vasut .pinconf_group_set = sh_pfc_pinconf_group_set, 705d52132c3SMarek Vasut #endif 706*2489bb54SMarek Vasut .pinmux_set = sh_pfc_pinctrl_pin_set, 707910df4d0SMarek Vasut .pinmux_group_set = sh_pfc_pinctrl_group_set, 708910df4d0SMarek Vasut .set_state = pinctrl_generic_set_state, 709910df4d0SMarek Vasut }; 710910df4d0SMarek Vasut 711910df4d0SMarek Vasut static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) 712910df4d0SMarek Vasut { 713910df4d0SMarek Vasut unsigned int i; 714910df4d0SMarek Vasut 715910df4d0SMarek Vasut /* Allocate and initialize the pins and configs arrays. */ 716910df4d0SMarek Vasut pmx->configs = kzalloc(sizeof(*pmx->configs) * pfc->info->nr_pins, 717910df4d0SMarek Vasut GFP_KERNEL); 718910df4d0SMarek Vasut if (unlikely(!pmx->configs)) 719910df4d0SMarek Vasut return -ENOMEM; 720910df4d0SMarek Vasut 721910df4d0SMarek Vasut for (i = 0; i < pfc->info->nr_pins; ++i) { 722910df4d0SMarek Vasut struct sh_pfc_pin_config *cfg = &pmx->configs[i]; 723910df4d0SMarek Vasut cfg->type = PINMUX_TYPE_NONE; 724910df4d0SMarek Vasut } 725910df4d0SMarek Vasut 726910df4d0SMarek Vasut return 0; 727910df4d0SMarek Vasut } 728910df4d0SMarek Vasut 729910df4d0SMarek Vasut 730910df4d0SMarek Vasut static int sh_pfc_pinctrl_probe(struct udevice *dev) 731910df4d0SMarek Vasut { 732910df4d0SMarek Vasut struct sh_pfc_pinctrl_priv *priv = dev_get_priv(dev); 733910df4d0SMarek Vasut enum sh_pfc_model model = dev_get_driver_data(dev); 734910df4d0SMarek Vasut fdt_addr_t base; 735910df4d0SMarek Vasut 736910df4d0SMarek Vasut base = devfdt_get_addr(dev); 737910df4d0SMarek Vasut if (base == FDT_ADDR_T_NONE) 738910df4d0SMarek Vasut return -EINVAL; 739910df4d0SMarek Vasut 740910df4d0SMarek Vasut priv->pfc.regs = devm_ioremap(dev, base, SZ_2K); 741910df4d0SMarek Vasut if (!priv->pfc.regs) 742910df4d0SMarek Vasut return -ENOMEM; 743910df4d0SMarek Vasut 744910df4d0SMarek Vasut #ifdef CONFIG_PINCTRL_PFC_R8A7795 745910df4d0SMarek Vasut if (model == SH_PFC_R8A7795) 746910df4d0SMarek Vasut priv->pfc.info = &r8a7795_pinmux_info; 747910df4d0SMarek Vasut #endif 748910df4d0SMarek Vasut #ifdef CONFIG_PINCTRL_PFC_R8A7796 749910df4d0SMarek Vasut if (model == SH_PFC_R8A7796) 750910df4d0SMarek Vasut priv->pfc.info = &r8a7796_pinmux_info; 751910df4d0SMarek Vasut #endif 752910df4d0SMarek Vasut 753910df4d0SMarek Vasut priv->pmx.pfc = &priv->pfc; 754910df4d0SMarek Vasut sh_pfc_init_ranges(&priv->pfc); 755910df4d0SMarek Vasut sh_pfc_map_pins(&priv->pfc, &priv->pmx); 756910df4d0SMarek Vasut 757910df4d0SMarek Vasut return 0; 758910df4d0SMarek Vasut } 759910df4d0SMarek Vasut 760910df4d0SMarek Vasut static const struct udevice_id sh_pfc_pinctrl_ids[] = { 761910df4d0SMarek Vasut #ifdef CONFIG_PINCTRL_PFC_R8A7795 762910df4d0SMarek Vasut { 763910df4d0SMarek Vasut .compatible = "renesas,pfc-r8a7795", 764910df4d0SMarek Vasut .data = SH_PFC_R8A7795, 765910df4d0SMarek Vasut }, 766910df4d0SMarek Vasut #endif 767910df4d0SMarek Vasut #ifdef CONFIG_PINCTRL_PFC_R8A7796 768910df4d0SMarek Vasut { 769910df4d0SMarek Vasut .compatible = "renesas,pfc-r8a7796", 770910df4d0SMarek Vasut .data = SH_PFC_R8A7796, 771910df4d0SMarek Vasut }, 772910df4d0SMarek Vasut #endif 773910df4d0SMarek Vasut { }, 774910df4d0SMarek Vasut }; 775910df4d0SMarek Vasut 776910df4d0SMarek Vasut U_BOOT_DRIVER(pinctrl_sh_pfc) = { 777910df4d0SMarek Vasut .name = "sh_pfc_pinctrl", 778910df4d0SMarek Vasut .id = UCLASS_PINCTRL, 779910df4d0SMarek Vasut .of_match = sh_pfc_pinctrl_ids, 780910df4d0SMarek Vasut .priv_auto_alloc_size = sizeof(struct sh_pfc_pinctrl_priv), 781910df4d0SMarek Vasut .ops = &sh_pfc_pinctrl_ops, 782910df4d0SMarek Vasut .probe = sh_pfc_pinctrl_probe, 783910df4d0SMarek Vasut }; 784