mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 11:15:07 +07: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>
317 lines
7.3 KiB
C
317 lines
7.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _NB8800_H_
|
|
#define _NB8800_H_
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/phy.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#define RX_DESC_COUNT 256
|
|
#define TX_DESC_COUNT 256
|
|
|
|
#define NB8800_DESC_LOW 4
|
|
|
|
#define RX_BUF_SIZE 1552
|
|
|
|
#define RX_COPYBREAK 256
|
|
#define RX_COPYHDR 128
|
|
|
|
#define MAX_MDC_CLOCK 2500000
|
|
|
|
/* Stargate Solutions SSN8800 core registers */
|
|
#define NB8800_TX_CTL1 0x000
|
|
#define TX_TPD BIT(5)
|
|
#define TX_APPEND_FCS BIT(4)
|
|
#define TX_PAD_EN BIT(3)
|
|
#define TX_RETRY_EN BIT(2)
|
|
#define TX_EN BIT(0)
|
|
|
|
#define NB8800_TX_CTL2 0x001
|
|
|
|
#define NB8800_RX_CTL 0x004
|
|
#define RX_BC_DISABLE BIT(7)
|
|
#define RX_RUNT BIT(6)
|
|
#define RX_AF_EN BIT(5)
|
|
#define RX_PAUSE_EN BIT(3)
|
|
#define RX_SEND_CRC BIT(2)
|
|
#define RX_PAD_STRIP BIT(1)
|
|
#define RX_EN BIT(0)
|
|
|
|
#define NB8800_RANDOM_SEED 0x008
|
|
#define NB8800_TX_SDP 0x14
|
|
#define NB8800_TX_TPDP1 0x18
|
|
#define NB8800_TX_TPDP2 0x19
|
|
#define NB8800_SLOT_TIME 0x1c
|
|
|
|
#define NB8800_MDIO_CMD 0x020
|
|
#define MDIO_CMD_GO BIT(31)
|
|
#define MDIO_CMD_WR BIT(26)
|
|
#define MDIO_CMD_ADDR(x) ((x) << 21)
|
|
#define MDIO_CMD_REG(x) ((x) << 16)
|
|
#define MDIO_CMD_DATA(x) ((x) << 0)
|
|
|
|
#define NB8800_MDIO_STS 0x024
|
|
#define MDIO_STS_ERR BIT(31)
|
|
|
|
#define NB8800_MC_ADDR(i) (0x028 + (i))
|
|
#define NB8800_MC_INIT 0x02e
|
|
#define NB8800_UC_ADDR(i) (0x03c + (i))
|
|
|
|
#define NB8800_MAC_MODE 0x044
|
|
#define RGMII_MODE BIT(7)
|
|
#define HALF_DUPLEX BIT(4)
|
|
#define BURST_EN BIT(3)
|
|
#define LOOPBACK_EN BIT(2)
|
|
#define GMAC_MODE BIT(0)
|
|
|
|
#define NB8800_IC_THRESHOLD 0x050
|
|
#define NB8800_PE_THRESHOLD 0x051
|
|
#define NB8800_PF_THRESHOLD 0x052
|
|
#define NB8800_TX_BUFSIZE 0x054
|
|
#define NB8800_FIFO_CTL 0x056
|
|
#define NB8800_PQ1 0x060
|
|
#define NB8800_PQ2 0x061
|
|
#define NB8800_SRC_ADDR(i) (0x06a + (i))
|
|
#define NB8800_STAT_DATA 0x078
|
|
#define NB8800_STAT_INDEX 0x07c
|
|
#define NB8800_STAT_CLEAR 0x07d
|
|
|
|
#define NB8800_SLEEP_MODE 0x07e
|
|
#define SLEEP_MODE BIT(0)
|
|
|
|
#define NB8800_WAKEUP 0x07f
|
|
#define WAKEUP BIT(0)
|
|
|
|
/* Aurora NB8800 host interface registers */
|
|
#define NB8800_TXC_CR 0x100
|
|
#define TCR_LK BIT(12)
|
|
#define TCR_DS BIT(11)
|
|
#define TCR_BTS(x) (((x) & 0x7) << 8)
|
|
#define TCR_DIE BIT(7)
|
|
#define TCR_TFI(x) (((x) & 0x7) << 4)
|
|
#define TCR_LE BIT(3)
|
|
#define TCR_RS BIT(2)
|
|
#define TCR_DM BIT(1)
|
|
#define TCR_EN BIT(0)
|
|
|
|
#define NB8800_TXC_SR 0x104
|
|
#define TSR_DE BIT(3)
|
|
#define TSR_DI BIT(2)
|
|
#define TSR_TO BIT(1)
|
|
#define TSR_TI BIT(0)
|
|
|
|
#define NB8800_TX_SAR 0x108
|
|
#define NB8800_TX_DESC_ADDR 0x10c
|
|
|
|
#define NB8800_TX_REPORT_ADDR 0x110
|
|
#define TX_BYTES_TRANSFERRED(x) (((x) >> 16) & 0xffff)
|
|
#define TX_FIRST_DEFERRAL BIT(7)
|
|
#define TX_EARLY_COLLISIONS(x) (((x) >> 3) & 0xf)
|
|
#define TX_LATE_COLLISION BIT(2)
|
|
#define TX_PACKET_DROPPED BIT(1)
|
|
#define TX_FIFO_UNDERRUN BIT(0)
|
|
#define IS_TX_ERROR(r) ((r) & 0x07)
|
|
|
|
#define NB8800_TX_FIFO_SR 0x114
|
|
#define NB8800_TX_ITR 0x118
|
|
|
|
#define NB8800_RXC_CR 0x200
|
|
#define RCR_FL BIT(13)
|
|
#define RCR_LK BIT(12)
|
|
#define RCR_DS BIT(11)
|
|
#define RCR_BTS(x) (((x) & 7) << 8)
|
|
#define RCR_DIE BIT(7)
|
|
#define RCR_RFI(x) (((x) & 7) << 4)
|
|
#define RCR_LE BIT(3)
|
|
#define RCR_RS BIT(2)
|
|
#define RCR_DM BIT(1)
|
|
#define RCR_EN BIT(0)
|
|
|
|
#define NB8800_RXC_SR 0x204
|
|
#define RSR_DE BIT(3)
|
|
#define RSR_DI BIT(2)
|
|
#define RSR_RO BIT(1)
|
|
#define RSR_RI BIT(0)
|
|
|
|
#define NB8800_RX_SAR 0x208
|
|
#define NB8800_RX_DESC_ADDR 0x20c
|
|
|
|
#define NB8800_RX_REPORT_ADDR 0x210
|
|
#define RX_BYTES_TRANSFERRED(x) (((x) >> 16) & 0xFFFF)
|
|
#define RX_MULTICAST_PKT BIT(9)
|
|
#define RX_BROADCAST_PKT BIT(8)
|
|
#define RX_LENGTH_ERR BIT(7)
|
|
#define RX_FCS_ERR BIT(6)
|
|
#define RX_RUNT_PKT BIT(5)
|
|
#define RX_FIFO_OVERRUN BIT(4)
|
|
#define RX_LATE_COLLISION BIT(3)
|
|
#define RX_ALIGNMENT_ERROR BIT(2)
|
|
#define RX_ERROR_MASK 0xfc
|
|
#define IS_RX_ERROR(r) ((r) & RX_ERROR_MASK)
|
|
|
|
#define NB8800_RX_FIFO_SR 0x214
|
|
#define NB8800_RX_ITR 0x218
|
|
|
|
/* Sigma Designs SMP86xx additional registers */
|
|
#define NB8800_TANGOX_PAD_MODE 0x400
|
|
#define PAD_MODE_MASK 0x7
|
|
#define PAD_MODE_MII 0x0
|
|
#define PAD_MODE_RGMII 0x1
|
|
#define PAD_MODE_GTX_CLK_INV BIT(3)
|
|
#define PAD_MODE_GTX_CLK_DELAY BIT(4)
|
|
|
|
#define NB8800_TANGOX_MDIO_CLKDIV 0x420
|
|
#define NB8800_TANGOX_RESET 0x424
|
|
|
|
/* Hardware DMA descriptor */
|
|
struct nb8800_dma_desc {
|
|
u32 s_addr; /* start address */
|
|
u32 n_addr; /* next descriptor address */
|
|
u32 r_addr; /* report address */
|
|
u32 config;
|
|
} __aligned(8);
|
|
|
|
#define DESC_ID BIT(23)
|
|
#define DESC_EOC BIT(22)
|
|
#define DESC_EOF BIT(21)
|
|
#define DESC_LK BIT(20)
|
|
#define DESC_DS BIT(19)
|
|
#define DESC_BTS(x) (((x) & 0x7) << 16)
|
|
|
|
/* DMA descriptor and associated data for rx.
|
|
* Allocated from coherent memory.
|
|
*/
|
|
struct nb8800_rx_desc {
|
|
/* DMA descriptor */
|
|
struct nb8800_dma_desc desc;
|
|
|
|
/* Status report filled in by hardware */
|
|
u32 report;
|
|
};
|
|
|
|
/* Address of buffer on rx ring */
|
|
struct nb8800_rx_buf {
|
|
struct page *page;
|
|
unsigned long offset;
|
|
};
|
|
|
|
/* DMA descriptors and associated data for tx.
|
|
* Allocated from coherent memory.
|
|
*/
|
|
struct nb8800_tx_desc {
|
|
/* DMA descriptor. The second descriptor is used if packet
|
|
* data is unaligned.
|
|
*/
|
|
struct nb8800_dma_desc desc[2];
|
|
|
|
/* Status report filled in by hardware */
|
|
u32 report;
|
|
|
|
/* Bounce buffer for initial unaligned part of packet */
|
|
u8 buf[8] __aligned(8);
|
|
};
|
|
|
|
/* Packet in tx queue */
|
|
struct nb8800_tx_buf {
|
|
/* Currently queued skb */
|
|
struct sk_buff *skb;
|
|
|
|
/* DMA address of the first descriptor */
|
|
dma_addr_t dma_desc;
|
|
|
|
/* DMA address of packet data */
|
|
dma_addr_t dma_addr;
|
|
|
|
/* Length of DMA mapping, less than skb->len if alignment
|
|
* buffer is used.
|
|
*/
|
|
unsigned int dma_len;
|
|
|
|
/* Number of packets in chain starting here */
|
|
unsigned int chain_len;
|
|
|
|
/* Packet chain ready to be submitted to hardware */
|
|
bool ready;
|
|
};
|
|
|
|
struct nb8800_priv {
|
|
struct napi_struct napi;
|
|
|
|
void __iomem *base;
|
|
|
|
/* RX DMA descriptors */
|
|
struct nb8800_rx_desc *rx_descs;
|
|
|
|
/* RX buffers referenced by DMA descriptors */
|
|
struct nb8800_rx_buf *rx_bufs;
|
|
|
|
/* Current end of chain */
|
|
u32 rx_eoc;
|
|
|
|
/* Value for rx interrupt time register in NAPI interrupt mode */
|
|
u32 rx_itr_irq;
|
|
|
|
/* Value for rx interrupt time register in NAPI poll mode */
|
|
u32 rx_itr_poll;
|
|
|
|
/* Value for config field of rx DMA descriptors */
|
|
u32 rx_dma_config;
|
|
|
|
/* TX DMA descriptors */
|
|
struct nb8800_tx_desc *tx_descs;
|
|
|
|
/* TX packet queue */
|
|
struct nb8800_tx_buf *tx_bufs;
|
|
|
|
/* Number of free tx queue entries */
|
|
atomic_t tx_free;
|
|
|
|
/* First free tx queue entry */
|
|
u32 tx_next;
|
|
|
|
/* Next buffer to transmit */
|
|
u32 tx_queue;
|
|
|
|
/* Start of current packet chain */
|
|
struct nb8800_tx_buf *tx_chain;
|
|
|
|
/* Next buffer to reclaim */
|
|
u32 tx_done;
|
|
|
|
/* Lock for DMA activation */
|
|
spinlock_t tx_lock;
|
|
|
|
struct mii_bus *mii_bus;
|
|
struct device_node *phy_node;
|
|
|
|
/* PHY connection type from DT */
|
|
int phy_mode;
|
|
|
|
/* Current link status */
|
|
int speed;
|
|
int duplex;
|
|
int link;
|
|
|
|
/* Pause settings */
|
|
bool pause_aneg;
|
|
bool pause_rx;
|
|
bool pause_tx;
|
|
|
|
/* DMA base address of rx descriptors, see rx_descs above */
|
|
dma_addr_t rx_desc_dma;
|
|
|
|
/* DMA base address of tx descriptors, see tx_descs above */
|
|
dma_addr_t tx_desc_dma;
|
|
|
|
struct clk *clk;
|
|
};
|
|
|
|
struct nb8800_ops {
|
|
int (*init)(struct net_device *dev);
|
|
int (*reset)(struct net_device *dev);
|
|
};
|
|
|
|
#endif /* _NB8800_H_ */
|