Commit Graph

26 Commits

Author SHA1 Message Date
Andriy Gapon
2559473944 follow-up to r336635, update TAILQ to CK_SLIST for ie_handlers
arm, mips and sparc64 were affected.
2018-07-23 15:36:55 +00:00
Marcin Wojtas
2a94dbf567 Replace FDT tree parsing with gpio_map_gpios implementation in mv_gpio driver
This patch replaces in-driver FDT parsing, which was
needed for setting initial values on GPIO pins.
Now FDT is parsed by generic kernel code, pins are set
by invoking gpio_map_gpios method.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14757
2018-04-26 19:10:18 +00:00
Marcin Wojtas
ded9da6832 Update mv_gpio driver to new FreeBSD API
This patch implements and exports functions described
in gpio_if.m file. It also uses new gpiobus_attach_bus function
instead of adding gpioc and gpiobus as children. It removes
ulgy reading SoC ID and related if..else, so it depends only on
data read from FDT.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14756
2018-04-26 19:00:48 +00:00
Marcin Wojtas
edf9ef7384 Enable Marvell gpio driver to work with many controllers
This patch moves all global data structures into mv_gpio_softc,
and puts device_t parameter to functions calls everywhere where needed.
As a result, we can create multiple driver instances.

Removed names in function declaration to keep style.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14755
2018-04-04 13:20:29 +00:00
Marcin Wojtas
ad2be10ff0 Improve interrupt and resource allocation in Marvell GPIO driver
This patch adds support for more than one interrupts
in GPIO controller. It reads necessary information (such as cell size)
from FDT, so there are no magic numbers.

Note that interrupts are still not working, but this patch makes
one good step in correct direction

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14754
2018-04-04 13:12:49 +00:00
Marcin Wojtas
1c45bd112b Introduce port debouncing mechanism in mv_gpio driver
This patch introduces gpio debouncing mechanism
with fixed memory allocation in critical section.

When you press button, value at gpio pin connected to button
is changing many times which will cause in unexpected behaviour.
Debouncing mechanism will prevent this phenomenon

Submitted by: Patryk Duda <pdk@semihalf.com>
	      Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D14753
2018-04-04 13:08:51 +00:00
Pedro F. Giffuni
af3dc4a7ca sys/arm: further adoption of SPDX licensing ID tags.
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.
2017-11-27 15:04:10 +00:00
Andrew Turner
9783ea5c9f Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
integer data from the device tree.

Sponsored by:	ABT Systems Ltd
2016-11-14 12:03:08 +00:00
Andrew Turner
87acb7f815 Use the modern spelling of ofw_bus_node_is_compatible in sys/arm.
Sponsored by:	ABT Systems Ltd
2016-11-11 15:13:30 +00:00
Andrew Turner
ff3b52bb19 Stop using machine/fdt.h in the arm kernel code when we don't need it. 2015-04-04 21:34:26 +00:00
Ian Lepore
752ba93078 Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with:	nwhitehorn
2014-09-01 18:51:01 +00:00
Andrew Turner
87ef4d1f85 Rename platform_gpio_init to be platform specific, and make it static as
it's only used from this file.
2014-05-10 20:31:05 +00:00
Ian Lepore
add35ed5b8 Follow r261352 by updating all drivers which are children of simplebus
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.
2014-02-02 19:17:28 +00:00
Nathan Whitehorn
e3bb91c23f Typo while reviewing diffs. Sorry for the breakage! 2013-10-23 19:56:13 +00:00
Nathan Whitehorn
755c959170 Remove OF_instance_to_package() hack for FDT and replace with use of the
generic OF_xref_phandle() API universally. Also replace some related
explicit uses of fdt32_to_cpu() with OF_getencprop() calls.
2013-10-23 14:04:09 +00:00
Hiroki Sato
d542454787 Fix a bug that could fail to initialize GPIO pins specified in "gpios" because
"gpio-controller" property at the controller node was always ignored.
2012-08-18 11:33:21 +00:00
Hiroki Sato
c8953e1273 Add support for Marvell 88F6282.
Sponsored by:	Plat'Home, Co.,Ltd.
2012-07-28 21:56:24 +00:00
Marcel Moolenaar
cb06595948 Do not call platform_gpio_init() early. It doesn't work because we do
not have enough information to reliably setup GPIO pins. Do it when
we attach the gpio driver. This prevents hangs and the need to fake
up a softc.
2011-07-15 02:29:10 +00:00
Marcel Moolenaar
e4623c22fe Fix mv_gpio_in() for pin numbers that occupy bits 8-31 in GPIO registers.
The compiler will truncate the 32-bit return value of mv_gpio_value_get()
to match the 8-bit return value of mv_gpio_in(). A conditional expression
is used to have mv_gpio_in() always return 0 or 1 instead.
2011-03-16 00:42:15 +00:00
Marcel Moolenaar
0d838e9ed0 Remove use_high from the softc and simply check the number of GPIO
pins to determine whether there's a high register set or not. This
allows platform_gpio_init() to work without duplicating the work
done in the attach method.
2011-02-07 05:36:32 +00:00
John Baldwin
31e55059be - Add a proper return value to mv_gpio_intr().
- Remove an obsolete use of INTR_FAST.
2011-01-06 21:03:55 +00:00
Rafal Jaworowski
db5ef4fc77 Convert Marvell ARM platforms to FDT convention.
The following systems are involved:

  - DB-88F5182
  - DB-88F5281
  - DB-88F6281
  - DB-78100
  - SheevaPlug

This overhaul covers the following major changes:

  - All integrated peripherals drivers for Marvell ARM SoC, which are
    currently in the FreeBSD source tree are reworked and adjusted so they
    derive config data out of the device tree blob (instead of hard coded /
    tabelarized values).

  - Since the common FDT infrastrucutre (fdtbus, simplebus) is used we say
    good by to obio / mbus drivers and numerous hard-coded config data.

Note that world needs to be built WITH_FDT for the affected platforms.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation.
2010-06-13 13:28:53 +00:00
Rafal Jaworowski
bc26e2e38f Adjust Marvell Discovery (MV78xxx) support to recognize newest chip revisions,
handle Z0 revision (early silicon) explicitly due to its quirks.

Obtained from:	Marvell, Semihalf
2009-04-16 11:20:18 +00:00
Rafal Jaworowski
673c4fe419 Improve and extend Marvell SOCs platform code.
- Allow for setting per platform MPP/GPIO configuration in the kernel, so
  that we can override all settings firmware might set.

- Set decode windows for the remaining on-chip peripherals: CESA, SATA and XOR.

- Improve handling of USB controllers so that all port are available on the
  given SOC/platform (e.g. up to three on DB-78xxx), this includes rework of
  USB decode windows set-up.

- Other minor fixes and cosmetics.

Obtained from:	Semihalf
2009-01-08 18:31:43 +00:00
Rafal Jaworowski
aba47c3f81 Minor style(9) corrections. 2009-01-08 13:25:22 +00:00
Rafal Jaworowski
373bbe25ff Introduce basic support for Marvell families of system-on-chip ARM devices:
*  Orion
     - 88F5181
     - 88F5182
     - 88F5281

  * Kirkwood
     - 88F6281

  * Discovery
     - MV78100

The above families of SOCs are built around CPU cores compliant with ARMv5TE
instruction set architecture definition. They share a number of integrated
peripherals. This commit brings support for the following basic elements:

  * GPIO
  * Interrupt controller
  * L1, L2 cache
  * Timers, watchdog, RTC
  * TWSI (I2C)
  * UART

Other peripherals drivers will be introduced separately.

Reviewed by:	imp, marcel, stass (Thanks guys!)
Obtained from:	Marvell, Semihalf
2008-10-13 20:07:13 +00:00