Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* linux/include/asm-arm/arch-s3c2410/hardware.h |
| 2 | * |
Ben Dooks | f056076 | 2006-12-17 19:59:20 +0100 | [diff] [blame] | 3 | * Copyright (c) 2003 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #ifndef __ASM_ARCH_HARDWARE_H |
| 14 | #define __ASM_ARCH_HARDWARE_H |
| 15 | |
Arnaud Patard | 431d2cd | 2006-12-27 22:56:44 +0100 | [diff] [blame] | 16 | #ifndef __ASM_HARDWARE_H |
| 17 | #error "Do not include this directly, instead #include <asm/hardware.h>" |
| 18 | #endif |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #ifndef __ASSEMBLY__ |
| 21 | |
| 22 | /* external functions for GPIO support |
| 23 | * |
| 24 | * These allow various different clients to access the same GPIO |
| 25 | * registers without conflicting. If your driver only owns the entire |
| 26 | * GPIO register, then it is safe to ioremap/__raw_{read|write} to it. |
| 27 | */ |
| 28 | |
| 29 | /* s3c2410_gpio_cfgpin |
| 30 | * |
| 31 | * set the configuration of the given pin to the value passed. |
| 32 | * |
| 33 | * eg: |
| 34 | * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0); |
| 35 | * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1); |
| 36 | */ |
| 37 | |
| 38 | extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function); |
| 39 | |
| 40 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); |
| 41 | |
| 42 | /* s3c2410_gpio_getirq |
| 43 | * |
| 44 | * turn the given pin number into the corresponding IRQ number |
| 45 | * |
| 46 | * returns: |
| 47 | * < 0 = no interrupt for this pin |
| 48 | * >=0 = interrupt number for the pin |
| 49 | */ |
| 50 | |
| 51 | extern int s3c2410_gpio_getirq(unsigned int pin); |
| 52 | |
Ben Dooks | c27cb68 | 2008-01-28 13:01:33 +0100 | [diff] [blame] | 53 | /* s3c2410_gpio_irq2pin |
| 54 | * |
| 55 | * turn the given irq number into the corresponding GPIO number |
| 56 | * |
| 57 | * returns: |
| 58 | * < 0 = no pin |
| 59 | * >=0 = gpio pin number |
| 60 | */ |
| 61 | |
| 62 | extern int s3c2410_gpio_irq2pin(unsigned int irq); |
| 63 | |
Lucas Correia Villa Real | 0ca5bc3 | 2006-02-01 21:24:23 +0000 | [diff] [blame] | 64 | #ifdef CONFIG_CPU_S3C2400 |
| 65 | |
| 66 | extern int s3c2400_gpio_getirq(unsigned int pin); |
| 67 | |
| 68 | #endif /* CONFIG_CPU_S3C2400 */ |
| 69 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | /* s3c2410_gpio_irqfilter |
| 71 | * |
| 72 | * set the irq filtering on the given pin |
| 73 | * |
| 74 | * on = 0 => disable filtering |
| 75 | * 1 => enable filtering |
| 76 | * |
| 77 | * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with |
| 78 | * width of filter (0 through 63) |
| 79 | * |
| 80 | * |
| 81 | */ |
| 82 | |
| 83 | extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, |
| 84 | unsigned int config); |
| 85 | |
| 86 | /* s3c2410_gpio_pullup |
| 87 | * |
| 88 | * configure the pull-up control on the given pin |
| 89 | * |
| 90 | * to = 1 => disable the pull-up |
| 91 | * 0 => enable the pull-up |
| 92 | * |
| 93 | * eg; |
| 94 | * |
| 95 | * s3c2410_gpio_pullup(S3C2410_GPB0, 0); |
| 96 | * s3c2410_gpio_pullup(S3C2410_GPE8, 0); |
| 97 | */ |
| 98 | |
| 99 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); |
| 100 | |
Ben Dooks | bb6d9b5 | 2008-01-28 13:01:23 +0100 | [diff] [blame] | 101 | /* s3c2410_gpio_getpull |
| 102 | * |
| 103 | * Read the state of the pull-up on a given pin |
| 104 | * |
| 105 | * return: |
| 106 | * < 0 => error code |
| 107 | * 0 => enabled |
| 108 | * 1 => disabled |
| 109 | */ |
| 110 | |
| 111 | extern int s3c2410_gpio_getpull(unsigned int pin); |
| 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); |
| 114 | |
| 115 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); |
| 116 | |
| 117 | extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg); |
| 118 | |
Ben Dooks | 9153bd7 | 2005-10-13 16:46:35 +0100 | [diff] [blame] | 119 | #ifdef CONFIG_CPU_S3C2440 |
| 120 | |
| 121 | extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); |
| 122 | |
| 123 | #endif /* CONFIG_CPU_S3C2440 */ |
| 124 | |
Ben Dooks | 67d729a | 2008-01-28 13:01:19 +0100 | [diff] [blame] | 125 | #ifdef CONFIG_CPU_S3C2412 |
| 126 | |
| 127 | extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state); |
| 128 | |
| 129 | #endif /* CONFIG_CPU_S3C2412 */ |
Ben Dooks | 9153bd7 | 2005-10-13 16:46:35 +0100 | [diff] [blame] | 130 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | #endif /* __ASSEMBLY__ */ |
| 132 | |
| 133 | #include <asm/sizes.h> |
| 134 | #include <asm/arch/map.h> |
| 135 | |
| 136 | /* machine specific hardware definitions should go after this */ |
| 137 | |
| 138 | /* currently here until moved into config (todo) */ |
| 139 | #define CONFIG_NO_MULTIWORD_IO |
| 140 | |
| 141 | #endif /* __ASM_ARCH_HARDWARE_H */ |