gpio.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * arch/arm/plat-orion/gpio.c
  3. *
  4. * Marvell Orion SoC GPIO handling.
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #define DEBUG
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <linux/irqdomain.h>
  15. #include <linux/module.h>
  16. #include <linux/spinlock.h>
  17. #include <linux/bitops.h>
  18. #include <linux/io.h>
  19. #include <linux/gpio/driver.h>
  20. #include <linux/gpio/consumer.h>
  21. #include <linux/leds.h>
  22. #include <linux/of.h>
  23. #include <linux/of_irq.h>
  24. #include <linux/of_address.h>
  25. #include <plat/orion-gpio.h>
  26. /*
  27. * GPIO unit register offsets.
  28. */
  29. #define GPIO_OUT_OFF 0x0000
  30. #define GPIO_IO_CONF_OFF 0x0004
  31. #define GPIO_BLINK_EN_OFF 0x0008
  32. #define GPIO_IN_POL_OFF 0x000c
  33. #define GPIO_DATA_IN_OFF 0x0010
  34. #define GPIO_EDGE_CAUSE_OFF 0x0014
  35. #define GPIO_EDGE_MASK_OFF 0x0018
  36. #define GPIO_LEVEL_MASK_OFF 0x001c
  37. struct orion_gpio_chip {
  38. struct gpio_chip chip;
  39. spinlock_t lock;
  40. void __iomem *base;
  41. unsigned long valid_input;
  42. unsigned long valid_output;
  43. int mask_offset;
  44. int secondary_irq_base;
  45. struct irq_domain *domain;
  46. };
  47. static void __iomem *GPIO_OUT(struct orion_gpio_chip *ochip)
  48. {
  49. return ochip->base + GPIO_OUT_OFF;
  50. }
  51. static void __iomem *GPIO_IO_CONF(struct orion_gpio_chip *ochip)
  52. {
  53. return ochip->base + GPIO_IO_CONF_OFF;
  54. }
  55. static void __iomem *GPIO_BLINK_EN(struct orion_gpio_chip *ochip)
  56. {
  57. return ochip->base + GPIO_BLINK_EN_OFF;
  58. }
  59. static void __iomem *GPIO_IN_POL(struct orion_gpio_chip *ochip)
  60. {
  61. return ochip->base + GPIO_IN_POL_OFF;
  62. }
  63. static void __iomem *GPIO_DATA_IN(struct orion_gpio_chip *ochip)
  64. {
  65. return ochip->base + GPIO_DATA_IN_OFF;
  66. }
  67. static void __iomem *GPIO_EDGE_CAUSE(struct orion_gpio_chip *ochip)
  68. {
  69. return ochip->base + GPIO_EDGE_CAUSE_OFF;
  70. }
  71. static void __iomem *GPIO_EDGE_MASK(struct orion_gpio_chip *ochip)
  72. {
  73. return ochip->base + ochip->mask_offset + GPIO_EDGE_MASK_OFF;
  74. }
  75. static void __iomem *GPIO_LEVEL_MASK(struct orion_gpio_chip *ochip)
  76. {
  77. return ochip->base + ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
  78. }
  79. static struct orion_gpio_chip orion_gpio_chips[2];
  80. static int orion_gpio_chip_count;
  81. static inline void
  82. __set_direction(struct orion_gpio_chip *ochip, unsigned pin, int input)
  83. {
  84. u32 u;
  85. u = readl(GPIO_IO_CONF(ochip));
  86. if (input)
  87. u |= 1 << pin;
  88. else
  89. u &= ~(1 << pin);
  90. writel(u, GPIO_IO_CONF(ochip));
  91. }
  92. static void __set_level(struct orion_gpio_chip *ochip, unsigned pin, int high)
  93. {
  94. u32 u;
  95. u = readl(GPIO_OUT(ochip));
  96. if (high)
  97. u |= 1 << pin;
  98. else
  99. u &= ~(1 << pin);
  100. writel(u, GPIO_OUT(ochip));
  101. }
  102. static inline void
  103. __set_blinking(struct orion_gpio_chip *ochip, unsigned pin, int blink)
  104. {
  105. u32 u;
  106. u = readl(GPIO_BLINK_EN(ochip));
  107. if (blink)
  108. u |= 1 << pin;
  109. else
  110. u &= ~(1 << pin);
  111. writel(u, GPIO_BLINK_EN(ochip));
  112. }
  113. static inline int
  114. orion_gpio_is_valid(struct orion_gpio_chip *ochip, unsigned pin, int mode)
  115. {
  116. if (pin >= ochip->chip.ngpio)
  117. goto err_out;
  118. if ((mode & GPIO_INPUT_OK) && !test_bit(pin, &ochip->valid_input))
  119. goto err_out;
  120. if ((mode & GPIO_OUTPUT_OK) && !test_bit(pin, &ochip->valid_output))
  121. goto err_out;
  122. return 1;
  123. err_out:
  124. pr_debug("%s: invalid GPIO %d\n", __func__, pin);
  125. return false;
  126. }
  127. /*
  128. * GPIO primitives.
  129. */
  130. static int orion_gpio_request(struct gpio_chip *chip, unsigned pin)
  131. {
  132. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  133. if (orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK) ||
  134. orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK))
  135. return 0;
  136. return -EINVAL;
  137. }
  138. static int orion_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
  139. {
  140. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  141. unsigned long flags;
  142. if (!orion_gpio_is_valid(ochip, pin, GPIO_INPUT_OK))
  143. return -EINVAL;
  144. spin_lock_irqsave(&ochip->lock, flags);
  145. __set_direction(ochip, pin, 1);
  146. spin_unlock_irqrestore(&ochip->lock, flags);
  147. return 0;
  148. }
  149. static int orion_gpio_get(struct gpio_chip *chip, unsigned pin)
  150. {
  151. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  152. int val;
  153. if (readl(GPIO_IO_CONF(ochip)) & (1 << pin)) {
  154. val = readl(GPIO_DATA_IN(ochip)) ^ readl(GPIO_IN_POL(ochip));
  155. } else {
  156. val = readl(GPIO_OUT(ochip));
  157. }
  158. return (val >> pin) & 1;
  159. }
  160. static int
  161. orion_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value)
  162. {
  163. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  164. unsigned long flags;
  165. if (!orion_gpio_is_valid(ochip, pin, GPIO_OUTPUT_OK))
  166. return -EINVAL;
  167. spin_lock_irqsave(&ochip->lock, flags);
  168. __set_blinking(ochip, pin, 0);
  169. __set_level(ochip, pin, value);
  170. __set_direction(ochip, pin, 0);
  171. spin_unlock_irqrestore(&ochip->lock, flags);
  172. return 0;
  173. }
  174. static void orion_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
  175. {
  176. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  177. unsigned long flags;
  178. spin_lock_irqsave(&ochip->lock, flags);
  179. __set_level(ochip, pin, value);
  180. spin_unlock_irqrestore(&ochip->lock, flags);
  181. }
  182. static int orion_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
  183. {
  184. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  185. return irq_create_mapping(ochip->domain,
  186. ochip->secondary_irq_base + pin);
  187. }
  188. /*
  189. * Orion-specific GPIO API extensions.
  190. */
  191. static struct orion_gpio_chip *orion_gpio_chip_find(int pin)
  192. {
  193. int i;
  194. for (i = 0; i < orion_gpio_chip_count; i++) {
  195. struct orion_gpio_chip *ochip = orion_gpio_chips + i;
  196. struct gpio_chip *chip = &ochip->chip;
  197. if (pin >= chip->base && pin < chip->base + chip->ngpio)
  198. return ochip;
  199. }
  200. return NULL;
  201. }
  202. void __init orion_gpio_set_unused(unsigned pin)
  203. {
  204. struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin);
  205. if (ochip == NULL)
  206. return;
  207. pin -= ochip->chip.base;
  208. /* Configure as output, drive low. */
  209. __set_level(ochip, pin, 0);
  210. __set_direction(ochip, pin, 0);
  211. }
  212. void __init orion_gpio_set_valid(unsigned pin, int mode)
  213. {
  214. struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin);
  215. if (ochip == NULL)
  216. return;
  217. pin -= ochip->chip.base;
  218. if (mode == 1)
  219. mode = GPIO_INPUT_OK | GPIO_OUTPUT_OK;
  220. if (mode & GPIO_INPUT_OK)
  221. __set_bit(pin, &ochip->valid_input);
  222. else
  223. __clear_bit(pin, &ochip->valid_input);
  224. if (mode & GPIO_OUTPUT_OK)
  225. __set_bit(pin, &ochip->valid_output);
  226. else
  227. __clear_bit(pin, &ochip->valid_output);
  228. }
  229. void orion_gpio_set_blink(unsigned pin, int blink)
  230. {
  231. struct orion_gpio_chip *ochip = orion_gpio_chip_find(pin);
  232. unsigned long flags;
  233. if (ochip == NULL)
  234. return;
  235. spin_lock_irqsave(&ochip->lock, flags);
  236. __set_level(ochip, pin & 31, 0);
  237. __set_blinking(ochip, pin & 31, blink);
  238. spin_unlock_irqrestore(&ochip->lock, flags);
  239. }
  240. EXPORT_SYMBOL(orion_gpio_set_blink);
  241. #define ORION_BLINK_HALF_PERIOD 100 /* ms */
  242. int orion_gpio_led_blink_set(struct gpio_desc *desc, int state,
  243. unsigned long *delay_on, unsigned long *delay_off)
  244. {
  245. unsigned gpio = desc_to_gpio(desc);
  246. if (delay_on && delay_off && !*delay_on && !*delay_off)
  247. *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
  248. switch (state) {
  249. case GPIO_LED_NO_BLINK_LOW:
  250. case GPIO_LED_NO_BLINK_HIGH:
  251. orion_gpio_set_blink(gpio, 0);
  252. gpiod_set_raw_value(desc, state);
  253. break;
  254. case GPIO_LED_BLINK:
  255. orion_gpio_set_blink(gpio, 1);
  256. }
  257. return 0;
  258. }
  259. EXPORT_SYMBOL_GPL(orion_gpio_led_blink_set);
  260. /*****************************************************************************
  261. * Orion GPIO IRQ
  262. *
  263. * GPIO_IN_POL register controls whether GPIO_DATA_IN will hold the same
  264. * value of the line or the opposite value.
  265. *
  266. * Level IRQ handlers: DATA_IN is used directly as cause register.
  267. * Interrupt are masked by LEVEL_MASK registers.
  268. * Edge IRQ handlers: Change in DATA_IN are latched in EDGE_CAUSE.
  269. * Interrupt are masked by EDGE_MASK registers.
  270. * Both-edge handlers: Similar to regular Edge handlers, but also swaps
  271. * the polarity to catch the next line transaction.
  272. * This is a race condition that might not perfectly
  273. * work on some use cases.
  274. *
  275. * Every eight GPIO lines are grouped (OR'ed) before going up to main
  276. * cause register.
  277. *
  278. * EDGE cause mask
  279. * data-in /--------| |-----| |----\
  280. * -----| |----- ---- to main cause reg
  281. * X \----------------| |----/
  282. * polarity LEVEL mask
  283. *
  284. ****************************************************************************/
  285. static int gpio_irq_set_type(struct irq_data *d, u32 type)
  286. {
  287. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  288. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  289. struct orion_gpio_chip *ochip = gc->private;
  290. int pin;
  291. u32 u;
  292. pin = d->hwirq - ochip->secondary_irq_base;
  293. u = readl(GPIO_IO_CONF(ochip)) & (1 << pin);
  294. if (!u) {
  295. return -EINVAL;
  296. }
  297. type &= IRQ_TYPE_SENSE_MASK;
  298. if (type == IRQ_TYPE_NONE)
  299. return -EINVAL;
  300. /* Check if we need to change chip and handler */
  301. if (!(ct->type & type))
  302. if (irq_setup_alt_chip(d, type))
  303. return -EINVAL;
  304. /*
  305. * Configure interrupt polarity.
  306. */
  307. if (type == IRQ_TYPE_EDGE_RISING || type == IRQ_TYPE_LEVEL_HIGH) {
  308. u = readl(GPIO_IN_POL(ochip));
  309. u &= ~(1 << pin);
  310. writel(u, GPIO_IN_POL(ochip));
  311. } else if (type == IRQ_TYPE_EDGE_FALLING || type == IRQ_TYPE_LEVEL_LOW) {
  312. u = readl(GPIO_IN_POL(ochip));
  313. u |= 1 << pin;
  314. writel(u, GPIO_IN_POL(ochip));
  315. } else if (type == IRQ_TYPE_EDGE_BOTH) {
  316. u32 v;
  317. v = readl(GPIO_IN_POL(ochip)) ^ readl(GPIO_DATA_IN(ochip));
  318. /*
  319. * set initial polarity based on current input level
  320. */
  321. u = readl(GPIO_IN_POL(ochip));
  322. if (v & (1 << pin))
  323. u |= 1 << pin; /* falling */
  324. else
  325. u &= ~(1 << pin); /* rising */
  326. writel(u, GPIO_IN_POL(ochip));
  327. }
  328. return 0;
  329. }
  330. static void gpio_irq_handler(struct irq_desc *desc)
  331. {
  332. struct orion_gpio_chip *ochip = irq_desc_get_handler_data(desc);
  333. u32 cause, type;
  334. int i;
  335. if (ochip == NULL)
  336. return;
  337. cause = readl(GPIO_DATA_IN(ochip)) & readl(GPIO_LEVEL_MASK(ochip));
  338. cause |= readl(GPIO_EDGE_CAUSE(ochip)) & readl(GPIO_EDGE_MASK(ochip));
  339. for (i = 0; i < ochip->chip.ngpio; i++) {
  340. int irq;
  341. irq = ochip->secondary_irq_base + i;
  342. if (!(cause & (1 << i)))
  343. continue;
  344. type = irq_get_trigger_type(irq);
  345. if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
  346. /* Swap polarity (race with GPIO line) */
  347. u32 polarity;
  348. polarity = readl(GPIO_IN_POL(ochip));
  349. polarity ^= 1 << i;
  350. writel(polarity, GPIO_IN_POL(ochip));
  351. }
  352. generic_handle_irq(irq);
  353. }
  354. }
  355. #ifdef CONFIG_DEBUG_FS
  356. #include <linux/seq_file.h>
  357. static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
  358. {
  359. struct orion_gpio_chip *ochip = gpiochip_get_data(chip);
  360. u32 out, io_conf, blink, in_pol, data_in, cause, edg_msk, lvl_msk;
  361. const char *label;
  362. int i;
  363. out = readl_relaxed(GPIO_OUT(ochip));
  364. io_conf = readl_relaxed(GPIO_IO_CONF(ochip));
  365. blink = readl_relaxed(GPIO_BLINK_EN(ochip));
  366. in_pol = readl_relaxed(GPIO_IN_POL(ochip));
  367. data_in = readl_relaxed(GPIO_DATA_IN(ochip));
  368. cause = readl_relaxed(GPIO_EDGE_CAUSE(ochip));
  369. edg_msk = readl_relaxed(GPIO_EDGE_MASK(ochip));
  370. lvl_msk = readl_relaxed(GPIO_LEVEL_MASK(ochip));
  371. for_each_requested_gpio(chip, i, label) {
  372. u32 msk;
  373. bool is_out;
  374. msk = 1 << i;
  375. is_out = !(io_conf & msk);
  376. seq_printf(s, " gpio-%-3d (%-20.20s)", chip->base + i, label);
  377. if (is_out) {
  378. seq_printf(s, " out %s %s\n",
  379. out & msk ? "hi" : "lo",
  380. blink & msk ? "(blink )" : "");
  381. continue;
  382. }
  383. seq_printf(s, " in %s (act %s) - IRQ",
  384. (data_in ^ in_pol) & msk ? "hi" : "lo",
  385. in_pol & msk ? "lo" : "hi");
  386. if (!((edg_msk | lvl_msk) & msk)) {
  387. seq_puts(s, " disabled\n");
  388. continue;
  389. }
  390. if (edg_msk & msk)
  391. seq_puts(s, " edge ");
  392. if (lvl_msk & msk)
  393. seq_puts(s, " level");
  394. seq_printf(s, " (%s)\n", cause & msk ? "pending" : "clear ");
  395. }
  396. }
  397. #else
  398. #define orion_gpio_dbg_show NULL
  399. #endif
  400. static void orion_gpio_unmask_irq(struct irq_data *d)
  401. {
  402. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  403. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  404. u32 reg_val;
  405. u32 mask = d->mask;
  406. irq_gc_lock(gc);
  407. reg_val = irq_reg_readl(gc, ct->regs.mask);
  408. reg_val |= mask;
  409. irq_reg_writel(gc, reg_val, ct->regs.mask);
  410. irq_gc_unlock(gc);
  411. }
  412. static void orion_gpio_mask_irq(struct irq_data *d)
  413. {
  414. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  415. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  416. u32 mask = d->mask;
  417. u32 reg_val;
  418. irq_gc_lock(gc);
  419. reg_val = irq_reg_readl(gc, ct->regs.mask);
  420. reg_val &= ~mask;
  421. irq_reg_writel(gc, reg_val, ct->regs.mask);
  422. irq_gc_unlock(gc);
  423. }
  424. void __init orion_gpio_init(int gpio_base, int ngpio,
  425. void __iomem *base, int mask_offset,
  426. int secondary_irq_base,
  427. int irqs[4])
  428. {
  429. struct orion_gpio_chip *ochip;
  430. struct irq_chip_generic *gc;
  431. struct irq_chip_type *ct;
  432. char gc_label[16];
  433. int i;
  434. if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips))
  435. return;
  436. snprintf(gc_label, sizeof(gc_label), "orion_gpio%d",
  437. orion_gpio_chip_count);
  438. ochip = orion_gpio_chips + orion_gpio_chip_count;
  439. ochip->chip.label = kstrdup(gc_label, GFP_KERNEL);
  440. ochip->chip.request = orion_gpio_request;
  441. ochip->chip.direction_input = orion_gpio_direction_input;
  442. ochip->chip.get = orion_gpio_get;
  443. ochip->chip.direction_output = orion_gpio_direction_output;
  444. ochip->chip.set = orion_gpio_set;
  445. ochip->chip.to_irq = orion_gpio_to_irq;
  446. ochip->chip.base = gpio_base;
  447. ochip->chip.ngpio = ngpio;
  448. ochip->chip.can_sleep = 0;
  449. ochip->chip.dbg_show = orion_gpio_dbg_show;
  450. spin_lock_init(&ochip->lock);
  451. ochip->base = (void __iomem *)base;
  452. ochip->valid_input = 0;
  453. ochip->valid_output = 0;
  454. ochip->mask_offset = mask_offset;
  455. ochip->secondary_irq_base = secondary_irq_base;
  456. gpiochip_add_data(&ochip->chip, ochip);
  457. /*
  458. * Mask and clear GPIO interrupts.
  459. */
  460. writel(0, GPIO_EDGE_CAUSE(ochip));
  461. writel(0, GPIO_EDGE_MASK(ochip));
  462. writel(0, GPIO_LEVEL_MASK(ochip));
  463. /* Setup the interrupt handlers. Each chip can have up to 4
  464. * interrupt handlers, with each handler dealing with 8 GPIO
  465. * pins. */
  466. for (i = 0; i < 4; i++) {
  467. if (irqs[i]) {
  468. irq_set_chained_handler_and_data(irqs[i],
  469. gpio_irq_handler,
  470. ochip);
  471. }
  472. }
  473. gc = irq_alloc_generic_chip("orion_gpio_irq", 2,
  474. secondary_irq_base,
  475. ochip->base, handle_level_irq);
  476. gc->private = ochip;
  477. ct = gc->chip_types;
  478. ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
  479. ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW;
  480. ct->chip.irq_mask = orion_gpio_mask_irq;
  481. ct->chip.irq_unmask = orion_gpio_unmask_irq;
  482. ct->chip.irq_set_type = gpio_irq_set_type;
  483. ct->chip.name = ochip->chip.label;
  484. ct++;
  485. ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF;
  486. ct->regs.ack = GPIO_EDGE_CAUSE_OFF;
  487. ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
  488. ct->chip.irq_ack = irq_gc_ack_clr_bit;
  489. ct->chip.irq_mask = orion_gpio_mask_irq;
  490. ct->chip.irq_unmask = orion_gpio_unmask_irq;
  491. ct->chip.irq_set_type = gpio_irq_set_type;
  492. ct->handler = handle_edge_irq;
  493. ct->chip.name = ochip->chip.label;
  494. irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE,
  495. IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
  496. /* Setup irq domain on top of the generic chip. */
  497. ochip->domain = irq_domain_add_legacy(NULL,
  498. ochip->chip.ngpio,
  499. ochip->secondary_irq_base,
  500. ochip->secondary_irq_base,
  501. &irq_domain_simple_ops,
  502. ochip);
  503. if (!ochip->domain)
  504. panic("%s: couldn't allocate irq domain (DT).\n",
  505. ochip->chip.label);
  506. orion_gpio_chip_count++;
  507. }