aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/bfin_gpio.c
Commit message (Collapse)AuthorAgeFilesLines
* Blackfin: bf54x: fix GPIO resume codeMike Frysinger2011-07-231-2/+2
| | | | | | | | | Back in commit c03c2a87347b849ec927d, we fixed logic in the non-bf54x GPIO resume code to set the data levels properly before the direction to avoid spurious line glitches. But we missed the bf54x code paths. So add the same fix there. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: bf538: pull gpio/port logic out of core hibernate pathsMike Frysinger2011-07-231-0/+22
| | | | | | | | Re-architect how we save/restore the gpio/port logic that only pertains to bf538/bf539 parts by pulling it out of the core code paths and pushing it out to bf538-specific locations. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: switch /proc/gpio to seq_fileAlexey Dobriyan2011-05-251-11/+20
| | | | | | | ->read_proc interface is going away, switch to seq_file. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: bf537: demux port H mask A and emac rx intsMike Frysinger2011-05-251-1/+1
| | | | | | | | | | | The BF537 SIC combines the gpio port H mask A interrupts with the emac rx interrupt, so we need to demux this in software. It also combines the gpio port H mask B and the emac tx interrupts, and the watchdog and port F mask B interrupts, but since we don't support mask B yet, just add the defines for now. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: move internal irq prototypes out of global namespaceMike Frysinger2011-05-251-0/+1
| | | | | | | | These are only used in a few internal Blackfin places, so move the irq prototypes out of the global header and into the internal irq one. No functional changes other than shuffling locales. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: gpio: add peripheral group checksteven miao2010-10-221-67/+118
| | | | | | | | | | | | | | | | | | | | Many Blackfin parts group sets of pins into a single functional unit. This means you cannot use different pins within a group for different peripherals. Our resource conflict checking thus far has been limited to individual pins, so if someone tried to grab a different pin from the same group, it would be allowed while silently changing the other pins in the same group. One common example is the pin set PG12 - PG15 on BF51x parts. They may either be used with SPI0 (1st function), or they may be used with PTP/PWM/AMS3 (3rd function). Ideally, we'd like to use PG12 - PG14 for SPI0 while using PG15 with AMS3, but the hardware does not permit this. In the past, the software would allow the pins to be requested this way, but ultimately things like the Blackfin SPI driver would stop working when the hardware rerouted to a different peripheral. Signed-off-by: steven miao <realmz6@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: Rename IRQ flags handling functionsDavid Howells2010-10-071-51/+51
| | | | | | | | | | | | | | | Rename h/w IRQ flags handling functions to be in line with what is expected for the irq renaming patch. This renames local_*_hw() to hard_local_*() using the following perl command: perl -pi -e 's/local_irq_(restore|enable|disable)_hw/hard_local_irq_\1/ or s/local_irq_save_hw([_a-z]*)[(]flags[)]/flags = hard_local_irq_save\1()/' `find arch/blackfin/ -name "*.[ch]"` and then fixing up asm/irqflags.h manually. Additionally, arch/hard_local_save_flags() and arch/hard_local_irq_save() both return the flags rather than passing it through the argument list. Signed-off-by: David Howells <dhowells@redhat.com>
* Blackfin: portmux: fix peripheral map overflow when requesting pinsMichael Hennerich2010-08-061-1/+1
| | | | | | | | | | | Some processors have groups of pins that aren't an even number of 16. This causes the array size calculation to under count the number of needed entries due to integer truncation. So on the BF51x, while we should have 3 bitmaps (41 / 16), we end up with 2 and pin requests for the 3rd bank end up scribbling over the top of the GPIO IRQ array. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: gpio/portmux: clean up whitespace corruptionMike Frysinger2010-08-061-2/+2
| | | | | | | Random tabs instead of spaces, mixes of the two, and unicode spaces instead of ascii spaces. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: gpio: unify & clean up reserved map handlingMike Frysinger2010-08-061-51/+56
| | | | | | | | The duplicated bit banging logic is getting out of hand, so unify the local API to make management a lot easier. This also makes the code a lot easier to follow. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: punt Blackfin-specific GPIO wakeup APIMichael Hennerich2010-05-211-119/+12
| | | | | | | | | | | This patch removes a custom GPIO wakeup API which allowed GPIOs to act as wakeup sources, which are not configured as Interrupts. This API is a leftover from the time before irq_wake was established. From now on people must use enable_irq_wake(GPIO_IRQx) and the GPIO in question needs to be configured as Interrupt. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: mark gpio lib functions staticJoachim Eastwood2010-03-091-7/+7
| | | | | Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: GPIO: implement to_irq handlerJoachim Eastwood2010-03-091-0/+6
| | | | | | | | This makes it possible to support IRQs coming from off-chip GPIO controllers. Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: gpio: use shorter nameMichael Hennerich2010-03-091-1/+1
| | | | | | | | | The gpio label size is 16 char, but the current code uses a longer name resulting in chopped display. So use a shorter name. Reported-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: bf538: add support for extended GPIO banksMichael Hennerich2009-12-151-0/+97
| | | | | | | | | | | The GPIOs on ports C/D/E on the BF538/BF539 do not behave the same way as the other ports on the part and the same way as all other Blackfin parts. The MMRs are programmed slightly different and they cannot be used to generate interrupts or wakeup a sleeping system. Since these guys don't fit into the existing code, create a simple gpiolib driver for them. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: add some bounds checking to peripheral_requestBarry Song2009-12-151-0/+2
| | | | | | | | | | | The requested peripheral is turned into an index into some state arrays, so make sure the calculated index doesn't exceed the index. This occurs when using bogus pin values or the define headers are screwed up. Now we'll notice right away that something needs fixing instead of trying to track down random memory corruption. Signed-off-by: Barry Song <barry.song@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: mass clean up of copyright/licensing infoRobin Getz2009-10-071-24/+3
| | | | | | | | | | | | | | | | | | Bill Gatliff & David Brownell pointed out we were missing some copyrights, and licensing terms in some of the files in ./arch/blackfin, so this fixes things, and cleans them up. It also removes: - verbose GPL text(refer to the top level ./COPYING file) - file names (you are looking at the file) - bug url (it's in the ./MAINTAINERS file) - "or later" on GPL-2, when we did not have that right It also allows some Blackfin-specific assembly files to be under a BSD like license (for people to use them outside of Linux). Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: remove useless duplicated assignment in gpio codeMichael Hennerich2009-09-161-1/+0
| | | | | Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: fix bugs in GPIO resume codeMichael Hennerich2009-07-161-4/+2
| | | | | | | | | Change the bfin_gpio_pm_hibernate_restore() function to: 1) AND restored DATA with DIR (not OR) to get correct final state 2) Restore DATA before setting DIR to avoid glitches Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: punt useless GPIO init callMike Frysinger2009-06-121-9/+0
| | | | | | This init code existed only to dump a printk(), and not even a useful one. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin: do not error if GPIO IRQ is requested already as GPIOMichael Hennerich2009-06-121-9/+0
| | | | | | | | | Some drivers expect to be able to request both as GPIO and GPIO IRQ, so allow that use case. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Blackfin arch: be less noisy when gets a gpio conflict after kernel has bootedRobin Getz2009-03-291-8/+16
| | | | | | | | | Once the kernel has booted - be less noisy when someone does a modprobe (and gets a gpio conflict). Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: convert BF5{18,27,48}_FAMILY to CONFIG_BF{51,52,54}xMike Frysinger2009-03-281-27/+27
| | | | | | | | | convert BF5{18,27,48}_FAMILY to CONFIG_BF{51,52,54}x as the defines are redundant in these cases Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Fix bug - BF518 port F, G, and H have different mux offset ↵Graf Yang2009-02-041-5/+12
| | | | | | | | | | | compare to BF527 [Mike Frysinger <vapier.adi@gmail.com>: keep the ifdef nest down] Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Fix bug - Run "reboot" hangs bf518-ezbrdSonic Zhang2009-02-041-3/+2
| | | | | | | | | | | | | | [Mike Frysinger <vapier.adi@gmail.com>: - setup P_DEFAULT_BOOT_SPI_CS for every arch based on the default bootrom behavior and convert all our boards to it - revert previous anomaly change ... bf51x is not affected by anomaly 05000353] Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: cleanup bf54x ifdef mess in gpio codeMike Frysinger2009-02-041-345/+202
| | | | | | | | | merge more of the bf54x and !bf54x gpio code together to cut down on #ifdef mess Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: explicit add a might sleep to gpio_freeUwe Kleine-Koenig2009-02-041-0/+2
| | | | | | | | | | | | | | | According to the documentation gpio_free should only be called from task context only. To make this more explicit add a might sleep to all implementations. This patch changes the gpio_free implementations for the blackfin architecture. Signed-off-by: Uwe Kleine-Koenig <ukleinek@strlen.de> Cc: David Brownell <david-b@pacbell.net> Acked-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
* Blackfin arch: reset POLAR setting when acquiring a gpio for the first timeMichael Hennerich2009-02-041-1/+7
| | | | | | | | | | | | | | | | | | | | | when requesting a GPIO for the first time, the POLAR setting is not set to a sane state. this can lead to indeterminate behavior that cannot be resolved without an explicit write to the Blackfin port POLAR register. when requesting a GPIO for the first time via gpio_request(), the POLAR setting for the GPIO in question should be set to sane state. this should occur if the GPIO has not been allocated in any other way. some examples: - when doing something like "request_irq(); gpio_request();" on the same GPIO, the POLAR setting should not be reset. - when doing "gpio_request(); gpio_request();" on the same GPIO, the POLAR setting should be reset only the first time and not the second. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Fix Bug - request lines with peripheral_request_list, but ↵Michael Hennerich2009-02-041-3/+0
| | | | | | | | | | | don't get freed with peripheral_free_list Remove erroneous check_gpio(ident) in peripheral_free() Reported-by: Michael McTernan <mmcternan@airvana.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: merge adeos blackfin part to arch/blackfin/Yi Li2009-01-071-50/+50
| | | | | | | | | | | | | | | | | | [Mike Frysinger <vapier.adi@gmail.com>: - handle bf531/bf532/bf534/bf536 variants in ipipe.h - cleanup IPIPE logic for bfin_set_irq_handler() - cleanup ipipe asm code a bit and add missing ENDPROC() - simplify IPIPE code in trap_c - unify some of the IPIPE code and fix style - simplify DO_IRQ_L1 handling with ipipe code - revert IRQ_SW_INT# addition from ipipe merge - remove duplicate get_{c,s}clk() prototypes ] Signed-off-by: Yi Li <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Allow a gpio pin be requested both as gpio and irq.Graf Yang2009-01-071-6/+76
| | | | | | | | | | | | [Mike Frysinger <vapier.adi@gmail.com>: - use KERN_NOTICE when using gpios as both irq and non rather than KERN_ERR - embedded newlines in printk() does not fly] Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Request the gpio resource when making it as an irq pin, ↵Graf Yang2008-11-181-2/+2
| | | | | | | | avoiding override it. Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Convert Blackfin GPIO driver to use common gpiolib/gpiochip ↵Michael Hennerich2008-11-181-18/+72
| | | | | | | | | | | | infrastructure - This patch adds support for ARCH_WANT_OPTIONAL_GPIOLIB. - It may be changed in future to ARCH_REQUIRE_GPIOLIB. - Change GPIO_BANK_NUM use DIV_ROUND_UP( , ) macro Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: fix bug - gpio_bank() macros messed up bank number caculating ↵Bryan Wu2008-11-181-15/+15
| | | | | | | | | | | | | | | | | | | | with positioning a gpio The whole story: Before BF51x merged, all the MAX_BLACKFIN_GPIOS are integral multiple of GPIO_BANKSIZE (= 16). But BF51x provides MAX_BLACKFIN_GPIOS = 40 which includes 3 banks and the 3rd bank has only 8 GPIO pins. Therefore, gpio_bank() macros is correct when you try to find a GPIO in which bank (GPIO_35 is in bank 2). But on BF51x gpio_bank(MAX_BLACKFIN_GPIOS) only gives out 2 banks instead of 3 banks for some static array initialization. This patch add a new macros gpio_bank_n() and GPIO_BANK_NUM to do bank number caculating and remain the gpio_bank() macros for positioning a gpio in which bank. Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: refine the gpio checkMike Frysinger2008-10-281-5/+5
| | | | | | | | | refine the gpio check in peripheral_request() so that it only checks pins that can be used as both GPIO and a peripheral Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: unify port_setup() to reduce arch differencesMike Frysinger2008-10-281-14/+10
| | | | | | Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: unify peripheral_request() to reduce arch differencesMike Frysinger2008-10-281-78/+11
| | | | | | Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: fix cmp_label() so it doesnt incorrectly accept partial ↵Mike Frysinger2008-10-281-2/+1
| | | | | | | | leading matches Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: unify check_gpio() to reduce arch differencesMike Frysinger2008-10-281-9/+3
| | | | | | Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: add support for Blackfin latest processor family BF51xBryan Wu2008-11-181-11/+11
| | | | | Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: BF538/9 Linux kernel SupportMichael Hennerich2008-11-181-1/+5
| | | | | | | | Add supporing for Blackfin BF538 and BF539 processors. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: fix incorrect limit check for bf54x check_gpioMike Frysinger2008-10-281-1/+1
| | | | | | Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Fix bogus str_ident check in gpio codeMichael Hennerich2008-10-131-5/+2
| | | | | | Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: mark local gpio_error() as staticMike Frysinger2008-10-081-1/+1
| | | | | | Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Functional power management supportMichael Hennerich2008-07-191-6/+112
| | | | | | | | | | Enable: PM_SUSPEND_MEM -> Blackfin Hibernate to SDRAM This feature requires a special bootloader (u-boot) supporting return from hibernate. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* Blackfin arch: Add workaround to read edge triggered GPIOsMichael Hennerich2008-05-171-0/+19
| | | | | | Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* [Blackfin] arch: Allow concurrent use of GPIO and GPIO IRQMichael Hennerich2008-04-241-28/+17
| | | | | | | | | | | The irq setup code no longer calls gpio request and free. This patch also changes the default gpio_free behavior on Blackfin. A freed GPIO keeps it's last state, and is not defaulted back to an input. This is also what all other architectures do. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* [Blackfin] arch: declare list of peripherals as const since we dont modify ↵Mike Frysinger2008-04-241-2/+2
| | | | | | | | the incoming array Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* [Blackfin] arch: Resolve the clash issue of UART defines between blackfin ↵Graf Yang2008-04-241-8/+8
| | | | | | | | | headers and include/linux/serial_reg. Signed-off-by: Graf Yang <graf.yang@analog.com> Cc: Robin Getz <rgetz@blackfin.uclinux.org> Signed-off-by: Bryan Wu <cooloney@kernel.org>
* [Blackfin] arch: __FUNCTION__ is gcc-specific, use __func__Harvey Harrison2008-04-231-4/+4
| | | | | | | | | | Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bryan Wu <cooloney@kernel.org>