Lines Matching +full:1 +full:- +full:2

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
9 * 1. Redistributions of source code must retain the above copyright
11 * 2. Redistributions in binary form must reproduce the above copyright
114 #define RK_PINCTRL_LOCK(_sc) mtx_lock_spin(&(_sc)->mtx)
115 #define RK_PINCTRL_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->mtx)
116 #define RK_PINCTRL_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
151 RK_GPIO(1, "gpio1"),
152 RK_GPIO(2, "gpio2"),
164 RK_IOMUX(0, 0, 0x0084, 2),
165 RK_IOMUX(0, 1, 0x0088, 2),
166 RK_IOMUX(0, 2, 0x008C, 2),
168 RK_IOMUX(1, 3, 0x000C, 2),
169 RK_IOMUX(2, 0, 0x0010, 2),
170 RK_IOMUX(2, 1, 0x0014, 2),
171 RK_IOMUX(2, 2, 0x0018, 2),
172 RK_IOMUX(2, 3, 0x001C, 2),
173 RK_IOMUX(3, 0, 0x0020, 2),
174 RK_IOMUX(3, 1, 0x0024, 2),
175 RK_IOMUX(3, 2, 0x0028, 2),
178 RK_IOMUX(4, 1, 0x003C, 4),
179 RK_IOMUX(4, 2, 0x0044, 2),
180 RK_IOMUX(4, 3, 0x0048, 2),
181 /* 5,0 - Empty */
182 RK_IOMUX(5, 1, 0x0050, 2),
183 RK_IOMUX(5, 2, 0x0054, 2),
184 /* 5,3 - Empty */
185 RK_IOMUX(6, 0, 0x005C, 2),
186 RK_IOMUX(6, 1, 0x0060, 2),
187 RK_IOMUX(6, 2, 0x0064, 2),
188 /* 6,3 - Empty */
189 RK_IOMUX(7, 0, 0x006C, 2),
190 RK_IOMUX(7, 1, 0x0070, 2),
191 RK_IOMUX(7, 2, 0x0074, 4),
192 /* 7,3 - Empty */
193 RK_IOMUX(8, 0, 0x0080, 2),
194 RK_IOMUX(8, 1, 0x0084, 2),
195 /* 8,2 - Empty */
196 /* 8,3 - Empty */
206 RK_PINDRIVE(0, 0, 0x070, 0, 2),
207 RK_PINDRIVE(0, 0, 0x070, 1, 4),
208 RK_PINDRIVE(0, 0, 0x070, 2, 8),
212 RK_PINDRIVE(0, 1, 0x074, 0, 2),
213 RK_PINDRIVE(0, 1, 0x074, 1, 4),
214 RK_PINDRIVE(0, 1, 0x074, 2, 8),
215 RK_PINDRIVE(0, 1, 0x074, 3, 12),
218 RK_PINDRIVE(0, 2, 0x078, 0, 2),
219 RK_PINDRIVE(0, 2, 0x078, 1, 4),
220 RK_PINDRIVE(0, 2, 0x078, 2, 8),
221 RK_PINDRIVE(0, 2, 0x078, 3, 12),
224 RK_PINDRIVE(1, 3, 0x1CC, 0, 2),
225 RK_PINDRIVE(1, 3, 0x1CC, 1, 4),
226 RK_PINDRIVE(1, 3, 0x1CC, 2, 8),
227 RK_PINDRIVE(1, 3, 0x1CC, 3, 12),
230 RK_PINDRIVE(2, 0, 0x1D0, 0, 2),
231 RK_PINDRIVE(2, 0, 0x1D0, 1, 4),
232 RK_PINDRIVE(2, 0, 0x1D0, 2, 8),
233 RK_PINDRIVE(2, 0, 0x1D0, 3, 12),
236 RK_PINDRIVE(2, 1, 0x1D4, 0, 2),
237 RK_PINDRIVE(2, 1, 0x1D4, 1, 4),
238 RK_PINDRIVE(2, 1, 0x1D4, 2, 8),
239 RK_PINDRIVE(2, 1, 0x1D4, 3, 12),
242 RK_PINDRIVE(2, 2, 0x1D8, 0, 2),
243 RK_PINDRIVE(2, 2, 0x1D8, 1, 4),
244 RK_PINDRIVE(2, 2, 0x1D8, 2, 8),
245 RK_PINDRIVE(2, 2, 0x1D8, 3, 12),
248 RK_PINDRIVE(2, 3, 0x1DC, 0, 2),
249 RK_PINDRIVE(2, 3, 0x1DC, 1, 4),
250 RK_PINDRIVE(2, 3, 0x1DC, 2, 8),
251 RK_PINDRIVE(2, 3, 0x1DC, 3, 12),
254 RK_PINDRIVE(3, 0, 0x1E0, 0, 2),
255 RK_PINDRIVE(3, 0, 0x1E0, 1, 4),
256 RK_PINDRIVE(3, 0, 0x1E0, 2, 8),
260 RK_PINDRIVE(3, 1, 0x1E4, 0, 2),
261 RK_PINDRIVE(3, 1, 0x1E4, 1, 4),
262 RK_PINDRIVE(3, 1, 0x1E4, 2, 8),
263 RK_PINDRIVE(3, 1, 0x1E4, 3, 12),
266 RK_PINDRIVE(3, 2, 0x1E8, 0, 2),
267 RK_PINDRIVE(3, 2, 0x1E8, 1, 4),
268 RK_PINDRIVE(3, 2, 0x1E8, 2, 8),
269 RK_PINDRIVE(3, 2, 0x1E8, 3, 12),
272 RK_PINDRIVE(3, 3, 0x1EC, 0, 2),
273 RK_PINDRIVE(3, 3, 0x1EC, 1, 4),
274 RK_PINDRIVE(3, 3, 0x1EC, 2, 8),
278 RK_PINDRIVE(4, 0, 0x1F0, 0, 2),
279 RK_PINDRIVE(4, 0, 0x1F0, 1, 4),
280 RK_PINDRIVE(4, 0, 0x1F0, 2, 8),
284 RK_PINDRIVE(4, 1, 0x1F4, 0, 2),
285 RK_PINDRIVE(4, 1, 0x1F4, 1, 4),
286 RK_PINDRIVE(4, 1, 0x1F4, 2, 8),
287 RK_PINDRIVE(4, 1, 0x1F4, 3, 12),
290 RK_PINDRIVE(4, 2, 0x1F8, 0, 2),
291 RK_PINDRIVE(4, 2, 0x1F8, 1, 4),
292 RK_PINDRIVE(4, 2, 0x1F8, 2, 8),
293 RK_PINDRIVE(4, 2, 0x1F8, 3, 12),
296 RK_PINDRIVE(4, 3, 0x1FC, 0, 2),
297 RK_PINDRIVE(4, 3, 0x1FC, 1, 4),
298 RK_PINDRIVE(4, 3, 0x1FC, 2, 8),
302 RK_PINDRIVE(5, 1, 0x204, 0, 2),
303 RK_PINDRIVE(5, 1, 0x204, 1, 4),
304 RK_PINDRIVE(5, 1, 0x204, 2, 8),
305 RK_PINDRIVE(5, 1, 0x204, 3, 12),
308 RK_PINDRIVE(5, 2, 0x208, 0, 2),
309 RK_PINDRIVE(5, 2, 0x208, 1, 4),
310 RK_PINDRIVE(5, 2, 0x208, 2, 8),
311 RK_PINDRIVE(5, 2, 0x208, 3, 12),
314 RK_PINDRIVE(6, 0, 0x210, 0, 2),
315 RK_PINDRIVE(6, 0, 0x210, 1, 4),
316 RK_PINDRIVE(6, 0, 0x210, 2, 8),
320 RK_PINDRIVE(6, 1, 0x214, 0, 2),
321 RK_PINDRIVE(6, 1, 0x214, 1, 4),
322 RK_PINDRIVE(6, 1, 0x214, 2, 8),
323 RK_PINDRIVE(6, 1, 0x214, 3, 12),
326 RK_PINDRIVE(6, 2, 0x218, 0, 2),
327 RK_PINDRIVE(6, 2, 0x218, 1, 4),
328 RK_PINDRIVE(6, 2, 0x218, 2, 8),
329 RK_PINDRIVE(6, 2, 0x218, 3, 12),
332 RK_PINDRIVE(7, 0, 0x220, 0, 2),
333 RK_PINDRIVE(7, 0, 0x220, 1, 4),
334 RK_PINDRIVE(7, 0, 0x220, 2, 8),
338 RK_PINDRIVE(7, 1, 0x224, 0, 2),
339 RK_PINDRIVE(7, 1, 0x224, 1, 4),
340 RK_PINDRIVE(7, 1, 0x224, 2, 8),
341 RK_PINDRIVE(7, 1, 0x224, 3, 12),
344 RK_PINDRIVE(7, 2, 0x228, 0, 2),
345 RK_PINDRIVE(7, 2, 0x228, 1, 4),
346 RK_PINDRIVE(7, 2, 0x228, 2, 8),
347 RK_PINDRIVE(7, 2, 0x228, 3, 12),
350 RK_PINDRIVE(8, 0, 0x230, 0, 2),
351 RK_PINDRIVE(8, 0, 0x230, 1, 4),
352 RK_PINDRIVE(8, 0, 0x230, 2, 8),
356 RK_PINDRIVE(8, 1, 0x234, 0, 2),
357 RK_PINDRIVE(8, 1, 0x234, 1, 4),
358 RK_PINDRIVE(8, 1, 0x234, 2, 8),
359 RK_PINDRIVE(8, 1, 0x234, 3, 12),
374 return (sc->pmu); in rk3288_get_syscon()
375 return (sc->grf); in rk3288_get_syscon()
381 if (OF_hasprop(node, "bias-disable")) in rk3288_parse_bias()
383 if (OF_hasprop(node, "bias-pull-up")) in rk3288_parse_bias()
384 return (1); in rk3288_parse_bias()
385 if (OF_hasprop(node, "bias-pull-down")) in rk3288_parse_bias()
386 return (2); in rk3288_parse_bias()
388 return (-1); in rk3288_parse_bias()
396 if (bias == 1) in rk3288_resolv_bias_value()
398 else if (bias == 2) in rk3288_resolv_bias_value()
410 rv = 1; in rk3288_get_bias_value()
412 rv = 2; in rk3288_get_bias_value()
435 RK_GPIO(1, "gpio1"),
436 RK_GPIO(2, "gpio2"),
442 RK_IOMUX(0, 0, 0x0000, 2),
443 RK_IOMUX(0, 1, 0x0004, 2),
444 RK_IOMUX(0, 2, 0x0008, 2),
445 RK_IOMUX(0, 3, 0x000C, 2),
446 RK_IOMUX(1, 0, 0x0010, 2),
447 RK_IOMUX(1, 1, 0x0014, 2),
448 RK_IOMUX(1, 2, 0x0018, 2),
449 RK_IOMUX(1, 3, 0x001C, 2),
450 RK_IOMUX(2, 0, 0x0020, 2),
451 RK_IOMUX(2, 1, 0x0024, 3),
452 RK_IOMUX(2, 2, 0x002c, 3),
453 RK_IOMUX(2, 3, 0x0034, 2),
455 RK_IOMUX(3, 1, 0x0040, 3),
456 RK_IOMUX(3, 2, 0x0048, 2),
457 RK_IOMUX(3, 3, 0x004c, 2),
462 RK_PINFIX(2, 12, 0x24, 8, 0x300),
463 RK_PINFIX(2, 15, 0x28, 0, 0x7),
464 RK_PINFIX(2, 23, 0x30, 14, 0x6000),
469 RK_PINDRIVE(0, 0, 0x200, 0, 2),
470 RK_PINDRIVE(0, 0, 0x200, 1, 4),
471 RK_PINDRIVE(0, 0, 0x200, 2, 8),
474 RK_PINDRIVE(0, 1, 0x204, 0, 2),
475 RK_PINDRIVE(0, 1, 0x204, 1, 4),
476 RK_PINDRIVE(0, 1, 0x204, 2, 8),
477 RK_PINDRIVE(0, 1, 0x204, 3, 12),
479 RK_PINDRIVE(0, 2, 0x208, 0, 2),
480 RK_PINDRIVE(0, 2, 0x208, 1, 4),
481 RK_PINDRIVE(0, 2, 0x208, 2, 8),
482 RK_PINDRIVE(0, 2, 0x208, 3, 12),
484 RK_PINDRIVE(0, 3, 0x20C, 0, 2),
485 RK_PINDRIVE(0, 3, 0x20C, 1, 4),
486 RK_PINDRIVE(0, 3, 0x20C, 2, 8),
489 RK_PINDRIVE(1, 0, 0x210, 0, 2),
490 RK_PINDRIVE(1, 0, 0x210, 1, 4),
491 RK_PINDRIVE(1, 0, 0x210, 2, 8),
492 RK_PINDRIVE(1, 0, 0x210, 3, 12),
494 RK_PINDRIVE(1, 1, 0x214, 0, 2),
495 RK_PINDRIVE(1, 1, 0x214, 1, 4),
496 RK_PINDRIVE(1, 1, 0x214, 2, 8),
497 RK_PINDRIVE(1, 1, 0x214, 3, 12),
499 RK_PINDRIVE(1, 2, 0x218, 0, 2),
500 RK_PINDRIVE(1, 2, 0x218, 1, 4),
501 RK_PINDRIVE(1, 2, 0x218, 2, 8),
502 RK_PINDRIVE(1, 2, 0x218, 3, 12),
504 RK_PINDRIVE(1, 3, 0x21C, 0, 2),
505 RK_PINDRIVE(1, 3, 0x21C, 1, 4),
506 RK_PINDRIVE(1, 3, 0x21C, 2, 8),
507 RK_PINDRIVE(1, 3, 0x21C, 3, 12),
509 RK_PINDRIVE(2, 0, 0x220, 0, 2),
510 RK_PINDRIVE(2, 0, 0x220, 1, 4),
511 RK_PINDRIVE(2, 0, 0x220, 2, 8),
512 RK_PINDRIVE(2, 0, 0x220, 3, 12),
514 RK_PINDRIVE(2, 1, 0x224, 0, 2),
515 RK_PINDRIVE(2, 1, 0x224, 1, 4),
516 RK_PINDRIVE(2, 1, 0x224, 2, 8),
517 RK_PINDRIVE(2, 1, 0x224, 3, 12),
519 RK_PINDRIVE(2, 2, 0x228, 0, 2),
520 RK_PINDRIVE(2, 2, 0x228, 1, 4),
521 RK_PINDRIVE(2, 2, 0x228, 2, 8),
522 RK_PINDRIVE(2, 2, 0x228, 3, 12),
524 RK_PINDRIVE(2, 3, 0x22C, 0, 2),
525 RK_PINDRIVE(2, 3, 0x22C, 1, 4),
526 RK_PINDRIVE(2, 3, 0x22C, 2, 8),
527 RK_PINDRIVE(2, 3, 0x22C, 3, 12),
529 RK_PINDRIVE(3, 0, 0x230, 0, 2),
530 RK_PINDRIVE(3, 0, 0x230, 1, 4),
531 RK_PINDRIVE(3, 0, 0x230, 2, 8),
534 RK_PINDRIVE(3, 1, 0x234, 0, 2),
535 RK_PINDRIVE(3, 1, 0x234, 1, 4),
536 RK_PINDRIVE(3, 1, 0x234, 2, 8),
537 RK_PINDRIVE(3, 1, 0x234, 3, 12),
539 RK_PINDRIVE(3, 2, 0x238, 0, 2),
540 RK_PINDRIVE(3, 2, 0x238, 1, 4),
541 RK_PINDRIVE(3, 2, 0x238, 2, 8),
542 RK_PINDRIVE(3, 2, 0x238, 3, 12),
544 RK_PINDRIVE(3, 3, 0x23C, 0, 2),
545 RK_PINDRIVE(3, 3, 0x23C, 1, 4),
546 RK_PINDRIVE(3, 3, 0x23C, 2, 8),
559 return (sc->grf); in rk3328_get_syscon()
580 RK_GPIO(1, "gpio1"),
581 RK_GPIO(2, "gpio2"),
588 RK_IOMUX(0, 0, 0x0000, 2),
589 RK_IOMUX(0, 1, 0x0004, 2),
590 RK_IOMUX(0, 2, 0x0008, 2),
591 RK_IOMUX(0, 3, 0x000C, 2),
592 RK_IOMUX(1, 0, 0x0010, 2),
593 RK_IOMUX(1, 1, 0x0014, 2),
594 RK_IOMUX(1, 2, 0x0018, 2),
595 RK_IOMUX(1, 3, 0x001C, 2),
596 RK_IOMUX(2, 0, 0xE000, 2),
597 RK_IOMUX(2, 1, 0xE004, 2),
598 RK_IOMUX(2, 2, 0xE008, 2),
599 RK_IOMUX(2, 3, 0xE00C, 2),
600 RK_IOMUX(3, 0, 0xE010, 2),
601 RK_IOMUX(3, 1, 0xE014, 2),
602 RK_IOMUX(3, 2, 0xE018, 2),
603 RK_IOMUX(3, 3, 0xE01C, 2),
604 RK_IOMUX(4, 0, 0xE020, 2),
605 RK_IOMUX(4, 1, 0xE024, 2),
606 RK_IOMUX(4, 2, 0xE028, 2),
607 RK_IOMUX(4, 3, 0xE02C, 2),
616 RK_PINDRIVE(0, 0, 0x80, 1, 10),
617 RK_PINDRIVE(0, 0, 0x80, 2, 15),
621 RK_PINDRIVE(0, 1, 0x88, 0, 5),
622 RK_PINDRIVE(0, 1, 0x88, 1, 10),
623 RK_PINDRIVE(0, 1, 0x88, 2, 15),
624 RK_PINDRIVE(0, 1, 0x88, 3, 20),
627 RK_PINDRIVE(1, 0, 0xA0, 0, 3),
628 RK_PINDRIVE(1, 0, 0xA0, 1, 6),
629 RK_PINDRIVE(1, 0, 0xA0, 2, 9),
630 RK_PINDRIVE(1, 0, 0xA0, 3, 12),
633 RK_PINDRIVE(1, 1, 0xA8, 0, 3),
634 RK_PINDRIVE(1, 1, 0xA8, 1, 6),
635 RK_PINDRIVE(1, 1, 0xA8, 2, 9),
636 RK_PINDRIVE(1, 1, 0xA8, 3, 12),
639 RK_PINDRIVE(1, 2, 0xB0, 0, 3),
640 RK_PINDRIVE(1, 2, 0xB0, 1, 6),
641 RK_PINDRIVE(1, 2, 0xB0, 2, 9),
642 RK_PINDRIVE(1, 2, 0xB0, 3, 12),
645 RK_PINDRIVE(1, 3, 0xB8, 0, 3),
646 RK_PINDRIVE(1, 3, 0xB8, 1, 6),
647 RK_PINDRIVE(1, 3, 0xB8, 2, 9),
648 RK_PINDRIVE(1, 3, 0xB8, 3, 12),
654 if (bank < 2) in rk3399_get_pd_offset()
663 if (bank < 2) in rk3399_get_syscon()
664 return (sc->pmu); in rk3399_get_syscon()
666 return (sc->grf); in rk3399_get_syscon()
674 if (OF_hasprop(node, "bias-disable")) in rk3399_parse_bias()
679 case 2: in rk3399_parse_bias()
681 pulldown = 1; in rk3399_parse_bias()
683 case 1: in rk3399_parse_bias()
686 pullup = 1; in rk3399_parse_bias()
687 pulldown = 2; in rk3399_parse_bias()
691 if (OF_hasprop(node, "bias-pull-up")) in rk3399_parse_bias()
693 if (OF_hasprop(node, "bias-pull-down")) in rk3399_parse_bias()
696 return (-1); in rk3399_parse_bias()
706 case 2: in rk3399_resolv_bias_value()
709 else if (bias == 1) in rk3399_resolv_bias_value()
712 case 1: in rk3399_resolv_bias_value()
715 if (bias == 1) in rk3399_resolv_bias_value()
717 else if (bias == 2) in rk3399_resolv_bias_value()
732 case 2: in rk3399_get_bias_value()
736 rv = 1; in rk3399_get_bias_value()
738 case 1: in rk3399_get_bias_value()
742 rv = 1; in rk3399_get_bias_value()
744 rv = 2; in rk3399_get_bias_value()
773 RK_GPIO(1, "gpio1"),
774 RK_GPIO(2, "gpio2"),
782 RK_IOMUX(0, 1, 0x0008, 4),
783 RK_IOMUX(0, 2, 0x0010, 4),
786 RK_IOMUX(1, 0, 0x0000, 4), /* SYS_GRF */
787 RK_IOMUX(1, 1, 0x0008, 4),
788 RK_IOMUX(1, 2, 0x0010, 4),
789 RK_IOMUX(1, 3, 0x0018, 4),
790 RK_IOMUX(2, 0, 0x0020, 4),
791 RK_IOMUX(2, 1, 0x0028, 4),
792 RK_IOMUX(2, 2, 0x0030, 4),
793 RK_IOMUX(2, 3, 0x0038, 4),
795 RK_IOMUX(3, 1, 0x0048, 4),
796 RK_IOMUX(3, 2, 0x0050, 4),
799 RK_IOMUX(4, 1, 0x0068, 4),
800 RK_IOMUX(4, 2, 0x0070, 4),
809 RK_PINDRIVE(0, 0, 0x0020, 0, 2),
810 RK_PINDRIVE(0, 0, 0x0020, 1, 4),
811 RK_PINDRIVE(0, 0, 0x0020, 2, 8),
815 RK_PINDRIVE(0, 1, 0x0024, 0, 2),
816 RK_PINDRIVE(0, 1, 0x0024, 1, 4),
817 RK_PINDRIVE(0, 1, 0x0024, 2, 8),
818 RK_PINDRIVE(0, 1, 0x0024, 3, 12),
821 RK_PINDRIVE(0, 1, 0x0028, 0, 2),
822 RK_PINDRIVE(0, 1, 0x0028, 1, 4),
823 RK_PINDRIVE(0, 1, 0x0028, 2, 8),
824 RK_PINDRIVE(0, 1, 0x0028, 3, 12),
827 RK_PINDRIVE(0, 1, 0x002c, 0, 2),
828 RK_PINDRIVE(0, 1, 0x002c, 1, 4),
829 RK_PINDRIVE(0, 1, 0x002c, 2, 8),
830 RK_PINDRIVE(0, 1, 0x002c, 3, 12),
833 RK_PINDRIVE(1, 0, 0x0080, 0, 2),
834 RK_PINDRIVE(1, 0, 0x0080, 1, 4),
835 RK_PINDRIVE(1, 0, 0x0080, 2, 8),
836 RK_PINDRIVE(1, 0, 0x0080, 3, 12),
839 RK_PINDRIVE(1, 1, 0x0084, 0, 2),
840 RK_PINDRIVE(1, 1, 0x0084, 1, 4),
841 RK_PINDRIVE(1, 1, 0x0084, 2, 8),
842 RK_PINDRIVE(1, 1, 0x0084, 3, 12),
845 RK_PINDRIVE(1, 2, 0x0088, 0, 2),
846 RK_PINDRIVE(1, 2, 0x0088, 1, 4),
847 RK_PINDRIVE(1, 2, 0x0088, 2, 8),
848 RK_PINDRIVE(1, 2, 0x0088, 3, 12),
851 RK_PINDRIVE(1, 3, 0x008c, 0, 2),
852 RK_PINDRIVE(1, 3, 0x008c, 1, 4),
853 RK_PINDRIVE(1, 3, 0x008c, 2, 8),
854 RK_PINDRIVE(1, 3, 0x008c, 3, 12),
857 RK_PINDRIVE(2, 0, 0x0090, 0, 2),
858 RK_PINDRIVE(2, 0, 0x0090, 1, 4),
859 RK_PINDRIVE(2, 0, 0x0090, 2, 8),
860 RK_PINDRIVE(2, 0, 0x0090, 3, 12),
863 RK_PINDRIVE(2, 1, 0x0094, 0, 2),
864 RK_PINDRIVE(2, 1, 0x0094, 1, 4),
865 RK_PINDRIVE(2, 1, 0x0094, 2, 8),
866 RK_PINDRIVE(2, 1, 0x0094, 3, 12),
869 RK_PINDRIVE(2, 2, 0x0098, 0, 2),
870 RK_PINDRIVE(2, 2, 0x0098, 1, 4),
871 RK_PINDRIVE(2, 2, 0x0098, 2, 8),
872 RK_PINDRIVE(2, 2, 0x0098, 3, 12),
875 RK_PINDRIVE(2, 3, 0x009c, 0, 2),
876 RK_PINDRIVE(2, 3, 0x009c, 1, 4),
877 RK_PINDRIVE(2, 3, 0x009c, 2, 8),
878 RK_PINDRIVE(2, 3, 0x009c, 3, 12),
881 RK_PINDRIVE(3, 0, 0x00a0, 0, 2),
882 RK_PINDRIVE(3, 0, 0x00a0, 1, 4),
883 RK_PINDRIVE(3, 0, 0x00a0, 2, 8),
887 RK_PINDRIVE(3, 1, 0x00a4, 0, 2),
888 RK_PINDRIVE(3, 1, 0x00a4, 1, 4),
889 RK_PINDRIVE(3, 1, 0x00a4, 2, 8),
890 RK_PINDRIVE(3, 1, 0x00a4, 3, 12),
893 RK_PINDRIVE(3, 2, 0x00a8, 0, 2),
894 RK_PINDRIVE(3, 2, 0x00a8, 1, 4),
895 RK_PINDRIVE(3, 2, 0x00a8, 2, 8),
896 RK_PINDRIVE(3, 2, 0x00a8, 3, 12),
899 RK_PINDRIVE(3, 3, 0x00ac, 0, 2),
900 RK_PINDRIVE(3, 3, 0x00ac, 1, 4),
901 RK_PINDRIVE(3, 3, 0x00ac, 2, 8),
905 RK_PINDRIVE(4, 0, 0x00b0, 0, 2),
906 RK_PINDRIVE(4, 0, 0x00b0, 1, 4),
907 RK_PINDRIVE(4, 0, 0x00b0, 2, 8),
911 RK_PINDRIVE(4, 1, 0x00b4, 0, 2),
912 RK_PINDRIVE(4, 1, 0x00b4, 1, 4),
913 RK_PINDRIVE(4, 1, 0x00b4, 2, 8),
914 RK_PINDRIVE(4, 1, 0x00b4, 3, 12),
917 RK_PINDRIVE(4, 2, 0x00b8, 0, 2),
918 RK_PINDRIVE(4, 2, 0x00b8, 1, 4),
919 RK_PINDRIVE(4, 2, 0x00b8, 2, 8),
920 RK_PINDRIVE(4, 2, 0x00b8, 3, 12),
923 RK_PINDRIVE(4, 3, 0x00bc, 0, 2),
924 RK_PINDRIVE(4, 3, 0x00bc, 1, 4),
925 RK_PINDRIVE(4, 3, 0x00bc, 2, 8),
937 * Registers start at 0x80, but bank index starts at 1. Return 0x70 in rk3568_get_pd_offset()
948 return (sc->grf); in rk3568_get_syscon()
950 return (sc->pmu); in rk3568_get_syscon()
957 if (OF_hasprop(node, "bias-disable")) in rk3568_parse_bias()
959 if (OF_hasprop(node, "bias-pull-up")) in rk3568_parse_bias()
960 return (1); in rk3568_parse_bias()
961 if (OF_hasprop(node, "bias-pull-down")) in rk3568_parse_bias()
962 return (2); in rk3568_parse_bias()
963 return (-1); in rk3568_parse_bias()
970 if (bias == 1) in rk3568_resolv_bias_value()
972 if (bias == 2) in rk3568_resolv_bias_value()
982 return (1); in rk3568_get_bias_value()
984 return (2); in rk3568_get_bias_value()
1005 {"rockchip,rk3288-pinctrl", (uintptr_t)&rk3288_conf},
1006 {"rockchip,rk3328-pinctrl", (uintptr_t)&rk3328_conf},
1007 {"rockchip,rk3399-pinctrl", (uintptr_t)&rk3399_conf},
1008 {"rockchip,rk3568-pinctrl", (uintptr_t)&rk3568_conf},
1019 if (OF_getencprop(node, "drive-strength", &value, in rk_pinctrl_parse_drive()
1021 return (-1); in rk_pinctrl_parse_drive()
1024 for (i = 0; i < sc->conf->npin_drive; i++) { in rk_pinctrl_parse_drive()
1025 if (sc->conf->pin_drive[i].bank != bank && in rk_pinctrl_parse_drive()
1026 sc->conf->pin_drive[i].subbank != subbank) in rk_pinctrl_parse_drive()
1028 if (sc->conf->pin_drive[i].ma == value) { in rk_pinctrl_parse_drive()
1029 *drive = sc->conf->pin_drive[i].value; in rk_pinctrl_parse_drive()
1034 return (-1); in rk_pinctrl_parse_drive()
1043 for (i = 0; i < sc->conf->npin_fixup; i++) in rk_pinctrl_get_fixup()
1044 if (sc->conf->pin_fixup[i].bank == bank && in rk_pinctrl_get_fixup()
1045 sc->conf->pin_fixup[i].pin == pin) { in rk_pinctrl_get_fixup()
1046 *reg = sc->conf->pin_fixup[i].reg; in rk_pinctrl_get_fixup()
1047 *mask = sc->conf->pin_fixup[i].mask; in rk_pinctrl_get_fixup()
1048 *bit = sc->conf->pin_fixup[i].bit; in rk_pinctrl_get_fixup()
1068 if (OF_hasprop(node, "output-disable")) { in rk_pinctrl_handle_io()
1074 if (OF_hasprop(node, "output-enable")) { in rk_pinctrl_handle_io()
1080 if (OF_hasprop(node, "output-low")) { in rk_pinctrl_handle_io()
1088 if (OF_hasprop(node, "output-high")) { in rk_pinctrl_handle_io()
1093 pin_value = 1; in rk_pinctrl_handle_io()
1101 for(i = 0; i < sc->conf->ngpio_bank; i++) { in rk_pinctrl_handle_io()
1102 if (bank == sc->conf->gpio_bank[i].bank) { in rk_pinctrl_handle_io()
1103 gpio = sc->conf->gpio_bank + i; in rk_pinctrl_handle_io()
1108 device_printf(sc->dev, "Cannot find GPIO bank %d\n", bank); in rk_pinctrl_handle_io()
1111 if (gpio->gpio_dev == NULL) { in rk_pinctrl_handle_io()
1112 device_printf(sc->dev, in rk_pinctrl_handle_io()
1119 rv = GPIO_PIN_SET(gpio->gpio_dev, pin, pin_value); in rk_pinctrl_handle_io()
1121 device_printf(sc->dev, "Cannot set GPIO value: %d\n", in rk_pinctrl_handle_io()
1128 rv = GPIO_PIN_SETFLAGS(gpio->gpio_dev, pin, direction_value); in rk_pinctrl_handle_io()
1130 device_printf(sc->dev, in rk_pinctrl_handle_io()
1149 pin = pindata[1]; in rk_pinctrl_configure_pin()
1150 function = pindata[2]; in rk_pinctrl_configure_pin()
1154 for (i = 0; i < sc->conf->iomux_nbanks; i++) in rk_pinctrl_configure_pin()
1155 if (sc->conf->iomux_conf[i].bank == bank && in rk_pinctrl_configure_pin()
1156 sc->conf->iomux_conf[i].subbank == subbank) in rk_pinctrl_configure_pin()
1159 if (i == sc->conf->iomux_nbanks) { in rk_pinctrl_configure_pin()
1160 device_printf(sc->dev, "Unknown pin %d in bank %d\n", pin, in rk_pinctrl_configure_pin()
1166 syscon = sc->conf->get_syscon(sc, bank); in rk_pinctrl_configure_pin()
1171 /* Then pin pull-up/down */ in rk_pinctrl_configure_pin()
1172 bias = sc->conf->parse_bias(pin_conf, bank); in rk_pinctrl_configure_pin()
1174 reg = sc->conf->get_pd_offset(sc, bank); in rk_pinctrl_configure_pin()
1176 bit = (pin % 8) * 2; in rk_pinctrl_configure_pin()
1182 if (ofw_bus_node_is_compatible(ofw_bus_get_node(sc->dev), in rk_pinctrl_configure_pin()
1183 "rockchip,rk3568-pinctrl")) { in rk_pinctrl_configure_pin()
1185 if (OF_getencprop(pin_conf, "drive-strength", &value, in rk_pinctrl_configure_pin()
1188 reg = 0x01c0 + (bank * 0x40) + (pin / 2 * 4); in rk_pinctrl_configure_pin()
1190 reg = 0x0070 + (pin / 2 * 4); in rk_pinctrl_configure_pin()
1192 drive = ((1 << (value + 1)) - 1) << (pin % 2); in rk_pinctrl_configure_pin()
1194 mask = 0x3f << (pin % 2); in rk_pinctrl_configure_pin()
1202 bit = (pin % 8) * 2; in rk_pinctrl_configure_pin()
1210 reg = sc->conf->iomux_conf[i].offset; in rk_pinctrl_configure_pin()
1211 switch (sc->conf->iomux_conf[i].nbits) { in rk_pinctrl_configure_pin()
1224 case 2: in rk_pinctrl_configure_pin()
1225 bit = (pin % 8) * 2; in rk_pinctrl_configure_pin()
1229 device_printf(sc->dev, in rk_pinctrl_configure_pin()
1231 sc->conf->iomux_conf[i].nbits, bank); in rk_pinctrl_configure_pin()
1237 * NOTE: not all syscon registers uses hi-word write mask, thus in rk_pinctrl_configure_pin()
1240 * without hi-word write mask. in rk_pinctrl_configure_pin()
1245 if (ofw_bus_node_is_compatible(ofw_bus_get_node(sc->dev), in rk_pinctrl_configure_pin()
1246 "rockchip,rk3568-pinctrl")) { in rk_pinctrl_configure_pin()
1248 SYSCON_WRITE_4(sc->grf, in rk_pinctrl_configure_pin()
1251 SYSCON_WRITE_4(sc->grf, in rk_pinctrl_configure_pin()
1291 for (i = 0; i < sc->conf->iomux_nbanks; i++) in rk_pinctrl_is_gpio_locked()
1292 if (sc->conf->iomux_conf[i].bank == bank && in rk_pinctrl_is_gpio_locked()
1293 sc->conf->iomux_conf[i].subbank == subbank) in rk_pinctrl_is_gpio_locked()
1296 if (i == sc->conf->iomux_nbanks) { in rk_pinctrl_is_gpio_locked()
1297 device_printf(sc->dev, "Unknown pin %d in bank %d\n", pin, in rk_pinctrl_is_gpio_locked()
1302 syscon = sc->conf->get_syscon(sc, bank); in rk_pinctrl_is_gpio_locked()
1305 reg = sc->conf->iomux_conf[i].offset; in rk_pinctrl_is_gpio_locked()
1306 switch (sc->conf->iomux_conf[i].nbits) { in rk_pinctrl_is_gpio_locked()
1319 case 2: in rk_pinctrl_is_gpio_locked()
1320 bit = (pin % 8) * 2; in rk_pinctrl_is_gpio_locked()
1324 device_printf(sc->dev, in rk_pinctrl_is_gpio_locked()
1326 sc->conf->iomux_conf[i].nbits, bank); in rk_pinctrl_is_gpio_locked()
1346 for (i = 0; i < sc->conf->ngpio_bank; i++) { in rk_pinctrl_get_bank()
1347 if (sc->conf->gpio_bank[i].gpio_dev == gpio) in rk_pinctrl_get_bank()
1350 if (i == sc->conf->ngpio_bank) in rk_pinctrl_get_bank()
1371 syscon = sc->conf->get_syscon(sc, bank); in rk_pinctrl_is_gpio()
1398 syscon = sc->conf->get_syscon(sc, bank); in rk_pinctrl_get_flags()
1407 reg = sc->conf->get_pd_offset(sc, bank); in rk_pinctrl_get_flags()
1409 bit = (pin % 8) * 2; in rk_pinctrl_get_flags()
1412 bias = sc->conf->resolv_bias_value(bank, reg); in rk_pinctrl_get_flags()
1438 syscon = sc->conf->get_syscon(sc, bank); in rk_pinctrl_set_flags()
1447 reg = sc->conf->get_pd_offset(sc, bank); in rk_pinctrl_set_flags()
1449 bit = (pin % 8) * 2; in rk_pinctrl_set_flags()
1451 bias = sc->conf->get_bias_value(bank, flags); in rk_pinctrl_set_flags()
1466 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in rk_pinctrl_probe()
1482 sc->dev = dev; in rk_pinctrl_attach()
1488 "rockchip,grf", &sc->grf) != 0) { in rk_pinctrl_attach()
1494 if (ofw_bus_node_is_compatible(node, "rockchip,rk3568-pinctrl") || in rk_pinctrl_attach()
1495 ofw_bus_node_is_compatible(node, "rockchip,rk3399-pinctrl") || in rk_pinctrl_attach()
1496 ofw_bus_node_is_compatible(node, "rockchip,rk3288-pinctrl")) { in rk_pinctrl_attach()
1499 "rockchip,pmu", &sc->pmu) != 0) { in rk_pinctrl_attach()
1505 mtx_init(&sc->mtx, "rk pinctrl", "pinctrl", MTX_SPIN); in rk_pinctrl_attach()
1507 sc->conf = (struct rk_pinctrl_conf *)ofw_bus_search_compatible(dev, in rk_pinctrl_attach()
1508 compat_data)->ocd_data; in rk_pinctrl_attach()
1519 if (!ofw_bus_node_is_compatible(node, "rockchip,gpio-bank")) in rk_pinctrl_attach()
1521 cdev = simplebus_add_device(dev, node, 0, NULL, -1, NULL); in rk_pinctrl_attach()
1524 gpio_unit += 1; in rk_pinctrl_attach()
1529 device_printf(sc->dev, in rk_pinctrl_attach()
1531 gpio_unit += 1; in rk_pinctrl_attach()
1534 sc->conf->gpio_bank[gpio_unit].gpio_dev = cdev; in rk_pinctrl_attach()
1535 gpio_unit += 1; in rk_pinctrl_attach()
1571 MODULE_VERSION(rk_pinctrl, 1);