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-footbridge/netwinder-hw.c
|
|
|
|
*
|
|
|
|
* Netwinder machine fixup
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998, 1999 Russell King, Phil Blundell
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/init.h>
|
2008-09-06 19:10:45 +08:00
|
|
|
#include <linux/io.h>
|
2008-12-06 16:25:16 +08:00
|
|
|
#include <linux/spinlock.h>
|
2012-03-14 02:05:24 +08:00
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/leds.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/hardware/dec21285.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/setup.h>
|
2012-03-29 01:30:01 +08:00
|
|
|
#include <asm/system_misc.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#define IRDA_IO_BASE 0x180
|
|
|
|
#define GP1_IO_BASE 0x338
|
|
|
|
#define GP2_IO_BASE 0x33a
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Winbond WB83977F accessibility stuff
|
|
|
|
*/
|
|
|
|
static inline void wb977_open(void)
|
|
|
|
{
|
|
|
|
outb(0x87, 0x370);
|
|
|
|
outb(0x87, 0x370);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wb977_close(void)
|
|
|
|
{
|
|
|
|
outb(0xaa, 0x370);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wb977_wb(int reg, int val)
|
|
|
|
{
|
|
|
|
outb(reg, 0x370);
|
|
|
|
outb(val, 0x371);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void wb977_ww(int reg, int val)
|
|
|
|
{
|
|
|
|
outb(reg, 0x370);
|
|
|
|
outb(val >> 8, 0x371);
|
|
|
|
outb(reg + 1, 0x370);
|
|
|
|
outb(val & 255, 0x371);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define wb977_device_select(dev) wb977_wb(0x07, dev)
|
|
|
|
#define wb977_device_disable() wb977_wb(0x30, 0x00)
|
|
|
|
#define wb977_device_enable() wb977_wb(0x30, 0x01)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
|
|
|
|
*/
|
2009-07-03 21:44:46 +08:00
|
|
|
DEFINE_RAW_SPINLOCK(nw_gpio_lock);
|
2008-12-06 16:25:16 +08:00
|
|
|
EXPORT_SYMBOL(nw_gpio_lock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static unsigned int current_gpio_op;
|
|
|
|
static unsigned int current_gpio_io;
|
|
|
|
static unsigned int current_cpld;
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
void nw_gpio_modify_op(unsigned int mask, unsigned int set)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
unsigned int new_gpio, changed;
|
|
|
|
|
|
|
|
new_gpio = (current_gpio_op & ~mask) | set;
|
|
|
|
changed = new_gpio ^ current_gpio_op;
|
|
|
|
current_gpio_op = new_gpio;
|
|
|
|
|
|
|
|
if (changed & 0xff)
|
|
|
|
outb(new_gpio, GP1_IO_BASE);
|
|
|
|
if (changed & 0xff00)
|
|
|
|
outb(new_gpio >> 8, GP2_IO_BASE);
|
|
|
|
}
|
2008-12-06 16:25:16 +08:00
|
|
|
EXPORT_SYMBOL(nw_gpio_modify_op);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static inline void __gpio_modify_io(int mask, int in)
|
|
|
|
{
|
|
|
|
unsigned int new_gpio, changed;
|
|
|
|
int port;
|
|
|
|
|
|
|
|
new_gpio = (current_gpio_io & ~mask) | in;
|
|
|
|
changed = new_gpio ^ current_gpio_io;
|
|
|
|
current_gpio_io = new_gpio;
|
|
|
|
|
|
|
|
changed >>= 1;
|
|
|
|
new_gpio >>= 1;
|
|
|
|
|
|
|
|
wb977_device_select(7);
|
|
|
|
|
|
|
|
for (port = 0xe1; changed && port < 0xe8; changed >>= 1) {
|
|
|
|
wb977_wb(port, new_gpio & 1);
|
|
|
|
|
|
|
|
port += 1;
|
|
|
|
new_gpio >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
wb977_device_select(8);
|
|
|
|
|
|
|
|
for (port = 0xe8; changed && port < 0xec; changed >>= 1) {
|
|
|
|
wb977_wb(port, new_gpio & 1);
|
|
|
|
|
|
|
|
port += 1;
|
|
|
|
new_gpio >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
void nw_gpio_modify_io(unsigned int mask, unsigned int in)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
/* Open up the SuperIO chip */
|
|
|
|
wb977_open();
|
|
|
|
|
|
|
|
__gpio_modify_io(mask, in);
|
|
|
|
|
|
|
|
/* Close up the EFER gate */
|
|
|
|
wb977_close();
|
|
|
|
}
|
2008-12-06 16:25:16 +08:00
|
|
|
EXPORT_SYMBOL(nw_gpio_modify_io);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
unsigned int nw_gpio_read(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return inb(GP1_IO_BASE) | inb(GP2_IO_BASE) << 8;
|
|
|
|
}
|
2008-12-06 16:25:16 +08:00
|
|
|
EXPORT_SYMBOL(nw_gpio_read);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the Winbond W83977F global registers
|
|
|
|
*/
|
|
|
|
static inline void wb977_init_global(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Enable R/W config registers
|
|
|
|
*/
|
|
|
|
wb977_wb(0x26, 0x40);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Power down FDC (not used)
|
|
|
|
*/
|
|
|
|
wb977_wb(0x22, 0xfe);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GP12, GP11, CIRRX, IRRXH, GP10
|
|
|
|
*/
|
|
|
|
wb977_wb(0x2a, 0xc1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GP23, GP22, GP21, GP20, GP13
|
|
|
|
*/
|
|
|
|
wb977_wb(0x2b, 0x6b);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GP17, GP16, GP15, GP14
|
|
|
|
*/
|
|
|
|
wb977_wb(0x2c, 0x55);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the Winbond W83977F printer port
|
|
|
|
*/
|
|
|
|
static inline void wb977_init_printer(void)
|
|
|
|
{
|
|
|
|
wb977_device_select(1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* mode 1 == EPP
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf0, 0x01);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the Winbond W83977F keyboard controller
|
|
|
|
*/
|
|
|
|
static inline void wb977_init_keyboard(void)
|
|
|
|
{
|
|
|
|
wb977_device_select(5);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Keyboard controller address
|
|
|
|
*/
|
|
|
|
wb977_ww(0x60, 0x0060);
|
|
|
|
wb977_ww(0x62, 0x0064);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Keyboard IRQ 1, active high, edge trigger
|
|
|
|
*/
|
|
|
|
wb977_wb(0x70, 1);
|
|
|
|
wb977_wb(0x71, 0x02);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mouse IRQ 5, active high, edge trigger
|
|
|
|
*/
|
|
|
|
wb977_wb(0x72, 5);
|
|
|
|
wb977_wb(0x73, 0x02);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* KBC 8MHz
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf0, 0x40);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable device
|
|
|
|
*/
|
|
|
|
wb977_device_enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the Winbond W83977F Infra-Red device
|
|
|
|
*/
|
|
|
|
static inline void wb977_init_irda(void)
|
|
|
|
{
|
|
|
|
wb977_device_select(6);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IR base address
|
|
|
|
*/
|
|
|
|
wb977_ww(0x60, IRDA_IO_BASE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IRDA IRQ 6, active high, edge trigger
|
|
|
|
*/
|
|
|
|
wb977_wb(0x70, 6);
|
|
|
|
wb977_wb(0x71, 0x02);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* RX DMA - ISA DMA 0
|
|
|
|
*/
|
|
|
|
wb977_wb(0x74, 0x00);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TX DMA - Disable Tx DMA
|
|
|
|
*/
|
|
|
|
wb977_wb(0x75, 0x04);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Append CRC, Enable bank selection
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf0, 0x03);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable device
|
|
|
|
*/
|
|
|
|
wb977_device_enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise Winbond W83977F general purpose IO
|
|
|
|
*/
|
|
|
|
static inline void wb977_init_gpio(void)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up initial I/O definitions
|
|
|
|
*/
|
|
|
|
current_gpio_io = -1;
|
|
|
|
__gpio_modify_io(-1, GPIO_DONE | GPIO_WDTIMER);
|
|
|
|
|
|
|
|
wb977_device_select(7);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Group1 base address
|
|
|
|
*/
|
|
|
|
wb977_ww(0x60, GP1_IO_BASE);
|
|
|
|
wb977_ww(0x62, 0);
|
|
|
|
wb977_ww(0x64, 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GP10 (Orage button) IRQ 10, active high, edge trigger
|
|
|
|
*/
|
|
|
|
wb977_wb(0x70, 10);
|
|
|
|
wb977_wb(0x71, 0x02);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GP10: Debounce filter enabled, IRQ, input
|
|
|
|
*/
|
|
|
|
wb977_wb(0xe0, 0x19);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable Group1
|
|
|
|
*/
|
|
|
|
wb977_device_enable();
|
|
|
|
|
|
|
|
wb977_device_select(8);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Group2 base address
|
|
|
|
*/
|
|
|
|
wb977_ww(0x60, GP2_IO_BASE);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear watchdog timer regs
|
|
|
|
* - timer disable
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf2, 0x00);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* - disable LED, no mouse nor keyboard IRQ
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf3, 0x00);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* - timer counting, disable power LED, disable timeouot
|
|
|
|
*/
|
|
|
|
wb977_wb(0xf4, 0x00);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable group2
|
|
|
|
*/
|
|
|
|
wb977_device_enable();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set Group1/Group2 outputs
|
|
|
|
*/
|
2009-07-03 21:44:46 +08:00
|
|
|
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
|
2008-12-06 16:25:16 +08:00
|
|
|
nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
|
2009-07-03 21:44:46 +08:00
|
|
|
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the Winbond W83977F chip.
|
|
|
|
*/
|
|
|
|
static void __init wb977_init(void)
|
|
|
|
{
|
|
|
|
request_region(0x370, 2, "W83977AF configuration");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Open up the SuperIO chip
|
|
|
|
*/
|
|
|
|
wb977_open();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the global registers
|
|
|
|
*/
|
|
|
|
wb977_init_global();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise the various devices in
|
|
|
|
* the multi-IO chip.
|
|
|
|
*/
|
|
|
|
wb977_init_printer();
|
|
|
|
wb977_init_keyboard();
|
|
|
|
wb977_init_irda();
|
|
|
|
wb977_init_gpio();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Close up the EFER gate
|
|
|
|
*/
|
|
|
|
wb977_close();
|
|
|
|
}
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
void nw_cpld_modify(unsigned int mask, unsigned int set)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int msk;
|
|
|
|
|
|
|
|
current_cpld = (current_cpld & ~mask) | set;
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
nw_gpio_modify_io(GPIO_DATA | GPIO_IOCLK | GPIO_IOLOAD, 0);
|
|
|
|
nw_gpio_modify_op(GPIO_IOLOAD, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
for (msk = 8; msk; msk >>= 1) {
|
|
|
|
int bit = current_cpld & msk;
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
nw_gpio_modify_op(GPIO_DATA | GPIO_IOCLK, bit ? GPIO_DATA : 0);
|
|
|
|
nw_gpio_modify_op(GPIO_IOCLK, GPIO_IOCLK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-12-06 16:25:16 +08:00
|
|
|
nw_gpio_modify_op(GPIO_IOCLK|GPIO_DATA, 0);
|
|
|
|
nw_gpio_modify_op(GPIO_IOLOAD|GPIO_DSCLK, GPIO_IOLOAD|GPIO_DSCLK);
|
|
|
|
nw_gpio_modify_op(GPIO_IOLOAD, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-12-06 16:25:16 +08:00
|
|
|
EXPORT_SYMBOL(nw_cpld_modify);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static void __init cpld_init(void)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
2009-07-03 21:44:46 +08:00
|
|
|
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
|
2008-12-06 16:25:16 +08:00
|
|
|
nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
|
2009-07-03 21:44:46 +08:00
|
|
|
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned char rwa_unlock[] __initdata =
|
|
|
|
{ 0x00, 0x00, 0x6a, 0xb5, 0xda, 0xed, 0xf6, 0xfb, 0x7d, 0xbe, 0xdf, 0x6f, 0x37, 0x1b,
|
|
|
|
0x0d, 0x86, 0xc3, 0x61, 0xb0, 0x58, 0x2c, 0x16, 0x8b, 0x45, 0xa2, 0xd1, 0xe8, 0x74,
|
|
|
|
0x3a, 0x9d, 0xce, 0xe7, 0x73, 0x39 };
|
|
|
|
|
|
|
|
#ifndef DEBUG
|
|
|
|
#define dprintk(x...)
|
|
|
|
#else
|
|
|
|
#define dprintk(x...) printk(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WRITE_RWA(r,v) do { outb((r), 0x279); udelay(10); outb((v), 0xa79); } while (0)
|
|
|
|
|
|
|
|
static inline void rwa010_unlock(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
WRITE_RWA(2, 2);
|
|
|
|
mdelay(10);
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(rwa_unlock); i++) {
|
|
|
|
outb(rwa_unlock[i], 0x279);
|
|
|
|
udelay(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rwa010_read_ident(void)
|
|
|
|
{
|
|
|
|
unsigned char si[9];
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
WRITE_RWA(3, 0);
|
|
|
|
WRITE_RWA(0, 128);
|
|
|
|
|
|
|
|
outb(1, 0x279);
|
|
|
|
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
dprintk("Identifier: ");
|
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
si[i] = 0;
|
|
|
|
for (j = 0; j < 8; j++) {
|
|
|
|
int bit;
|
|
|
|
udelay(250);
|
|
|
|
inb(0x203);
|
|
|
|
udelay(250);
|
|
|
|
bit = inb(0x203);
|
|
|
|
dprintk("%02X ", bit);
|
|
|
|
bit = (bit == 0xaa) ? 1 : 0;
|
|
|
|
si[i] |= bit << j;
|
|
|
|
}
|
|
|
|
dprintk("(%02X) ", si[i]);
|
|
|
|
}
|
|
|
|
dprintk("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rwa010_global_init(void)
|
|
|
|
{
|
|
|
|
WRITE_RWA(6, 2); // Assign a card no = 2
|
|
|
|
|
|
|
|
dprintk("Card no = %d\n", inb(0x203));
|
|
|
|
|
|
|
|
/* disable the modem section of the chip */
|
|
|
|
WRITE_RWA(7, 3);
|
|
|
|
WRITE_RWA(0x30, 0);
|
|
|
|
|
|
|
|
/* disable the cdrom section of the chip */
|
|
|
|
WRITE_RWA(7, 4);
|
|
|
|
WRITE_RWA(0x30, 0);
|
|
|
|
|
|
|
|
/* disable the MPU-401 section of the chip */
|
|
|
|
WRITE_RWA(7, 2);
|
|
|
|
WRITE_RWA(0x30, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rwa010_game_port_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
WRITE_RWA(7, 5);
|
|
|
|
|
|
|
|
dprintk("Slider base: ");
|
|
|
|
WRITE_RWA(0x61, 1);
|
|
|
|
i = inb(0x203);
|
|
|
|
|
|
|
|
WRITE_RWA(0x60, 2);
|
|
|
|
dprintk("%02X%02X (201)\n", inb(0x203), i);
|
|
|
|
|
|
|
|
WRITE_RWA(0x30, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rwa010_waveartist_init(int base, int irq, int dma)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
WRITE_RWA(7, 0);
|
|
|
|
|
|
|
|
dprintk("WaveArtist base: ");
|
|
|
|
WRITE_RWA(0x61, base & 255);
|
|
|
|
i = inb(0x203);
|
|
|
|
|
|
|
|
WRITE_RWA(0x60, base >> 8);
|
|
|
|
dprintk("%02X%02X (%X),", inb(0x203), i, base);
|
|
|
|
|
|
|
|
WRITE_RWA(0x70, irq);
|
|
|
|
dprintk(" irq: %d (%d),", inb(0x203), irq);
|
|
|
|
|
|
|
|
WRITE_RWA(0x74, dma);
|
|
|
|
dprintk(" dma: %d (%d)\n", inb(0x203), dma);
|
|
|
|
|
|
|
|
WRITE_RWA(0x30, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, int dma)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
WRITE_RWA(7, 1);
|
|
|
|
|
|
|
|
dprintk("SoundBlaster base: ");
|
|
|
|
WRITE_RWA(0x61, sb_base & 255);
|
|
|
|
i = inb(0x203);
|
|
|
|
|
|
|
|
WRITE_RWA(0x60, sb_base >> 8);
|
|
|
|
dprintk("%02X%02X (%X),", inb(0x203), i, sb_base);
|
|
|
|
|
|
|
|
dprintk(" irq: ");
|
|
|
|
WRITE_RWA(0x70, irq);
|
|
|
|
dprintk("%d (%d),", inb(0x203), irq);
|
|
|
|
|
|
|
|
dprintk(" 8-bit DMA: ");
|
|
|
|
WRITE_RWA(0x74, dma);
|
|
|
|
dprintk("%d (%d)\n", inb(0x203), dma);
|
|
|
|
|
|
|
|
dprintk("AdLib base: ");
|
|
|
|
WRITE_RWA(0x63, al_base & 255);
|
|
|
|
i = inb(0x203);
|
|
|
|
|
|
|
|
WRITE_RWA(0x62, al_base >> 8);
|
|
|
|
dprintk("%02X%02X (%X)\n", inb(0x203), i, al_base);
|
|
|
|
|
|
|
|
WRITE_RWA(0x30, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void rwa010_soundblaster_reset(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
outb(1, 0x226);
|
|
|
|
udelay(3);
|
|
|
|
outb(0, 0x226);
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
if (inb(0x22e) & 0x80)
|
|
|
|
break;
|
|
|
|
mdelay(1);
|
|
|
|
}
|
|
|
|
if (i == 5)
|
|
|
|
printk("SoundBlaster: DSP reset failed\n");
|
|
|
|
|
|
|
|
dprintk("SoundBlaster DSP reset: %02X (AA)\n", inb(0x22a));
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
if ((inb(0x22c) & 0x80) == 0)
|
|
|
|
break;
|
|
|
|
mdelay(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 5)
|
|
|
|
printk("SoundBlaster: DSP not ready\n");
|
|
|
|
else {
|
|
|
|
outb(0xe1, 0x22c);
|
|
|
|
|
|
|
|
dprintk("SoundBlaster DSP id: ");
|
|
|
|
i = inb(0x22a);
|
|
|
|
udelay(1);
|
|
|
|
i |= inb(0x22a) << 8;
|
|
|
|
dprintk("%04X\n", i);
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
if ((inb(0x22c) & 0x80) == 0)
|
|
|
|
break;
|
|
|
|
mdelay(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 5)
|
|
|
|
printk("SoundBlaster: could not turn speaker off\n");
|
|
|
|
|
|
|
|
outb(0xd3, 0x22c);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* turn on OPL3 */
|
|
|
|
outb(5, 0x38a);
|
|
|
|
outb(1, 0x38b);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init rwa010_init(void)
|
|
|
|
{
|
|
|
|
rwa010_unlock();
|
|
|
|
rwa010_read_ident();
|
|
|
|
rwa010_global_init();
|
|
|
|
rwa010_game_port_init();
|
|
|
|
rwa010_waveartist_init(0x250, 3, 7);
|
|
|
|
rwa010_soundblaster_init(0x220, 0x388, 3, 1);
|
|
|
|
rwa010_soundblaster_reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise any other hardware after we've got the PCI bus
|
|
|
|
* initialised. We may need the PCI bus to talk to this other
|
|
|
|
* hardware.
|
|
|
|
*/
|
|
|
|
static int __init nw_hw_init(void)
|
|
|
|
{
|
|
|
|
if (machine_is_netwinder()) {
|
|
|
|
wb977_init();
|
|
|
|
cpld_init();
|
|
|
|
rwa010_init();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__initcall(nw_hw_init);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Older NeTTroms either do not provide a parameters
|
|
|
|
* page, or they don't supply correct information in
|
|
|
|
* the parameter page.
|
|
|
|
*/
|
|
|
|
static void __init
|
2014-04-14 05:54:58 +08:00
|
|
|
fixup_netwinder(struct tag *tags, char **cmdline)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_ISAPNP
|
|
|
|
extern int isapnp_disable;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We must not use the kernels ISAPnP code
|
|
|
|
* on the NetWinder - it will reset the settings
|
|
|
|
* for the WaveArtist chip and render it inoperable.
|
|
|
|
*/
|
|
|
|
isapnp_disable = 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-07-09 07:01:40 +08:00
|
|
|
static void netwinder_restart(enum reboot_mode mode, const char *cmd)
|
2011-11-04 03:47:54 +08:00
|
|
|
{
|
2013-07-09 07:01:40 +08:00
|
|
|
if (mode == REBOOT_SOFT) {
|
2011-11-04 03:47:54 +08:00
|
|
|
/* Jump into the ROM */
|
|
|
|
soft_restart(0x41000000);
|
|
|
|
} else {
|
|
|
|
local_irq_disable();
|
|
|
|
local_fiq_disable();
|
|
|
|
|
|
|
|
/* open up the SuperIO chip */
|
|
|
|
outb(0x87, 0x370);
|
|
|
|
outb(0x87, 0x370);
|
|
|
|
|
|
|
|
/* aux function group 1 (logical device 7) */
|
|
|
|
outb(0x07, 0x370);
|
|
|
|
outb(0x07, 0x371);
|
|
|
|
|
|
|
|
/* set GP16 for WD-TIMER output */
|
|
|
|
outb(0xe6, 0x370);
|
|
|
|
outb(0x00, 0x371);
|
|
|
|
|
|
|
|
/* set a RED LED and toggle WD_TIMER for rebooting */
|
|
|
|
outb(0xc4, 0x338);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-14 02:05:24 +08:00
|
|
|
/* LEDs */
|
|
|
|
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
|
|
|
|
struct netwinder_led {
|
|
|
|
struct led_classdev cdev;
|
|
|
|
u8 mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The triggers lines up below will only be used if the
|
|
|
|
* LED triggers are compiled in.
|
|
|
|
*/
|
|
|
|
static const struct {
|
|
|
|
const char *name;
|
|
|
|
const char *trigger;
|
|
|
|
} netwinder_leds[] = {
|
|
|
|
{ "netwinder:green", "heartbeat", },
|
|
|
|
{ "netwinder:red", "cpu0", },
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The LED control in Netwinder is reversed:
|
|
|
|
* - setting bit means turn off LED
|
|
|
|
* - clearing bit means turn on LED
|
|
|
|
*/
|
|
|
|
static void netwinder_led_set(struct led_classdev *cdev,
|
|
|
|
enum led_brightness b)
|
|
|
|
{
|
|
|
|
struct netwinder_led *led = container_of(cdev,
|
|
|
|
struct netwinder_led, cdev);
|
|
|
|
unsigned long flags;
|
|
|
|
u32 reg;
|
|
|
|
|
2013-10-31 18:52:05 +08:00
|
|
|
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
|
2012-03-14 02:05:24 +08:00
|
|
|
reg = nw_gpio_read();
|
|
|
|
if (b != LED_OFF)
|
|
|
|
reg &= ~led->mask;
|
|
|
|
else
|
|
|
|
reg |= led->mask;
|
|
|
|
nw_gpio_modify_op(led->mask, reg);
|
2013-10-31 18:52:05 +08:00
|
|
|
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
|
2012-03-14 02:05:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static enum led_brightness netwinder_led_get(struct led_classdev *cdev)
|
|
|
|
{
|
|
|
|
struct netwinder_led *led = container_of(cdev,
|
|
|
|
struct netwinder_led, cdev);
|
|
|
|
unsigned long flags;
|
|
|
|
u32 reg;
|
|
|
|
|
2013-10-31 18:52:05 +08:00
|
|
|
raw_spin_lock_irqsave(&nw_gpio_lock, flags);
|
2012-03-14 02:05:24 +08:00
|
|
|
reg = nw_gpio_read();
|
2013-10-31 18:52:05 +08:00
|
|
|
raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
|
2012-03-14 02:05:24 +08:00
|
|
|
|
|
|
|
return (reg & led->mask) ? LED_OFF : LED_FULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init netwinder_leds_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!machine_is_netwinder())
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(netwinder_leds); i++) {
|
|
|
|
struct netwinder_led *led;
|
|
|
|
|
|
|
|
led = kzalloc(sizeof(*led), GFP_KERNEL);
|
|
|
|
if (!led)
|
|
|
|
break;
|
|
|
|
|
|
|
|
led->cdev.name = netwinder_leds[i].name;
|
|
|
|
led->cdev.brightness_set = netwinder_led_set;
|
|
|
|
led->cdev.brightness_get = netwinder_led_get;
|
|
|
|
led->cdev.default_trigger = netwinder_leds[i].trigger;
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
led->mask = GPIO_GREEN_LED;
|
|
|
|
else
|
|
|
|
led->mask = GPIO_RED_LED;
|
|
|
|
|
|
|
|
if (led_classdev_register(NULL, &led->cdev) < 0) {
|
|
|
|
kfree(led);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since we may have triggers on any subsystem, defer registration
|
|
|
|
* until after subsystem_init.
|
|
|
|
*/
|
|
|
|
fs_initcall(netwinder_leds_init);
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_START(NETWINDER, "Rebel-NetWinder")
|
2005-07-04 00:38:58 +08:00
|
|
|
/* Maintainer: Russell King/Rebel.com */
|
2011-07-06 10:38:11 +08:00
|
|
|
.atag_offset = 0x100,
|
2005-07-04 00:38:58 +08:00
|
|
|
.video_start = 0x000a0000,
|
|
|
|
.video_end = 0x000bffff,
|
|
|
|
.reserve_lp0 = 1,
|
|
|
|
.reserve_lp2 = 1,
|
|
|
|
.fixup = fixup_netwinder,
|
|
|
|
.map_io = footbridge_map_io,
|
|
|
|
.init_irq = footbridge_init_irq,
|
2012-11-09 03:40:59 +08:00
|
|
|
.init_time = isa_timer_init,
|
2011-11-04 03:47:54 +08:00
|
|
|
.restart = netwinder_restart,
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_END
|