Commit 972c3fb6 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Paul Mundt

ARM: mach-shmobile: move helper macro PORT_xx to sh_pfc.h

This patch moves PORT_xx helper macro to sh_pfc.h,
and it expects CPU_ALL_PORT() macro for each CPU
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent bd8d0cba
...@@ -21,68 +21,49 @@ ...@@ -21,68 +21,49 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <mach/sh7367.h> #include <mach/sh7367.h>
#define _1(fn, pfx, sfx) fn(pfx, sfx) #define CPU_ALL_PORT(fn, pfx, sfx) \
PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
#define _10(fn, pfx, sfx) \ PORT_10(fn, pfx##10, sfx), PORT_90(fn, pfx##1, sfx), \
_1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
_1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
_1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
_1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ PORT_10(fn, pfx##26, sfx), PORT_1(fn, pfx##270, sfx), \
_1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) PORT_1(fn, pfx##271, sfx), PORT_1(fn, pfx##272, sfx)
#define _90(fn, pfx, sfx) \
_10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \
_10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \
_10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \
_10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \
_10(fn, pfx##9, sfx)
#define _273(fn, pfx, sfx) \
_10(fn, pfx, sfx), _90(fn, pfx, sfx), \
_10(fn, pfx##10, sfx), _90(fn, pfx##1, sfx), \
_10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
_10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
_10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
_10(fn, pfx##26, sfx), _1(fn, pfx##270, sfx), \
_1(fn, pfx##271, sfx), _1(fn, pfx##272, sfx)
#define _PORT(pfx, sfx) pfx##_##sfx
#define PORT_273(str) _273(_PORT, PORT, str)
enum { enum {
PINMUX_RESERVED = 0, PINMUX_RESERVED = 0,
PINMUX_DATA_BEGIN, PINMUX_DATA_BEGIN,
PORT_273(DATA), /* PORT0_DATA -> PORT272_DATA */ PORT_ALL(DATA), /* PORT0_DATA -> PORT272_DATA */
PINMUX_DATA_END, PINMUX_DATA_END,
PINMUX_INPUT_BEGIN, PINMUX_INPUT_BEGIN,
PORT_273(IN), /* PORT0_IN -> PORT272_IN */ PORT_ALL(IN), /* PORT0_IN -> PORT272_IN */
PINMUX_INPUT_END, PINMUX_INPUT_END,
PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_BEGIN,
PORT_273(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */
PINMUX_INPUT_PULLUP_END, PINMUX_INPUT_PULLUP_END,
PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_BEGIN,
PORT_273(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */
PINMUX_INPUT_PULLDOWN_END, PINMUX_INPUT_PULLDOWN_END,
PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_BEGIN,
PORT_273(OUT), /* PORT0_OUT -> PORT272_OUT */ PORT_ALL(OUT), /* PORT0_OUT -> PORT272_OUT */
PINMUX_OUTPUT_END, PINMUX_OUTPUT_END,
PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_BEGIN,
PORT_273(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */
PORT_273(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */
PORT_273(FN0), /* PORT0_FN0 -> PORT272_FN0 */ PORT_ALL(FN0), /* PORT0_FN0 -> PORT272_FN0 */
PORT_273(FN1), /* PORT0_FN1 -> PORT272_FN1 */ PORT_ALL(FN1), /* PORT0_FN1 -> PORT272_FN1 */
PORT_273(FN2), /* PORT0_FN2 -> PORT272_FN2 */ PORT_ALL(FN2), /* PORT0_FN2 -> PORT272_FN2 */
PORT_273(FN3), /* PORT0_FN3 -> PORT272_FN3 */ PORT_ALL(FN3), /* PORT0_FN3 -> PORT272_FN3 */
PORT_273(FN4), /* PORT0_FN4 -> PORT272_FN4 */ PORT_ALL(FN4), /* PORT0_FN4 -> PORT272_FN4 */
PORT_273(FN5), /* PORT0_FN5 -> PORT272_FN5 */ PORT_ALL(FN5), /* PORT0_FN5 -> PORT272_FN5 */
PORT_273(FN6), /* PORT0_FN6 -> PORT272_FN6 */ PORT_ALL(FN6), /* PORT0_FN6 -> PORT272_FN6 */
PORT_273(FN7), /* PORT0_FN7 -> PORT272_FN7 */ PORT_ALL(FN7), /* PORT0_FN7 -> PORT272_FN7 */
MSELBCR_MSEL2_1, MSELBCR_MSEL2_0, MSELBCR_MSEL2_1, MSELBCR_MSEL2_0,
PINMUX_FUNCTION_END, PINMUX_FUNCTION_END,
...@@ -1063,13 +1044,9 @@ static pinmux_enum_t pinmux_data[] = { ...@@ -1063,13 +1044,9 @@ static pinmux_enum_t pinmux_data[] = {
PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1), PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1),
}; };
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define GPIO_PORT_273() _273(_GPIO_PORT, , unused)
#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
static struct pinmux_gpio pinmux_gpios[] = { static struct pinmux_gpio pinmux_gpios[] = {
/* 49-1 -> 49-6 (GPIO) */ /* 49-1 -> 49-6 (GPIO) */
GPIO_PORT_273(), GPIO_PORT_ALL(),
/* Special Pull-up / Pull-down Functions */ /* Special Pull-up / Pull-down Functions */
GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU), GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU),
......
...@@ -25,27 +25,13 @@ ...@@ -25,27 +25,13 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <mach/sh7372.h> #include <mach/sh7372.h>
#define _1(fn, pfx, sfx) fn(pfx, sfx) #define CPU_ALL_PORT(fn, pfx, sfx) \
PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
#define _10(fn, pfx, sfx) \ PORT_10(fn, pfx##10, sfx), PORT_10(fn, pfx##11, sfx), \
_1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ PORT_10(fn, pfx##12, sfx), PORT_10(fn, pfx##13, sfx), \
_1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ PORT_10(fn, pfx##14, sfx), PORT_10(fn, pfx##15, sfx), \
_1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ PORT_10(fn, pfx##16, sfx), PORT_10(fn, pfx##17, sfx), \
_1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ PORT_10(fn, pfx##18, sfx), PORT_1(fn, pfx##190, sfx)
_1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx)
#define _80(fn, pfx, sfx) \
_10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \
_10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \
_10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \
_10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx)
#define _190(fn, pfx, sfx) \
_10(fn, pfx, sfx), _80(fn, pfx, sfx), _10(fn, pfx##9, sfx), \
_10(fn, pfx##10, sfx), _80(fn, pfx##1, sfx), _1(fn, pfx##190, sfx)
#define _PORT(pfx, sfx) pfx##_##sfx
#define PORT_ALL(str) _190(_PORT, PORT, str)
enum { enum {
PINMUX_RESERVED = 0, PINMUX_RESERVED = 0,
...@@ -942,10 +928,6 @@ static pinmux_enum_t pinmux_data[] = { ...@@ -942,10 +928,6 @@ static pinmux_enum_t pinmux_data[] = {
PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1),
}; };
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define GPIO_PORT_ALL() _190(_GPIO_PORT, , unused)
#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
static struct pinmux_gpio pinmux_gpios[] = { static struct pinmux_gpio pinmux_gpios[] = {
/* PORT */ /* PORT */
......
...@@ -22,84 +22,65 @@ ...@@ -22,84 +22,65 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <mach/sh7377.h> #include <mach/sh7377.h>
#define _1(fn, pfx, sfx) fn(pfx, sfx) #define CPU_ALL_PORT(fn, pfx, sfx) \
PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
#define _10(fn, pfx, sfx) \ PORT_10(fn, pfx##10, sfx), \
_1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
_1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
_1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \
_1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \
_1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) PORT_1(fn, pfx##118, sfx), \
PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \
#define _90(fn, pfx, sfx) \ PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \
_10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \ PORT_10(fn, pfx##15, sfx), \
_10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \ PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \
_10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \ PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \
_10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \ PORT_1(fn, pfx##164, sfx), \
_10(fn, pfx##9, sfx) PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \
PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \
#define _265(fn, pfx, sfx) \ PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \
_10(fn, pfx, sfx), _90(fn, pfx, sfx), \ PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \
_10(fn, pfx##10, sfx), \ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
_1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
_1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
_1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \ PORT_1(fn, pfx##260, sfx), PORT_1(fn, pfx##261, sfx), \
_1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \ PORT_1(fn, pfx##262, sfx), PORT_1(fn, pfx##263, sfx), \
_1(fn, pfx##118, sfx), \ PORT_1(fn, pfx##264, sfx)
_1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \
_10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \
_10(fn, pfx##15, sfx), \
_1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \
_1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \
_1(fn, pfx##164, sfx), \
_1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \
_1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \
_1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \
_1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \
_10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
_10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
_10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
_1(fn, pfx##260, sfx), _1(fn, pfx##261, sfx), \
_1(fn, pfx##262, sfx), _1(fn, pfx##263, sfx), \
_1(fn, pfx##264, sfx)
#define _PORT(pfx, sfx) pfx##_##sfx
#define PORT_265(str) _265(_PORT, PORT, str)
enum { enum {
PINMUX_RESERVED = 0, PINMUX_RESERVED = 0,
PINMUX_DATA_BEGIN, PINMUX_DATA_BEGIN,
PORT_265(DATA), /* PORT0_DATA -> PORT264_DATA */ PORT_ALL(DATA), /* PORT0_DATA -> PORT264_DATA */
PINMUX_DATA_END, PINMUX_DATA_END,
PINMUX_INPUT_BEGIN, PINMUX_INPUT_BEGIN,
PORT_265(IN), /* PORT0_IN -> PORT264_IN */ PORT_ALL(IN), /* PORT0_IN -> PORT264_IN */
PINMUX_INPUT_END, PINMUX_INPUT_END,
PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_BEGIN,
PORT_265(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */
PINMUX_INPUT_PULLUP_END, PINMUX_INPUT_PULLUP_END,
PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_BEGIN,
PORT_265(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */
PINMUX_INPUT_PULLDOWN_END, PINMUX_INPUT_PULLDOWN_END,
PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_BEGIN,
PORT_265(OUT), /* PORT0_OUT -> PORT264_OUT */ PORT_ALL(OUT), /* PORT0_OUT -> PORT264_OUT */
PINMUX_OUTPUT_END, PINMUX_OUTPUT_END,
PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_BEGIN,
PORT_265(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */
PORT_265(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */
PORT_265(FN0), /* PORT0_FN0 -> PORT264_FN0 */ PORT_ALL(FN0), /* PORT0_FN0 -> PORT264_FN0 */
PORT_265(FN1), /* PORT0_FN1 -> PORT264_FN1 */ PORT_ALL(FN1), /* PORT0_FN1 -> PORT264_FN1 */
PORT_265(FN2), /* PORT0_FN2 -> PORT264_FN2 */ PORT_ALL(FN2), /* PORT0_FN2 -> PORT264_FN2 */
PORT_265(FN3), /* PORT0_FN3 -> PORT264_FN3 */ PORT_ALL(FN3), /* PORT0_FN3 -> PORT264_FN3 */
PORT_265(FN4), /* PORT0_FN4 -> PORT264_FN4 */ PORT_ALL(FN4), /* PORT0_FN4 -> PORT264_FN4 */
PORT_265(FN5), /* PORT0_FN5 -> PORT264_FN5 */ PORT_ALL(FN5), /* PORT0_FN5 -> PORT264_FN5 */
PORT_265(FN6), /* PORT0_FN6 -> PORT264_FN6 */ PORT_ALL(FN6), /* PORT0_FN6 -> PORT264_FN6 */
PORT_265(FN7), /* PORT0_FN7 -> PORT264_FN7 */ PORT_ALL(FN7), /* PORT0_FN7 -> PORT264_FN7 */
MSELBCR_MSEL17_1, MSELBCR_MSEL17_0, MSELBCR_MSEL17_1, MSELBCR_MSEL17_0,
MSELBCR_MSEL16_1, MSELBCR_MSEL16_0, MSELBCR_MSEL16_1, MSELBCR_MSEL16_0,
...@@ -1039,13 +1020,9 @@ static pinmux_enum_t pinmux_data[] = { ...@@ -1039,13 +1020,9 @@ static pinmux_enum_t pinmux_data[] = {
PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1), PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1),
}; };
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define GPIO_PORT_265() _265(_GPIO_PORT, , unused)
#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
static struct pinmux_gpio pinmux_gpios[] = { static struct pinmux_gpio pinmux_gpios[] = {
/* 55-1 -> 55-5 (GPIO) */ /* 55-1 -> 55-5 (GPIO) */
GPIO_PORT_265(), GPIO_PORT_ALL(),
/* Special Pull-up / Pull-down Functions */ /* Special Pull-up / Pull-down Functions */
GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU), GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU),
......
...@@ -24,83 +24,71 @@ ...@@ -24,83 +24,71 @@
#include <mach/sh73a0.h> #include <mach/sh73a0.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#define _1(fn, pfx, sfx) fn(pfx, sfx) #define CPU_ALL_PORT(fn, pfx, sfx) \
PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \
#define _10(fn, pfx, sfx) \ PORT_10(fn, pfx##2, sfx), PORT_10(fn, pfx##3, sfx), \
_1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ PORT_10(fn, pfx##4, sfx), PORT_10(fn, pfx##5, sfx), \
_1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ PORT_10(fn, pfx##6, sfx), PORT_10(fn, pfx##7, sfx), \
_1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ PORT_10(fn, pfx##8, sfx), PORT_10(fn, pfx##9, sfx), \
_1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ PORT_10(fn, pfx##10, sfx), \
_1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
#define _310(fn, pfx, sfx) \ PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \
_10(fn, pfx, sfx), _10(fn, pfx##1, sfx), \ PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \
_10(fn, pfx##2, sfx), _10(fn, pfx##3, sfx), \ PORT_1(fn, pfx##118, sfx), \
_10(fn, pfx##4, sfx), _10(fn, pfx##5, sfx), \ PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \
_10(fn, pfx##6, sfx), _10(fn, pfx##7, sfx), \ PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \
_10(fn, pfx##8, sfx), _10(fn, pfx##9, sfx), \ PORT_10(fn, pfx##15, sfx), \
_10(fn, pfx##10, sfx), \ PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \
_1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \ PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \
_1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \ PORT_1(fn, pfx##164, sfx), \
_1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \ PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \
_1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \ PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \
_1(fn, pfx##118, sfx), \ PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \
_1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \ PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \
_10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
_10(fn, pfx##15, sfx), \ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
_1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
_1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \ PORT_10(fn, pfx##26, sfx), PORT_10(fn, pfx##27, sfx), \
_1(fn, pfx##164, sfx), \ PORT_1(fn, pfx##280, sfx), PORT_1(fn, pfx##281, sfx), \
_1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \ PORT_1(fn, pfx##282, sfx), \
_1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \ PORT_1(fn, pfx##288, sfx), PORT_1(fn, pfx##289, sfx), \
_1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \ PORT_10(fn, pfx##29, sfx), PORT_10(fn, pfx##30, sfx)
_1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \
_10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
_10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
_10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
_10(fn, pfx##26, sfx), _10(fn, pfx##27, sfx), \
_1(fn, pfx##280, sfx), _1(fn, pfx##281, sfx), \
_1(fn, pfx##282, sfx), \
_1(fn, pfx##288, sfx), _1(fn, pfx##289, sfx), \
_10(fn, pfx##29, sfx), _10(fn, pfx##30, sfx)
#define _PORT(pfx, sfx) pfx##_##sfx
#define PORT_310(str) _310(_PORT, PORT, str)
enum { enum {
PINMUX_RESERVED = 0, PINMUX_RESERVED = 0,
PINMUX_DATA_BEGIN, PINMUX_DATA_BEGIN,
PORT_310(DATA), /* PORT0_DATA -> PORT309_DATA */ PORT_ALL(DATA), /* PORT0_DATA -> PORT309_DATA */
PINMUX_DATA_END, PINMUX_DATA_END,
PINMUX_INPUT_BEGIN, PINMUX_INPUT_BEGIN,
PORT_310(IN), /* PORT0_IN -> PORT309_IN */ PORT_ALL(IN), /* PORT0_IN -> PORT309_IN */
PINMUX_INPUT_END, PINMUX_INPUT_END,
PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_BEGIN,
PORT_310(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */
PINMUX_INPUT_PULLUP_END, PINMUX_INPUT_PULLUP_END,
PINMUX_INPUT_PULLDOWN_BEGIN, PINMUX_INPUT_PULLDOWN_BEGIN,
PORT_310(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */
PINMUX_INPUT_PULLDOWN_END, PINMUX_INPUT_PULLDOWN_END,
PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_BEGIN,
PORT_310(OUT), /* PORT0_OUT -> PORT309_OUT */ PORT_ALL(OUT), /* PORT0_OUT -> PORT309_OUT */
PINMUX_OUTPUT_END, PINMUX_OUTPUT_END,
PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_BEGIN,
PORT_310(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */
PORT_310(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */
PORT_310(FN0), /* PORT0_FN0 -> PORT309_FN0 */ PORT_ALL(FN0), /* PORT0_FN0 -> PORT309_FN0 */
PORT_310(FN1), /* PORT0_FN1 -> PORT309_FN1 */ PORT_ALL(FN1), /* PORT0_FN1 -> PORT309_FN1 */
PORT_310(FN2), /* PORT0_FN2 -> PORT309_FN2 */ PORT_ALL(FN2), /* PORT0_FN2 -> PORT309_FN2 */
PORT_310(FN3), /* PORT0_FN3 -> PORT309_FN3 */ PORT_ALL(FN3), /* PORT0_FN3 -> PORT309_FN3 */
PORT_310(FN4), /* PORT0_FN4 -> PORT309_FN4 */ PORT_ALL(FN4), /* PORT0_FN4 -> PORT309_FN4 */
PORT_310(FN5), /* PORT0_FN5 -> PORT309_FN5 */ PORT_ALL(FN5), /* PORT0_FN5 -> PORT309_FN5 */
PORT_310(FN6), /* PORT0_FN6 -> PORT309_FN6 */ PORT_ALL(FN6), /* PORT0_FN6 -> PORT309_FN6 */
PORT_310(FN7), /* PORT0_FN7 -> PORT309_FN7 */ PORT_ALL(FN7), /* PORT0_FN7 -> PORT309_FN7 */
MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1, MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1,
MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1, MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1,
...@@ -1555,12 +1543,8 @@ static pinmux_enum_t pinmux_data[] = { ...@@ -1555,12 +1543,8 @@ static pinmux_enum_t pinmux_data[] = {
PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU),
}; };
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define GPIO_PORT_310() _310(_GPIO_PORT, , unused)
#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
static struct pinmux_gpio pinmux_gpios[] = { static struct pinmux_gpio pinmux_gpios[] = {
GPIO_PORT_310(), GPIO_PORT_ALL(),
/* Table 25-1 (Functions 0-7) */ /* Table 25-1 (Functions 0-7) */
GPIO_FN(VBUS_0), GPIO_FN(VBUS_0),
......
...@@ -104,6 +104,29 @@ struct pinmux_info { ...@@ -104,6 +104,29 @@ struct pinmux_info {
int register_pinmux(struct pinmux_info *pip); int register_pinmux(struct pinmux_info *pip);
int unregister_pinmux(struct pinmux_info *pip); int unregister_pinmux(struct pinmux_info *pip);
/* helper macro for port */
#define PORT_1(fn, pfx, sfx) fn(pfx, sfx)
#define PORT_10(fn, pfx, sfx) \
PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)
#define PORT_90(fn, pfx, sfx) \
PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \
PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \
PORT_10(fn, pfx##9, sfx)
#define _PORT_ALL(pfx, sfx) pfx##_##sfx
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
/* helper macro for pinmux_enum_t */ /* helper macro for pinmux_enum_t */
#define PORT_DATA_I(nr) \ #define PORT_DATA_I(nr) \
PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN) PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment