aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/ti/ti_gpio.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* arm: ti: Remove unused function ti_first_gpio_bankEmmanuel Vadot2020-11-261-16/+0
| | | | Notes: svn path=/head/; revision=368064
* Move Ti AM335x to dev/extres/clk framework.Michal Meloun2020-07-301-14/+68
| | | | | | | | | | | | | | | | | Re-implement clocks for these SoC by using now standard extres/clk framework. This is necessary for future expansion of these. The new implementation is (due to the size of the patch) only the initial (minimum) version. It will be updated/expanded with a subsequent set of particular patches. This patch is also not tested on OMAP4 based boards (BeagleBone), so all possible issues should be (and will be) fixed by ASAP once identified. Submited by: Oskar Holmlund (oskar.holmlund@ohdata.se) Differential Revision: https://reviews.freebsd.org/D25118 Notes: svn path=/head/; revision=363700
* sys/arm: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326258
* Fix ti_gpio_detach() to avoid crashing if something goes wrong.Luiz Otavio O Souza2016-11-151-5/+8
| | | | | | | Sponsored by: Rubicon Communication, LLC (Netgate) Notes: svn path=/head/; revision=308692
* Stop including fdt_common.h from the arm code when it's unneeded.Andrew Turner2016-11-141-1/+0
| | | | | | | Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=308638
* Start to remove the old pre-INTRNG code from the arm platforms. These haveAndrew Turner2016-11-081-296/+0
| | | | | | | | | | | all moved to use INTRNG. Reviewed by: manu, mmel Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D8469 Notes: svn path=/head/; revision=308444
* Return the struct intr_pic pointer from intr_pic_register. This will beAndrew Turner2016-05-181-2/+5
| | | | | | | | | | | needed in later changes where we may not be able to lock the pic list lock to perform a lookup, e.g. from within interrupt context. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=300149
* INTRNG - update gpio pin capabilities according to r299166.Svatopluk Kraus2016-05-081-1/+13
| | | | | | | | | | Note that the updated comment is valid only for INTRNG. This should not be a problem as not INTRNG code is left in place for debugging reasons only and should not be used anymore. It's anticipated that this old code will be removed soon. Notes: svn path=/head/; revision=299228
* INTRNG - support new interrupt mapping type INTR_MAP_DATA_GPIOSvatopluk Kraus2016-05-061-22/+50
| | | | | | | introduced in r298738. Notes: svn path=/head/; revision=299166
* INTRNG - use gpio interrupt modes definitions added in r298738 andSvatopluk Kraus2016-05-061-43/+43
| | | | | | | | implement also GPIO_INTR_EDGE_BOTH mode. All reasonable interrupt modes are supported now. Notes: svn path=/head/; revision=299165
* INTRNG - redefine struct intr_map_data to avoid headers pollution. EachSvatopluk Kraus2016-05-051-3/+7
| | | | | | | | | | | | | | | | | | | struct associated with some type defined in enum intr_map_data_type must have struct intr_map_data on the top of its own definition now. When such structs are used, correct type and size must be filled in. There are three such structs defined in sys/intr.h now. Their definitions should be moved to corresponding headers by follow-up commits. While this change was propagated to all INTRNG like PICs, pic_map_intr() method implementations were corrected on some places. For this specific method, it's ensured by a caller that the 'data' argument passed to this method is never NULL. Also, the return error values were standardized there. Notes: svn path=/head/; revision=299117
* Rename ARM_INTRNG and MIPS_INTRNG to INTRNG. This will help with machineAndrew Turner2016-04-151-8/+8
| | | | | | | | | | independent code that needs to know about INTRNG such as PCI drivers. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=298068
* Rework TI gpio interrupt controller for INTRNG. It's used on PANDABOARDSvatopluk Kraus2016-04-041-11/+329
| | | | | | | | | | and BEAGLEBONE where INTRNG is already enabled by default. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D5806 Notes: svn path=/head/; revision=297541
* Pass correct type of argument to ti_gpio_unmask_irq in ti_gpio_activate_resourceOleksandr Tymoshenko2015-08-031-3/+5
| | | | Notes: svn path=/head/; revision=286214
* Set output pin initial value based on pin's pinmux pullup/pulldown setupOleksandr Tymoshenko2015-08-011-2/+8
| | | | | | | | | | | | | Some of FDT blobs for AM335x-based devices use pinmux pullup/pulldown flag to setup initial GPIO ouputp value, e.g. 4DCAPE-43 sets LCD DATAEN signal this way. It works for Linux because Linux driver does not enforce pin direction until after it's requested by consumer. So input with pullup flag set acts as output with GPIO_HIGH value Reviewed by: loos Notes: svn path=/head/; revision=286165
* Switch TI platform support code from using FreeBSD's custom-baked DTSOleksandr Tymoshenko2015-05-221-221/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | files to vendor-provided ones. It should make easier to adopt platform code to new revisions of hardware and to use DTS overlays for various Beaglebone extensions (shields/capes). Original dts filenames were not changed, they're now wrappers over dts files provided by TI. So make sure you update .dtb files on your devices as part of kernel update GPIO addressing was changed: instead of one global /dev/gpioc0 there are per-bank instances of /dev/gpiocX. Each bank has 32 pins so for instance pin 121 on /dev/gpioc0 in old addressing scheme is now pin 25 on /dev/gpioc3 On Pandaboard serial console devices was changed from /dev/ttyu0 to /dev/ttyu2 so you'll have to update /etc/ttys to get login prompt on serial port in multiuser mode. Single user mode serial console should work as-is Differential Revision: https://reviews.freebsd.org/D2146 Reviewed by: rpaulo, ian, Michal Meloun, Svatopluk Kraus Notes: svn path=/head/; revision=283276
* Fix a bug where an interrupt could be masked unintentionally whenLuiz Otavio O Souza2015-02-041-1/+1
| | | | | | | | | | bus_config_intr() is called with the same interrupt type and polarity that is already set. Pointy hat: loos Notes: svn path=/head/; revision=278216
* Implement GPIO_GET_BUS() method for all GPIO drivers.Luiz Otavio O Souza2015-01-311-6/+19
| | | | | | | | Add helper routines to deal with attach and detach of gpiobus and gpioc devices that are common to all drivers. Notes: svn path=/head/; revision=277996
* Clean up and fix the device detach routine and the failure path on GPIOLuiz Otavio O Souza2015-01-311-16/+12
| | | | | | | | | drivers. This paves the way for upcoming work. Notes: svn path=/head/; revision=277968
* Fix a off-by-one bug.Luiz Otavio O Souza2014-12-271-1/+2
| | | | | | | Pointy hat to: loos Notes: svn path=/head/; revision=276315
* Squelch a (bogus) gcc use-before-init warning.Ian Lepore2014-12-261-0/+1
| | | | Notes: svn path=/head/; revision=276245
* Add interrupt support for GPIO pins on OMAP4 and AM335x.Luiz Otavio O Souza2014-12-251-32/+299
| | | | | | | | | | | | | | | | | | | | This enables the use of GPIO pins as interrupt sources for kernel devices directly attached to gpiobus (userland notification will be added soon). The use of gpio interrupts for other kernel devices will be possible when intrng is complete. All GPIO pins can be set to trigger on: - active-low; - active-high; - rising edge; - falling edge. Tested on: Beaglebone-black Notes: svn path=/head/; revision=276207
* Bring in the last round of updates before adding the interrupt support.Luiz Otavio O Souza2014-12-241-52/+56
| | | | | | | | | | | | | | | | | Fix the following issues: - Removed revision from device softc, it isn't used anywhere else out of device attach routine; - Move the duplicated code for verification of valid banks (and pins) to a single function; - Use some macros to simplify the handling of some constants; - Update some stale comments. Notes: svn path=/head/; revision=276173
* Do not return the total number of available pins but the maximum pin numberLuiz Otavio O Souza2014-12-231-12/+1
| | | | | | | | | we can cope. Previously the returned value could prevent access to some of the pins. Notes: svn path=/head/; revision=276151
* Remove some leftovers from OMAP3 support.Luiz Otavio O Souza2014-12-221-9/+4
| | | | Notes: svn path=/head/; revision=276060
* Simplify the use of locks where possible, remove the locking when it is notLuiz Otavio O Souza2014-12-221-70/+41
| | | | | | | | | | | required. Simplify the code a little bit. Reviewed by: andrew (previous version) Notes: svn path=/head/; revision=276059
* Moves all the duplicate code to a single function.Luiz Otavio O Souza2014-11-181-10/+0
| | | | | | | | Verify for invalid modes and unwanted flags before pass the new flags to driver. Notes: svn path=/head/; revision=274670
* Make the GPIO children attach to the first unit available and not only toLuiz Otavio O Souza2014-10-281-2/+2
| | | | | | | | | | | | unit 0. It seems that this 'simplification' was copied to all GPIO drivers in tree. This fix a bug where a GPIO controller could fail to attach its children (gpioc and gpiobus) if another GPIO driver attach first. Notes: svn path=/head/; revision=273799
* Rework the Ti GPIO code to allow for both the OMAP4 and AM335X attachmentsAndrew Turner2014-10-181-66/+6
| | | | | | | | | | | | to be present. Thsi creates a new per-SoC driver that handles probe and setting/getting the gpio flags. Differential Revision: https://reviews.freebsd.org/D943 Reviewed by: loos, rpaulo MFC after: 1 week Notes: svn path=/head/; revision=273262
* Start removing the omap3 support. In base it was only ever a header and aAndrew Turner2014-10-131-46/+1
| | | | | | | | | | | | | | few changes to drivers, no kernel config was added. As the SoCs are quite old and the code is unmaintained start the process of removing support by deleting the header file and code that depends on it along with the macro SOC_OMAP3. Other Ti SoCs shouldn't be affected, other than for us to have less code to maintain. Differential Revision: https://reviews.freebsd.org/D936 Reviewed by: rpaulo, loos Notes: svn path=/head/; revision=273041
* Rework the Ti GPIO driver to work on multiple SoCs. At the moment it couldAndrew Turner2014-05-261-30/+109
| | | | | | | | | work with OMAP4 and AM335x without needing to recompile. Reviewed by: loos Notes: svn path=/head/; revision=266707
* Partially revert r264083.Luiz Otavio O Souza2014-04-061-15/+2
| | | | | | | | | | | | While it is the recommended initialization procedure, it hangs on the reset of the second GPIO module on pandaboard. Removes the module reset for now as more investigation would be needed. Reported by: jceel Notes: svn path=/head/; revision=264197
* - Fix the setup of interrupts for banks 2 and 3 on AM335x.Luiz Otavio O Souza2014-04-051-16/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | On AM335x each one of the four GPIO banks has two physical interrupt lines, so we now allocate resources and setup our interrupt handler for all the (8) available interrupts. On OMAP3 and OMAP4 there is only one interrupt for each GPIO bank (6 banks, 6 interrupts), but there are two set of registers where the first one is used to setup the delivery of interrupts to the MPU and the second set, setup the delivery of interrupts to the DSP. On AM335x, each set of registers controls each one of the interrupt lines. - Remove nonexistent registers for OMAP4 and AM335x, replace their use with the correct ones for these SoCs. - Remove stray whitespace. Based on OMAP3, OMAP4 and AM335x TRMs. Tested on Beaglebone-black. Notes: svn path=/head/; revision=264153
* Move the GPIO bank initialization to a new function to make easier to detectLuiz Otavio O Souza2014-04-031-57/+128
| | | | | | | | | | | | | | errors. Reset the GPIO module during the initialization. This is guaranteed to be the same as a hardware reset. Tested on AM335x (BBB) and checked against the omap3 and omap4 TRM. Do a better job freeing resources when there are errors and on ti_gpio_detach(). Notes: svn path=/head/; revision=264083
* Fix some of the style(9) problems on ti_gpio. Note that this commit doesLuiz Otavio O Souza2014-04-011-104/+99
| | | | | | | | | | | not fix all the style(9) problems, but will open room for the next commits. Remove redundant code and declarations. No functional changes. Notes: svn path=/head/; revision=264019
* Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio. With thisLuiz Otavio O Souza2014-02-131-0/+12
| | | | | | | | | | | | | | | | change the gpio children can be described as directly connected to the GPIO controller without the need of describing the OFW GPIO bus itself on the DTS file. With this commit the OFW GPIO bus is fully functional on BBB and RPi. GPIO controllers which want to use the OFW GPIO bus will need similar changes. Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=261845
* Follow r261352 by updating all drivers which are children of simplebusIan Lepore2014-02-021-0/+4
| | | | | | | | | | | | | | | | to check the status property in their probe routines. Simplebus used to only instantiate its children whose status="okay" but that was improper behavior, fixed in r261352. Now that it doesn't check anymore and probes all its children; the children all have to do the check because really only the children know how to properly interpret their status property strings. Right now all existing drivers only understand "okay" versus something- that's-not-okay, so they all use the new ofw_bus_status_okay() helper. Notes: svn path=/head/; revision=261410
* Fix the pin value reading on AM335x. Because of the inverted logic it wasLuiz Otavio O Souza2013-12-061-2/+2
| | | | | | | | | | | always returning '0' for all the reads, even for the outputs. It is now known to work with gpioiic(4) and gpioled(4). Approved by: adrian (mentor) Tested on: BBB Notes: svn path=/head/; revision=259037
* Fix typoOleksandr Tymoshenko2013-02-271-1/+1
| | | | Notes: svn path=/head/; revision=247391
* - Initialize GPIO_OE register based on pinmux configurationOleksandr Tymoshenko2013-02-271-0/+14
| | | | | | | | | Although AM335x TRM states that GPIO_OE register is not used and just reflects pads configuration in practice it does control pin behavior and shoiuld be set in addition to pinmux setup Notes: svn path=/head/; revision=247390
* Fix off-by-one error in sanity checksOleksandr Tymoshenko2013-02-251-7/+7
| | | | Notes: svn path=/head/; revision=247259
* - Fix off-by-one error when returning max pin numberOleksandr Tymoshenko2013-02-251-7/+6
| | | | | | | | | - Fix GPIOGET for output pins. Requesting state for output pin is valid operation, get the state from TI_GPIO_DATAOUTX register Notes: svn path=/head/; revision=247252
* Merging of projects/armv6, part 10Oleksandr Tymoshenko2012-08-151-0/+802
- Support for Texas Instruments SoCs: - AM335x - OMAP4 - Kernel configs, DTS for Beaglebone and Pandaboard Submitted by: Ben Gray, Damjan Marion Notes: svn path=/head/; revision=239281