mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 14:59:52 +07:00
aaf9128abc
Update license to use SPDX-License-Identifier instead of verbose license text. Link: http://lkml.kernel.org/r/87in08ct0n.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Cc: Rich Felker <dalias@libc.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* SDK7786 FPGA USRGPIR Support.
|
|
*
|
|
* Copyright (C) 2010 Paul Mundt
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/gpio/driver.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/io.h>
|
|
#include <mach/fpga.h>
|
|
|
|
#define NR_FPGA_GPIOS 8
|
|
|
|
static const char *usrgpir_gpio_names[NR_FPGA_GPIOS] = {
|
|
"in0", "in1", "in2", "in3", "in4", "in5", "in6", "in7",
|
|
};
|
|
|
|
static int usrgpir_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
|
|
{
|
|
/* always in */
|
|
return 0;
|
|
}
|
|
|
|
static int usrgpir_gpio_get(struct gpio_chip *chip, unsigned gpio)
|
|
{
|
|
return !!(fpga_read_reg(USRGPIR) & (1 << gpio));
|
|
}
|
|
|
|
static struct gpio_chip usrgpir_gpio_chip = {
|
|
.label = "sdk7786-fpga",
|
|
.names = usrgpir_gpio_names,
|
|
.direction_input = usrgpir_gpio_direction_input,
|
|
.get = usrgpir_gpio_get,
|
|
.base = -1, /* don't care */
|
|
.ngpio = NR_FPGA_GPIOS,
|
|
};
|
|
|
|
static int __init usrgpir_gpio_setup(void)
|
|
{
|
|
return gpiochip_add_data(&usrgpir_gpio_chip, NULL);
|
|
}
|
|
device_initcall(usrgpir_gpio_setup);
|