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
|
|
|
/*
|
|
|
|
* I/O Processor (IOP) ADB Driver
|
|
|
|
* Written and (C) 1999 by Joshua M. Thompson (funaho@jurai.org)
|
|
|
|
* Based on via-cuda.c by Paul Mackerras.
|
|
|
|
*
|
|
|
|
* 1999-07-01 (jmt) - First implementation for new driver architecture.
|
|
|
|
*
|
|
|
|
* 1999-07-31 (jmt) - First working version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
2018-09-12 08:18:44 +08:00
|
|
|
#include <asm/macintosh.h>
|
|
|
|
#include <asm/macints.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/mac_iop.h>
|
|
|
|
#include <asm/adb_iop.h>
|
2021-01-18 14:19:40 +08:00
|
|
|
#include <asm/unaligned.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2018-09-12 08:18:44 +08:00
|
|
|
#include <linux/adb.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static struct adb_request *current_req;
|
|
|
|
static struct adb_request *last_req;
|
2020-05-31 07:17:03 +08:00
|
|
|
static unsigned int autopoll_devs;
|
2020-11-20 12:39:56 +08:00
|
|
|
static u8 autopoll_addr;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static enum adb_iop_state {
|
2018-09-12 08:18:44 +08:00
|
|
|
idle,
|
|
|
|
sending,
|
|
|
|
awaiting_reply
|
2005-04-17 06:20:36 +08:00
|
|
|
} adb_iop_state;
|
|
|
|
|
|
|
|
static void adb_iop_start(void);
|
|
|
|
static int adb_iop_probe(void);
|
|
|
|
static int adb_iop_init(void);
|
|
|
|
static int adb_iop_send_request(struct adb_request *, int);
|
|
|
|
static int adb_iop_write(struct adb_request *);
|
|
|
|
static int adb_iop_autopoll(int);
|
|
|
|
static void adb_iop_poll(void);
|
|
|
|
static int adb_iop_reset_bus(void);
|
|
|
|
|
2020-11-20 12:39:56 +08:00
|
|
|
/* ADB command byte structure */
|
|
|
|
#define ADDR_MASK 0xF0
|
|
|
|
#define OP_MASK 0x0C
|
|
|
|
#define TALK 0x0C
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct adb_driver adb_iop_driver = {
|
2018-03-29 08:36:04 +08:00
|
|
|
.name = "ISM IOP",
|
|
|
|
.probe = adb_iop_probe,
|
|
|
|
.init = adb_iop_init,
|
|
|
|
.send_request = adb_iop_send_request,
|
|
|
|
.autopoll = adb_iop_autopoll,
|
|
|
|
.poll = adb_iop_poll,
|
|
|
|
.reset_bus = adb_iop_reset_bus
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static void adb_iop_done(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2020-05-31 07:17:03 +08:00
|
|
|
struct adb_request *req = current_req;
|
|
|
|
|
|
|
|
adb_iop_state = idle;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
req->complete = 1;
|
|
|
|
current_req = req->next;
|
2018-09-12 08:18:44 +08:00
|
|
|
if (req->done)
|
|
|
|
(*req->done)(req);
|
2020-05-31 07:17:03 +08:00
|
|
|
|
|
|
|
if (adb_iop_state == idle)
|
|
|
|
adb_iop_start();
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Completion routine for ADB commands sent to the IOP.
|
|
|
|
*
|
|
|
|
* This will be called when a packet has been successfully sent.
|
|
|
|
*/
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
static void adb_iop_complete(struct iop_msg *msg)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2010-11-12 06:05:06 +08:00
|
|
|
unsigned long flags;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
local_irq_save(flags);
|
|
|
|
|
2020-11-20 12:39:56 +08:00
|
|
|
adb_iop_state = awaiting_reply;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Listen for ADB messages from the IOP.
|
|
|
|
*
|
2020-11-20 12:39:56 +08:00
|
|
|
* This will be called when unsolicited IOP messages are received.
|
|
|
|
* These IOP messages can carry ADB autopoll responses and also occur
|
|
|
|
* after explicit ADB commands.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
static void adb_iop_listen(struct iop_msg *msg)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2018-09-12 08:18:44 +08:00
|
|
|
struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message;
|
2020-11-20 12:39:56 +08:00
|
|
|
u8 addr = (amsg->cmd & ADDR_MASK) >> 4;
|
|
|
|
u8 op = amsg->cmd & OP_MASK;
|
2010-11-12 06:05:06 +08:00
|
|
|
unsigned long flags;
|
2020-05-31 07:17:03 +08:00
|
|
|
bool req_done = false;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
local_irq_save(flags);
|
|
|
|
|
2020-11-20 12:39:56 +08:00
|
|
|
/* Responses to Talk commands may be unsolicited as they are
|
|
|
|
* produced when the IOP polls devices. They are mostly timeouts.
|
2020-05-31 07:17:03 +08:00
|
|
|
*/
|
2020-11-20 12:39:56 +08:00
|
|
|
if (op == TALK && ((1 << addr) & autopoll_devs))
|
|
|
|
autopoll_addr = addr;
|
|
|
|
|
|
|
|
switch (amsg->flags & (ADB_IOP_EXPLICIT |
|
|
|
|
ADB_IOP_AUTOPOLL |
|
|
|
|
ADB_IOP_TIMEOUT)) {
|
|
|
|
case ADB_IOP_EXPLICIT:
|
|
|
|
case ADB_IOP_EXPLICIT | ADB_IOP_TIMEOUT:
|
2020-05-31 07:17:03 +08:00
|
|
|
if (adb_iop_state == awaiting_reply) {
|
|
|
|
struct adb_request *req = current_req;
|
|
|
|
|
2020-11-20 12:39:56 +08:00
|
|
|
if (req->reply_expected) {
|
|
|
|
req->reply_len = amsg->count + 1;
|
|
|
|
memcpy(req->reply, &amsg->cmd, req->reply_len);
|
|
|
|
}
|
2020-05-31 07:17:03 +08:00
|
|
|
|
|
|
|
req_done = true;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2020-11-20 12:39:56 +08:00
|
|
|
break;
|
|
|
|
case ADB_IOP_AUTOPOLL:
|
|
|
|
if (((1 << addr) & autopoll_devs) &&
|
|
|
|
amsg->cmd == ADB_READREG(addr, 0))
|
|
|
|
adb_input(&amsg->cmd, amsg->count + 1, 1);
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2020-11-20 12:39:56 +08:00
|
|
|
msg->reply[0] = autopoll_addr ? ADB_IOP_AUTOPOLL : 0;
|
|
|
|
msg->reply[1] = 0;
|
|
|
|
msg->reply[2] = autopoll_addr ? ADB_READREG(autopoll_addr, 0) : 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
iop_complete_message(msg);
|
2020-05-31 07:17:03 +08:00
|
|
|
|
|
|
|
if (req_done)
|
|
|
|
adb_iop_done();
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start sending an ADB packet, IOP style
|
|
|
|
*
|
|
|
|
* There isn't much to do other than hand the packet over to the IOP
|
|
|
|
* after encapsulating it in an adb_iopmsg.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void adb_iop_start(void)
|
|
|
|
{
|
|
|
|
struct adb_request *req;
|
|
|
|
struct adb_iopmsg amsg;
|
|
|
|
|
|
|
|
/* get the packet to send */
|
|
|
|
req = current_req;
|
2018-09-12 08:18:44 +08:00
|
|
|
if (!req)
|
|
|
|
return;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
/* The IOP takes MacII-style packets, so strip the initial
|
|
|
|
* ADB_PACKET byte.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
amsg.flags = ADB_IOP_EXPLICIT;
|
|
|
|
amsg.count = req->nbytes - 2;
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
/* amsg.data immediately follows amsg.cmd, effectively making
|
|
|
|
* &amsg.cmd a pointer to the beginning of a full ADB packet.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
memcpy(&amsg.cmd, req->data + 1, req->nbytes - 1);
|
|
|
|
|
|
|
|
req->sent = 1;
|
|
|
|
adb_iop_state = sending;
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
/* Now send it. The IOP manager will call adb_iop_complete
|
|
|
|
* when the message has been sent.
|
|
|
|
*/
|
2018-09-12 08:18:44 +08:00
|
|
|
iop_send_message(ADB_IOP, ADB_CHAN, req, sizeof(amsg), (__u8 *)&amsg,
|
|
|
|
adb_iop_complete);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static int adb_iop_probe(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2018-09-12 08:18:44 +08:00
|
|
|
if (!iop_ism_present)
|
|
|
|
return -ENODEV;
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static int adb_iop_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2018-09-12 08:18:44 +08:00
|
|
|
pr_info("adb: IOP ISM driver v0.4 for Unified ADB\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
iop_listen(ADB_IOP, ADB_CHAN, adb_iop_listen, "ADB");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static int adb_iop_send_request(struct adb_request *req, int sync)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = adb_iop_write(req);
|
2018-09-12 08:18:44 +08:00
|
|
|
if (err)
|
|
|
|
return err;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (sync) {
|
2018-09-12 08:18:44 +08:00
|
|
|
while (!req->complete)
|
|
|
|
adb_iop_poll();
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int adb_iop_write(struct adb_request *req)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
if ((req->nbytes < 2) || (req->data[0] != ADB_PACKET)) {
|
|
|
|
req->complete = 1;
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2006-01-12 17:06:34 +08:00
|
|
|
req->next = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
req->sent = 0;
|
|
|
|
req->complete = 0;
|
|
|
|
req->reply_len = 0;
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
local_irq_save(flags);
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
if (current_req) {
|
2005-04-17 06:20:36 +08:00
|
|
|
last_req->next = req;
|
|
|
|
last_req = req;
|
|
|
|
} else {
|
|
|
|
current_req = req;
|
|
|
|
last_req = req;
|
|
|
|
}
|
|
|
|
|
2018-09-12 08:18:44 +08:00
|
|
|
if (adb_iop_state == idle)
|
|
|
|
adb_iop_start();
|
2020-05-31 07:17:03 +08:00
|
|
|
|
|
|
|
local_irq_restore(flags);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static void adb_iop_set_ap_complete(struct iop_msg *msg)
|
|
|
|
{
|
|
|
|
struct adb_iopmsg *amsg = (struct adb_iopmsg *)msg->message;
|
|
|
|
|
2021-01-18 14:19:40 +08:00
|
|
|
autopoll_devs = get_unaligned_be16(amsg->data);
|
2020-11-20 12:39:56 +08:00
|
|
|
if (autopoll_devs & (1 << autopoll_addr))
|
|
|
|
return;
|
|
|
|
autopoll_addr = autopoll_devs ? (ffs(autopoll_devs) - 1) : 0;
|
2020-05-31 07:17:03 +08:00
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static int adb_iop_autopoll(int devs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2020-05-31 07:17:03 +08:00
|
|
|
struct adb_iopmsg amsg;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned int mask = (unsigned int)devs & 0xFFFE;
|
|
|
|
|
|
|
|
local_irq_save(flags);
|
|
|
|
|
|
|
|
amsg.flags = ADB_IOP_SET_AUTOPOLL | (mask ? ADB_IOP_AUTOPOLL : 0);
|
|
|
|
amsg.count = 2;
|
|
|
|
amsg.cmd = 0;
|
2021-01-18 14:19:40 +08:00
|
|
|
put_unaligned_be16(mask, amsg.data);
|
2020-05-31 07:17:03 +08:00
|
|
|
|
|
|
|
iop_send_message(ADB_IOP, ADB_CHAN, NULL, sizeof(amsg), (__u8 *)&amsg,
|
|
|
|
adb_iop_set_ap_complete);
|
|
|
|
|
|
|
|
local_irq_restore(flags);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static void adb_iop_poll(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2017-10-27 10:45:24 +08:00
|
|
|
iop_ism_irq_poll(ADB_IOP);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2020-05-31 07:17:03 +08:00
|
|
|
static int adb_iop_reset_bus(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2020-05-31 07:17:03 +08:00
|
|
|
struct adb_request req;
|
|
|
|
|
|
|
|
/* Command = 0, Address = ignored */
|
|
|
|
adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_BUSRESET);
|
|
|
|
adb_iop_send_request(&req, 1);
|
|
|
|
|
|
|
|
/* Don't want any more requests during the Global Reset low time. */
|
|
|
|
mdelay(3);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|