aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/bfin_gpio.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-03-16arch: remove blackfin portArnd Bergmann1-1208/+0
The Analog Devices Blackfin port was added in 2007 and was rather active for a while, but all work on it has come to a standstill over time, as Analog have changed their product line-up. Aaron Wu confirmed that the architecture port is no longer relevant, and multiple people suggested removing blackfin independently because of some of its oddities like a non-working SMP port, and the amount of duplication between the chip variants, which cause extra work when doing cross-architecture changes. Link: https://docs.blackfin.uclinux.org/ Acked-by: Aaron Wu <Aaron.Wu@analog.com> Acked-by: Bryan Wu <cooloney@gmail.com> Cc: Steven Miao <realmz6@gmail.com> Cc: Mike Frysinger <vapier@chromium.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2017-10-19blackfin: Fix local <asm/gpio.h> includesLinus Walleij1-0/+3
When making the pin control submenu globally visible, all kinds of oddities appear, in blackfin a few files were #including <linux/gpio.h> and relying on that to pull in <asm/gpio.h>. This was not working when pin control but not GPIOLIB was selected resulting in a breakage in allmodconfig. The code these files were using was still there and defined in <asm/gpio.h> just not pulle in from just including <linux/gpio.h> Simply add the required includes explicitly in the blackfin kernel core and everything compiles fine. Delete the use of the incorrect <linux/gpio.h> where possible. Add stubs to <asm/gpio.h> for the functions called from PM: these should probably also depend on !PINCTRL but since the global CONFIG_PM symbol is used to compile PM support, we need some more intrusive thing here, to be tested by Blackfin maintainers. Cc: Steven Miao <realmz6@gmail.com> Cc: Huanhuan Feng <huanhuan.feng@analog.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19blackfin: gpio: switch to gpiochip_add_data()Linus Walleij1-1/+3
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: Sonic Zhang <sonic.zhang@analog.com> Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-01-25blackfin: gpio: Be sure to clamp return valueLinus Walleij1-1/+1
As we want gpio_chip .get() calls to be able to return negative error codes and propagate to drivers, we need to go over all drivers and make sure their return values are clamped to [0,1]. We do this by using the ret = !!(val) design pattern. Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-11-15blackfin: adi gpio driver and pinctrl driver supportSonic Zhang1-134/+4
Remove gpio driver for new gpio controller on BF54x and BF60x. Build the bfin_gpio driver only when other BF5xx processors are selected. Replace the prefix of some gpio and peripheral functions with adi. add portmux platform data in machine portmux.h Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Steven Miao <realmz6@gmail.com>
2013-11-15Blackfin: bfin_gpio: Use proper mask for comparing pfuncSonic Zhang1-9/+14
For BF537_FAMILY, when offset != 1, the mask is 1. Thus add proper mask for comparing pfunc with function. Also has small refactor for better readability. In portmux_setup(), it looks odd having "pmux &= ~(3 << 1);" while in current code we do pmux |= (function << offset);. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
2012-10-08Blackfin: bfin_gpio: proc: fix return valueSteven Miao1-2/+2
Signed-off-by: Steven Miao <realmz6@gmail.com> Signed-off-by: Bob Liu <lliubbo@gmail.com>
2012-05-21bfin_gpio: fix bf548-ezkit kernel fail to bootSteven Miao1-1/+2
Fix bf548-ezkit kernel fail to boot when request peripheral pins. Signed-off-by: Steven Miao <realmz6@gmail.com> Signed-off-by: Bob Liu <lliubbo@gmail.com>
2012-05-21blackfin: add bf60x to current frameworkBob Liu1-13/+14
This patch added bf60x to current blackfin kernel framework. Signed-off-by: Bob Liu <lliubbo@gmail.com>
2011-07-23Blackfin: bf54x: fix GPIO resume codeMike Frysinger1-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>
2011-07-23Blackfin: bf538: pull gpio/port logic out of core hibernate pathsMike Frysinger1-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>
2011-05-25Blackfin: switch /proc/gpio to seq_fileAlexey Dobriyan1-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>
2011-05-25Blackfin: bf537: demux port H mask A and emac rx intsMike Frysinger1-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>
2011-05-25Blackfin: move internal irq prototypes out of global namespaceMike Frysinger1-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>
2010-10-22Blackfin: gpio: add peripheral group checksteven miao1-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>
2010-10-07Blackfin: Rename IRQ flags handling functionsDavid Howells1-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>
2010-08-06Blackfin: portmux: fix peripheral map overflow when requesting pinsMichael Hennerich1-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>
2010-08-06Blackfin: gpio/portmux: clean up whitespace corruptionMike Frysinger1-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>
2010-08-06Blackfin: gpio: unify & clean up reserved map handlingMike Frysinger1-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>
2010-05-21Blackfin: punt Blackfin-specific GPIO wakeup APIMichael Hennerich1-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>
2010-03-09Blackfin: mark gpio lib functions staticJoachim Eastwood1-7/+7
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-03-09Blackfin: GPIO: implement to_irq handlerJoachim Eastwood1-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>
2010-03-09Blackfin: gpio: use shorter nameMichael Hennerich1-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>
2009-12-15Blackfin: bf538: add support for extended GPIO banksMichael Hennerich1-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>
2009-12-15Blackfin: add some bounds checking to peripheral_requestBarry Song1-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>
2009-10-07Blackfin: mass clean up of copyright/licensing infoRobin Getz1-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>
2009-09-16Blackfin: remove useless duplicated assignment in gpio codeMichael Hennerich1-1/+0
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-16Blackfin: fix bugs in GPIO resume codeMichael Hennerich1-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>
2009-06-12Blackfin: punt useless GPIO init callMike Frysinger1-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>
2009-06-12Blackfin: do not error if GPIO IRQ is requested already as GPIOMichael Hennerich1-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>
2009-03-29Blackfin arch: be less noisy when gets a gpio conflict after kernel has bootedRobin Getz1-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>
2009-03-28Blackfin arch: convert BF5{18,27,48}_FAMILY to CONFIG_BF{51,52,54}xMike Frysinger1-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>
2009-02-04Blackfin arch: Fix bug - BF518 port F, G, and H have different mux offset compare to BF527Graf Yang1-5/+12
[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>
2009-02-04Blackfin arch: Fix bug - Run "reboot" hangs bf518-ezbrdSonic Zhang1-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>
2009-02-04Blackfin arch: cleanup bf54x ifdef mess in gpio codeMike Frysinger1-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>
2009-02-04Blackfin arch: explicit add a might sleep to gpio_freeUwe Kleine-Koenig1-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>
2009-02-04Blackfin arch: reset POLAR setting when acquiring a gpio for the first timeMichael Hennerich1-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>
2009-02-04Blackfin arch: Fix Bug - request lines with peripheral_request_list, but don't get freed with peripheral_free_listMichael Hennerich1-3/+0
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>
2009-01-07Blackfin arch: merge adeos blackfin part to arch/blackfin/Yi Li1-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>
2009-01-07Blackfin arch: Allow a gpio pin be requested both as gpio and irq.Graf Yang1-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>
2008-11-18Blackfin arch: Request the gpio resource when making it as an irq pin, avoiding override it.Graf Yang1-2/+2
Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-11-18Blackfin arch: Convert Blackfin GPIO driver to use common gpiolib/gpiochip infrastructureMichael Hennerich1-18/+72
- 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>
2008-11-18Blackfin arch: fix bug - gpio_bank() macros messed up bank number caculating with positioning a gpioBryan Wu1-15/+15
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>
2008-10-28Blackfin arch: refine the gpio checkMike Frysinger1-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>
2008-10-28Blackfin arch: unify port_setup() to reduce arch differencesMike Frysinger1-14/+10
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-10-28Blackfin arch: unify peripheral_request() to reduce arch differencesMike Frysinger1-78/+11
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-10-28Blackfin arch: fix cmp_label() so it doesnt incorrectly accept partial leading matchesMike Frysinger1-2/+1
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-10-28Blackfin arch: unify check_gpio() to reduce arch differencesMike Frysinger1-9/+3
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-11-18Blackfin arch: add support for Blackfin latest processor family BF51xBryan Wu1-11/+11
Signed-off-by: Bryan Wu <cooloney@kernel.org>
2008-11-18Blackfin arch: BF538/9 Linux kernel SupportMichael Hennerich1-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>