Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame^] | 1 | /* arch/arm/mach-s3c2410/include/mach/hardware.h |
| 2 | * |
| 3 | * Copyright (c) 2003 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
| 5 | * |
| 6 | * S3C2410 - hardware |
| 7 | * |
| 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. |
| 11 | */ |
| 12 | |
| 13 | #ifndef __ASM_ARCH_HARDWARE_H |
| 14 | #define __ASM_ARCH_HARDWARE_H |
| 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | |
| 18 | /* external functions for GPIO support |
| 19 | * |
| 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. |
| 23 | */ |
| 24 | |
| 25 | /* s3c2410_gpio_cfgpin |
| 26 | * |
| 27 | * set the configuration of the given pin to the value passed. |
| 28 | * |
| 29 | * eg: |
| 30 | * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0); |
| 31 | * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1); |
| 32 | */ |
| 33 | |
| 34 | extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function); |
| 35 | |
| 36 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); |
| 37 | |
| 38 | /* s3c2410_gpio_getirq |
| 39 | * |
| 40 | * turn the given pin number into the corresponding IRQ number |
| 41 | * |
| 42 | * returns: |
| 43 | * < 0 = no interrupt for this pin |
| 44 | * >=0 = interrupt number for the pin |
| 45 | */ |
| 46 | |
| 47 | extern int s3c2410_gpio_getirq(unsigned int pin); |
| 48 | |
| 49 | /* s3c2410_gpio_irq2pin |
| 50 | * |
| 51 | * turn the given irq number into the corresponding GPIO number |
| 52 | * |
| 53 | * returns: |
| 54 | * < 0 = no pin |
| 55 | * >=0 = gpio pin number |
| 56 | */ |
| 57 | |
| 58 | extern int s3c2410_gpio_irq2pin(unsigned int irq); |
| 59 | |
| 60 | #ifdef CONFIG_CPU_S3C2400 |
| 61 | |
| 62 | extern int s3c2400_gpio_getirq(unsigned int pin); |
| 63 | |
| 64 | #endif /* CONFIG_CPU_S3C2400 */ |
| 65 | |
| 66 | /* s3c2410_gpio_irqfilter |
| 67 | * |
| 68 | * set the irq filtering on the given pin |
| 69 | * |
| 70 | * on = 0 => disable filtering |
| 71 | * 1 => enable filtering |
| 72 | * |
| 73 | * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with |
| 74 | * width of filter (0 through 63) |
| 75 | * |
| 76 | * |
| 77 | */ |
| 78 | |
| 79 | extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, |
| 80 | unsigned int config); |
| 81 | |
| 82 | /* s3c2410_gpio_pullup |
| 83 | * |
| 84 | * configure the pull-up control on the given pin |
| 85 | * |
| 86 | * to = 1 => disable the pull-up |
| 87 | * 0 => enable the pull-up |
| 88 | * |
| 89 | * eg; |
| 90 | * |
| 91 | * s3c2410_gpio_pullup(S3C2410_GPB0, 0); |
| 92 | * s3c2410_gpio_pullup(S3C2410_GPE8, 0); |
| 93 | */ |
| 94 | |
| 95 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); |
| 96 | |
| 97 | /* s3c2410_gpio_getpull |
| 98 | * |
| 99 | * Read the state of the pull-up on a given pin |
| 100 | * |
| 101 | * return: |
| 102 | * < 0 => error code |
| 103 | * 0 => enabled |
| 104 | * 1 => disabled |
| 105 | */ |
| 106 | |
| 107 | extern int s3c2410_gpio_getpull(unsigned int pin); |
| 108 | |
| 109 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); |
| 110 | |
| 111 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); |
| 112 | |
| 113 | extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); |
| 114 | |
| 115 | #ifdef CONFIG_CPU_S3C2440 |
| 116 | |
| 117 | extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); |
| 118 | |
| 119 | #endif /* CONFIG_CPU_S3C2440 */ |
| 120 | |
| 121 | #ifdef CONFIG_CPU_S3C2412 |
| 122 | |
| 123 | extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state); |
| 124 | |
| 125 | #endif /* CONFIG_CPU_S3C2412 */ |
| 126 | |
| 127 | #endif /* __ASSEMBLY__ */ |
| 128 | |
| 129 | #include <asm/sizes.h> |
| 130 | #include <mach/map.h> |
| 131 | |
| 132 | /* machine specific hardware definitions should go after this */ |
| 133 | |
| 134 | /* currently here until moved into config (todo) */ |
| 135 | #define CONFIG_NO_MULTIWORD_IO |
| 136 | |
| 137 | #endif /* __ASM_ARCH_HARDWARE_H */ |