License cleanup: add SPDX GPL-2.0 license identifier to files with no license
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>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-sa1100/neponset.c
|
|
|
|
*/
|
2012-01-25 06:36:47 +08:00
|
|
|
#include <linux/err.h>
|
2016-08-31 15:49:45 +08:00
|
|
|
#include <linux/gpio/driver.h>
|
|
|
|
#include <linux/gpio/gpio-reg.h>
|
2018-11-28 21:57:23 +08:00
|
|
|
#include <linux/gpio/machine.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/ioport.h>
|
2012-01-25 06:22:18 +08:00
|
|
|
#include <linux/irq.h>
|
2012-01-25 06:13:00 +08:00
|
|
|
#include <linux/kernel.h>
|
2012-01-25 06:10:02 +08:00
|
|
|
#include <linux/module.h>
|
2005-10-30 02:07:23 +08:00
|
|
|
#include <linux/platform_device.h>
|
2012-01-25 07:29:47 +08:00
|
|
|
#include <linux/pm.h>
|
2012-01-25 06:13:00 +08:00
|
|
|
#include <linux/serial_core.h>
|
2012-01-25 06:10:02 +08:00
|
|
|
#include <linux/slab.h>
|
net: smc91x: use run-time configuration on all ARM machines
The smc91x driver traditionally gets configured at compile-time
for whichever hardware it runs on. This no longer works on
ARM as we continue to move to building all-in-one kernels.
Most ARM configurations with this driver already use run-time
configuration through DT or through platform_data, but a
few have not been converted yet.
I've checked all ARM boards that use this driver in their
legacy board files, and converted the ones that were using
compile-time configuration in smc91x.h to behave like the
other ones and provide the interrupt polarity along with
the MMIO configuration (width, stride) at platform device
creation time.
In particular, these combinations were previously selectable
in Kconfig but in fact broken:
- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform,
e.g. versatile.
None of these seem critical enough to warrant a backport
to stable, but it would be nice to clean this up for good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
I would like the patch to get merged through netdev, after
Robert and/or Linus have verified it on at least some hardware.
There are a few other non-ARM platforms using this driver,
I could do the same patch for those if we want to take
it further.
arch/arm/mach-msm/board-halibut.c | 8 ++++-
arch/arm/mach-msm/board-qsd8x50.c | 8 ++++-
arch/arm/mach-pxa/idp.c | 5 +++
arch/arm/mach-pxa/lpd270.c | 8 ++++-
arch/arm/mach-realview/core.c | 7 ++++
arch/arm/mach-realview/realview_eb.c | 2 +-
arch/arm/mach-sa1100/neponset.c | 6 ++++
arch/arm/mach-sa1100/pleb.c | 7 ++++
drivers/net/ethernet/smsc/smc91x.c | 9 +++--
drivers/net/ethernet/smsc/smc91x.h | 114 ++----------------------------------------------------------
10 files changed, 57 insertions(+), 117 deletions(-)
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-25 23:31:57 +08:00
|
|
|
#include <linux/smc91x.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/hardware/sa1111.h>
|
2019-05-15 06:46:51 +08:00
|
|
|
#include <linux/sizes.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-25 06:13:00 +08:00
|
|
|
#include <mach/hardware.h>
|
|
|
|
#include <mach/assabet.h>
|
|
|
|
#include <mach/neponset.h>
|
2012-02-24 07:06:51 +08:00
|
|
|
#include <mach/irqs.h>
|
2012-01-25 06:13:00 +08:00
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
#define NEP_IRQ_SMC91X 0
|
|
|
|
#define NEP_IRQ_USAR 1
|
|
|
|
#define NEP_IRQ_SA1111 2
|
|
|
|
#define NEP_IRQ_NR 3
|
|
|
|
|
2012-01-29 19:19:06 +08:00
|
|
|
#define WHOAMI 0x00
|
|
|
|
#define LEDS 0x10
|
|
|
|
#define SWPK 0x20
|
|
|
|
#define IRR 0x24
|
|
|
|
#define KP_Y_IN 0x80
|
|
|
|
#define KP_X_OUT 0x90
|
|
|
|
#define NCR_0 0xa0
|
|
|
|
#define MDM_CTL_0 0xb0
|
|
|
|
#define MDM_CTL_1 0xb4
|
|
|
|
#define AUD_CTL 0xc0
|
|
|
|
|
|
|
|
#define IRR_ETHERNET (1 << 0)
|
|
|
|
#define IRR_USAR (1 << 1)
|
|
|
|
#define IRR_SA1111 (1 << 2)
|
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
#define NCR_NGPIO 7
|
|
|
|
#define MDM_CTL0_NGPIO 4
|
|
|
|
#define MDM_CTL1_NGPIO 6
|
|
|
|
#define AUD_NGPIO 2
|
2012-01-29 19:19:06 +08:00
|
|
|
|
2012-01-26 19:50:23 +08:00
|
|
|
extern void sa1110_mb_disable(void);
|
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
#define to_neponset_gpio_chip(x) container_of(x, struct neponset_gpio_chip, gc)
|
|
|
|
|
|
|
|
static const char *neponset_ncr_names[] = {
|
|
|
|
"gp01_off", "tp_power", "ms_power", "enet_osc",
|
|
|
|
"spi_kb_wk_up", "a0vpp", "a1vpp"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *neponset_mdmctl0_names[] = {
|
|
|
|
"rts3", "dtr3", "rts1", "dtr1",
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *neponset_mdmctl1_names[] = {
|
|
|
|
"cts3", "dsr3", "dcd3", "cts1", "dsr1", "dcd1"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *neponset_aud_names[] = {
|
|
|
|
"sel_1341", "mute_1341",
|
|
|
|
};
|
|
|
|
|
2012-01-25 06:10:02 +08:00
|
|
|
struct neponset_drvdata {
|
2012-01-29 19:19:06 +08:00
|
|
|
void __iomem *base;
|
2012-01-25 06:36:47 +08:00
|
|
|
struct platform_device *sa1111;
|
|
|
|
struct platform_device *smc91x;
|
2012-01-25 06:22:18 +08:00
|
|
|
unsigned irq_base;
|
2016-08-31 15:49:45 +08:00
|
|
|
struct gpio_chip *gpio[4];
|
2012-01-25 06:10:02 +08:00
|
|
|
};
|
|
|
|
|
2016-08-31 15:49:52 +08:00
|
|
|
static struct gpiod_lookup_table neponset_uart1_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-uart.1",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl0", 2, "rts", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl0", 3, "dtr", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 3, "cts", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 4, "dsr", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 5, "dcd", GPIO_ACTIVE_LOW),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpiod_lookup_table neponset_uart3_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-uart.3",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl0", 0, "rts", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl0", 1, "dtr", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 0, "cts", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 1, "dsr", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("neponset-mdm-ctl1", 2, "dcd", GPIO_ACTIVE_LOW),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-11-28 21:57:23 +08:00
|
|
|
static struct gpiod_lookup_table neponset_pcmcia_table = {
|
|
|
|
.dev_id = "1800",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("sa1111", 1, "a0vcc", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("sa1111", 0, "a1vcc", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("neponset-ncr", 5, "a0vpp", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("neponset-ncr", 6, "a1vpp", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("sa1111", 2, "b0vcc", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("sa1111", 3, "b1vcc", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
static struct neponset_drvdata *nep;
|
2012-01-29 19:19:06 +08:00
|
|
|
|
2012-01-16 17:31:47 +08:00
|
|
|
void neponset_ncr_frob(unsigned int mask, unsigned int val)
|
|
|
|
{
|
2016-08-31 15:49:45 +08:00
|
|
|
struct neponset_drvdata *n = nep;
|
|
|
|
unsigned long m = mask, v = val;
|
|
|
|
|
|
|
|
if (nep)
|
|
|
|
n->gpio[0]->set_multiple(n->gpio[0], &m, &v);
|
|
|
|
else
|
|
|
|
WARN(1, "nep unset\n");
|
2012-01-16 17:31:47 +08:00
|
|
|
}
|
2012-05-25 15:41:53 +08:00
|
|
|
EXPORT_SYMBOL(neponset_ncr_frob);
|
2012-01-16 17:31:47 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Install handler for Neponset IRQ. Note that we have to loop here
|
|
|
|
* since the ETHERNET and USAR IRQs are level based, and we need to
|
|
|
|
* ensure that the IRQ signal is deasserted before returning. This
|
|
|
|
* is rather unfortunate.
|
|
|
|
*/
|
2015-09-14 16:42:37 +08:00
|
|
|
static void neponset_irq_handler(struct irq_desc *desc)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-01-25 06:22:18 +08:00
|
|
|
struct neponset_drvdata *d = irq_desc_get_handler_data(desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int irr;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
/*
|
|
|
|
* Acknowledge the parent IRQ.
|
|
|
|
*/
|
2010-11-29 18:12:06 +08:00
|
|
|
desc->irq_data.chip->irq_ack(&desc->irq_data);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the interrupt reason register. Let's have all
|
|
|
|
* active IRQ bits high. Note: there is a typo in the
|
|
|
|
* Neponset user's guide for the SA1111 IRR level.
|
|
|
|
*/
|
2012-01-29 19:19:06 +08:00
|
|
|
irr = readb_relaxed(d->base + IRR);
|
|
|
|
irr ^= IRR_ETHERNET | IRR_USAR;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if ((irr & (IRR_ETHERNET | IRR_USAR | IRR_SA1111)) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since there is no individual mask, we have to
|
|
|
|
* mask the parent IRQ. This is safe, since we'll
|
|
|
|
* recheck the register for any pending IRQs.
|
|
|
|
*/
|
|
|
|
if (irr & (IRR_ETHERNET | IRR_USAR)) {
|
2010-11-29 18:12:06 +08:00
|
|
|
desc->irq_data.chip->irq_mask(&desc->irq_data);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-06-09 00:59:31 +08:00
|
|
|
/*
|
|
|
|
* Ack the interrupt now to prevent re-entering
|
|
|
|
* this neponset handler. Again, this is safe
|
|
|
|
* since we'll check the IRR register prior to
|
|
|
|
* leaving.
|
|
|
|
*/
|
2010-11-29 18:12:06 +08:00
|
|
|
desc->irq_data.chip->irq_ack(&desc->irq_data);
|
2006-06-09 00:59:31 +08:00
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
if (irr & IRR_ETHERNET)
|
|
|
|
generic_handle_irq(d->irq_base + NEP_IRQ_SMC91X);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
if (irr & IRR_USAR)
|
|
|
|
generic_handle_irq(d->irq_base + NEP_IRQ_USAR);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-11-29 18:12:06 +08:00
|
|
|
desc->irq_data.chip->irq_unmask(&desc->irq_data);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
if (irr & IRR_SA1111)
|
|
|
|
generic_handle_irq(d->irq_base + NEP_IRQ_SA1111);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
/* Yes, we really do not have any kind of masking or unmasking */
|
2012-01-16 08:17:41 +08:00
|
|
|
static void nochip_noop(struct irq_data *irq)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irq_chip nochip = {
|
|
|
|
.name = "neponset",
|
|
|
|
.irq_ack = nochip_noop,
|
|
|
|
.irq_mask = nochip_noop,
|
|
|
|
.irq_unmask = nochip_noop,
|
|
|
|
};
|
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
static int neponset_init_gpio(struct gpio_chip **gcp,
|
|
|
|
struct device *dev, const char *label, void __iomem *reg,
|
|
|
|
unsigned num, bool in, const char *const * names)
|
|
|
|
{
|
|
|
|
struct gpio_chip *gc;
|
|
|
|
|
|
|
|
gc = gpio_reg_init(dev, reg, -1, num, label, in ? 0xffffffff : 0,
|
|
|
|
readl_relaxed(reg), names, NULL, NULL);
|
|
|
|
if (IS_ERR(gc))
|
|
|
|
return PTR_ERR(gc);
|
|
|
|
|
|
|
|
*gcp = gc;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-25 06:13:00 +08:00
|
|
|
static struct sa1111_platform_data sa1111_info = {
|
2012-01-26 21:34:21 +08:00
|
|
|
.disable_devs = SA1111_DEVID_PS2_MSE,
|
2012-01-25 06:13:00 +08:00
|
|
|
};
|
|
|
|
|
2012-12-22 06:02:24 +08:00
|
|
|
static int neponset_probe(struct platform_device *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-01-25 06:10:02 +08:00
|
|
|
struct neponset_drvdata *d;
|
2012-01-29 19:19:06 +08:00
|
|
|
struct resource *nep_res, *sa1111_res, *smc91x_res;
|
2012-01-25 06:22:18 +08:00
|
|
|
struct resource sa1111_resources[] = {
|
|
|
|
DEFINE_RES_MEM(0x40000000, SZ_8K),
|
|
|
|
{ .flags = IORESOURCE_IRQ },
|
|
|
|
};
|
2012-01-25 06:36:47 +08:00
|
|
|
struct platform_device_info sa1111_devinfo = {
|
|
|
|
.parent = &dev->dev,
|
|
|
|
.name = "sa1111",
|
|
|
|
.id = 0,
|
|
|
|
.res = sa1111_resources,
|
|
|
|
.num_res = ARRAY_SIZE(sa1111_resources),
|
|
|
|
.data = &sa1111_info,
|
|
|
|
.size_data = sizeof(sa1111_info),
|
|
|
|
.dma_mask = 0xffffffffUL,
|
|
|
|
};
|
2012-01-25 06:22:18 +08:00
|
|
|
struct resource smc91x_resources[] = {
|
|
|
|
DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS,
|
|
|
|
0x02000000, "smc91x-regs"),
|
|
|
|
DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
|
|
|
|
0x02000000, "smc91x-attrib"),
|
|
|
|
{ .flags = IORESOURCE_IRQ },
|
|
|
|
};
|
net: smc91x: use run-time configuration on all ARM machines
The smc91x driver traditionally gets configured at compile-time
for whichever hardware it runs on. This no longer works on
ARM as we continue to move to building all-in-one kernels.
Most ARM configurations with this driver already use run-time
configuration through DT or through platform_data, but a
few have not been converted yet.
I've checked all ARM boards that use this driver in their
legacy board files, and converted the ones that were using
compile-time configuration in smc91x.h to behave like the
other ones and provide the interrupt polarity along with
the MMIO configuration (width, stride) at platform device
creation time.
In particular, these combinations were previously selectable
in Kconfig but in fact broken:
- sa1100 assabet plus pleb
- msm combined with any other armv6/v7 platform
- pxa-idp combined with any non-DMA pxa variant
- LogicPD PXA270 combined with any other pxa
- nomadik combined with any other armv4/v5 platform,
e.g. versatile.
None of these seem critical enough to warrant a backport
to stable, but it would be nice to clean this up for good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
I would like the patch to get merged through netdev, after
Robert and/or Linus have verified it on at least some hardware.
There are a few other non-ARM platforms using this driver,
I could do the same patch for those if we want to take
it further.
arch/arm/mach-msm/board-halibut.c | 8 ++++-
arch/arm/mach-msm/board-qsd8x50.c | 8 ++++-
arch/arm/mach-pxa/idp.c | 5 +++
arch/arm/mach-pxa/lpd270.c | 8 ++++-
arch/arm/mach-realview/core.c | 7 ++++
arch/arm/mach-realview/realview_eb.c | 2 +-
arch/arm/mach-sa1100/neponset.c | 6 ++++
arch/arm/mach-sa1100/pleb.c | 7 ++++
drivers/net/ethernet/smsc/smc91x.c | 9 +++--
drivers/net/ethernet/smsc/smc91x.h | 114 ++----------------------------------------------------------
10 files changed, 57 insertions(+), 117 deletions(-)
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-02-25 23:31:57 +08:00
|
|
|
struct smc91x_platdata smc91x_platdata = {
|
|
|
|
.flags = SMC91X_USE_8BIT | SMC91X_IO_SHIFT_2 | SMC91X_NOWAIT,
|
|
|
|
};
|
2012-01-25 06:36:47 +08:00
|
|
|
struct platform_device_info smc91x_devinfo = {
|
|
|
|
.parent = &dev->dev,
|
|
|
|
.name = "smc91x",
|
|
|
|
.id = 0,
|
|
|
|
.res = smc91x_resources,
|
|
|
|
.num_res = ARRAY_SIZE(smc91x_resources),
|
2015-03-05 06:39:18 +08:00
|
|
|
.data = &smc91x_platdata,
|
|
|
|
.size_data = sizeof(smc91x_platdata),
|
2012-01-25 06:36:47 +08:00
|
|
|
};
|
2012-01-25 07:05:08 +08:00
|
|
|
int ret, irq;
|
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
if (nep)
|
2012-01-29 19:19:06 +08:00
|
|
|
return -EBUSY;
|
|
|
|
|
2012-01-25 07:05:08 +08:00
|
|
|
irq = ret = platform_get_irq(dev, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
goto err_alloc;
|
2012-01-25 06:10:02 +08:00
|
|
|
|
2012-01-29 19:19:06 +08:00
|
|
|
nep_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
2012-01-25 07:17:37 +08:00
|
|
|
smc91x_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
|
|
|
|
sa1111_res = platform_get_resource(dev, IORESOURCE_MEM, 2);
|
2012-01-29 19:19:06 +08:00
|
|
|
if (!nep_res || !smc91x_res || !sa1111_res) {
|
2012-01-25 07:17:37 +08:00
|
|
|
ret = -ENXIO;
|
|
|
|
goto err_alloc;
|
|
|
|
}
|
|
|
|
|
2012-01-25 06:10:02 +08:00
|
|
|
d = kzalloc(sizeof(*d), GFP_KERNEL);
|
|
|
|
if (!d) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto err_alloc;
|
|
|
|
}
|
|
|
|
|
2012-01-29 19:19:06 +08:00
|
|
|
d->base = ioremap(nep_res->start, SZ_4K);
|
|
|
|
if (!d->base) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto err_ioremap;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (readb_relaxed(d->base + WHOAMI) != 0x11) {
|
|
|
|
dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
|
|
|
|
readb_relaxed(d->base + WHOAMI));
|
|
|
|
ret = -ENODEV;
|
|
|
|
goto err_id;
|
|
|
|
}
|
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1);
|
|
|
|
if (ret <= 0) {
|
|
|
|
dev_err(&dev->dev, "unable to allocate %u irqs: %d\n",
|
|
|
|
NEP_IRQ_NR, ret);
|
|
|
|
if (ret == 0)
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto err_irq_alloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
d->irq_base = ret;
|
|
|
|
|
|
|
|
irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip,
|
|
|
|
handle_simple_irq);
|
2015-07-28 04:55:13 +08:00
|
|
|
irq_clear_status_flags(d->irq_base + NEP_IRQ_SMC91X, IRQ_NOREQUEST | IRQ_NOPROBE);
|
2012-01-25 06:22:18 +08:00
|
|
|
irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip,
|
|
|
|
handle_simple_irq);
|
2015-07-28 04:55:13 +08:00
|
|
|
irq_clear_status_flags(d->irq_base + NEP_IRQ_USAR, IRQ_NOREQUEST | IRQ_NOPROBE);
|
2012-01-25 06:22:18 +08:00
|
|
|
irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-25 07:05:08 +08:00
|
|
|
irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
|
2015-06-17 06:06:25 +08:00
|
|
|
irq_set_chained_handler_and_data(irq, neponset_irq_handler, d);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
/* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
|
|
|
|
writeb_relaxed(NCR_GP01_OFF, d->base + NCR_0);
|
|
|
|
|
|
|
|
neponset_init_gpio(&d->gpio[0], &dev->dev, "neponset-ncr",
|
|
|
|
d->base + NCR_0, NCR_NGPIO, false,
|
|
|
|
neponset_ncr_names);
|
|
|
|
neponset_init_gpio(&d->gpio[1], &dev->dev, "neponset-mdm-ctl0",
|
|
|
|
d->base + MDM_CTL_0, MDM_CTL0_NGPIO, false,
|
|
|
|
neponset_mdmctl0_names);
|
|
|
|
neponset_init_gpio(&d->gpio[2], &dev->dev, "neponset-mdm-ctl1",
|
|
|
|
d->base + MDM_CTL_1, MDM_CTL1_NGPIO, true,
|
|
|
|
neponset_mdmctl1_names);
|
|
|
|
neponset_init_gpio(&d->gpio[3], &dev->dev, "neponset-aud-ctl",
|
|
|
|
d->base + AUD_CTL, AUD_NGPIO, false,
|
|
|
|
neponset_aud_names);
|
|
|
|
|
2016-08-31 15:49:52 +08:00
|
|
|
gpiod_add_lookup_table(&neponset_uart1_gpio_table);
|
|
|
|
gpiod_add_lookup_table(&neponset_uart3_gpio_table);
|
2018-11-28 21:57:23 +08:00
|
|
|
gpiod_add_lookup_table(&neponset_pcmcia_table);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2012-01-25 06:22:18 +08:00
|
|
|
* We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately
|
|
|
|
* something on the Neponset activates this IRQ on sleep (eth?)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#if 0
|
2012-01-25 07:05:08 +08:00
|
|
|
enable_irq_wake(irq);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
|
|
|
|
d->irq_base, d->irq_base + NEP_IRQ_NR - 1);
|
2016-08-31 15:49:45 +08:00
|
|
|
nep = d;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-26 19:50:23 +08:00
|
|
|
/* Ensure that the memory bus request/grant signals are setup */
|
|
|
|
sa1110_mb_disable();
|
|
|
|
|
2012-01-25 07:17:37 +08:00
|
|
|
sa1111_resources[0].parent = sa1111_res;
|
2012-01-25 06:22:18 +08:00
|
|
|
sa1111_resources[1].start = d->irq_base + NEP_IRQ_SA1111;
|
|
|
|
sa1111_resources[1].end = d->irq_base + NEP_IRQ_SA1111;
|
2012-01-25 06:36:47 +08:00
|
|
|
d->sa1111 = platform_device_register_full(&sa1111_devinfo);
|
2012-01-25 06:22:18 +08:00
|
|
|
|
2012-01-25 07:17:37 +08:00
|
|
|
smc91x_resources[0].parent = smc91x_res;
|
|
|
|
smc91x_resources[1].parent = smc91x_res;
|
2012-01-25 06:22:18 +08:00
|
|
|
smc91x_resources[2].start = d->irq_base + NEP_IRQ_SMC91X;
|
|
|
|
smc91x_resources[2].end = d->irq_base + NEP_IRQ_SMC91X;
|
2012-01-25 06:36:47 +08:00
|
|
|
d->smc91x = platform_device_register_full(&smc91x_devinfo);
|
|
|
|
|
2012-01-25 06:10:02 +08:00
|
|
|
platform_set_drvdata(dev, d);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
2012-01-25 06:10:02 +08:00
|
|
|
|
2012-01-25 06:22:18 +08:00
|
|
|
err_irq_alloc:
|
2012-01-29 19:19:06 +08:00
|
|
|
err_id:
|
|
|
|
iounmap(d->base);
|
|
|
|
err_ioremap:
|
2012-01-25 06:22:18 +08:00
|
|
|
kfree(d);
|
2012-01-25 06:10:02 +08:00
|
|
|
err_alloc:
|
|
|
|
return ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-12-22 06:02:24 +08:00
|
|
|
static int neponset_remove(struct platform_device *dev)
|
2012-01-25 06:10:02 +08:00
|
|
|
{
|
|
|
|
struct neponset_drvdata *d = platform_get_drvdata(dev);
|
2012-01-25 07:05:08 +08:00
|
|
|
int irq = platform_get_irq(dev, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-01-25 06:36:47 +08:00
|
|
|
if (!IS_ERR(d->sa1111))
|
|
|
|
platform_device_unregister(d->sa1111);
|
|
|
|
if (!IS_ERR(d->smc91x))
|
|
|
|
platform_device_unregister(d->smc91x);
|
2018-11-28 21:57:23 +08:00
|
|
|
|
|
|
|
gpiod_remove_lookup_table(&neponset_pcmcia_table);
|
2016-08-31 15:49:52 +08:00
|
|
|
gpiod_remove_lookup_table(&neponset_uart3_gpio_table);
|
|
|
|
gpiod_remove_lookup_table(&neponset_uart1_gpio_table);
|
2018-11-28 21:57:23 +08:00
|
|
|
|
2012-01-25 07:05:08 +08:00
|
|
|
irq_set_chained_handler(irq, NULL);
|
2012-01-25 06:22:18 +08:00
|
|
|
irq_free_descs(d->irq_base, NEP_IRQ_NR);
|
2016-08-31 15:49:45 +08:00
|
|
|
nep = NULL;
|
2012-01-29 19:19:06 +08:00
|
|
|
iounmap(d->base);
|
2012-01-25 06:10:02 +08:00
|
|
|
kfree(d);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2007-07-10 02:39:19 +08:00
|
|
|
|
2012-01-25 07:29:47 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
static int neponset_resume(struct device *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2012-01-25 07:29:47 +08:00
|
|
|
struct neponset_drvdata *d = dev_get_drvdata(dev);
|
2016-08-31 15:49:45 +08:00
|
|
|
int i, ret = 0;
|
2012-01-25 06:10:02 +08:00
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
for (i = 0; i < ARRAY_SIZE(d->gpio); i++) {
|
|
|
|
ret = gpio_reg_resume(d->gpio[i]);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-08-31 15:49:45 +08:00
|
|
|
return ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2012-01-25 07:29:47 +08:00
|
|
|
static const struct dev_pm_ops neponset_pm_ops = {
|
|
|
|
.resume_noirq = neponset_resume,
|
|
|
|
.restore_noirq = neponset_resume,
|
|
|
|
};
|
|
|
|
#define PM_OPS &neponset_pm_ops
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
2012-01-25 07:29:47 +08:00
|
|
|
#define PM_OPS NULL
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
2005-11-10 06:32:44 +08:00
|
|
|
static struct platform_driver neponset_device_driver = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.probe = neponset_probe,
|
2012-12-22 06:02:24 +08:00
|
|
|
.remove = neponset_remove,
|
2005-11-10 06:32:44 +08:00
|
|
|
.driver = {
|
|
|
|
.name = "neponset",
|
2012-01-25 07:29:47 +08:00
|
|
|
.pm = PM_OPS,
|
2005-11-10 06:32:44 +08:00
|
|
|
},
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init neponset_init(void)
|
|
|
|
{
|
2012-01-26 19:50:23 +08:00
|
|
|
return platform_driver_register(&neponset_device_driver);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
subsys_initcall(neponset_init);
|