aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@openedhand.com>2008-06-20 05:09:51 -0400
committerSamuel Ortiz <samuel@sortiz.org>2008-07-20 13:55:00 -0400
commit3b26bf17226f66bfd6cd4e36ac81f83fe994043a (patch)
treef619c0570a31cbb0cdd2e3c148bd66bb962b7b74 /include/linux/mfd
parent1effe5bc6cfbac4506d7944d68dadbd29ad62645 (diff)
mfd: New asic3 gpio configuration code
The ASIC3 GPIO configuration code is a bit obscure and hardly readable. This patch changes it so that it is now more readable and understandable, by being more explicit. Signed-off-by: Samuel Ortiz <sameo@openedhand.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/asic3.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index b1c365800ab5..7e47cfb0c440 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -8,7 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * Copyright 2001 Compaq Computer Corporation. 10 * Copyright 2001 Compaq Computer Corporation.
11 * Copyright 2007 OpendHand. 11 * Copyright 2007-2008 OpenedHand Ltd.
12 */ 12 */
13 13
14#ifndef __ASIC3_H__ 14#ifndef __ASIC3_H__
@@ -17,15 +17,8 @@
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19struct asic3_platform_data { 19struct asic3_platform_data {
20 struct { 20 u16 *gpio_config;
21 u32 dir; 21 unsigned int gpio_config_num;
22 u32 init;
23 u32 sleep_mask;
24 u32 sleep_out;
25 u32 batt_fault_out;
26 u32 sleep_conf;
27 u32 alt_function;
28 } gpio_a, gpio_b, gpio_c, gpio_d;
29 22
30 unsigned int bus_shift; 23 unsigned int bus_shift;
31 24
@@ -86,6 +79,27 @@ struct asic3_platform_data {
86 */ 79 */
87#define ASIC3_GPIO_Status 0x30 /* R Pin status */ 80#define ASIC3_GPIO_Status 0x30 /* R Pin status */
88 81
82/*
83 * ASIC3 GPIO config
84 *
85 * Bits 0..6 gpio number
86 * Bits 7..13 Alternate function
87 * Bit 14 Direction
88 * Bit 15 Initial value
89 *
90 */
91#define ASIC3_CONFIG_GPIO_PIN(config) ((config) & 0x7f)
92#define ASIC3_CONFIG_GPIO_ALT(config) (((config) & (0x7f << 7)) >> 7)
93#define ASIC3_CONFIG_GPIO_DIR(config) ((config & (1 << 14)) >> 14)
94#define ASIC3_CONFIG_GPIO_INIT(config) ((config & (1 << 15)) >> 15)
95#define ASIC3_CONFIG_GPIO(gpio, alt, dir, init) (((gpio) & 0x7f) \
96 | (((alt) & 0x7f) << 7) | (((dir) & 0x1) << 14) \
97 | (((init) & 0x1) << 15))
98#define ASIC3_CONFIG_GPIO_DEFAULT(gpio, dir, init) \
99 ASIC3_CONFIG_GPIO((gpio), 0, (dir), (init))
100#define ASIC3_CONFIG_GPIO_DEFAULT_OUT(gpio, init) \
101 ASIC3_CONFIG_GPIO((gpio), 0, 1, (init))
102
89#define ASIC3_SPI_Base 0x0400 103#define ASIC3_SPI_Base 0x0400
90#define ASIC3_SPI_Control 0x0000 104#define ASIC3_SPI_Control 0x0000
91#define ASIC3_SPI_TxData 0x0004 105#define ASIC3_SPI_TxData 0x0004