Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pinmux-sh7720.c
Go to the documentation of this file.
1 /*
2  * SH7720 Pinmux
3  *
4  * Copyright (C) 2008 Magnus Damm
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License. See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/gpio.h>
14 #include <cpu/sh7720.h>
15 
16 enum {
18 
50 
82 
112 
142 
173 
194 
262 };
263 
264 static pinmux_enum_t pinmux_data[] = {
265  /* PTA GPIO */
274 
275  /* PTB GPIO */
284 
285  /* PTC GPIO */
294 
295  /* PTD GPIO */
304 
305  /* PTE GPIO */
313 
314  /* PTF GPIO */
322 
323  /* PTG GPIO */
331 
332  /* PTH GPIO */
340 
341  /* PTJ GPIO */
349 
350  /* PTK GPIO */
355 
356  /* PTL GPIO */
362 
363  /* PTM GPIO */
372 
373  /* PTP GPIO */
379 
380  /* PTR GPIO */
389 
390  /* PTS GPIO */
396 
397  /* PTT GPIO */
403 
404  /* PTU GPIO */
410 
411  /* PTV GPIO */
417 
418  /* PTA FN */
427 
428  /* PTB FN */
437 
438  /* PTC FN */
447 
448  /* PTD FN */
457 
458  /* PTE FN */
468 
469  /* PTF FN */
477 
478  /* PTG FN */
500 
501  /* PTH FN */
509 
510  /* PTJ FN */
518 
519  /* PTK FN */
524 
525  /* PTL FN */
531 
532  /* PTM FN */
541 
542  /* PTP FN */
550 
551  /* PTR FN */
560 
561  /* PTS FN */
567 
568  /* PTT FN */
576 
577  /* PTU FN */
590 
591  /* PTV FN */
606 };
607 
608 static struct pinmux_gpio pinmux_gpios[] = {
609  /* PTA */
618 
619  /* PTB */
628 
629  /* PTC */
638 
639  /* PTD */
648 
649  /* PTE */
657 
658  /* PTF */
666 
667  /* PTG */
675 
676  /* PTH */
684 
685  /* PTJ */
693 
694  /* PTK */
699 
700  /* PTL */
706 
707  /* PTM */
716 
717  /* PTP */
723 
724  /* PTR */
733 
734  /* PTS */
740 
741  /* PTT */
747 
748  /* PTU */
754 
755  /* PTV */
761 
762  /* BSC */
795 
796  /* LCDC */
820 
821  /* AFEIF */
829 
830  /* IIC */
833 
834  /* DAC */
837 
838  /* ADC */
844 
845  /* USB */
853 
858 
859  /* INTC */
866 
867  /* PCC */
878 
879  /* HUDI */
892 
893  /* DMAC */
900 
901  /* SIOF0 */
907 
908  /* SIOF1 */
914 
915  /* SCIF0 */
921 
922  /* SCIF1 */
928 
929  /* TPU */
938 
939  /* SIM */
943 
944  /* MMC */
950 
951  /* SYSC */
954 };
955 
956 static struct pinmux_cfg_reg pinmux_config_regs[] = {
957  { PINMUX_CFG_REG("PACR", 0xa4050100, 16, 2) {
966  },
967  { PINMUX_CFG_REG("PBCR", 0xa4050102, 16, 2) {
976  },
977  { PINMUX_CFG_REG("PCCR", 0xa4050104, 16, 2) {
986  },
987  { PINMUX_CFG_REG("PDCR", 0xa4050106, 16, 2) {
996  },
997  { PINMUX_CFG_REG("PECR", 0xa4050108, 16, 2) {
998  0, 0, 0, 0,
999  PTE6_FN, 0, 0, PTE6_IN,
1000  PTE5_FN, 0, 0, PTE5_IN,
1006  },
1007  { PINMUX_CFG_REG("PFCR", 0xa405010a, 16, 2) {
1008  0, 0, 0, 0,
1009  PTF6_FN, 0, 0, PTF6_IN,
1010  PTF5_FN, 0, 0, PTF5_IN,
1011  PTF4_FN, 0, 0, PTF4_IN,
1012  PTF3_FN, 0, 0, PTF3_IN,
1013  PTF2_FN, 0, 0, PTF2_IN,
1014  PTF1_FN, 0, 0, PTF1_IN,
1015  PTF0_FN, 0, 0, PTF0_IN }
1016  },
1017  { PINMUX_CFG_REG("PGCR", 0xa405010c, 16, 2) {
1018  0, 0, 0, 0,
1026  },
1027  { PINMUX_CFG_REG("PHCR", 0xa405010e, 16, 2) {
1028  0, 0, 0, 0,
1036  },
1037  { PINMUX_CFG_REG("PJCR", 0xa4050110, 16, 2) {
1038  0, 0, 0, 0,
1046  },
1047  { PINMUX_CFG_REG("PKCR", 0xa4050112, 16, 2) {
1048  0, 0, 0, 0,
1049  0, 0, 0, 0,
1050  0, 0, 0, 0,
1051  0, 0, 0, 0,
1056  },
1057  { PINMUX_CFG_REG("PLCR", 0xa4050114, 16, 2) {
1063  0, 0, 0, 0,
1064  0, 0, 0, 0,
1065  0, 0, 0, 0 }
1066  },
1067  { PINMUX_CFG_REG("PMCR", 0xa4050116, 16, 2) {
1076  },
1077  { PINMUX_CFG_REG("PPCR", 0xa4050118, 16, 2) {
1078  0, 0, 0, 0,
1079  0, 0, 0, 0,
1080  0, 0, 0, 0,
1086  },
1087  { PINMUX_CFG_REG("PRCR", 0xa405011a, 16, 2) {
1096  },
1097  { PINMUX_CFG_REG("PSCR", 0xa405011c, 16, 2) {
1098  0, 0, 0, 0,
1099  0, 0, 0, 0,
1100  0, 0, 0, 0,
1106  },
1107  { PINMUX_CFG_REG("PTCR", 0xa405011e, 16, 2) {
1108  0, 0, 0, 0,
1109  0, 0, 0, 0,
1110  0, 0, 0, 0,
1116  },
1117  { PINMUX_CFG_REG("PUCR", 0xa4050120, 16, 2) {
1118  0, 0, 0, 0,
1119  0, 0, 0, 0,
1120  0, 0, 0, 0,
1126  },
1127  { PINMUX_CFG_REG("PVCR", 0xa4050122, 16, 2) {
1128  0, 0, 0, 0,
1129  0, 0, 0, 0,
1130  0, 0, 0, 0,
1136  },
1137  {}
1138 };
1139 
1140 static struct pinmux_data_reg pinmux_data_regs[] = {
1141  { PINMUX_DATA_REG("PADR", 0xa4050140, 8) {
1144  },
1145  { PINMUX_DATA_REG("PBDR", 0xa4050142, 8) {
1148  },
1149  { PINMUX_DATA_REG("PCDR", 0xa4050144, 8) {
1152  },
1153  { PINMUX_DATA_REG("PDDR", 0xa4050126, 8) {
1156  },
1157  { PINMUX_DATA_REG("PEDR", 0xa4050148, 8) {
1160  },
1161  { PINMUX_DATA_REG("PFDR", 0xa405014a, 8) {
1164  },
1165  { PINMUX_DATA_REG("PGDR", 0xa405014c, 8) {
1168  },
1169  { PINMUX_DATA_REG("PHDR", 0xa405014e, 8) {
1172  },
1173  { PINMUX_DATA_REG("PJDR", 0xa4050150, 8) {
1176  },
1177  { PINMUX_DATA_REG("PKDR", 0xa4050152, 8) {
1178  0, 0, 0, 0,
1180  },
1181  { PINMUX_DATA_REG("PLDR", 0xa4050154, 8) {
1183  PTL3_DATA, 0, 0, 0 }
1184  },
1185  { PINMUX_DATA_REG("PMDR", 0xa4050156, 8) {
1188  },
1189  { PINMUX_DATA_REG("PPDR", 0xa4050158, 8) {
1190  0, 0, 0, PTP4_DATA,
1192  },
1193  { PINMUX_DATA_REG("PRDR", 0xa405015a, 8) {
1196  },
1197  { PINMUX_DATA_REG("PSDR", 0xa405015c, 8) {
1198  0, 0, 0, PTS4_DATA,
1200  },
1201  { PINMUX_DATA_REG("PTDR", 0xa405015e, 8) {
1202  0, 0, 0, PTT4_DATA,
1204  },
1205  { PINMUX_DATA_REG("PUDR", 0xa4050160, 8) {
1206  0, 0, 0, PTU4_DATA,
1208  },
1209  { PINMUX_DATA_REG("PVDR", 0xa4050162, 8) {
1210  0, 0, 0, PTV4_DATA,
1212  },
1213  { },
1214 };
1215 
1216 static struct pinmux_info sh7720_pinmux_info = {
1217  .name = "sh7720_pfc",
1218  .reserved_id = PINMUX_RESERVED,
1219  .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1220  .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1222  .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
1223  .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
1224  .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
1225 
1226  .first_gpio = GPIO_PTA7,
1227  .last_gpio = GPIO_FN_STATUS1,
1228 
1229  .gpios = pinmux_gpios,
1230  .cfg_regs = pinmux_config_regs,
1231  .data_regs = pinmux_data_regs,
1232 
1233  .gpio_data = pinmux_data,
1234  .gpio_data_size = ARRAY_SIZE(pinmux_data),
1235 };
1236 
1237 static int __init plat_pinmux_setup(void)
1238 {
1239  return register_pinmux(&sh7720_pinmux_info);
1240 }
1241 
1242 arch_initcall(plat_pinmux_setup);