diff options
author | Oleg Matcovschi <oleg.matcovschi@ti.com> | 2012-11-26 20:02:03 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-12-14 14:11:34 -0500 |
commit | 421e84509980206fb3b3bc039bc05bae1dd41c7b (patch) | |
tree | a15c269e3db4db310ba0b1a0610b2a095d18c76e /arch | |
parent | ca2e16faa7378878c1522a7c1b6c38211de3331d (diff) |
OMAP2+: mux: Fixed gpio mux mode analysis
OMAP_MODE_GPIO() macro verified only OMAP_MUX_MODE4.
It is not correct for following platforms:
2430 - gpio mux mode 3
44xx - gpio mux mode 3
54xx - gpio mux mode 6
Patch reserves first 3 bits in partition flags for storing gpio mux
mode in same format as stored in control pad register.
Modified OMAP_MODE_GPIO() macro to handle all possible cases of gpio mux mode.
Modified omap_mux_init() flags of omap34xx to include OMAP_MUX_GPIO_IN_MODE4.
Signed-off-by: Oleg Matcovschi <oleg.matcovschi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/mux.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/mux.h | 20 | ||||
-rw-r--r-- | arch/arm/mach-omap2/mux34xx.c | 2 |
3 files changed, 20 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 26126343d6ac..6a217c98db54 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -135,10 +135,7 @@ static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition, | |||
135 | 135 | ||
136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); | 136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); |
137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); | 137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); |
138 | if (partition->flags & OMAP_MUX_GPIO_IN_MODE3) | 138 | mux_mode |= partition->gpio; |
139 | mux_mode |= OMAP_MUX_MODE3; | ||
140 | else | ||
141 | mux_mode |= OMAP_MUX_MODE4; | ||
142 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, | 139 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, |
143 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); | 140 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); |
144 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); | 141 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); |
@@ -800,7 +797,7 @@ int __init omap_mux_late_init(void) | |||
800 | struct omap_mux *m = &e->mux; | 797 | struct omap_mux *m = &e->mux; |
801 | u16 mode = omap_mux_read(partition, m->reg_offset); | 798 | u16 mode = omap_mux_read(partition, m->reg_offset); |
802 | 799 | ||
803 | if (OMAP_MODE_GPIO(mode)) | 800 | if (OMAP_MODE_GPIO(partition, mode)) |
804 | continue; | 801 | continue; |
805 | 802 | ||
806 | #ifndef CONFIG_DEBUG_FS | 803 | #ifndef CONFIG_DEBUG_FS |
@@ -1065,7 +1062,7 @@ static void __init omap_mux_init_list(struct omap_mux_partition *partition, | |||
1065 | } | 1062 | } |
1066 | #else | 1063 | #else |
1067 | /* Skip pins that are not muxed as GPIO by bootloader */ | 1064 | /* Skip pins that are not muxed as GPIO by bootloader */ |
1068 | if (!OMAP_MODE_GPIO(omap_mux_read(partition, | 1065 | if (!OMAP_MODE_GPIO(partition, omap_mux_read(partition, |
1069 | superset->reg_offset))) { | 1066 | superset->reg_offset))) { |
1070 | superset++; | 1067 | superset++; |
1071 | continue; | 1068 | continue; |
@@ -1132,6 +1129,7 @@ int __init omap_mux_init(const char *name, u32 flags, | |||
1132 | 1129 | ||
1133 | partition->name = name; | 1130 | partition->name = name; |
1134 | partition->flags = flags; | 1131 | partition->flags = flags; |
1132 | partition->gpio = flags & OMAP_MUX_MODE7; | ||
1135 | partition->size = mux_size; | 1133 | partition->size = mux_size; |
1136 | partition->phys = mux_pbase; | 1134 | partition->phys = mux_pbase; |
1137 | partition->base = ioremap(mux_pbase, mux_size); | 1135 | partition->base = ioremap(mux_pbase, mux_size); |
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 76f9b3c2f586..fdb22f14021f 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h | |||
@@ -58,7 +58,8 @@ | |||
58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) | 58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) |
59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN | 59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN |
60 | 60 | ||
61 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) | 61 | #define OMAP_MODE_GPIO(partition, x) (((x) & OMAP_MUX_MODE7) == \ |
62 | partition->gpio) | ||
62 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) | 63 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) |
63 | 64 | ||
64 | /* Flags for omapX_mux_init */ | 65 | /* Flags for omapX_mux_init */ |
@@ -79,13 +80,20 @@ | |||
79 | /* | 80 | /* |
80 | * omap_mux_init flags definition: | 81 | * omap_mux_init flags definition: |
81 | * | 82 | * |
83 | * OMAP_GPIO_MUX_MODE, bits 0-2: gpio muxing mode, same like pad control | ||
84 | * register which includes values from 0-7. | ||
82 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. | 85 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. |
83 | * The default value is 16 bits. | 86 | * The default value is 16 bits. |
84 | * OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3. | ||
85 | * The default is mode4. | ||
86 | */ | 87 | */ |
87 | #define OMAP_MUX_REG_8BIT (1 << 0) | 88 | #define OMAP_MUX_GPIO_IN_MODE0 OMAP_MUX_MODE0 |
88 | #define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) | 89 | #define OMAP_MUX_GPIO_IN_MODE1 OMAP_MUX_MODE1 |
90 | #define OMAP_MUX_GPIO_IN_MODE2 OMAP_MUX_MODE2 | ||
91 | #define OMAP_MUX_GPIO_IN_MODE3 OMAP_MUX_MODE3 | ||
92 | #define OMAP_MUX_GPIO_IN_MODE4 OMAP_MUX_MODE4 | ||
93 | #define OMAP_MUX_GPIO_IN_MODE5 OMAP_MUX_MODE5 | ||
94 | #define OMAP_MUX_GPIO_IN_MODE6 OMAP_MUX_MODE6 | ||
95 | #define OMAP_MUX_GPIO_IN_MODE7 OMAP_MUX_MODE7 | ||
96 | #define OMAP_MUX_REG_8BIT (1 << 3) | ||
89 | 97 | ||
90 | /** | 98 | /** |
91 | * struct omap_board_data - board specific device data | 99 | * struct omap_board_data - board specific device data |
@@ -105,6 +113,7 @@ struct omap_board_data { | |||
105 | * struct mux_partition - contain partition related information | 113 | * struct mux_partition - contain partition related information |
106 | * @name: name of the current partition | 114 | * @name: name of the current partition |
107 | * @flags: flags specific to this partition | 115 | * @flags: flags specific to this partition |
116 | * @gpio: gpio mux mode | ||
108 | * @phys: physical address | 117 | * @phys: physical address |
109 | * @size: partition size | 118 | * @size: partition size |
110 | * @base: virtual address after ioremap | 119 | * @base: virtual address after ioremap |
@@ -114,6 +123,7 @@ struct omap_board_data { | |||
114 | struct omap_mux_partition { | 123 | struct omap_mux_partition { |
115 | const char *name; | 124 | const char *name; |
116 | u32 flags; | 125 | u32 flags; |
126 | u32 gpio; | ||
117 | u32 phys; | 127 | u32 phys; |
118 | u32 size; | 128 | u32 size; |
119 | void __iomem *base; | 129 | void __iomem *base; |
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c index c47140bbbec4..c53609f46294 100644 --- a/arch/arm/mach-omap2/mux34xx.c +++ b/arch/arm/mach-omap2/mux34xx.c | |||
@@ -2053,7 +2053,7 @@ int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags) | |||
2053 | return -EINVAL; | 2053 | return -EINVAL; |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | return omap_mux_init("core", 0, | 2056 | return omap_mux_init("core", OMAP_MUX_GPIO_IN_MODE4, |
2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, | 2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, |
2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, | 2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, |
2059 | omap3_muxmodes, package_subset, board_subset, | 2059 | omap3_muxmodes, package_subset, board_subset, |