MERGE-master-patchset-edits
[linux-2.6/openmoko-kernel.git] / arch / arm / mach-s3c2410 / include / mach / hardware.h
blobdb72beb61d7c98bf0219bbbadfab22e8ca272d3b
1 /* arch/arm/mach-s3c2410/include/mach/hardware.h
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2410 - hardware
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __ASM_ARCH_HARDWARE_H
14 #define __ASM_ARCH_HARDWARE_H
16 #ifndef __ASSEMBLY__
18 /* external functions for GPIO support
20 * These allow various different clients to access the same GPIO
21 * registers without conflicting. If your driver only owns the entire
22 * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
25 /* s3c2410_gpio_cfgpin
27 * set the configuration of the given pin to the value passed.
29 * eg:
30 * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);
31 * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);
34 extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);
36 extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
38 /* s3c2410_gpio_getirq
40 * turn the given pin number into the corresponding IRQ number
42 * returns:
43 * < 0 = no interrupt for this pin
44 * >=0 = interrupt number for the pin
47 extern int s3c2410_gpio_getirq(unsigned int pin);
49 /* s3c2410_gpio_irq2pin
51 * turn the given irq number into the corresponding GPIO number
53 * returns:
54 * < 0 = no pin
55 * >=0 = gpio pin number
58 extern int s3c2410_gpio_irq2pin(unsigned int irq);
60 #ifdef CONFIG_CPU_S3C2400
62 extern int s3c2400_gpio_getirq(unsigned int pin);
64 #endif /* CONFIG_CPU_S3C2400 */
66 /* s3c2410_gpio_irqfilter
68 * set the irq filtering on the given pin
70 * on = 0 => disable filtering
71 * 1 => enable filtering
73 * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
74 * width of filter (0 through 63)
79 extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
80 unsigned int config);
82 /* s3c2410_gpio_pullup
84 * configure the pull-up control on the given pin
86 * to = 1 => disable the pull-up
87 * 0 => enable the pull-up
89 * eg;
91 * s3c2410_gpio_pullup(S3C2410_GPB0, 0);
92 * s3c2410_gpio_pullup(S3C2410_GPE8, 0);
95 extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
97 /* s3c2410_gpio_getpull
99 * Read the state of the pull-up on a given pin
101 * return:
102 * < 0 => error code
103 * 0 => enabled
104 * 1 => disabled
107 extern int s3c2410_gpio_getpull(unsigned int pin);
109 extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
111 extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
113 extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
115 #ifdef CONFIG_CPU_S3C2440
117 extern int s3c2440_set_dsc(unsigned int pin, unsigned int value);
119 #endif /* CONFIG_CPU_S3C2440 */
121 #ifdef CONFIG_CPU_S3C2412
123 extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state);
125 #endif /* CONFIG_CPU_S3C2412 */
127 #endif /* __ASSEMBLY__ */
129 #include <asm/sizes.h>
130 #include <mach/map.h>
132 /* machine specific hardware definitions should go after this */
134 #endif /* __ASM_ARCH_HARDWARE_H */