Hi Marcin,

On Mon, 25 May 2020 14:55:37 +0000 (UTC)
Marcin Wojtas <m...@freebsd.org> wrote:

> Author: mw
> Date: Mon May 25 14:55:37 2020
> New Revision: 361460
> URL: https://svnweb.freebsd.org/changeset/base/361460
> 
> Log:
>   Add GPIO support for QorIQ boards.
>   
>   This patch adds a GPIO controller support targeted for NXP LS1046A
>   SoC. The driver implements the following features:
>    * setting direction of each pin (IN or OUT)
>    * setting the mode of output pins (PUSHPULL or OPENDRAIN)
>    * setting the state of each output pin (1 or 0)
>    * reading the state of each input pin (1 or 0)
>   
>   Submitted by: Kamil Koczurek <k...@semihalf.com>
>                 Dawid Gorecki <d...@semihalf.com>
>   Reviewed by: manu
>   Obtained from: Semihalf
>   Sponsored by: Alstom Group
>   Differential Revision: https://reviews.freebsd.org/D24353
> 
> Added:
>   head/sys/arm64/qoriq/ls1046_gpio.c   (contents, props changed)
> Modified:
>   head/sys/arm64/conf/GENERIC
>   head/sys/conf/files.arm64
> 
> Modified: head/sys/arm64/conf/GENERIC
> ==============================================================================
> --- head/sys/arm64/conf/GENERIC       Mon May 25 14:45:18
> 2020  (r361459) +++ head/sys/arm64/conf/GENERIC       Mon May
> 25 14:55:37 2020      (r361460) @@ -248,6 +248,7 @@ device
>       gpio device             gpioled
>  device               fdt_pinctrl
>  device               gpioregulator
> +device               ls1046_gpio     # LS1046A GPIO controller
>  device               mv_gpio         # Marvell GPIO
> controller device             mvebu_pinctrl   # Marvell
> Pinmux Controller device              rk_gpio         #
> RockChip GPIO Controller
> 
> Added: head/sys/arm64/qoriq/ls1046_gpio.c
> ==============================================================================
> --- /dev/null 00:00:00 1970   (empty, because file is
> newly added) +++ head/sys/arm64/qoriq/ls1046_gpio.c   Mon May 25
> 14:55:37 2020 (r361460) @@ -0,0 +1,586 @@
> +/*-
> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> + *
> + * Copyright (c) 2020 Alstom Group.
> + * Copyright (c) 2020 Semihalf.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above
> copyright
> + *    notice, this list of conditions and the following disclaimer
> in the
> + *    documentation and/or other materials provided with the
> distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS
> IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
> THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
> LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
> ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#include <sys/cdefs.h>
> +__FBSDID("$FreeBSD$");
> +
> +#include <sys/param.h>
> +
> +#include <sys/bus.h>
> +#include <sys/endian.h>
> +#include <sys/gpio.h>
> +#include <sys/kernel.h>
> +#include <sys/module.h>
> +#include <sys/mutex.h>
> +
> +#include <dev/gpio/gpiobusvar.h>
> +#include <dev/ofw/ofw_bus.h>
> +#include <machine/bus.h>
> +
> +#include "gpio_if.h"
> +
> +/* constants */
> +enum {
> +     DIRECTION  = 0x0,
> +     OPEN_DRAIN = 0x4,
> +     DATA       = 0x8,
> +     INT_EV     = 0xC,
> +     INT_MASK   = 0x10,
> +     INT_CTRL   = 0x14
> +};

This looks a lot like the GPIO module whose driver is in
sys/powerpc/mpc85xx/qoriq_gpio.c.  Is there any difference in hardware?
 If not, can you merge this driver with that, if there's anything to
 merge, to reduce duplication?

- Justin
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to