pinctrl.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. // 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. #define LOG_CATEGORY UCLASS_GPIO
  17. #include <common.h>
  18. #include <dm.h>
  19. #include <irq.h>
  20. #include <log.h>
  21. #include <malloc.h>
  22. #include <p2sb.h>
  23. #include <spl.h>
  24. #include <asm-generic/gpio.h>
  25. #include <asm/intel_pinctrl.h>
  26. #include <asm/intel_pinctrl_defs.h>
  27. #include <asm/arch/gpio.h>
  28. #include <asm/itss.h>
  29. #include <dm/device-internal.h>
  30. #include <dt-bindings/gpio/gpio.h>
  31. #include <linux/err.h>
  32. #define GPIO_DW_SIZE(x) (sizeof(u32) * (x))
  33. #define PAD_CFG_OFFSET(x, dw_num) ((x) + GPIO_DW_SIZE(dw_num))
  34. #define PAD_CFG0_OFFSET(x) PAD_CFG_OFFSET(x, 0)
  35. #define PAD_CFG1_OFFSET(x) PAD_CFG_OFFSET(x, 1)
  36. #define MISCCFG_GPE0_DW0_SHIFT 8
  37. #define MISCCFG_GPE0_DW0_MASK (0xf << MISCCFG_GPE0_DW0_SHIFT)
  38. #define MISCCFG_GPE0_DW1_SHIFT 12
  39. #define MISCCFG_GPE0_DW1_MASK (0xf << MISCCFG_GPE0_DW1_SHIFT)
  40. #define MISCCFG_GPE0_DW2_SHIFT 16
  41. #define MISCCFG_GPE0_DW2_MASK (0xf << MISCCFG_GPE0_DW2_SHIFT)
  42. #define GPI_SMI_STS_OFFSET(comm, group) ((comm)->gpi_smi_sts_reg_0 + \
  43. ((group) * sizeof(u32)))
  44. #define GPI_SMI_EN_OFFSET(comm, group) ((comm)->gpi_smi_en_reg_0 + \
  45. ((group) * sizeof(u32)))
  46. #define GPI_IS_OFFSET(comm, group) ((comm)->gpi_int_sts_reg_0 + \
  47. ((group) * sizeof(uint32_t)))
  48. #define GPI_IE_OFFSET(comm, group) ((comm)->gpi_int_en_reg_0 + \
  49. ((group) * sizeof(uint32_t)))
  50. /**
  51. * relative_pad_in_comm() - Get the relative position of a GPIO
  52. *
  53. * This finds the position of a GPIO within a community
  54. *
  55. * @comm: Community to search
  56. * @gpio: Pad number to look up (assumed to be valid)
  57. * Return: offset, 0 for first GPIO in community
  58. */
  59. static size_t relative_pad_in_comm(const struct pad_community *comm,
  60. uint gpio)
  61. {
  62. return gpio - comm->first_pad;
  63. }
  64. /**
  65. * pinctrl_group_index() - Find group for a a pad
  66. *
  67. * Find the group within the community that the pad is a part of
  68. *
  69. * @comm: Community to search
  70. * @relative_pad: Pad to look up
  71. * Return: group number if found (see community_n_groups, etc.), or
  72. * -ESPIPE if no groups, or -ENOENT if not found
  73. */
  74. static int pinctrl_group_index(const struct pad_community *comm,
  75. uint relative_pad)
  76. {
  77. int i;
  78. if (!comm->groups)
  79. return -ESPIPE;
  80. /* find the base pad number for this pad's group */
  81. for (i = 0; i < comm->num_groups; i++) {
  82. if (relative_pad >= comm->groups[i].first_pad &&
  83. relative_pad < comm->groups[i].first_pad +
  84. comm->groups[i].size)
  85. return i;
  86. }
  87. return -ENOENT;
  88. }
  89. static int pinctrl_group_index_scaled(const struct pad_community *comm,
  90. uint relative_pad, size_t scale)
  91. {
  92. int ret;
  93. ret = pinctrl_group_index(comm, relative_pad);
  94. if (ret < 0)
  95. return ret;
  96. return ret * scale;
  97. }
  98. static int pinctrl_within_group(const struct pad_community *comm,
  99. uint relative_pad)
  100. {
  101. int ret;
  102. ret = pinctrl_group_index(comm, relative_pad);
  103. if (ret < 0)
  104. return ret;
  105. return relative_pad - comm->groups[ret].first_pad;
  106. }
  107. static u32 pinctrl_bitmask_within_group(const struct pad_community *comm,
  108. uint relative_pad)
  109. {
  110. return 1U << pinctrl_within_group(comm, relative_pad);
  111. }
  112. /**
  113. * pinctrl_get_device() - Find the device for a particular pad
  114. *
  115. * Each pinctr, device is attached to one community and this supports a number
  116. * of pads. This function finds the device which controls a particular pad.
  117. *
  118. * @pad: Pad to check
  119. * @devp: Returns the device for that pad
  120. * Return: 0 if OK, -ENOTBLK if no device was found for the given pin
  121. */
  122. static int pinctrl_get_device(uint pad, struct udevice **devp)
  123. {
  124. struct udevice *dev;
  125. /*
  126. * We have to probe each one of these since the community link is only
  127. * attached in intel_pinctrl_of_to_plat().
  128. */
  129. uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
  130. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  131. const struct pad_community *comm = priv->comm;
  132. if (pad >= comm->first_pad && pad <= comm->last_pad) {
  133. *devp = dev;
  134. return 0;
  135. }
  136. }
  137. log_debug("pad %d not found\n", pad);
  138. return -ENOTBLK;
  139. }
  140. int intel_pinctrl_get_pad(uint pad, struct udevice **devp, uint *offsetp)
  141. {
  142. const struct pad_community *comm;
  143. struct intel_pinctrl_priv *priv;
  144. struct udevice *dev;
  145. int ret;
  146. ret = pinctrl_get_device(pad, &dev);
  147. if (ret)
  148. return log_msg_ret("pad", ret);
  149. priv = dev_get_priv(dev);
  150. comm = priv->comm;
  151. *devp = dev;
  152. *offsetp = relative_pad_in_comm(comm, pad);
  153. return 0;
  154. }
  155. static int pinctrl_configure_owner(struct udevice *dev,
  156. const struct pad_config *cfg,
  157. const struct pad_community *comm)
  158. {
  159. u32 hostsw_own;
  160. u16 hostsw_own_offset;
  161. int pin;
  162. int ret;
  163. pin = relative_pad_in_comm(comm, cfg->pad);
  164. /*
  165. * Based on the gpio pin number configure the corresponding bit in
  166. * HOSTSW_OWN register. Value of 0x1 indicates GPIO Driver onwership.
  167. */
  168. hostsw_own_offset = comm->host_own_reg_0;
  169. ret = pinctrl_group_index_scaled(comm, pin, sizeof(u32));
  170. if (ret < 0)
  171. return ret;
  172. hostsw_own_offset += ret;
  173. hostsw_own = pcr_read32(dev, hostsw_own_offset);
  174. /*
  175. *The 4th bit in pad_config 1 (RO) is used to indicate if the pad
  176. * needs GPIO driver ownership. Set the bit if GPIO driver ownership
  177. * requested, otherwise clear the bit.
  178. */
  179. if (cfg->pad_config[1] & PAD_CFG1_GPIO_DRIVER)
  180. hostsw_own |= pinctrl_bitmask_within_group(comm, pin);
  181. else
  182. hostsw_own &= ~pinctrl_bitmask_within_group(comm, pin);
  183. pcr_write32(dev, hostsw_own_offset, hostsw_own);
  184. return 0;
  185. }
  186. static int gpi_enable_smi(struct udevice *dev, const struct pad_config *cfg,
  187. const struct pad_community *comm)
  188. {
  189. u32 value;
  190. u16 sts_reg;
  191. u16 en_reg;
  192. int group;
  193. int pin;
  194. int ret;
  195. if ((cfg->pad_config[0] & PAD_CFG0_ROUTE_SMI) != PAD_CFG0_ROUTE_SMI)
  196. return 0;
  197. pin = relative_pad_in_comm(comm, cfg->pad);
  198. ret = pinctrl_group_index(comm, pin);
  199. if (ret < 0)
  200. return ret;
  201. group = ret;
  202. sts_reg = GPI_SMI_STS_OFFSET(comm, group);
  203. value = pcr_read32(dev, sts_reg);
  204. /* Write back 1 to reset the sts bits */
  205. pcr_write32(dev, sts_reg, value);
  206. /* Set enable bits */
  207. en_reg = GPI_SMI_EN_OFFSET(comm, group);
  208. pcr_setbits32(dev, en_reg, pinctrl_bitmask_within_group(comm, pin));
  209. return 0;
  210. }
  211. static int pinctrl_configure_itss(struct udevice *dev,
  212. const struct pad_config *cfg,
  213. uint pad_cfg_offset)
  214. {
  215. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  216. if (!priv->itss_pol_cfg)
  217. return -ENOSYS;
  218. int irq;
  219. /*
  220. * Set up ITSS polarity if pad is routed to APIC.
  221. *
  222. * The ITSS takes only active high interrupt signals. Therefore,
  223. * if the pad configuration indicates an inversion assume the
  224. * intent is for the ITSS polarity. Before forwarding on the
  225. * request to the APIC there's an inversion setting for how the
  226. * signal is forwarded to the APIC. Honor the inversion setting
  227. * in the GPIO pad configuration so that a hardware active low
  228. * signal looks that way to the APIC (double inversion).
  229. */
  230. if (!(cfg->pad_config[0] & PAD_CFG0_ROUTE_IOAPIC))
  231. return 0;
  232. irq = pcr_read32(dev, PAD_CFG1_OFFSET(pad_cfg_offset));
  233. irq &= PAD_CFG1_IRQ_MASK;
  234. if (!irq) {
  235. if (spl_phase() > PHASE_TPL)
  236. log_err("GPIO %u doesn't support APIC routing\n",
  237. cfg->pad);
  238. return -EPROTONOSUPPORT;
  239. }
  240. irq_set_polarity(priv->itss, irq,
  241. cfg->pad_config[0] & PAD_CFG0_RX_POL_INVERT);
  242. return 0;
  243. }
  244. /* Number of DWx config registers can be different for different SOCs */
  245. static uint pad_config_offset(struct intel_pinctrl_priv *priv, uint pad)
  246. {
  247. const struct pad_community *comm = priv->comm;
  248. size_t offset;
  249. offset = relative_pad_in_comm(comm, pad);
  250. offset *= GPIO_DW_SIZE(priv->num_cfgs);
  251. return offset + comm->pad_cfg_base;
  252. }
  253. static int pinctrl_pad_reset_config_override(const struct pad_community *comm,
  254. u32 config_value)
  255. {
  256. const struct reset_mapping *rst_map = comm->reset_map;
  257. int i;
  258. /* Logical reset values equal chipset values */
  259. if (!rst_map || !comm->num_reset_vals)
  260. return config_value;
  261. for (i = 0; i < comm->num_reset_vals; i++, rst_map++) {
  262. if ((config_value & PAD_CFG0_RESET_MASK) == rst_map->logical) {
  263. config_value &= ~PAD_CFG0_RESET_MASK;
  264. config_value |= rst_map->chipset;
  265. return config_value;
  266. }
  267. }
  268. if (spl_phase() > PHASE_TPL)
  269. log_err("Logical-to-Chipset mapping not found\n");
  270. return -ENOENT;
  271. }
  272. static const int mask[4] = {
  273. PAD_CFG0_TX_STATE |
  274. PAD_CFG0_TX_DISABLE | PAD_CFG0_RX_DISABLE | PAD_CFG0_MODE_MASK |
  275. PAD_CFG0_ROUTE_MASK | PAD_CFG0_RXTENCFG_MASK |
  276. PAD_CFG0_RXINV_MASK | PAD_CFG0_PREGFRXSEL |
  277. PAD_CFG0_TRIG_MASK | PAD_CFG0_RXRAW1_MASK |
  278. PAD_CFG0_RXPADSTSEL_MASK | PAD_CFG0_RESET_MASK,
  279. #ifdef CONFIG_INTEL_PINCTRL_IOSTANDBY
  280. PAD_CFG1_IOSTERM_MASK | PAD_CFG1_PULL_MASK | PAD_CFG1_IOSSTATE_MASK,
  281. #else
  282. PAD_CFG1_IOSTERM_MASK | PAD_CFG1_PULL_MASK,
  283. #endif
  284. PAD_CFG2_DEBOUNCE_MASK,
  285. 0,
  286. };
  287. /**
  288. * pinctrl_configure_pad() - Configure a pad
  289. *
  290. * @dev: Pinctrl device containing the pad (see pinctrl_get_device())
  291. * @cfg: Configuration to apply
  292. * Return: 0 if OK, -ve on error
  293. */
  294. static int pinctrl_configure_pad(struct udevice *dev,
  295. const struct pad_config *cfg)
  296. {
  297. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  298. const struct pad_community *comm = priv->comm;
  299. uint config_offset;
  300. u32 pad_conf, soc_pad_conf;
  301. int ret;
  302. int i;
  303. if (IS_ERR(comm))
  304. return PTR_ERR(comm);
  305. config_offset = pad_config_offset(priv, cfg->pad);
  306. for (i = 0; i < priv->num_cfgs; i++) {
  307. pad_conf = pcr_read32(dev, PAD_CFG_OFFSET(config_offset, i));
  308. soc_pad_conf = cfg->pad_config[i];
  309. if (i == 0) {
  310. ret = pinctrl_pad_reset_config_override(comm,
  311. soc_pad_conf);
  312. if (ret < 0)
  313. return ret;
  314. soc_pad_conf = ret;
  315. }
  316. soc_pad_conf &= mask[i];
  317. soc_pad_conf |= pad_conf & ~mask[i];
  318. log_debug("pinctrl_padcfg [0x%02x, %02zd] DW%d [0x%08x : 0x%08x : 0x%08x]\n",
  319. comm->port, relative_pad_in_comm(comm, cfg->pad), i,
  320. pad_conf,/* old value */
  321. /* value passed from pinctrl table */
  322. cfg->pad_config[i],
  323. soc_pad_conf); /*new value*/
  324. pcr_write32(dev, PAD_CFG_OFFSET(config_offset, i),
  325. soc_pad_conf);
  326. }
  327. ret = pinctrl_configure_itss(dev, cfg, config_offset);
  328. if (ret && ret != -ENOSYS)
  329. return log_msg_ret("itss config failed", ret);
  330. ret = pinctrl_configure_owner(dev, cfg, comm);
  331. if (ret)
  332. return ret;
  333. ret = gpi_enable_smi(dev, cfg, comm);
  334. if (ret)
  335. return ret;
  336. return 0;
  337. }
  338. u32 intel_pinctrl_get_config_reg_offset(struct udevice *dev, uint offset)
  339. {
  340. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  341. const struct pad_community *comm = priv->comm;
  342. uint config_offset;
  343. assert(device_get_uclass_id(dev) == UCLASS_PINCTRL);
  344. config_offset = comm->pad_cfg_base + offset *
  345. GPIO_DW_SIZE(priv->num_cfgs);
  346. return config_offset;
  347. }
  348. u32 intel_pinctrl_get_config_reg_addr(struct udevice *dev, uint offset)
  349. {
  350. uint config_offset = intel_pinctrl_get_config_reg_offset(dev, offset);
  351. return (u32)(ulong)pcr_reg_address(dev, config_offset);
  352. }
  353. u32 intel_pinctrl_get_config_reg(struct udevice *dev, uint offset)
  354. {
  355. uint config_offset = intel_pinctrl_get_config_reg_offset(dev, offset);
  356. return pcr_read32(dev, config_offset);
  357. }
  358. int intel_pinctrl_get_acpi_pin(struct udevice *dev, uint offset)
  359. {
  360. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  361. const struct pad_community *comm = priv->comm;
  362. int group;
  363. if (IS_ENABLED(CONFIG_INTEL_PINCTRL_MULTI_ACPI_DEVICES))
  364. return offset;
  365. group = pinctrl_group_index(comm, offset);
  366. /* If pad base is not set then use GPIO number as ACPI pin number */
  367. if (comm->groups[group].acpi_pad_base == PAD_BASE_NONE)
  368. return comm->first_pad + offset;
  369. /*
  370. * If this group has a non-zero pad base then compute the ACPI pin
  371. * number from the pad base and the relative pad in the group.
  372. */
  373. return comm->groups[group].acpi_pad_base +
  374. pinctrl_within_group(comm, offset);
  375. }
  376. int pinctrl_route_gpe(struct udevice *itss, uint gpe0b, uint gpe0c, uint gpe0d)
  377. {
  378. struct udevice *pinctrl_dev;
  379. u32 misccfg_value;
  380. u32 misccfg_clr;
  381. int ret;
  382. /*
  383. * Get the group here for community specific MISCCFG register.
  384. * If any of these returns -1 then there is some error in devicetree
  385. * where the group is probably hardcoded and does not comply with the
  386. * PMC group defines. So we return from here and MISCFG is set to
  387. * default.
  388. */
  389. ret = irq_route_pmc_gpio_gpe(itss, gpe0b);
  390. if (ret)
  391. return ret;
  392. gpe0b = ret;
  393. ret = irq_route_pmc_gpio_gpe(itss, gpe0c);
  394. if (ret)
  395. return ret;
  396. gpe0c = ret;
  397. ret = irq_route_pmc_gpio_gpe(itss, gpe0d);
  398. if (ret)
  399. return ret;
  400. gpe0d = ret;
  401. misccfg_value = gpe0b << MISCCFG_GPE0_DW0_SHIFT;
  402. misccfg_value |= gpe0c << MISCCFG_GPE0_DW1_SHIFT;
  403. misccfg_value |= gpe0d << MISCCFG_GPE0_DW2_SHIFT;
  404. /* Program GPIO_MISCCFG */
  405. misccfg_clr = MISCCFG_GPE0_DW2_MASK | MISCCFG_GPE0_DW1_MASK |
  406. MISCCFG_GPE0_DW0_MASK;
  407. log_debug("misccfg_clr:%x misccfg_value:%x\n", misccfg_clr,
  408. misccfg_value);
  409. uclass_foreach_dev_probe(UCLASS_PINCTRL, pinctrl_dev) {
  410. pcr_clrsetbits32(pinctrl_dev, GPIO_MISCCFG, misccfg_clr,
  411. misccfg_value);
  412. }
  413. return 0;
  414. }
  415. int pinctrl_gpi_clear_int_cfg(void)
  416. {
  417. struct udevice *dev;
  418. struct uclass *uc;
  419. int ret;
  420. ret = uclass_get(UCLASS_PINCTRL, &uc);
  421. if (ret)
  422. return log_msg_ret("pinctrl uc", ret);
  423. uclass_foreach_dev(dev, uc) {
  424. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  425. const struct pad_community *comm = priv->comm;
  426. uint sts_value;
  427. int group;
  428. for (group = 0; group < comm->num_gpi_regs; group++) {
  429. /* Clear the enable register */
  430. pcr_write32(dev, GPI_IE_OFFSET(comm, group), 0);
  431. /* Read and clear the set status register bits*/
  432. sts_value = pcr_read32(dev,
  433. GPI_IS_OFFSET(comm, group));
  434. pcr_write32(dev, GPI_IS_OFFSET(comm, group), sts_value);
  435. }
  436. }
  437. return 0;
  438. }
  439. int pinctrl_config_pads(struct udevice *dev, u32 *pads, int pads_count)
  440. {
  441. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  442. const u32 *ptr;
  443. int i;
  444. log_debug("%s: pads_count=%d\n", __func__, pads_count);
  445. for (ptr = pads, i = 0; i < pads_count;
  446. ptr += 1 + priv->num_cfgs, i++) {
  447. struct udevice *pad_dev = NULL;
  448. struct pad_config *cfg;
  449. int ret;
  450. cfg = (struct pad_config *)ptr;
  451. ret = pinctrl_get_device(cfg->pad, &pad_dev);
  452. if (ret)
  453. return ret;
  454. ret = pinctrl_configure_pad(pad_dev, cfg);
  455. if (ret)
  456. return ret;
  457. }
  458. return 0;
  459. }
  460. int pinctrl_read_pads(struct udevice *dev, ofnode node, const char *prop,
  461. u32 **padsp, int *pad_countp)
  462. {
  463. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  464. u32 *pads;
  465. int size;
  466. int ret;
  467. *padsp = NULL;
  468. *pad_countp = 0;
  469. size = ofnode_read_size(node, prop);
  470. if (size < 0)
  471. return 0;
  472. pads = malloc(size);
  473. if (!pads)
  474. return -ENOMEM;
  475. size /= sizeof(fdt32_t);
  476. ret = ofnode_read_u32_array(node, prop, pads, size);
  477. if (ret) {
  478. free(pads);
  479. return ret;
  480. }
  481. *pad_countp = size / (1 + priv->num_cfgs);
  482. *padsp = pads;
  483. return 0;
  484. }
  485. int pinctrl_count_pads(struct udevice *dev, u32 *pads, int size)
  486. {
  487. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  488. int count = 0;
  489. int i;
  490. for (i = 0; i < size;) {
  491. u32 val;
  492. int j;
  493. for (val = j = 0; j < priv->num_cfgs + 1; j++)
  494. val |= pads[i + j];
  495. if (!val)
  496. break;
  497. count++;
  498. i += priv->num_cfgs + 1;
  499. }
  500. return count;
  501. }
  502. int pinctrl_config_pads_for_node(struct udevice *dev, ofnode node)
  503. {
  504. int pads_count;
  505. u32 *pads;
  506. int ret;
  507. if (device_get_uclass_id(dev) != UCLASS_PINCTRL)
  508. return log_msg_ret("uclass", -EPROTONOSUPPORT);
  509. ret = pinctrl_read_pads(dev, node, "pads", &pads, &pads_count);
  510. if (ret)
  511. return log_msg_ret("no pads", ret);
  512. ret = pinctrl_config_pads(dev, pads, pads_count);
  513. free(pads);
  514. if (ret)
  515. return log_msg_ret("pad config", ret);
  516. return 0;
  517. }
  518. int intel_pinctrl_of_to_plat(struct udevice *dev,
  519. const struct pad_community *comm, int num_cfgs)
  520. {
  521. struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
  522. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  523. if (!comm) {
  524. if (spl_phase() > PHASE_TPL)
  525. log_err("Cannot find community for pid %d\n",
  526. pplat->pid);
  527. return -EDOM;
  528. }
  529. priv->comm = comm;
  530. priv->num_cfgs = num_cfgs;
  531. return 0;
  532. }
  533. int intel_pinctrl_probe(struct udevice *dev)
  534. {
  535. struct intel_pinctrl_priv *priv = dev_get_priv(dev);
  536. int ret;
  537. priv->itss_pol_cfg = true;
  538. ret = irq_first_device_type(X86_IRQT_ITSS, &priv->itss);
  539. if (ret)
  540. return log_msg_ret("Cannot find ITSS", ret);
  541. return 0;
  542. }
  543. const struct pinctrl_ops intel_pinctrl_ops = {
  544. /* No operations are supported, but DM expects this to be present */
  545. };