Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pinmux-sh7786.c
Go to the documentation of this file.
1 /*
2  * SH7786 Pinmux
3  *
4  * Copyright (C) 2008, 2009 Renesas Solutions Corp.
5  * Kuninori Morimoto <[email protected]>
6  *
7  * Based on SH7785 pinmux
8  *
9  * Copyright (C) 2008 Magnus Damm
10  *
11  * This file is subject to the terms and conditions of the GNU General Public
12  * License. See the file "COPYING" in the main directory of this archive
13  * for more details.
14  */
15 
16 #include <linux/init.h>
17 #include <linux/kernel.h>
18 #include <linux/gpio.h>
19 #include <cpu/sh7786.h>
20 
21 enum {
23 
42 
61 
80 
99 
132 
150 
191 };
192 
193 static pinmux_enum_t pinmux_data[] = {
194 
195  /* PA GPIO */
204 
205  /* PB GPIO */
214 
215  /* PC GPIO */
224 
225  /* PD GPIO */
234 
235  /* PE GPIO */
238 
239  /* PF GPIO */
248 
249  /* PG GPIO */
253 
254  /* PH GPIO */
263 
264  /* PJ GPIO */
272 
273  /* PA FN */
290 
291  /* PB FN */
308 
309  /* PC FN */
318 
327 
328  /* PD FN */
343 
344  /* PE FN */
347 
348  /* PF FN */
373 
374  /* PG FN */
383 
384  /* PH FN */
406 
407  /* PJ FN */
427 };
428 
429 static struct pinmux_gpio pinmux_gpios[] = {
430  /* PA */
439 
440  /* PB */
449 
450  /* PC */
459 
460  /* PD */
469 
470  /* PE */
473 
474  /* PF */
483 
484  /* PG */
488 
489  /* PH */
498 
499  /* PJ */
507 
508  /* FN */
645 };
646 
647 static struct pinmux_cfg_reg pinmux_config_regs[] = {
648  { PINMUX_CFG_REG("PACR", 0xffcc0000, 16, 2) {
657  },
658  { PINMUX_CFG_REG("PBCR", 0xffcc0002, 16, 2) {
667  },
668  { PINMUX_CFG_REG("PCCR", 0xffcc0004, 16, 2) {
677  },
678  { PINMUX_CFG_REG("PDCR", 0xffcc0006, 16, 2) {
687  },
688  { PINMUX_CFG_REG("PECR", 0xffcc0008, 16, 2) {
691  0, 0, 0, 0,
692  0, 0, 0, 0,
693  0, 0, 0, 0,
694  0, 0, 0, 0,
695  0, 0, 0, 0,
696  0, 0, 0, 0, }
697  },
698  { PINMUX_CFG_REG("PFCR", 0xffcc000a, 16, 2) {
707  },
708  { PINMUX_CFG_REG("PGCR", 0xffcc000c, 16, 2) {
712  0, 0, 0, 0,
713  0, 0, 0, 0,
714  0, 0, 0, 0,
715  0, 0, 0, 0,
716  0, 0, 0, 0, }
717  },
718  { PINMUX_CFG_REG("PHCR", 0xffcc000e, 16, 2) {
727  },
728  { PINMUX_CFG_REG("PJCR", 0xffcc0010, 16, 2) {
736  0, 0, 0, 0, }
737  },
738  { PINMUX_CFG_REG("P1MSELR", 0xffcc0080, 16, 1) {
739  0, 0,
755  },
756  { PINMUX_CFG_REG("P2MSELR", 0xffcc0082, 16, 1) {
773  },
774  {}
775 };
776 
777 static struct pinmux_data_reg pinmux_data_regs[] = {
778  { PINMUX_DATA_REG("PADR", 0xffcc0020, 8) {
781  },
782  { PINMUX_DATA_REG("PBDR", 0xffcc0022, 8) {
785  },
786  { PINMUX_DATA_REG("PCDR", 0xffcc0024, 8) {
789  },
790  { PINMUX_DATA_REG("PDDR", 0xffcc0026, 8) {
793  },
794  { PINMUX_DATA_REG("PEDR", 0xffcc0028, 8) {
796  0, 0, 0, 0, 0, 0 }
797  },
798  { PINMUX_DATA_REG("PFDR", 0xffcc002a, 8) {
801  },
802  { PINMUX_DATA_REG("PGDR", 0xffcc002c, 8) {
804  0, 0, 0, 0 }
805  },
806  { PINMUX_DATA_REG("PHDR", 0xffcc002e, 8) {
809  },
810  { PINMUX_DATA_REG("PJDR", 0xffcc0030, 8) {
812  PJ3_DATA, PJ2_DATA, PJ1_DATA, 0 }
813  },
814  { },
815 };
816 
817 static struct pinmux_info sh7786_pinmux_info = {
818  .name = "sh7786_pfc",
819  .reserved_id = PINMUX_RESERVED,
820  .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
821  .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
823  .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
824  .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
826 
827  .first_gpio = GPIO_PA7,
828  .last_gpio = GPIO_FN_FSE,
829 
830  .gpios = pinmux_gpios,
831  .cfg_regs = pinmux_config_regs,
832  .data_regs = pinmux_data_regs,
833 
834  .gpio_data = pinmux_data,
835  .gpio_data_size = ARRAY_SIZE(pinmux_data),
836 };
837 
838 static int __init plat_pinmux_setup(void)
839 {
840  return register_pinmux(&sh7786_pinmux_info);
841 }
842 
843 arch_initcall(plat_pinmux_setup);