mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 16:54:20 +08:00
b24413180f
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
476 lines
11 KiB
C
476 lines
11 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/gpio/driver.h>
|
|
#include <linux/of_gpio.h>
|
|
#include <linux/io.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
#define ETRAX_FS_rw_pa_dout 0
|
|
#define ETRAX_FS_r_pa_din 4
|
|
#define ETRAX_FS_rw_pa_oe 8
|
|
#define ETRAX_FS_rw_intr_cfg 12
|
|
#define ETRAX_FS_rw_intr_mask 16
|
|
#define ETRAX_FS_rw_ack_intr 20
|
|
#define ETRAX_FS_r_intr 24
|
|
#define ETRAX_FS_r_masked_intr 28
|
|
#define ETRAX_FS_rw_pb_dout 32
|
|
#define ETRAX_FS_r_pb_din 36
|
|
#define ETRAX_FS_rw_pb_oe 40
|
|
#define ETRAX_FS_rw_pc_dout 48
|
|
#define ETRAX_FS_r_pc_din 52
|
|
#define ETRAX_FS_rw_pc_oe 56
|
|
#define ETRAX_FS_rw_pd_dout 64
|
|
#define ETRAX_FS_r_pd_din 68
|
|
#define ETRAX_FS_rw_pd_oe 72
|
|
#define ETRAX_FS_rw_pe_dout 80
|
|
#define ETRAX_FS_r_pe_din 84
|
|
#define ETRAX_FS_rw_pe_oe 88
|
|
|
|
#define ARTPEC3_r_pa_din 0
|
|
#define ARTPEC3_rw_pa_dout 4
|
|
#define ARTPEC3_rw_pa_oe 8
|
|
#define ARTPEC3_r_pb_din 44
|
|
#define ARTPEC3_rw_pb_dout 48
|
|
#define ARTPEC3_rw_pb_oe 52
|
|
#define ARTPEC3_r_pc_din 88
|
|
#define ARTPEC3_rw_pc_dout 92
|
|
#define ARTPEC3_rw_pc_oe 96
|
|
#define ARTPEC3_r_pd_din 116
|
|
#define ARTPEC3_rw_intr_cfg 120
|
|
#define ARTPEC3_rw_intr_pins 124
|
|
#define ARTPEC3_rw_intr_mask 128
|
|
#define ARTPEC3_rw_ack_intr 132
|
|
#define ARTPEC3_r_masked_intr 140
|
|
|
|
#define GIO_CFG_OFF 0
|
|
#define GIO_CFG_HI 1
|
|
#define GIO_CFG_LO 2
|
|
#define GIO_CFG_SET 3
|
|
#define GIO_CFG_POSEDGE 5
|
|
#define GIO_CFG_NEGEDGE 6
|
|
#define GIO_CFG_ANYEDGE 7
|
|
|
|
struct etraxfs_gpio_info;
|
|
|
|
struct etraxfs_gpio_block {
|
|
raw_spinlock_t lock;
|
|
u32 mask;
|
|
u32 cfg;
|
|
u32 pins;
|
|
unsigned int group[8];
|
|
|
|
void __iomem *regs;
|
|
const struct etraxfs_gpio_info *info;
|
|
};
|
|
|
|
struct etraxfs_gpio_chip {
|
|
struct gpio_chip gc;
|
|
struct etraxfs_gpio_block *block;
|
|
};
|
|
|
|
struct etraxfs_gpio_port {
|
|
const char *label;
|
|
unsigned int oe;
|
|
unsigned int dout;
|
|
unsigned int din;
|
|
unsigned int ngpio;
|
|
};
|
|
|
|
struct etraxfs_gpio_info {
|
|
unsigned int num_ports;
|
|
const struct etraxfs_gpio_port *ports;
|
|
|
|
unsigned int rw_ack_intr;
|
|
unsigned int rw_intr_mask;
|
|
unsigned int rw_intr_cfg;
|
|
unsigned int rw_intr_pins;
|
|
unsigned int r_masked_intr;
|
|
};
|
|
|
|
static const struct etraxfs_gpio_port etraxfs_gpio_etraxfs_ports[] = {
|
|
{
|
|
.label = "A",
|
|
.ngpio = 8,
|
|
.oe = ETRAX_FS_rw_pa_oe,
|
|
.dout = ETRAX_FS_rw_pa_dout,
|
|
.din = ETRAX_FS_r_pa_din,
|
|
},
|
|
{
|
|
.label = "B",
|
|
.ngpio = 18,
|
|
.oe = ETRAX_FS_rw_pb_oe,
|
|
.dout = ETRAX_FS_rw_pb_dout,
|
|
.din = ETRAX_FS_r_pb_din,
|
|
},
|
|
{
|
|
.label = "C",
|
|
.ngpio = 18,
|
|
.oe = ETRAX_FS_rw_pc_oe,
|
|
.dout = ETRAX_FS_rw_pc_dout,
|
|
.din = ETRAX_FS_r_pc_din,
|
|
},
|
|
{
|
|
.label = "D",
|
|
.ngpio = 18,
|
|
.oe = ETRAX_FS_rw_pd_oe,
|
|
.dout = ETRAX_FS_rw_pd_dout,
|
|
.din = ETRAX_FS_r_pd_din,
|
|
},
|
|
{
|
|
.label = "E",
|
|
.ngpio = 18,
|
|
.oe = ETRAX_FS_rw_pe_oe,
|
|
.dout = ETRAX_FS_rw_pe_dout,
|
|
.din = ETRAX_FS_r_pe_din,
|
|
},
|
|
};
|
|
|
|
static const struct etraxfs_gpio_info etraxfs_gpio_etraxfs = {
|
|
.num_ports = ARRAY_SIZE(etraxfs_gpio_etraxfs_ports),
|
|
.ports = etraxfs_gpio_etraxfs_ports,
|
|
.rw_ack_intr = ETRAX_FS_rw_ack_intr,
|
|
.rw_intr_mask = ETRAX_FS_rw_intr_mask,
|
|
.rw_intr_cfg = ETRAX_FS_rw_intr_cfg,
|
|
.r_masked_intr = ETRAX_FS_r_masked_intr,
|
|
};
|
|
|
|
static const struct etraxfs_gpio_port etraxfs_gpio_artpec3_ports[] = {
|
|
{
|
|
.label = "A",
|
|
.ngpio = 32,
|
|
.oe = ARTPEC3_rw_pa_oe,
|
|
.dout = ARTPEC3_rw_pa_dout,
|
|
.din = ARTPEC3_r_pa_din,
|
|
},
|
|
{
|
|
.label = "B",
|
|
.ngpio = 32,
|
|
.oe = ARTPEC3_rw_pb_oe,
|
|
.dout = ARTPEC3_rw_pb_dout,
|
|
.din = ARTPEC3_r_pb_din,
|
|
},
|
|
{
|
|
.label = "C",
|
|
.ngpio = 16,
|
|
.oe = ARTPEC3_rw_pc_oe,
|
|
.dout = ARTPEC3_rw_pc_dout,
|
|
.din = ARTPEC3_r_pc_din,
|
|
},
|
|
{
|
|
.label = "D",
|
|
.ngpio = 32,
|
|
.din = ARTPEC3_r_pd_din,
|
|
},
|
|
};
|
|
|
|
static const struct etraxfs_gpio_info etraxfs_gpio_artpec3 = {
|
|
.num_ports = ARRAY_SIZE(etraxfs_gpio_artpec3_ports),
|
|
.ports = etraxfs_gpio_artpec3_ports,
|
|
.rw_ack_intr = ARTPEC3_rw_ack_intr,
|
|
.rw_intr_mask = ARTPEC3_rw_intr_mask,
|
|
.rw_intr_cfg = ARTPEC3_rw_intr_cfg,
|
|
.r_masked_intr = ARTPEC3_r_masked_intr,
|
|
.rw_intr_pins = ARTPEC3_rw_intr_pins,
|
|
};
|
|
|
|
static unsigned int etraxfs_gpio_chip_to_port(struct gpio_chip *gc)
|
|
{
|
|
return gc->label[0] - 'A';
|
|
}
|
|
|
|
static int etraxfs_gpio_of_xlate(struct gpio_chip *gc,
|
|
const struct of_phandle_args *gpiospec,
|
|
u32 *flags)
|
|
{
|
|
/*
|
|
* Port numbers are A to E, and the properties are integers, so we
|
|
* specify them as 0xA - 0xE.
|
|
*/
|
|
if (etraxfs_gpio_chip_to_port(gc) + 0xA != gpiospec->args[2])
|
|
return -EINVAL;
|
|
|
|
return of_gpio_simple_xlate(gc, gpiospec, flags);
|
|
}
|
|
|
|
static const struct of_device_id etraxfs_gpio_of_table[] = {
|
|
{
|
|
.compatible = "axis,etraxfs-gio",
|
|
.data = &etraxfs_gpio_etraxfs,
|
|
},
|
|
{
|
|
.compatible = "axis,artpec3-gio",
|
|
.data = &etraxfs_gpio_artpec3,
|
|
},
|
|
{},
|
|
};
|
|
|
|
static unsigned int etraxfs_gpio_to_group_irq(unsigned int gpio)
|
|
{
|
|
return gpio % 8;
|
|
}
|
|
|
|
static unsigned int etraxfs_gpio_to_group_pin(struct etraxfs_gpio_chip *chip,
|
|
unsigned int gpio)
|
|
{
|
|
return 4 * etraxfs_gpio_chip_to_port(&chip->gc) + gpio / 8;
|
|
}
|
|
|
|
static void etraxfs_gpio_irq_ack(struct irq_data *d)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
|
|
writel(BIT(grpirq), block->regs + block->info->rw_ack_intr);
|
|
}
|
|
|
|
static void etraxfs_gpio_irq_mask(struct irq_data *d)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
|
|
raw_spin_lock(&block->lock);
|
|
block->mask &= ~BIT(grpirq);
|
|
writel(block->mask, block->regs + block->info->rw_intr_mask);
|
|
raw_spin_unlock(&block->lock);
|
|
}
|
|
|
|
static void etraxfs_gpio_irq_unmask(struct irq_data *d)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
|
|
raw_spin_lock(&block->lock);
|
|
block->mask |= BIT(grpirq);
|
|
writel(block->mask, block->regs + block->info->rw_intr_mask);
|
|
raw_spin_unlock(&block->lock);
|
|
}
|
|
|
|
static int etraxfs_gpio_irq_set_type(struct irq_data *d, u32 type)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
u32 cfg;
|
|
|
|
switch (type) {
|
|
case IRQ_TYPE_EDGE_RISING:
|
|
cfg = GIO_CFG_POSEDGE;
|
|
break;
|
|
case IRQ_TYPE_EDGE_FALLING:
|
|
cfg = GIO_CFG_NEGEDGE;
|
|
break;
|
|
case IRQ_TYPE_EDGE_BOTH:
|
|
cfg = GIO_CFG_ANYEDGE;
|
|
break;
|
|
case IRQ_TYPE_LEVEL_LOW:
|
|
cfg = GIO_CFG_LO;
|
|
break;
|
|
case IRQ_TYPE_LEVEL_HIGH:
|
|
cfg = GIO_CFG_HI;
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
raw_spin_lock(&block->lock);
|
|
block->cfg &= ~(0x7 << (grpirq * 3));
|
|
block->cfg |= (cfg << (grpirq * 3));
|
|
writel(block->cfg, block->regs + block->info->rw_intr_cfg);
|
|
raw_spin_unlock(&block->lock);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int etraxfs_gpio_irq_request_resources(struct irq_data *d)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
int ret = -EBUSY;
|
|
|
|
raw_spin_lock(&block->lock);
|
|
if (block->group[grpirq])
|
|
goto out;
|
|
|
|
ret = gpiochip_lock_as_irq(&chip->gc, d->hwirq);
|
|
if (ret)
|
|
goto out;
|
|
|
|
block->group[grpirq] = d->irq;
|
|
if (block->info->rw_intr_pins) {
|
|
unsigned int pin = etraxfs_gpio_to_group_pin(chip, d->hwirq);
|
|
|
|
block->pins &= ~(0xf << (grpirq * 4));
|
|
block->pins |= (pin << (grpirq * 4));
|
|
|
|
writel(block->pins, block->regs + block->info->rw_intr_pins);
|
|
}
|
|
|
|
out:
|
|
raw_spin_unlock(&block->lock);
|
|
return ret;
|
|
}
|
|
|
|
static void etraxfs_gpio_irq_release_resources(struct irq_data *d)
|
|
{
|
|
struct etraxfs_gpio_chip *chip =
|
|
gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
struct etraxfs_gpio_block *block = chip->block;
|
|
unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
|
|
|
|
raw_spin_lock(&block->lock);
|
|
block->group[grpirq] = 0;
|
|
gpiochip_unlock_as_irq(&chip->gc, d->hwirq);
|
|
raw_spin_unlock(&block->lock);
|
|
}
|
|
|
|
static struct irq_chip etraxfs_gpio_irq_chip = {
|
|
.name = "gpio-etraxfs",
|
|
.irq_ack = etraxfs_gpio_irq_ack,
|
|
.irq_mask = etraxfs_gpio_irq_mask,
|
|
.irq_unmask = etraxfs_gpio_irq_unmask,
|
|
.irq_set_type = etraxfs_gpio_irq_set_type,
|
|
.irq_request_resources = etraxfs_gpio_irq_request_resources,
|
|
.irq_release_resources = etraxfs_gpio_irq_release_resources,
|
|
};
|
|
|
|
static irqreturn_t etraxfs_gpio_interrupt(int irq, void *dev_id)
|
|
{
|
|
struct etraxfs_gpio_block *block = dev_id;
|
|
unsigned long intr = readl(block->regs + block->info->r_masked_intr);
|
|
int bit;
|
|
|
|
for_each_set_bit(bit, &intr, 8)
|
|
generic_handle_irq(block->group[bit]);
|
|
|
|
return IRQ_RETVAL(intr & 0xff);
|
|
}
|
|
|
|
static int etraxfs_gpio_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
const struct etraxfs_gpio_info *info;
|
|
const struct of_device_id *match;
|
|
struct etraxfs_gpio_block *block;
|
|
struct etraxfs_gpio_chip *chips;
|
|
struct resource *res, *irq;
|
|
bool allportsirq = false;
|
|
void __iomem *regs;
|
|
int ret;
|
|
int i;
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
regs = devm_ioremap_resource(dev, res);
|
|
if (IS_ERR(regs))
|
|
return PTR_ERR(regs);
|
|
|
|
match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
|
|
if (!match)
|
|
return -EINVAL;
|
|
|
|
info = match->data;
|
|
|
|
chips = devm_kzalloc(dev, sizeof(*chips) * info->num_ports, GFP_KERNEL);
|
|
if (!chips)
|
|
return -ENOMEM;
|
|
|
|
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
|
if (!irq)
|
|
return -EINVAL;
|
|
|
|
block = devm_kzalloc(dev, sizeof(*block), GFP_KERNEL);
|
|
if (!block)
|
|
return -ENOMEM;
|
|
|
|
raw_spin_lock_init(&block->lock);
|
|
|
|
block->regs = regs;
|
|
block->info = info;
|
|
|
|
writel(0, block->regs + info->rw_intr_mask);
|
|
writel(0, block->regs + info->rw_intr_cfg);
|
|
if (info->rw_intr_pins) {
|
|
allportsirq = true;
|
|
writel(0, block->regs + info->rw_intr_pins);
|
|
}
|
|
|
|
ret = devm_request_irq(dev, irq->start, etraxfs_gpio_interrupt,
|
|
IRQF_SHARED, dev_name(dev), block);
|
|
if (ret) {
|
|
dev_err(dev, "Unable to request irq %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
for (i = 0; i < info->num_ports; i++) {
|
|
struct etraxfs_gpio_chip *chip = &chips[i];
|
|
struct gpio_chip *gc = &chip->gc;
|
|
const struct etraxfs_gpio_port *port = &info->ports[i];
|
|
unsigned long flags = BGPIOF_READ_OUTPUT_REG_SET;
|
|
void __iomem *dat = regs + port->din;
|
|
void __iomem *set = regs + port->dout;
|
|
void __iomem *dirout = regs + port->oe;
|
|
|
|
chip->block = block;
|
|
|
|
if (dirout == set) {
|
|
dirout = set = NULL;
|
|
flags = BGPIOF_NO_OUTPUT;
|
|
}
|
|
|
|
ret = bgpio_init(gc, dev, 4,
|
|
dat, set, NULL, dirout, NULL,
|
|
flags);
|
|
if (ret) {
|
|
dev_err(dev, "Unable to init port %s\n",
|
|
port->label);
|
|
continue;
|
|
}
|
|
|
|
gc->ngpio = port->ngpio;
|
|
gc->label = port->label;
|
|
|
|
gc->of_node = dev->of_node;
|
|
gc->of_gpio_n_cells = 3;
|
|
gc->of_xlate = etraxfs_gpio_of_xlate;
|
|
|
|
ret = gpiochip_add_data(gc, chip);
|
|
if (ret) {
|
|
dev_err(dev, "Unable to register port %s\n",
|
|
gc->label);
|
|
continue;
|
|
}
|
|
|
|
if (i > 0 && !allportsirq)
|
|
continue;
|
|
|
|
ret = gpiochip_irqchip_add(gc, &etraxfs_gpio_irq_chip, 0,
|
|
handle_level_irq, IRQ_TYPE_NONE);
|
|
if (ret) {
|
|
dev_err(dev, "Unable to add irqchip to port %s\n",
|
|
gc->label);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct platform_driver etraxfs_gpio_driver = {
|
|
.driver = {
|
|
.name = "etraxfs-gpio",
|
|
.of_match_table = of_match_ptr(etraxfs_gpio_of_table),
|
|
},
|
|
.probe = etraxfs_gpio_probe,
|
|
};
|
|
|
|
builtin_platform_driver(etraxfs_gpio_driver);
|