blob: 6cfe83a593a278c9299219f33b7221ddce8bb70f [file] [log] [blame]
Simon Glass74749f12019-12-06 21:42:53 -07001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2017 Intel Corp.
4 * Copyright 2019 Google LLC
5 *
6 * Taken partly from coreboot gpio.c
7 *
8 * Pinctrl is modelled as a separate device-tree node and device for each
9 * 'community' (basically a set of GPIOs). The separate devices work together
10 * and many functions permit any PINCTRL device to be provided as a parameter,
11 * since the pad numbering is unique across all devices.
12 *
13 * Each pinctrl has a single child GPIO device to handle GPIO access and
14 * therefore there is a simple GPIO driver included in this file.
15 */
16
17#define LOG_CATEGORY UCLASS_GPIO
18
Simon Glass74749f12019-12-06 21:42:53 -070019#include <dm.h>
20#include <irq.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060021#include <log.h>
Simon Glass336d4612020-02-03 07:36:16 -070022#include <malloc.h>
Simon Glass74749f12019-12-06 21:42:53 -070023#include <p2sb.h>
24#include <spl.h>
25#include <asm-generic/gpio.h>
26#include <asm/intel_pinctrl.h>
27#include <asm/intel_pinctrl_defs.h>
28#include <asm/arch/gpio.h>
Wolfgang Wallner142c9752020-01-22 16:01:45 +010029#include <asm/itss.h>
Simon Glass74749f12019-12-06 21:42:53 -070030#include <dm/device-internal.h>
31#include <dt-bindings/gpio/gpio.h>
Simon Glass61b29b82020-02-03 07:36:15 -070032#include <linux/err.h>
Simon Glass74749f12019-12-06 21:42:53 -070033
34#define GPIO_DW_SIZE(x) (sizeof(u32) * (x))
35#define PAD_CFG_OFFSET(x, dw_num) ((x) + GPIO_DW_SIZE(dw_num))
36#define PAD_CFG0_OFFSET(x) PAD_CFG_OFFSET(x, 0)
37#define PAD_CFG1_OFFSET(x) PAD_CFG_OFFSET(x, 1)
38
39#define MISCCFG_GPE0_DW0_SHIFT 8
40#define MISCCFG_GPE0_DW0_MASK (0xf << MISCCFG_GPE0_DW0_SHIFT)
41#define MISCCFG_GPE0_DW1_SHIFT 12
42#define MISCCFG_GPE0_DW1_MASK (0xf << MISCCFG_GPE0_DW1_SHIFT)
43#define MISCCFG_GPE0_DW2_SHIFT 16
44#define MISCCFG_GPE0_DW2_MASK (0xf << MISCCFG_GPE0_DW2_SHIFT)
45
46#define GPI_SMI_STS_OFFSET(comm, group) ((comm)->gpi_smi_sts_reg_0 + \
47 ((group) * sizeof(u32)))
48#define GPI_SMI_EN_OFFSET(comm, group) ((comm)->gpi_smi_en_reg_0 + \
49 ((group) * sizeof(u32)))
50#define GPI_IS_OFFSET(comm, group) ((comm)->gpi_int_sts_reg_0 + \
51 ((group) * sizeof(uint32_t)))
52#define GPI_IE_OFFSET(comm, group) ((comm)->gpi_int_en_reg_0 + \
53 ((group) * sizeof(uint32_t)))
54
55/**
56 * relative_pad_in_comm() - Get the relative position of a GPIO
57 *
58 * This finds the position of a GPIO within a community
59 *
60 * @comm: Community to search
61 * @gpio: Pad number to look up (assumed to be valid)
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010062 * Return: offset, 0 for first GPIO in community
Simon Glass74749f12019-12-06 21:42:53 -070063 */
64static size_t relative_pad_in_comm(const struct pad_community *comm,
65 uint gpio)
66{
67 return gpio - comm->first_pad;
68}
69
70/**
71 * pinctrl_group_index() - Find group for a a pad
72 *
73 * Find the group within the community that the pad is a part of
74 *
75 * @comm: Community to search
76 * @relative_pad: Pad to look up
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010077 * Return: group number if found (see community_n_groups, etc.), or
Simon Glass74749f12019-12-06 21:42:53 -070078 * -ESPIPE if no groups, or -ENOENT if not found
79 */
80static int pinctrl_group_index(const struct pad_community *comm,
81 uint relative_pad)
82{
83 int i;
84
85 if (!comm->groups)
86 return -ESPIPE;
87
88 /* find the base pad number for this pad's group */
89 for (i = 0; i < comm->num_groups; i++) {
90 if (relative_pad >= comm->groups[i].first_pad &&
91 relative_pad < comm->groups[i].first_pad +
92 comm->groups[i].size)
93 return i;
94 }
95
96 return -ENOENT;
97}
98
99static int pinctrl_group_index_scaled(const struct pad_community *comm,
100 uint relative_pad, size_t scale)
101{
102 int ret;
103
104 ret = pinctrl_group_index(comm, relative_pad);
105 if (ret < 0)
106 return ret;
107
108 return ret * scale;
109}
110
111static int pinctrl_within_group(const struct pad_community *comm,
112 uint relative_pad)
113{
114 int ret;
115
116 ret = pinctrl_group_index(comm, relative_pad);
117 if (ret < 0)
118 return ret;
119
120 return relative_pad - comm->groups[ret].first_pad;
121}
122
123static u32 pinctrl_bitmask_within_group(const struct pad_community *comm,
124 uint relative_pad)
125{
126 return 1U << pinctrl_within_group(comm, relative_pad);
127}
128
129/**
130 * pinctrl_get_device() - Find the device for a particular pad
131 *
132 * Each pinctr, device is attached to one community and this supports a number
133 * of pads. This function finds the device which controls a particular pad.
134 *
135 * @pad: Pad to check
136 * @devp: Returns the device for that pad
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100137 * Return: 0 if OK, -ENOTBLK if no device was found for the given pin
Simon Glass74749f12019-12-06 21:42:53 -0700138 */
139static int pinctrl_get_device(uint pad, struct udevice **devp)
140{
141 struct udevice *dev;
142
143 /*
144 * We have to probe each one of these since the community link is only
Simon Glassd1998a92020-12-03 16:55:21 -0700145 * attached in intel_pinctrl_of_to_plat().
Simon Glass74749f12019-12-06 21:42:53 -0700146 */
147 uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
148 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
149 const struct pad_community *comm = priv->comm;
150
151 if (pad >= comm->first_pad && pad <= comm->last_pad) {
152 *devp = dev;
153 return 0;
154 }
155 }
Simon Glassdd27cd62020-11-04 09:57:42 -0700156 log_debug("pad %d not found\n", pad);
Simon Glass74749f12019-12-06 21:42:53 -0700157
158 return -ENOTBLK;
159}
160
161int intel_pinctrl_get_pad(uint pad, struct udevice **devp, uint *offsetp)
162{
163 const struct pad_community *comm;
164 struct intel_pinctrl_priv *priv;
165 struct udevice *dev;
166 int ret;
167
168 ret = pinctrl_get_device(pad, &dev);
169 if (ret)
170 return log_msg_ret("pad", ret);
171 priv = dev_get_priv(dev);
172 comm = priv->comm;
173 *devp = dev;
174 *offsetp = relative_pad_in_comm(comm, pad);
175
176 return 0;
177}
178
179static int pinctrl_configure_owner(struct udevice *dev,
180 const struct pad_config *cfg,
181 const struct pad_community *comm)
182{
183 u32 hostsw_own;
184 u16 hostsw_own_offset;
185 int pin;
186 int ret;
187
188 pin = relative_pad_in_comm(comm, cfg->pad);
189
190 /*
191 * Based on the gpio pin number configure the corresponding bit in
192 * HOSTSW_OWN register. Value of 0x1 indicates GPIO Driver onwership.
193 */
194 hostsw_own_offset = comm->host_own_reg_0;
195 ret = pinctrl_group_index_scaled(comm, pin, sizeof(u32));
196 if (ret < 0)
197 return ret;
198 hostsw_own_offset += ret;
199
200 hostsw_own = pcr_read32(dev, hostsw_own_offset);
201
202 /*
203 *The 4th bit in pad_config 1 (RO) is used to indicate if the pad
204 * needs GPIO driver ownership. Set the bit if GPIO driver ownership
205 * requested, otherwise clear the bit.
206 */
207 if (cfg->pad_config[1] & PAD_CFG1_GPIO_DRIVER)
208 hostsw_own |= pinctrl_bitmask_within_group(comm, pin);
209 else
210 hostsw_own &= ~pinctrl_bitmask_within_group(comm, pin);
211
212 pcr_write32(dev, hostsw_own_offset, hostsw_own);
213
214 return 0;
215}
216
217static int gpi_enable_smi(struct udevice *dev, const struct pad_config *cfg,
218 const struct pad_community *comm)
219{
220 u32 value;
221 u16 sts_reg;
222 u16 en_reg;
223 int group;
224 int pin;
225 int ret;
226
227 if ((cfg->pad_config[0] & PAD_CFG0_ROUTE_SMI) != PAD_CFG0_ROUTE_SMI)
228 return 0;
229
230 pin = relative_pad_in_comm(comm, cfg->pad);
231 ret = pinctrl_group_index(comm, pin);
232 if (ret < 0)
233 return ret;
234 group = ret;
235
236 sts_reg = GPI_SMI_STS_OFFSET(comm, group);
237 value = pcr_read32(dev, sts_reg);
238 /* Write back 1 to reset the sts bits */
239 pcr_write32(dev, sts_reg, value);
240
241 /* Set enable bits */
242 en_reg = GPI_SMI_EN_OFFSET(comm, group);
243 pcr_setbits32(dev, en_reg, pinctrl_bitmask_within_group(comm, pin));
244
245 return 0;
246}
247
248static int pinctrl_configure_itss(struct udevice *dev,
249 const struct pad_config *cfg,
250 uint pad_cfg_offset)
251{
252 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
253
254 if (!priv->itss_pol_cfg)
255 return -ENOSYS;
256
257 int irq;
258
259 /*
260 * Set up ITSS polarity if pad is routed to APIC.
261 *
262 * The ITSS takes only active high interrupt signals. Therefore,
263 * if the pad configuration indicates an inversion assume the
264 * intent is for the ITSS polarity. Before forwarding on the
265 * request to the APIC there's an inversion setting for how the
266 * signal is forwarded to the APIC. Honor the inversion setting
267 * in the GPIO pad configuration so that a hardware active low
268 * signal looks that way to the APIC (double inversion).
269 */
270 if (!(cfg->pad_config[0] & PAD_CFG0_ROUTE_IOAPIC))
271 return 0;
272
273 irq = pcr_read32(dev, PAD_CFG1_OFFSET(pad_cfg_offset));
274 irq &= PAD_CFG1_IRQ_MASK;
275 if (!irq) {
Simon Glass53d59692020-12-23 08:11:31 -0700276 if (spl_phase() > PHASE_TPL)
277 log_err("GPIO %u doesn't support APIC routing\n",
278 cfg->pad);
Simon Glass74749f12019-12-06 21:42:53 -0700279
280 return -EPROTONOSUPPORT;
281 }
282 irq_set_polarity(priv->itss, irq,
283 cfg->pad_config[0] & PAD_CFG0_RX_POL_INVERT);
284
285 return 0;
286}
287
288/* Number of DWx config registers can be different for different SOCs */
289static uint pad_config_offset(struct intel_pinctrl_priv *priv, uint pad)
290{
291 const struct pad_community *comm = priv->comm;
292 size_t offset;
293
294 offset = relative_pad_in_comm(comm, pad);
295 offset *= GPIO_DW_SIZE(priv->num_cfgs);
296
297 return offset + comm->pad_cfg_base;
298}
299
300static int pinctrl_pad_reset_config_override(const struct pad_community *comm,
301 u32 config_value)
302{
303 const struct reset_mapping *rst_map = comm->reset_map;
304 int i;
305
306 /* Logical reset values equal chipset values */
307 if (!rst_map || !comm->num_reset_vals)
308 return config_value;
309
310 for (i = 0; i < comm->num_reset_vals; i++, rst_map++) {
311 if ((config_value & PAD_CFG0_RESET_MASK) == rst_map->logical) {
312 config_value &= ~PAD_CFG0_RESET_MASK;
313 config_value |= rst_map->chipset;
314
315 return config_value;
316 }
317 }
Simon Glass53d59692020-12-23 08:11:31 -0700318 if (spl_phase() > PHASE_TPL)
319 log_err("Logical-to-Chipset mapping not found\n");
Simon Glass74749f12019-12-06 21:42:53 -0700320
321 return -ENOENT;
322}
323
324static const int mask[4] = {
325 PAD_CFG0_TX_STATE |
326 PAD_CFG0_TX_DISABLE | PAD_CFG0_RX_DISABLE | PAD_CFG0_MODE_MASK |
327 PAD_CFG0_ROUTE_MASK | PAD_CFG0_RXTENCFG_MASK |
328 PAD_CFG0_RXINV_MASK | PAD_CFG0_PREGFRXSEL |
329 PAD_CFG0_TRIG_MASK | PAD_CFG0_RXRAW1_MASK |
330 PAD_CFG0_RXPADSTSEL_MASK | PAD_CFG0_RESET_MASK,
331
332#ifdef CONFIG_INTEL_PINCTRL_IOSTANDBY
333 PAD_CFG1_IOSTERM_MASK | PAD_CFG1_PULL_MASK | PAD_CFG1_IOSSTATE_MASK,
334#else
335 PAD_CFG1_IOSTERM_MASK | PAD_CFG1_PULL_MASK,
336#endif
337
338 PAD_CFG2_DEBOUNCE_MASK,
339
340 0,
341};
342
343/**
344 * pinctrl_configure_pad() - Configure a pad
345 *
346 * @dev: Pinctrl device containing the pad (see pinctrl_get_device())
347 * @cfg: Configuration to apply
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100348 * Return: 0 if OK, -ve on error
Simon Glass74749f12019-12-06 21:42:53 -0700349 */
350static int pinctrl_configure_pad(struct udevice *dev,
351 const struct pad_config *cfg)
352{
353 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
354 const struct pad_community *comm = priv->comm;
355 uint config_offset;
356 u32 pad_conf, soc_pad_conf;
357 int ret;
358 int i;
359
360 if (IS_ERR(comm))
361 return PTR_ERR(comm);
362 config_offset = pad_config_offset(priv, cfg->pad);
363 for (i = 0; i < priv->num_cfgs; i++) {
364 pad_conf = pcr_read32(dev, PAD_CFG_OFFSET(config_offset, i));
365
366 soc_pad_conf = cfg->pad_config[i];
367 if (i == 0) {
368 ret = pinctrl_pad_reset_config_override(comm,
369 soc_pad_conf);
370 if (ret < 0)
371 return ret;
372 soc_pad_conf = ret;
373 }
374 soc_pad_conf &= mask[i];
375 soc_pad_conf |= pad_conf & ~mask[i];
376
377 log_debug("pinctrl_padcfg [0x%02x, %02zd] DW%d [0x%08x : 0x%08x : 0x%08x]\n",
378 comm->port, relative_pad_in_comm(comm, cfg->pad), i,
379 pad_conf,/* old value */
380 /* value passed from pinctrl table */
381 cfg->pad_config[i],
382 soc_pad_conf); /*new value*/
383 pcr_write32(dev, PAD_CFG_OFFSET(config_offset, i),
384 soc_pad_conf);
385 }
386 ret = pinctrl_configure_itss(dev, cfg, config_offset);
387 if (ret && ret != -ENOSYS)
388 return log_msg_ret("itss config failed", ret);
389 ret = pinctrl_configure_owner(dev, cfg, comm);
390 if (ret)
391 return ret;
392 ret = gpi_enable_smi(dev, cfg, comm);
393 if (ret)
394 return ret;
395
396 return 0;
397}
398
Simon Glass4916f452020-07-07 21:32:19 -0600399u32 intel_pinctrl_get_config_reg_offset(struct udevice *dev, uint offset)
Simon Glass74749f12019-12-06 21:42:53 -0700400{
401 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
402 const struct pad_community *comm = priv->comm;
403 uint config_offset;
404
405 assert(device_get_uclass_id(dev) == UCLASS_PINCTRL);
406 config_offset = comm->pad_cfg_base + offset *
407 GPIO_DW_SIZE(priv->num_cfgs);
408
409 return config_offset;
410}
411
Simon Glass4916f452020-07-07 21:32:19 -0600412u32 intel_pinctrl_get_config_reg_addr(struct udevice *dev, uint offset)
413{
414 uint config_offset = intel_pinctrl_get_config_reg_offset(dev, offset);
415
416 return (u32)(ulong)pcr_reg_address(dev, config_offset);
417}
418
Simon Glass74749f12019-12-06 21:42:53 -0700419u32 intel_pinctrl_get_config_reg(struct udevice *dev, uint offset)
420{
Simon Glass4916f452020-07-07 21:32:19 -0600421 uint config_offset = intel_pinctrl_get_config_reg_offset(dev, offset);
Simon Glass74749f12019-12-06 21:42:53 -0700422
423 return pcr_read32(dev, config_offset);
424}
425
426int intel_pinctrl_get_acpi_pin(struct udevice *dev, uint offset)
427{
428 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
429 const struct pad_community *comm = priv->comm;
430 int group;
431
Simon Glassa9331a32020-07-07 21:32:21 -0600432 if (IS_ENABLED(CONFIG_INTEL_PINCTRL_MULTI_ACPI_DEVICES))
433 return offset;
Simon Glass74749f12019-12-06 21:42:53 -0700434 group = pinctrl_group_index(comm, offset);
435
436 /* If pad base is not set then use GPIO number as ACPI pin number */
437 if (comm->groups[group].acpi_pad_base == PAD_BASE_NONE)
438 return comm->first_pad + offset;
439
440 /*
441 * If this group has a non-zero pad base then compute the ACPI pin
442 * number from the pad base and the relative pad in the group.
443 */
444 return comm->groups[group].acpi_pad_base +
445 pinctrl_within_group(comm, offset);
446}
447
448int pinctrl_route_gpe(struct udevice *itss, uint gpe0b, uint gpe0c, uint gpe0d)
449{
450 struct udevice *pinctrl_dev;
451 u32 misccfg_value;
452 u32 misccfg_clr;
453 int ret;
454
455 /*
456 * Get the group here for community specific MISCCFG register.
457 * If any of these returns -1 then there is some error in devicetree
458 * where the group is probably hardcoded and does not comply with the
459 * PMC group defines. So we return from here and MISCFG is set to
460 * default.
461 */
462 ret = irq_route_pmc_gpio_gpe(itss, gpe0b);
463 if (ret)
464 return ret;
465 gpe0b = ret;
466
467 ret = irq_route_pmc_gpio_gpe(itss, gpe0c);
468 if (ret)
469 return ret;
470 gpe0c = ret;
471
472 ret = irq_route_pmc_gpio_gpe(itss, gpe0d);
473 if (ret)
474 return ret;
475 gpe0d = ret;
476
477 misccfg_value = gpe0b << MISCCFG_GPE0_DW0_SHIFT;
478 misccfg_value |= gpe0c << MISCCFG_GPE0_DW1_SHIFT;
479 misccfg_value |= gpe0d << MISCCFG_GPE0_DW2_SHIFT;
480
481 /* Program GPIO_MISCCFG */
482 misccfg_clr = MISCCFG_GPE0_DW2_MASK | MISCCFG_GPE0_DW1_MASK |
483 MISCCFG_GPE0_DW0_MASK;
484
485 log_debug("misccfg_clr:%x misccfg_value:%x\n", misccfg_clr,
486 misccfg_value);
487 uclass_foreach_dev_probe(UCLASS_PINCTRL, pinctrl_dev) {
488 pcr_clrsetbits32(pinctrl_dev, GPIO_MISCCFG, misccfg_clr,
489 misccfg_value);
490 }
491
492 return 0;
493}
494
495int pinctrl_gpi_clear_int_cfg(void)
496{
497 struct udevice *dev;
498 struct uclass *uc;
499 int ret;
500
501 ret = uclass_get(UCLASS_PINCTRL, &uc);
502 if (ret)
503 return log_msg_ret("pinctrl uc", ret);
504 uclass_foreach_dev(dev, uc) {
505 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
506 const struct pad_community *comm = priv->comm;
507 uint sts_value;
508 int group;
509
510 for (group = 0; group < comm->num_gpi_regs; group++) {
511 /* Clear the enable register */
512 pcr_write32(dev, GPI_IE_OFFSET(comm, group), 0);
513
514 /* Read and clear the set status register bits*/
515 sts_value = pcr_read32(dev,
516 GPI_IS_OFFSET(comm, group));
517 pcr_write32(dev, GPI_IS_OFFSET(comm, group), sts_value);
518 }
519 }
520
521 return 0;
522}
523
524int pinctrl_config_pads(struct udevice *dev, u32 *pads, int pads_count)
525{
526 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
527 const u32 *ptr;
528 int i;
529
530 log_debug("%s: pads_count=%d\n", __func__, pads_count);
531 for (ptr = pads, i = 0; i < pads_count;
532 ptr += 1 + priv->num_cfgs, i++) {
533 struct udevice *pad_dev = NULL;
534 struct pad_config *cfg;
535 int ret;
536
537 cfg = (struct pad_config *)ptr;
538 ret = pinctrl_get_device(cfg->pad, &pad_dev);
539 if (ret)
540 return ret;
541 ret = pinctrl_configure_pad(pad_dev, cfg);
542 if (ret)
543 return ret;
544 }
545
546 return 0;
547}
548
549int pinctrl_read_pads(struct udevice *dev, ofnode node, const char *prop,
550 u32 **padsp, int *pad_countp)
551{
552 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
553 u32 *pads;
554 int size;
555 int ret;
556
557 *padsp = NULL;
558 *pad_countp = 0;
559 size = ofnode_read_size(node, prop);
560 if (size < 0)
561 return 0;
562
563 pads = malloc(size);
564 if (!pads)
565 return -ENOMEM;
566 size /= sizeof(fdt32_t);
567 ret = ofnode_read_u32_array(node, prop, pads, size);
568 if (ret) {
569 free(pads);
570 return ret;
571 }
572 *pad_countp = size / (1 + priv->num_cfgs);
573 *padsp = pads;
574
575 return 0;
576}
577
578int pinctrl_count_pads(struct udevice *dev, u32 *pads, int size)
579{
580 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
581 int count = 0;
582 int i;
583
584 for (i = 0; i < size;) {
585 u32 val;
586 int j;
587
588 for (val = j = 0; j < priv->num_cfgs + 1; j++)
589 val |= pads[i + j];
590 if (!val)
591 break;
592 count++;
593 i += priv->num_cfgs + 1;
594 }
595
596 return count;
597}
598
599int pinctrl_config_pads_for_node(struct udevice *dev, ofnode node)
600{
601 int pads_count;
602 u32 *pads;
603 int ret;
604
605 if (device_get_uclass_id(dev) != UCLASS_PINCTRL)
606 return log_msg_ret("uclass", -EPROTONOSUPPORT);
607 ret = pinctrl_read_pads(dev, node, "pads", &pads, &pads_count);
608 if (ret)
609 return log_msg_ret("no pads", ret);
610 ret = pinctrl_config_pads(dev, pads, pads_count);
611 free(pads);
612 if (ret)
613 return log_msg_ret("pad config", ret);
614
615 return 0;
616}
617
Simon Glassd1998a92020-12-03 16:55:21 -0700618int intel_pinctrl_of_to_plat(struct udevice *dev,
619 const struct pad_community *comm, int num_cfgs)
Simon Glass74749f12019-12-06 21:42:53 -0700620{
Simon Glass8a8d24b2020-12-03 16:55:23 -0700621 struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
Simon Glass74749f12019-12-06 21:42:53 -0700622 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
Simon Glass74749f12019-12-06 21:42:53 -0700623
624 if (!comm) {
Simon Glass53d59692020-12-23 08:11:31 -0700625 if (spl_phase() > PHASE_TPL)
626 log_err("Cannot find community for pid %d\n",
627 pplat->pid);
Simon Glass74749f12019-12-06 21:42:53 -0700628 return -EDOM;
629 }
Simon Glass74749f12019-12-06 21:42:53 -0700630 priv->comm = comm;
631 priv->num_cfgs = num_cfgs;
632
633 return 0;
634}
635
636int intel_pinctrl_probe(struct udevice *dev)
637{
638 struct intel_pinctrl_priv *priv = dev_get_priv(dev);
Simon Glass6b651482020-07-07 21:32:22 -0600639 int ret;
Simon Glass74749f12019-12-06 21:42:53 -0700640
641 priv->itss_pol_cfg = true;
Simon Glass6b651482020-07-07 21:32:22 -0600642 ret = irq_first_device_type(X86_IRQT_ITSS, &priv->itss);
643 if (ret)
644 return log_msg_ret("Cannot find ITSS", ret);
Simon Glass74749f12019-12-06 21:42:53 -0700645
646 return 0;
647}
648
649const struct pinctrl_ops intel_pinctrl_ops = {
650 /* No operations are supported, but DM expects this to be present */
651};