gpio.c 15 KB

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