ARM: uniphier: add external IRQ setup code
[platform/kernel/u-boot.git] / arch / arm / mach-uniphier / pinctrl / pinctrl-ld20.c
1 /*
2  * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <linux/io.h>
8
9 #include "../init.h"
10 #include "../sg-regs.h"
11
12 void uniphier_ld20_pin_init(void)
13 {
14         /* Comment format:    PAD Name -> Function Name */
15
16 #ifdef CONFIG_NAND_DENALI
17         sg_set_pinsel(3, 0, 8, 4);      /* XNFWP   -> XNFWP */
18         sg_set_pinsel(4, 0, 8, 4);      /* XNFCE0  -> XNFCE0 */
19         sg_set_pinsel(5, 0, 8, 4);      /* NFRYBY0 -> NFRYBY0 */
20         sg_set_pinsel(6, 0, 8, 4);      /* XNFRE   -> XNFRE */
21         sg_set_pinsel(7, 0, 8, 4);      /* XNFWE   -> XNFWE */
22         sg_set_pinsel(8, 0, 8, 4);      /* NFALE   -> NFALE */
23         sg_set_pinsel(9, 0, 8, 4);      /* NFCLE   -> NFCLE */
24         sg_set_pinsel(10, 0, 8, 4);     /* NFD0    -> NFD0 */
25         sg_set_pinsel(11, 0, 8, 4);     /* NFD1    -> NFD1 */
26         sg_set_pinsel(12, 0, 8, 4);     /* NFD2    -> NFD2 */
27         sg_set_pinsel(13, 0, 8, 4);     /* NFD3    -> NFD3 */
28         sg_set_pinsel(14, 0, 8, 4);     /* NFD4    -> NFD4 */
29         sg_set_pinsel(15, 0, 8, 4);     /* NFD5    -> NFD5 */
30         sg_set_pinsel(16, 0, 8, 4);     /* NFD6    -> NFD6 */
31         sg_set_pinsel(17, 0, 8, 4);     /* NFD7    -> NFD7 */
32         sg_set_iectrl_range(3, 17);
33 #endif
34
35 #ifdef CONFIG_USB_XHCI_UNIPHIER
36         sg_set_pinsel(46, 0, 8, 4);     /* USB0VBUS -> USB0VBUS */
37         sg_set_pinsel(47, 0, 8, 4);     /* USB0OD   -> USB0OD */
38         sg_set_pinsel(48, 0, 8, 4);     /* USB1VBUS -> USB1VBUS */
39         sg_set_pinsel(49, 0, 8, 4);     /* USB1OD   -> USB1OD */
40         sg_set_pinsel(50, 0, 8, 4);     /* USB2VBUS -> USB2VBUS */
41         sg_set_pinsel(51, 0, 8, 4);     /* USB2OD   -> USB2OD */
42         sg_set_pinsel(52, 0, 8, 4);     /* USB3VBUS -> USB3VBUS */
43         sg_set_pinsel(53, 0, 8, 4);     /* USB3OD   -> USB3OD */
44         sg_set_iectrl_range(46, 53);
45 #endif
46
47         sg_set_pinsel(149, 14, 8, 4);   /* XIRQ0    -> XIRQ0 */
48         sg_set_iectrl(149);
49         sg_set_pinsel(153, 14, 8, 4);   /* XIRQ4    -> XIRQ4 */
50         sg_set_iectrl(153);
51 }