forked from luck/tmp_suning_uos_patched
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>
251 lines
6.3 KiB
C
251 lines
6.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* SL811HS register declarations and HCD data structures
|
|
*
|
|
* Copyright (C) 2004 Psion Teklogix
|
|
* Copyright (C) 2004 David Brownell
|
|
* Copyright (C) 2001 Cypress Semiconductor Inc.
|
|
*/
|
|
|
|
/*
|
|
* SL811HS has transfer registers, and control registers. In host/master
|
|
* mode one set of registers is used; in peripheral/slave mode, another.
|
|
* - SL11H only has some "A" transfer registers from 0x00-0x04
|
|
* - SL811HS also has "B" registers from 0x08-0x0c
|
|
* - SL811S (or HS in slave mode) has four A+B sets, at 00, 10, 20, 30
|
|
*/
|
|
|
|
#define SL811_EP_A(base) ((base) + 0)
|
|
#define SL811_EP_B(base) ((base) + 8)
|
|
|
|
#define SL811_HOST_BUF 0x00
|
|
#define SL811_PERIPH_EP0 0x00
|
|
#define SL811_PERIPH_EP1 0x10
|
|
#define SL811_PERIPH_EP2 0x20
|
|
#define SL811_PERIPH_EP3 0x30
|
|
|
|
|
|
/* TRANSFER REGISTERS: host and peripheral sides are similar
|
|
* except for the control models (master vs slave).
|
|
*/
|
|
#define SL11H_HOSTCTLREG 0
|
|
# define SL11H_HCTLMASK_ARM 0x01
|
|
# define SL11H_HCTLMASK_ENABLE 0x02
|
|
# define SL11H_HCTLMASK_IN 0x00
|
|
# define SL11H_HCTLMASK_OUT 0x04
|
|
# define SL11H_HCTLMASK_ISOCH 0x10
|
|
# define SL11H_HCTLMASK_AFTERSOF 0x20
|
|
# define SL11H_HCTLMASK_TOGGLE 0x40
|
|
# define SL11H_HCTLMASK_PREAMBLE 0x80
|
|
#define SL11H_BUFADDRREG 1
|
|
#define SL11H_BUFLNTHREG 2
|
|
#define SL11H_PKTSTATREG 3 /* read */
|
|
# define SL11H_STATMASK_ACK 0x01
|
|
# define SL11H_STATMASK_ERROR 0x02
|
|
# define SL11H_STATMASK_TMOUT 0x04
|
|
# define SL11H_STATMASK_SEQ 0x08
|
|
# define SL11H_STATMASK_SETUP 0x10
|
|
# define SL11H_STATMASK_OVF 0x20
|
|
# define SL11H_STATMASK_NAK 0x40
|
|
# define SL11H_STATMASK_STALL 0x80
|
|
#define SL11H_PIDEPREG 3 /* write */
|
|
# define SL_SETUP 0xd0
|
|
# define SL_IN 0x90
|
|
# define SL_OUT 0x10
|
|
# define SL_SOF 0x50
|
|
# define SL_PREAMBLE 0xc0
|
|
# define SL_NAK 0xa0
|
|
# define SL_STALL 0xe0
|
|
# define SL_DATA0 0x30
|
|
# define SL_DATA1 0xb0
|
|
#define SL11H_XFERCNTREG 4 /* read */
|
|
#define SL11H_DEVADDRREG 4 /* write */
|
|
|
|
|
|
/* CONTROL REGISTERS: host and peripheral are very different.
|
|
*/
|
|
#define SL11H_CTLREG1 5
|
|
# define SL11H_CTL1MASK_SOF_ENA 0x01
|
|
# define SL11H_CTL1MASK_FORCE 0x18
|
|
# define SL11H_CTL1MASK_NORMAL 0x00
|
|
# define SL11H_CTL1MASK_SE0 0x08 /* reset */
|
|
# define SL11H_CTL1MASK_J 0x10
|
|
# define SL11H_CTL1MASK_K 0x18 /* resume */
|
|
# define SL11H_CTL1MASK_LSPD 0x20
|
|
# define SL11H_CTL1MASK_SUSPEND 0x40
|
|
#define SL11H_IRQ_ENABLE 6
|
|
# define SL11H_INTMASK_DONE_A 0x01
|
|
# define SL11H_INTMASK_DONE_B 0x02
|
|
# define SL11H_INTMASK_SOFINTR 0x10
|
|
# define SL11H_INTMASK_INSRMV 0x20 /* to/from SE0 */
|
|
# define SL11H_INTMASK_RD 0x40
|
|
# define SL11H_INTMASK_DP 0x80 /* only in INTSTATREG */
|
|
#define SL11S_ADDRESS 7
|
|
|
|
/* 0x08-0x0c are for the B buffer (not in SL11) */
|
|
|
|
#define SL11H_IRQ_STATUS 0x0D /* write to ack */
|
|
#define SL11H_HWREVREG 0x0E /* read */
|
|
# define SL11H_HWRMASK_HWREV 0xF0
|
|
#define SL11H_SOFLOWREG 0x0E /* write */
|
|
#define SL11H_SOFTMRREG 0x0F /* read */
|
|
|
|
/* a write to this register enables SL811HS features.
|
|
* HOST flag presumably overrides the chip input signal?
|
|
*/
|
|
#define SL811HS_CTLREG2 0x0F
|
|
# define SL811HS_CTL2MASK_SOF_MASK 0x3F
|
|
# define SL811HS_CTL2MASK_DSWAP 0x40
|
|
# define SL811HS_CTL2MASK_HOST 0x80
|
|
|
|
#define SL811HS_CTL2_INIT (SL811HS_CTL2MASK_HOST | 0x2e)
|
|
|
|
|
|
/* DATA BUFFERS: registers from 0x10..0xff are for data buffers;
|
|
* that's 240 bytes, which we'll split evenly between A and B sides.
|
|
* Only ISO can use more than 64 bytes per packet.
|
|
* (The SL11S has 0x40..0xff for buffers.)
|
|
*/
|
|
#define H_MAXPACKET 120 /* bytes in A or B fifos */
|
|
|
|
#define SL11H_DATA_START 0x10
|
|
#define SL811HS_PACKET_BUF(is_a) ((is_a) \
|
|
? SL11H_DATA_START \
|
|
: (SL11H_DATA_START + H_MAXPACKET))
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
#define LOG2_PERIODIC_SIZE 5 /* arbitrary; this matches OHCI */
|
|
#define PERIODIC_SIZE (1 << LOG2_PERIODIC_SIZE)
|
|
|
|
struct sl811 {
|
|
spinlock_t lock;
|
|
void __iomem *addr_reg;
|
|
void __iomem *data_reg;
|
|
struct sl811_platform_data *board;
|
|
struct dentry *debug_file;
|
|
|
|
unsigned long stat_insrmv;
|
|
unsigned long stat_wake;
|
|
unsigned long stat_sof;
|
|
unsigned long stat_a;
|
|
unsigned long stat_b;
|
|
unsigned long stat_lost;
|
|
unsigned long stat_overrun;
|
|
|
|
/* sw model */
|
|
struct timer_list timer;
|
|
struct sl811h_ep *next_periodic;
|
|
struct sl811h_ep *next_async;
|
|
|
|
struct sl811h_ep *active_a;
|
|
unsigned long jiffies_a;
|
|
struct sl811h_ep *active_b;
|
|
unsigned long jiffies_b;
|
|
|
|
u32 port1;
|
|
u8 ctrl1, ctrl2, irq_enable;
|
|
u16 frame;
|
|
|
|
/* async schedule: control, bulk */
|
|
struct list_head async;
|
|
|
|
/* periodic schedule: interrupt, iso */
|
|
u16 load[PERIODIC_SIZE];
|
|
struct sl811h_ep *periodic[PERIODIC_SIZE];
|
|
unsigned periodic_count;
|
|
};
|
|
|
|
static inline struct sl811 *hcd_to_sl811(struct usb_hcd *hcd)
|
|
{
|
|
return (struct sl811 *) (hcd->hcd_priv);
|
|
}
|
|
|
|
static inline struct usb_hcd *sl811_to_hcd(struct sl811 *sl811)
|
|
{
|
|
return container_of((void *) sl811, struct usb_hcd, hcd_priv);
|
|
}
|
|
|
|
struct sl811h_ep {
|
|
struct usb_host_endpoint *hep;
|
|
struct usb_device *udev;
|
|
|
|
u8 defctrl;
|
|
u8 maxpacket;
|
|
u8 epnum;
|
|
u8 nextpid;
|
|
|
|
u16 error_count;
|
|
u16 nak_count;
|
|
u16 length; /* of current packet */
|
|
|
|
/* periodic schedule */
|
|
u16 period;
|
|
u16 branch;
|
|
u16 load;
|
|
struct sl811h_ep *next;
|
|
|
|
/* async schedule */
|
|
struct list_head schedule;
|
|
};
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
/* These register utilities should work for the SL811S register API too
|
|
* NOTE: caller must hold sl811->lock.
|
|
*/
|
|
|
|
static inline u8 sl811_read(struct sl811 *sl811, int reg)
|
|
{
|
|
writeb(reg, sl811->addr_reg);
|
|
return readb(sl811->data_reg);
|
|
}
|
|
|
|
static inline void sl811_write(struct sl811 *sl811, int reg, u8 val)
|
|
{
|
|
writeb(reg, sl811->addr_reg);
|
|
writeb(val, sl811->data_reg);
|
|
}
|
|
|
|
static inline void
|
|
sl811_write_buf(struct sl811 *sl811, int addr, const void *buf, size_t count)
|
|
{
|
|
const u8 *data;
|
|
void __iomem *data_reg;
|
|
|
|
if (!count)
|
|
return;
|
|
writeb(addr, sl811->addr_reg);
|
|
|
|
data = buf;
|
|
data_reg = sl811->data_reg;
|
|
do {
|
|
writeb(*data++, data_reg);
|
|
} while (--count);
|
|
}
|
|
|
|
static inline void
|
|
sl811_read_buf(struct sl811 *sl811, int addr, void *buf, size_t count)
|
|
{
|
|
u8 *data;
|
|
void __iomem *data_reg;
|
|
|
|
if (!count)
|
|
return;
|
|
writeb(addr, sl811->addr_reg);
|
|
|
|
data = buf;
|
|
data_reg = sl811->data_reg;
|
|
do {
|
|
*data++ = readb(data_reg);
|
|
} while (--count);
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
#ifdef PACKET_TRACE
|
|
# define PACKET pr_debug("sl811: "stuff)
|
|
#else
|
|
# define PACKET(stuff...) do{}while(0)
|
|
#endif
|