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 21:07:57 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2013-06-24 12:54:27 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2004-2013 Synopsys, Inc. (www.synopsys.com)
|
|
|
|
*
|
|
|
|
* Registers and bits definitions of ARC EMAC
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ARC_EMAC_H
|
|
|
|
#define ARC_EMAC_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/phy.h>
|
2014-04-25 15:06:13 +07:00
|
|
|
#include <linux/clk.h>
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
/* STATUS and ENABLE Register bit masks */
|
2016-03-14 15:01:55 +07:00
|
|
|
#define TXINT_MASK (1 << 0) /* Transmit interrupt */
|
|
|
|
#define RXINT_MASK (1 << 1) /* Receive interrupt */
|
|
|
|
#define ERR_MASK (1 << 2) /* Error interrupt */
|
|
|
|
#define TXCH_MASK (1 << 3) /* Transmit chaining error interrupt */
|
|
|
|
#define MSER_MASK (1 << 4) /* Missed packet counter error */
|
|
|
|
#define RXCR_MASK (1 << 8) /* RXCRCERR counter rolled over */
|
|
|
|
#define RXFR_MASK (1 << 9) /* RXFRAMEERR counter rolled over */
|
|
|
|
#define RXFL_MASK (1 << 10) /* RXOFLOWERR counter rolled over */
|
|
|
|
#define MDIO_MASK (1 << 12) /* MDIO complete interrupt */
|
|
|
|
#define TXPL_MASK (1 << 31) /* Force polling of BD by EMAC */
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
/* CONTROL Register bit masks */
|
2016-03-14 15:01:55 +07:00
|
|
|
#define EN_MASK (1 << 0) /* VMAC enable */
|
|
|
|
#define TXRN_MASK (1 << 3) /* TX enable */
|
|
|
|
#define RXRN_MASK (1 << 4) /* RX enable */
|
|
|
|
#define DSBC_MASK (1 << 8) /* Disable receive broadcast */
|
|
|
|
#define ENFL_MASK (1 << 10) /* Enable Full-duplex */
|
|
|
|
#define PROM_MASK (1 << 11) /* Promiscuous mode */
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
/* Buffer descriptor INFO bit masks */
|
2016-03-14 15:01:55 +07:00
|
|
|
#define OWN_MASK (1 << 31) /* 0-CPU or 1-EMAC owns buffer */
|
|
|
|
#define FIRST_MASK (1 << 16) /* First buffer in chain */
|
|
|
|
#define LAST_MASK (1 << 17) /* Last buffer in chain */
|
2013-06-24 12:54:27 +07:00
|
|
|
#define LEN_MASK 0x000007FF /* last 11 bits */
|
2016-03-14 15:01:55 +07:00
|
|
|
#define CRLS (1 << 21)
|
|
|
|
#define DEFR (1 << 22)
|
|
|
|
#define DROP (1 << 23)
|
|
|
|
#define RTRY (1 << 24)
|
|
|
|
#define LTCL (1 << 28)
|
|
|
|
#define UFLO (1 << 29)
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
#define FOR_EMAC OWN_MASK
|
|
|
|
#define FOR_CPU 0
|
|
|
|
|
|
|
|
/* ARC EMAC register set combines entries for MAC and MDIO */
|
|
|
|
enum {
|
|
|
|
R_ID = 0,
|
|
|
|
R_STATUS,
|
|
|
|
R_ENABLE,
|
|
|
|
R_CTRL,
|
|
|
|
R_POLLRATE,
|
|
|
|
R_RXERR,
|
|
|
|
R_MISS,
|
|
|
|
R_TX_RING,
|
|
|
|
R_RX_RING,
|
|
|
|
R_ADDRL,
|
|
|
|
R_ADDRH,
|
|
|
|
R_LAFL,
|
|
|
|
R_LAFH,
|
|
|
|
R_MDIO,
|
|
|
|
};
|
|
|
|
|
2016-03-14 15:01:55 +07:00
|
|
|
#define TX_TIMEOUT (400 * HZ / 1000) /* Transmission timeout */
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
#define ARC_EMAC_NAPI_WEIGHT 40 /* Workload for NAPI */
|
|
|
|
|
|
|
|
#define EMAC_BUFFER_SIZE 1536 /* EMAC buffer size */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct arc_emac_bd - EMAC buffer descriptor (BD).
|
|
|
|
*
|
|
|
|
* @info: Contains status information on the buffer itself.
|
|
|
|
* @data: 32-bit byte addressable pointer to the packet data.
|
|
|
|
*/
|
|
|
|
struct arc_emac_bd {
|
|
|
|
__le32 info;
|
|
|
|
dma_addr_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Number of Rx/Tx BD's */
|
|
|
|
#define RX_BD_NUM 128
|
|
|
|
#define TX_BD_NUM 128
|
|
|
|
|
|
|
|
#define RX_RING_SZ (RX_BD_NUM * sizeof(struct arc_emac_bd))
|
|
|
|
#define TX_RING_SZ (TX_BD_NUM * sizeof(struct arc_emac_bd))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct buffer_state - Stores Rx/Tx buffer state.
|
|
|
|
* @sk_buff: Pointer to socket buffer.
|
|
|
|
* @addr: Start address of DMA-mapped memory region.
|
|
|
|
* @len: Length of DMA-mapped memory region.
|
|
|
|
*/
|
|
|
|
struct buffer_state {
|
|
|
|
struct sk_buff *skb;
|
|
|
|
DEFINE_DMA_UNMAP_ADDR(addr);
|
|
|
|
DEFINE_DMA_UNMAP_LEN(len);
|
|
|
|
};
|
|
|
|
|
2016-03-14 15:01:54 +07:00
|
|
|
struct arc_emac_mdio_bus_data {
|
|
|
|
struct gpio_desc *reset_gpio;
|
|
|
|
int msec;
|
|
|
|
};
|
|
|
|
|
2013-06-24 12:54:27 +07:00
|
|
|
/**
|
|
|
|
* struct arc_emac_priv - Storage of EMAC's private information.
|
|
|
|
* @dev: Pointer to the current device.
|
|
|
|
* @phy_dev: Pointer to attached PHY device.
|
|
|
|
* @bus: Pointer to the current MII bus.
|
|
|
|
* @regs: Base address of EMAC memory-mapped control registers.
|
|
|
|
* @napi: Structure for NAPI.
|
|
|
|
* @rxbd: Pointer to Rx BD ring.
|
|
|
|
* @txbd: Pointer to Tx BD ring.
|
|
|
|
* @rxbd_dma: DMA handle for Rx BD ring.
|
|
|
|
* @txbd_dma: DMA handle for Tx BD ring.
|
|
|
|
* @rx_buff: Storage for Rx buffers states.
|
|
|
|
* @tx_buff: Storage for Tx buffers states.
|
|
|
|
* @txbd_curr: Index of Tx BD to use on the next "ndo_start_xmit".
|
|
|
|
* @txbd_dirty: Index of Tx BD to free on the next Tx interrupt.
|
|
|
|
* @last_rx_bd: Index of the last Rx BD we've got from EMAC.
|
|
|
|
* @link: PHY's last seen link state.
|
|
|
|
* @duplex: PHY's last set duplex mode.
|
|
|
|
* @speed: PHY's last set speed.
|
|
|
|
*/
|
|
|
|
struct arc_emac_priv {
|
2014-08-26 20:14:51 +07:00
|
|
|
const char *drv_name;
|
|
|
|
const char *drv_version;
|
2014-09-09 00:14:47 +07:00
|
|
|
void (*set_mac_speed)(void *priv, unsigned int speed);
|
|
|
|
|
|
|
|
/* Devices */
|
2013-06-24 12:54:27 +07:00
|
|
|
struct device *dev;
|
|
|
|
struct mii_bus *bus;
|
2016-03-14 15:01:54 +07:00
|
|
|
struct arc_emac_mdio_bus_data bus_data;
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
void __iomem *regs;
|
2014-04-25 15:06:13 +07:00
|
|
|
struct clk *clk;
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
struct napi_struct napi;
|
|
|
|
|
|
|
|
struct arc_emac_bd *rxbd;
|
|
|
|
struct arc_emac_bd *txbd;
|
|
|
|
|
|
|
|
dma_addr_t rxbd_dma;
|
|
|
|
dma_addr_t txbd_dma;
|
|
|
|
|
|
|
|
struct buffer_state rx_buff[RX_BD_NUM];
|
|
|
|
struct buffer_state tx_buff[TX_BD_NUM];
|
|
|
|
unsigned int txbd_curr;
|
|
|
|
unsigned int txbd_dirty;
|
|
|
|
|
|
|
|
unsigned int last_rx_bd;
|
|
|
|
|
|
|
|
unsigned int link;
|
|
|
|
unsigned int duplex;
|
|
|
|
unsigned int speed;
|
2017-12-19 18:03:57 +07:00
|
|
|
|
|
|
|
unsigned int rx_missed_errors;
|
2013-06-24 12:54:27 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arc_reg_set - Sets EMAC register with provided value.
|
|
|
|
* @priv: Pointer to ARC EMAC private data structure.
|
|
|
|
* @reg: Register offset from base address.
|
|
|
|
* @value: Value to set in register.
|
|
|
|
*/
|
|
|
|
static inline void arc_reg_set(struct arc_emac_priv *priv, int reg, int value)
|
|
|
|
{
|
|
|
|
iowrite32(value, priv->regs + reg * sizeof(int));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arc_reg_get - Gets value of specified EMAC register.
|
|
|
|
* @priv: Pointer to ARC EMAC private data structure.
|
|
|
|
* @reg: Register offset from base address.
|
|
|
|
*
|
|
|
|
* returns: Value of requested register.
|
|
|
|
*/
|
|
|
|
static inline unsigned int arc_reg_get(struct arc_emac_priv *priv, int reg)
|
|
|
|
{
|
|
|
|
return ioread32(priv->regs + reg * sizeof(int));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arc_reg_or - Applies mask to specified EMAC register - ("reg" | "mask").
|
|
|
|
* @priv: Pointer to ARC EMAC private data structure.
|
|
|
|
* @reg: Register offset from base address.
|
|
|
|
* @mask: Mask to apply to specified register.
|
|
|
|
*
|
|
|
|
* This function reads initial register value, then applies provided mask
|
|
|
|
* to it and then writes register back.
|
|
|
|
*/
|
|
|
|
static inline void arc_reg_or(struct arc_emac_priv *priv, int reg, int mask)
|
|
|
|
{
|
|
|
|
unsigned int value = arc_reg_get(priv, reg);
|
2016-03-14 15:01:55 +07:00
|
|
|
|
2013-06-24 12:54:27 +07:00
|
|
|
arc_reg_set(priv, reg, value | mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* arc_reg_clr - Applies mask to specified EMAC register - ("reg" & ~"mask").
|
|
|
|
* @priv: Pointer to ARC EMAC private data structure.
|
|
|
|
* @reg: Register offset from base address.
|
|
|
|
* @mask: Mask to apply to specified register.
|
|
|
|
*
|
|
|
|
* This function reads initial register value, then applies provided mask
|
|
|
|
* to it and then writes register back.
|
|
|
|
*/
|
|
|
|
static inline void arc_reg_clr(struct arc_emac_priv *priv, int reg, int mask)
|
|
|
|
{
|
|
|
|
unsigned int value = arc_reg_get(priv, reg);
|
2016-03-14 15:01:55 +07:00
|
|
|
|
2013-06-24 12:54:27 +07:00
|
|
|
arc_reg_set(priv, reg, value & ~mask);
|
|
|
|
}
|
|
|
|
|
2014-08-26 20:14:50 +07:00
|
|
|
int arc_mdio_probe(struct arc_emac_priv *priv);
|
2013-06-24 12:54:27 +07:00
|
|
|
int arc_mdio_remove(struct arc_emac_priv *priv);
|
2014-08-26 20:14:51 +07:00
|
|
|
int arc_emac_probe(struct net_device *ndev, int interface);
|
|
|
|
int arc_emac_remove(struct net_device *ndev);
|
2013-06-24 12:54:27 +07:00
|
|
|
|
|
|
|
#endif /* ARC_EMAC_H */
|