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-sa1100/simpad.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
2016-08-31 15:49:48 +08:00
|
|
|
#include <linux/gpio/machine.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/tty.h>
|
|
|
|
#include <linux/proc_fs.h>
|
2012-02-24 07:06:51 +08:00
|
|
|
#include <linux/string.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/pm.h>
|
2012-09-21 17:18:58 +08:00
|
|
|
#include <linux/platform_data/sa11x0-serial.h>
|
2005-10-30 02:07:23 +08:00
|
|
|
#include <linux/platform_device.h>
|
2012-01-21 06:13:52 +08:00
|
|
|
#include <linux/mfd/ucb1x00.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
2008-09-06 19:10:45 +08:00
|
|
|
#include <linux/io.h>
|
2015-12-08 18:20:44 +08:00
|
|
|
#include <linux/gpio/driver.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/hardware.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/setup.h>
|
2013-10-25 23:23:30 +08:00
|
|
|
#include <asm/irq.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
#include <asm/mach/map.h>
|
2012-08-24 21:17:38 +08:00
|
|
|
#include <linux/platform_data/mfd-mcp-sa11x0.h>
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/simpad.h>
|
2012-02-24 07:06:51 +08:00
|
|
|
#include <mach/irqs.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <linux/serial_core.h>
|
|
|
|
#include <linux/ioport.h>
|
2011-08-19 04:51:06 +08:00
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/gpio_keys.h>
|
2011-08-19 04:51:39 +08:00
|
|
|
#include <linux/leds.h>
|
2018-04-20 04:00:07 +08:00
|
|
|
#include <linux/platform_data/i2c-gpio.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
/*
|
|
|
|
* CS3 support
|
|
|
|
*/
|
|
|
|
|
|
|
|
static long cs3_shadow;
|
|
|
|
static spinlock_t cs3_lock;
|
|
|
|
static struct gpio_chip cs3_gpio;
|
|
|
|
|
|
|
|
long simpad_get_cs3_ro(void)
|
|
|
|
{
|
|
|
|
return readl(CS3_BASE);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(simpad_get_cs3_ro);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
long simpad_get_cs3_shadow(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return cs3_shadow;
|
|
|
|
}
|
2011-08-19 04:50:31 +08:00
|
|
|
EXPORT_SYMBOL(simpad_get_cs3_shadow);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
static void __simpad_write_cs3(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
writel(cs3_shadow, CS3_BASE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
void simpad_set_cs3_bit(int value)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&cs3_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
cs3_shadow |= value;
|
2011-08-19 04:50:31 +08:00
|
|
|
__simpad_write_cs3();
|
|
|
|
spin_unlock_irqrestore(&cs3_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2011-08-19 04:50:31 +08:00
|
|
|
EXPORT_SYMBOL(simpad_set_cs3_bit);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
void simpad_clear_cs3_bit(int value)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&cs3_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
cs3_shadow &= ~value;
|
2011-08-19 04:50:31 +08:00
|
|
|
__simpad_write_cs3();
|
|
|
|
spin_unlock_irqrestore(&cs3_lock, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2011-08-19 04:50:31 +08:00
|
|
|
EXPORT_SYMBOL(simpad_clear_cs3_bit);
|
|
|
|
|
|
|
|
static void cs3_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
|
|
|
{
|
|
|
|
if (offset > 15)
|
|
|
|
return;
|
|
|
|
if (value)
|
|
|
|
simpad_set_cs3_bit(1 << offset);
|
|
|
|
else
|
|
|
|
simpad_clear_cs3_bit(1 << offset);
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
static int cs3_gpio_get(struct gpio_chip *chip, unsigned offset)
|
|
|
|
{
|
|
|
|
if (offset > 15)
|
2015-12-22 22:36:12 +08:00
|
|
|
return !!(simpad_get_cs3_ro() & (1 << (offset - 16)));
|
|
|
|
return !!(simpad_get_cs3_shadow() & (1 << offset));
|
2011-08-19 04:50:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int cs3_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
|
|
|
{
|
|
|
|
if (offset > 15)
|
|
|
|
return 0;
|
|
|
|
return -EINVAL;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int cs3_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
|
|
|
|
int value)
|
|
|
|
{
|
|
|
|
if (offset > 15)
|
|
|
|
return -EINVAL;
|
|
|
|
cs3_gpio_set(chip, offset, value);
|
|
|
|
return 0;
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static struct map_desc simpad_io_desc[] __initdata = {
|
2005-10-28 22:19:04 +08:00
|
|
|
{ /* MQ200 */
|
|
|
|
.virtual = 0xf2800000,
|
|
|
|
.pfn = __phys_to_pfn(0x4b800000),
|
|
|
|
.length = 0x00800000,
|
|
|
|
.type = MT_DEVICE
|
2011-08-19 04:50:31 +08:00
|
|
|
}, { /* Simpad CS3 */
|
2012-09-15 04:21:32 +08:00
|
|
|
.virtual = (unsigned long)CS3_BASE,
|
2011-08-19 04:50:31 +08:00
|
|
|
.pfn = __phys_to_pfn(SA1100_CS3_PHYS),
|
2005-10-28 22:19:04 +08:00
|
|
|
.length = 0x00100000,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
},
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void simpad_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
|
|
|
|
{
|
|
|
|
if (port->mapbase == (u_int)&Ser1UTCR0) {
|
|
|
|
if (state)
|
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
simpad_clear_cs3_bit(RS232_ON);
|
|
|
|
simpad_clear_cs3_bit(DECT_POWER_ON);
|
2005-04-17 06:20:36 +08:00
|
|
|
}else
|
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
simpad_set_cs3_bit(RS232_ON);
|
|
|
|
simpad_set_cs3_bit(DECT_POWER_ON);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct sa1100_port_fns simpad_port_fns __initdata = {
|
|
|
|
.pm = simpad_uart_pm,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct mtd_partition simpad_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "SIMpad boot firmware",
|
|
|
|
.size = 0x00080000,
|
|
|
|
.offset = 0,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
}, {
|
|
|
|
.name = "SIMpad kernel",
|
|
|
|
.size = 0x0010000,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}, {
|
|
|
|
.name = "SIMpad root jffs2",
|
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct flash_platform_data simpad_flash_data = {
|
|
|
|
.map_name = "cfi_probe",
|
|
|
|
.parts = simpad_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(simpad_partitions),
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct resource simpad_flash_resources [] = {
|
2012-01-12 18:25:29 +08:00
|
|
|
DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_16M),
|
|
|
|
DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_16M),
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2012-01-21 06:13:52 +08:00
|
|
|
static struct ucb1x00_plat_data simpad_ucb1x00_data = {
|
|
|
|
.gpio_base = SIMPAD_UCB1X00_GPIO_BASE,
|
|
|
|
};
|
|
|
|
|
2005-08-18 17:10:46 +08:00
|
|
|
static struct mcp_plat_data simpad_mcp_data = {
|
|
|
|
.mccr0 = MCCR0_ADM,
|
|
|
|
.sclk_rate = 11981000,
|
2012-01-21 06:13:52 +08:00
|
|
|
.codec_pdata = &simpad_ucb1x00_data,
|
2005-08-18 17:10:46 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void __init simpad_map_io(void)
|
|
|
|
{
|
|
|
|
sa1100_map_io();
|
|
|
|
|
|
|
|
iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
|
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
/* Initialize CS3 */
|
|
|
|
cs3_shadow = (EN1 | EN0 | LED2_ON | DISPLAY_ON |
|
|
|
|
RS232_ON | ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
|
|
|
|
__simpad_write_cs3(); /* Spinlocks not yet initialized */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
sa1100_register_uart_fns(&simpad_port_fns);
|
|
|
|
sa1100_register_uart(0, 3); /* serial interface */
|
|
|
|
sa1100_register_uart(1, 1); /* DECT */
|
|
|
|
|
|
|
|
// Reassign UART 1 pins
|
|
|
|
GAFR |= GPIO_UART_TXD | GPIO_UART_RXD;
|
|
|
|
GPDR |= GPIO_UART_TXD | GPIO_LDD13 | GPIO_LDD15;
|
|
|
|
GPDR &= ~GPIO_UART_RXD;
|
|
|
|
PPAR |= PPAR_UPR;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up registers for sleep mode.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
PWER = PWER_GPIO0| PWER_RTC;
|
|
|
|
PGSR = 0x818;
|
|
|
|
PCFR = 0;
|
|
|
|
PSDR = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void simpad_power_off(void)
|
|
|
|
{
|
2011-08-19 04:50:31 +08:00
|
|
|
local_irq_disable();
|
|
|
|
cs3_shadow = SD_MEDIAQ;
|
|
|
|
__simpad_write_cs3(); /* Bypass spinlock here */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* disable internal oscillator, float CS lines */
|
|
|
|
PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
|
2011-08-19 04:50:31 +08:00
|
|
|
/* enable wake-up on GPIO0 */
|
|
|
|
PWER = GFER = GRER = PWER_GPIO0;
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* set scratchpad to zero, just in case it is used as a
|
|
|
|
* restart address by the bootloader.
|
|
|
|
*/
|
|
|
|
PSPR = 0;
|
|
|
|
PGSR = 0;
|
|
|
|
/* enter sleep mode */
|
|
|
|
PMCR = PMCR_SF;
|
|
|
|
while(1);
|
|
|
|
|
|
|
|
local_irq_enable(); /* we won't ever call it */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-08-19 04:51:06 +08:00
|
|
|
/*
|
|
|
|
* gpio_keys
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct gpio_keys_button simpad_button_table[] = {
|
|
|
|
{ KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data simpad_keys_data = {
|
|
|
|
.buttons = simpad_button_table,
|
|
|
|
.nbuttons = ARRAY_SIZE(simpad_button_table),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device simpad_keys = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &simpad_keys_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_button simpad_polled_button_table[] = {
|
|
|
|
{ KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" },
|
|
|
|
{ KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" },
|
|
|
|
{ KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" },
|
|
|
|
{ KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" },
|
|
|
|
{ KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" },
|
|
|
|
{ KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data simpad_polled_keys_data = {
|
|
|
|
.buttons = simpad_polled_button_table,
|
|
|
|
.nbuttons = ARRAY_SIZE(simpad_polled_button_table),
|
|
|
|
.poll_interval = 50,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device simpad_polled_keys = {
|
|
|
|
.name = "gpio-keys-polled",
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &simpad_polled_keys_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-08-19 04:51:39 +08:00
|
|
|
/*
|
|
|
|
* GPIO LEDs
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct gpio_led simpad_leds[] = {
|
|
|
|
{
|
|
|
|
.name = "simpad:power",
|
|
|
|
.gpio = SIMPAD_CS3_LED2_ON,
|
|
|
|
.active_low = 0,
|
|
|
|
.default_trigger = "default-on",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_led_platform_data simpad_led_data = {
|
|
|
|
.num_leds = ARRAY_SIZE(simpad_leds),
|
|
|
|
.leds = simpad_leds,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device simpad_gpio_leds = {
|
|
|
|
.name = "leds-gpio",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &simpad_led_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-08-19 04:51:06 +08:00
|
|
|
/*
|
|
|
|
* i2c
|
|
|
|
*/
|
i2c: gpio: Convert to use descriptors
This converts the GPIO-based I2C-driver to using GPIO
descriptors instead of the old global numberspace-based
GPIO interface. We:
- Convert the driver to unconditionally grab two GPIOs
from the device by index 0 (SDA) and 1 (SCL) which
will work fine with device tree and descriptor tables.
The existing device trees will continue to work just
like before, but without any roundtrip through the
global numberspace.
- Brutally convert all boardfiles still passing global
GPIOs by registering descriptor tables associated with
the devices instead so this driver does not need to keep
supporting passing any GPIO numbers as platform data.
There is no stepwise approach as elegant as this, I
strongly prefer this big hammer over any antsteps for this
conversion. This way the old GPIO numbers go away and
NEVER COME BACK.
Special conversion for the different boards utilizing
I2C-GPIO:
- EP93xx (arch/arm/mach-ep93xx): pretty straight forward as
all boards were using the same two GPIO lines, just define
these two in a lookup table for "i2c-gpio" and register
these along with the device. None of them define any
other platform data so just pass NULL as platform data.
This platform selects GPIOLIB so all should be smooth.
The pins appear on a gpiochip for bank "G" as pins 1 (SDA)
and 0 (SCL).
- IXP4 (arch/arm/mach-ixp4): descriptor tables have to
be registered for each board separately. They all use
"IXP4XX_GPIO_CHIP" so it is pretty straight forward.
Most board define no other platform data than SCL/SDA
so they can drop the #include of <linux/i2c-gpio.h> and
assign NULL to platform data.
The "goramo_mlr" (Goramo Multilink Router) board is a bit
worrisome: it implements its own I2C bit-banging in the
board file, and optionally registers an I2C serial port,
but claims the same GPIO lines for itself in the board file.
This is not going to work: there will be competition for the
GPIO lines, so delete the optional extra I2C bus instead, no
I2C devices are registered on it anyway, there are just hints
that it may contain an EEPROM that may be accessed from
userspace. This needs to be fixed up properly by the serial
clock using I2C emulation so drop a note in the code.
- KS8695 board acs5k (arch/arm/mach-ks8695/board-acs5.c)
has some platform data in addition to the pins so it needs to
be kept around sans GPIO lines. Its GPIO chip is named
"KS8695" and the arch selects GPIOLIB.
- PXA boards (arch/arm/mach-pxa/*) use some of the platform
data so it needs to be preserved here. The viper board even
registers two GPIO I2Cs. The gpiochip is named "gpio-pxa" and
the arch selects GPIOLIB.
- SA1100 Simpad (arch/arm/mach-sa1100/simpad.c) defines a GPIO
I2C bus, and the arch selects GPIOLIB.
- Blackfin boards (arch/blackfin/bf533 etc) for these I assume
their I2C GPIOs refer to the local gpiochip defined in
arch/blackfin/kernel/bfin_gpio.c names "BFIN-GPIO".
The arch selects GPIOLIB. The boards get spiked with
IF_ENABLED(I2C_GPIO) but that is a side effect of it
being like that already (I would just have Kconfig select
I2C_GPIO and get rid of them all.) I also delete any
platform data set to 0 as it will get that value anyway
from static declartions of platform data.
- The MIPS selects GPIOLIB and the Alchemy machine is using
two local GPIO chips, one of them has a GPIO I2C. We need
to adjust the local offset from the global number space here.
The ATH79 has a proper GPIO driver in drivers/gpio/gpio-ath79.c
and AFAICT the chip is named "ath79-gpio" and the PB44
PCF857x expander spawns from this on GPIO 1 and 0. The latter
board only use the platform data to specify pins so it can be
cut altogether after this.
- The MFD Silicon Motion SM501 is a special case. It dynamically
spawns an I2C bus off the MFD using sm501_create_subdev().
We use an approach to dynamically create a machine descriptor
table and attach this to the "SM501-LOW" or "SM501-HIGH"
gpiochip. We use chip-local offsets to grab the right lines.
We can get rid of two local static inline helpers as part
of this refactoring.
Cc: Steven Miao <realmz6@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Wu, Aaron <Aaron.Wu@analog.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-09-10 07:30:46 +08:00
|
|
|
static struct gpiod_lookup_table simpad_i2c_gpiod_table = {
|
2018-05-27 00:37:34 +08:00
|
|
|
.dev_id = "i2c-gpio.0",
|
i2c: gpio: Convert to use descriptors
This converts the GPIO-based I2C-driver to using GPIO
descriptors instead of the old global numberspace-based
GPIO interface. We:
- Convert the driver to unconditionally grab two GPIOs
from the device by index 0 (SDA) and 1 (SCL) which
will work fine with device tree and descriptor tables.
The existing device trees will continue to work just
like before, but without any roundtrip through the
global numberspace.
- Brutally convert all boardfiles still passing global
GPIOs by registering descriptor tables associated with
the devices instead so this driver does not need to keep
supporting passing any GPIO numbers as platform data.
There is no stepwise approach as elegant as this, I
strongly prefer this big hammer over any antsteps for this
conversion. This way the old GPIO numbers go away and
NEVER COME BACK.
Special conversion for the different boards utilizing
I2C-GPIO:
- EP93xx (arch/arm/mach-ep93xx): pretty straight forward as
all boards were using the same two GPIO lines, just define
these two in a lookup table for "i2c-gpio" and register
these along with the device. None of them define any
other platform data so just pass NULL as platform data.
This platform selects GPIOLIB so all should be smooth.
The pins appear on a gpiochip for bank "G" as pins 1 (SDA)
and 0 (SCL).
- IXP4 (arch/arm/mach-ixp4): descriptor tables have to
be registered for each board separately. They all use
"IXP4XX_GPIO_CHIP" so it is pretty straight forward.
Most board define no other platform data than SCL/SDA
so they can drop the #include of <linux/i2c-gpio.h> and
assign NULL to platform data.
The "goramo_mlr" (Goramo Multilink Router) board is a bit
worrisome: it implements its own I2C bit-banging in the
board file, and optionally registers an I2C serial port,
but claims the same GPIO lines for itself in the board file.
This is not going to work: there will be competition for the
GPIO lines, so delete the optional extra I2C bus instead, no
I2C devices are registered on it anyway, there are just hints
that it may contain an EEPROM that may be accessed from
userspace. This needs to be fixed up properly by the serial
clock using I2C emulation so drop a note in the code.
- KS8695 board acs5k (arch/arm/mach-ks8695/board-acs5.c)
has some platform data in addition to the pins so it needs to
be kept around sans GPIO lines. Its GPIO chip is named
"KS8695" and the arch selects GPIOLIB.
- PXA boards (arch/arm/mach-pxa/*) use some of the platform
data so it needs to be preserved here. The viper board even
registers two GPIO I2Cs. The gpiochip is named "gpio-pxa" and
the arch selects GPIOLIB.
- SA1100 Simpad (arch/arm/mach-sa1100/simpad.c) defines a GPIO
I2C bus, and the arch selects GPIOLIB.
- Blackfin boards (arch/blackfin/bf533 etc) for these I assume
their I2C GPIOs refer to the local gpiochip defined in
arch/blackfin/kernel/bfin_gpio.c names "BFIN-GPIO".
The arch selects GPIOLIB. The boards get spiked with
IF_ENABLED(I2C_GPIO) but that is a side effect of it
being like that already (I would just have Kconfig select
I2C_GPIO and get rid of them all.) I also delete any
platform data set to 0 as it will get that value anyway
from static declartions of platform data.
- The MIPS selects GPIOLIB and the Alchemy machine is using
two local GPIO chips, one of them has a GPIO I2C. We need
to adjust the local offset from the global number space here.
The ATH79 has a proper GPIO driver in drivers/gpio/gpio-ath79.c
and AFAICT the chip is named "ath79-gpio" and the PB44
PCF857x expander spawns from this on GPIO 1 and 0. The latter
board only use the platform data to specify pins so it can be
cut altogether after this.
- The MFD Silicon Motion SM501 is a special case. It dynamically
spawns an I2C bus off the MFD using sm501_create_subdev().
We use an approach to dynamically create a machine descriptor
table and attach this to the "SM501-LOW" or "SM501-HIGH"
gpiochip. We use chip-local offsets to grab the right lines.
We can get rid of two local static inline helpers as part
of this refactoring.
Cc: Steven Miao <realmz6@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Wu, Aaron <Aaron.Wu@analog.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-09-10 07:30:46 +08:00
|
|
|
.table = {
|
ARM: sa1100: simpad: Correct I2C GPIO offsets
Arnd reported the following build bug bug:
In file included from arch/arm/mach-sa1100/simpad.c:20:0:
arch/arm/mach-sa1100/include/mach/SA-1100.h:1118:18: error: large
integer implicitly truncated to unsigned type [-Werror=overflow]
(0x00000001 << (Nb))
^
include/linux/gpio/machine.h:56:16: note: in definition of macro
'GPIO_LOOKUP_IDX'
.chip_hwnum = _chip_hwnum,
^~~~~~~~~~~
arch/arm/mach-sa1100/include/mach/SA-1100.h:1140:21: note: in
expansion of macro 'GPIO_GPIO'
^~~~~~~~~
arch/arm/mach-sa1100/simpad.c:331:27: note: in expansion of
macro 'GPIO_GPIO21'
GPIO_LOOKUP_IDX("gpio", GPIO_GPIO21, NULL, 0,
This is what happened:
commit b2e63555592f81331c8da3afaa607d8cf83e8138
"i2c: gpio: Convert to use descriptors"
commit 4d0ce62c0a02e41a65cfdcfe277f5be430edc371
"i2c: gpio: Augment all boardfiles to use open drain"
together uncovered an old bug in the Simpad board
file: as theGPIO_LOOKUP_IDX() encodes GPIO offsets
on gpiochips in an u16 (see <linux/gpio/machine.h>)
these GPIO "numbers" does not fit, since in
arch/arm/mach-sa1100/include/mach/SA-1100.h it is
defined as:
#define GPIO_GPIO(Nb) (0x00000001 << (Nb))
(...)
#define GPIO_GPIO21 GPIO_GPIO(21) /* GPIO [21] */
This is however provably wrong, since the i2c-gpio
driver uses proper GPIO numbers, albeit earlier from
the global number space, whereas this GPIO_GPIO21
is the local line offset in the GPIO register, which
is used in other code but certainly not in the
gpiolib GPIO driver in drivers/gpio/gpio-sa1100.c, which
has code like this:
static void sa1100_gpio_set(struct gpio_chip *chip,
unsigned offset, int value)
{
int reg = value ? R_GPSR : R_GPCR;
writel_relaxed(BIT(offset),
sa1100_gpio_chip(chip)->membase + reg);
}
So far everything however compiled fine as an unsigned
int was used to pass the GPIO numbers in
struct i2c_gpio_platform_data. We can trace the actual error
back to
commit dbd406f9d0a1d33a1303eb75cbe3f9435513d339
"ARM: 7025/1: simpad: add GPIO based device definitions."
This added the i2c_gpio with the wrong offsets.
This commit was before the SA1100 was converted to use
the gpiolib, but as can be seen from the contemporary
gpio.c in mach-sa1100, it was already using:
static int sa1100_gpio_get(struct gpio_chip *chip,
unsigned offset)
{
return GPLR & GPIO_GPIO(offset);
}
And GPIO_GPIO() is essentially the BIT() macro.
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-11-08 04:18:57 +08:00
|
|
|
GPIO_LOOKUP_IDX("gpio", 21, NULL, 0,
|
2017-09-11 05:03:32 +08:00
|
|
|
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
|
ARM: sa1100: simpad: Correct I2C GPIO offsets
Arnd reported the following build bug bug:
In file included from arch/arm/mach-sa1100/simpad.c:20:0:
arch/arm/mach-sa1100/include/mach/SA-1100.h:1118:18: error: large
integer implicitly truncated to unsigned type [-Werror=overflow]
(0x00000001 << (Nb))
^
include/linux/gpio/machine.h:56:16: note: in definition of macro
'GPIO_LOOKUP_IDX'
.chip_hwnum = _chip_hwnum,
^~~~~~~~~~~
arch/arm/mach-sa1100/include/mach/SA-1100.h:1140:21: note: in
expansion of macro 'GPIO_GPIO'
^~~~~~~~~
arch/arm/mach-sa1100/simpad.c:331:27: note: in expansion of
macro 'GPIO_GPIO21'
GPIO_LOOKUP_IDX("gpio", GPIO_GPIO21, NULL, 0,
This is what happened:
commit b2e63555592f81331c8da3afaa607d8cf83e8138
"i2c: gpio: Convert to use descriptors"
commit 4d0ce62c0a02e41a65cfdcfe277f5be430edc371
"i2c: gpio: Augment all boardfiles to use open drain"
together uncovered an old bug in the Simpad board
file: as theGPIO_LOOKUP_IDX() encodes GPIO offsets
on gpiochips in an u16 (see <linux/gpio/machine.h>)
these GPIO "numbers" does not fit, since in
arch/arm/mach-sa1100/include/mach/SA-1100.h it is
defined as:
#define GPIO_GPIO(Nb) (0x00000001 << (Nb))
(...)
#define GPIO_GPIO21 GPIO_GPIO(21) /* GPIO [21] */
This is however provably wrong, since the i2c-gpio
driver uses proper GPIO numbers, albeit earlier from
the global number space, whereas this GPIO_GPIO21
is the local line offset in the GPIO register, which
is used in other code but certainly not in the
gpiolib GPIO driver in drivers/gpio/gpio-sa1100.c, which
has code like this:
static void sa1100_gpio_set(struct gpio_chip *chip,
unsigned offset, int value)
{
int reg = value ? R_GPSR : R_GPCR;
writel_relaxed(BIT(offset),
sa1100_gpio_chip(chip)->membase + reg);
}
So far everything however compiled fine as an unsigned
int was used to pass the GPIO numbers in
struct i2c_gpio_platform_data. We can trace the actual error
back to
commit dbd406f9d0a1d33a1303eb75cbe3f9435513d339
"ARM: 7025/1: simpad: add GPIO based device definitions."
This added the i2c_gpio with the wrong offsets.
This commit was before the SA1100 was converted to use
the gpiolib, but as can be seen from the contemporary
gpio.c in mach-sa1100, it was already using:
static int sa1100_gpio_get(struct gpio_chip *chip,
unsigned offset)
{
return GPLR & GPIO_GPIO(offset);
}
And GPIO_GPIO() is essentially the BIT() macro.
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-11-08 04:18:57 +08:00
|
|
|
GPIO_LOOKUP_IDX("gpio", 25, NULL, 1,
|
2017-09-11 05:03:32 +08:00
|
|
|
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
|
i2c: gpio: Convert to use descriptors
This converts the GPIO-based I2C-driver to using GPIO
descriptors instead of the old global numberspace-based
GPIO interface. We:
- Convert the driver to unconditionally grab two GPIOs
from the device by index 0 (SDA) and 1 (SCL) which
will work fine with device tree and descriptor tables.
The existing device trees will continue to work just
like before, but without any roundtrip through the
global numberspace.
- Brutally convert all boardfiles still passing global
GPIOs by registering descriptor tables associated with
the devices instead so this driver does not need to keep
supporting passing any GPIO numbers as platform data.
There is no stepwise approach as elegant as this, I
strongly prefer this big hammer over any antsteps for this
conversion. This way the old GPIO numbers go away and
NEVER COME BACK.
Special conversion for the different boards utilizing
I2C-GPIO:
- EP93xx (arch/arm/mach-ep93xx): pretty straight forward as
all boards were using the same two GPIO lines, just define
these two in a lookup table for "i2c-gpio" and register
these along with the device. None of them define any
other platform data so just pass NULL as platform data.
This platform selects GPIOLIB so all should be smooth.
The pins appear on a gpiochip for bank "G" as pins 1 (SDA)
and 0 (SCL).
- IXP4 (arch/arm/mach-ixp4): descriptor tables have to
be registered for each board separately. They all use
"IXP4XX_GPIO_CHIP" so it is pretty straight forward.
Most board define no other platform data than SCL/SDA
so they can drop the #include of <linux/i2c-gpio.h> and
assign NULL to platform data.
The "goramo_mlr" (Goramo Multilink Router) board is a bit
worrisome: it implements its own I2C bit-banging in the
board file, and optionally registers an I2C serial port,
but claims the same GPIO lines for itself in the board file.
This is not going to work: there will be competition for the
GPIO lines, so delete the optional extra I2C bus instead, no
I2C devices are registered on it anyway, there are just hints
that it may contain an EEPROM that may be accessed from
userspace. This needs to be fixed up properly by the serial
clock using I2C emulation so drop a note in the code.
- KS8695 board acs5k (arch/arm/mach-ks8695/board-acs5.c)
has some platform data in addition to the pins so it needs to
be kept around sans GPIO lines. Its GPIO chip is named
"KS8695" and the arch selects GPIOLIB.
- PXA boards (arch/arm/mach-pxa/*) use some of the platform
data so it needs to be preserved here. The viper board even
registers two GPIO I2Cs. The gpiochip is named "gpio-pxa" and
the arch selects GPIOLIB.
- SA1100 Simpad (arch/arm/mach-sa1100/simpad.c) defines a GPIO
I2C bus, and the arch selects GPIOLIB.
- Blackfin boards (arch/blackfin/bf533 etc) for these I assume
their I2C GPIOs refer to the local gpiochip defined in
arch/blackfin/kernel/bfin_gpio.c names "BFIN-GPIO".
The arch selects GPIOLIB. The boards get spiked with
IF_ENABLED(I2C_GPIO) but that is a side effect of it
being like that already (I would just have Kconfig select
I2C_GPIO and get rid of them all.) I also delete any
platform data set to 0 as it will get that value anyway
from static declartions of platform data.
- The MIPS selects GPIOLIB and the Alchemy machine is using
two local GPIO chips, one of them has a GPIO I2C. We need
to adjust the local offset from the global number space here.
The ATH79 has a proper GPIO driver in drivers/gpio/gpio-ath79.c
and AFAICT the chip is named "ath79-gpio" and the PB44
PCF857x expander spawns from this on GPIO 1 and 0. The latter
board only use the platform data to specify pins so it can be
cut altogether after this.
- The MFD Silicon Motion SM501 is a special case. It dynamically
spawns an I2C bus off the MFD using sm501_create_subdev().
We use an approach to dynamically create a machine descriptor
table and attach this to the "SM501-LOW" or "SM501-HIGH"
gpiochip. We use chip-local offsets to grab the right lines.
We can get rid of two local static inline helpers as part
of this refactoring.
Cc: Steven Miao <realmz6@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Wu, Aaron <Aaron.Wu@analog.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-09-10 07:30:46 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-08-19 04:51:06 +08:00
|
|
|
static struct i2c_gpio_platform_data simpad_i2c_data = {
|
|
|
|
.udelay = 10,
|
|
|
|
.timeout = HZ,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device simpad_i2c = {
|
|
|
|
.name = "i2c-gpio",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &simpad_i2c_data,
|
|
|
|
},
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* MediaQ Video Device
|
|
|
|
*/
|
|
|
|
static struct platform_device simpad_mq200fb = {
|
|
|
|
.name = "simpad-mq200",
|
|
|
|
.id = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device *devices[] __initdata = {
|
2011-08-19 04:51:06 +08:00
|
|
|
&simpad_keys,
|
|
|
|
&simpad_polled_keys,
|
|
|
|
&simpad_mq200fb,
|
2011-08-19 04:51:39 +08:00
|
|
|
&simpad_gpio_leds,
|
2011-08-19 04:51:06 +08:00
|
|
|
&simpad_i2c,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2016-08-31 15:49:48 +08:00
|
|
|
/* Compact Flash */
|
|
|
|
static struct gpiod_lookup_table simpad_cf_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-pcmcia",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio", GPIO_CF_IRQ, "cf-ready", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", GPIO_CF_CD, "cf-detect", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
static int __init simpad_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2011-08-19 04:50:31 +08:00
|
|
|
spin_lock_init(&cs3_lock);
|
|
|
|
|
|
|
|
cs3_gpio.label = "simpad_cs3";
|
|
|
|
cs3_gpio.base = SIMPAD_CS3_GPIO_BASE;
|
|
|
|
cs3_gpio.ngpio = 24;
|
|
|
|
cs3_gpio.set = cs3_gpio_set;
|
|
|
|
cs3_gpio.get = cs3_gpio_get;
|
|
|
|
cs3_gpio.direction_input = cs3_gpio_direction_input;
|
|
|
|
cs3_gpio.direction_output = cs3_gpio_direction_output;
|
2015-12-08 18:20:44 +08:00
|
|
|
ret = gpiochip_add_data(&cs3_gpio, NULL);
|
2011-08-19 04:50:31 +08:00
|
|
|
if (ret)
|
|
|
|
printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
pm_power_off = simpad_power_off;
|
|
|
|
|
2016-08-31 15:49:48 +08:00
|
|
|
sa11x0_register_pcmcia(-1, &simpad_cf_gpio_table);
|
2012-01-21 06:24:07 +08:00
|
|
|
sa11x0_ppc_configure_mcp();
|
2011-01-03 19:09:05 +08:00
|
|
|
sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
|
|
|
|
ARRAY_SIZE(simpad_flash_resources));
|
|
|
|
sa11x0_register_mcp(&simpad_mcp_data);
|
|
|
|
|
i2c: gpio: Convert to use descriptors
This converts the GPIO-based I2C-driver to using GPIO
descriptors instead of the old global numberspace-based
GPIO interface. We:
- Convert the driver to unconditionally grab two GPIOs
from the device by index 0 (SDA) and 1 (SCL) which
will work fine with device tree and descriptor tables.
The existing device trees will continue to work just
like before, but without any roundtrip through the
global numberspace.
- Brutally convert all boardfiles still passing global
GPIOs by registering descriptor tables associated with
the devices instead so this driver does not need to keep
supporting passing any GPIO numbers as platform data.
There is no stepwise approach as elegant as this, I
strongly prefer this big hammer over any antsteps for this
conversion. This way the old GPIO numbers go away and
NEVER COME BACK.
Special conversion for the different boards utilizing
I2C-GPIO:
- EP93xx (arch/arm/mach-ep93xx): pretty straight forward as
all boards were using the same two GPIO lines, just define
these two in a lookup table for "i2c-gpio" and register
these along with the device. None of them define any
other platform data so just pass NULL as platform data.
This platform selects GPIOLIB so all should be smooth.
The pins appear on a gpiochip for bank "G" as pins 1 (SDA)
and 0 (SCL).
- IXP4 (arch/arm/mach-ixp4): descriptor tables have to
be registered for each board separately. They all use
"IXP4XX_GPIO_CHIP" so it is pretty straight forward.
Most board define no other platform data than SCL/SDA
so they can drop the #include of <linux/i2c-gpio.h> and
assign NULL to platform data.
The "goramo_mlr" (Goramo Multilink Router) board is a bit
worrisome: it implements its own I2C bit-banging in the
board file, and optionally registers an I2C serial port,
but claims the same GPIO lines for itself in the board file.
This is not going to work: there will be competition for the
GPIO lines, so delete the optional extra I2C bus instead, no
I2C devices are registered on it anyway, there are just hints
that it may contain an EEPROM that may be accessed from
userspace. This needs to be fixed up properly by the serial
clock using I2C emulation so drop a note in the code.
- KS8695 board acs5k (arch/arm/mach-ks8695/board-acs5.c)
has some platform data in addition to the pins so it needs to
be kept around sans GPIO lines. Its GPIO chip is named
"KS8695" and the arch selects GPIOLIB.
- PXA boards (arch/arm/mach-pxa/*) use some of the platform
data so it needs to be preserved here. The viper board even
registers two GPIO I2Cs. The gpiochip is named "gpio-pxa" and
the arch selects GPIOLIB.
- SA1100 Simpad (arch/arm/mach-sa1100/simpad.c) defines a GPIO
I2C bus, and the arch selects GPIOLIB.
- Blackfin boards (arch/blackfin/bf533 etc) for these I assume
their I2C GPIOs refer to the local gpiochip defined in
arch/blackfin/kernel/bfin_gpio.c names "BFIN-GPIO".
The arch selects GPIOLIB. The boards get spiked with
IF_ENABLED(I2C_GPIO) but that is a side effect of it
being like that already (I would just have Kconfig select
I2C_GPIO and get rid of them all.) I also delete any
platform data set to 0 as it will get that value anyway
from static declartions of platform data.
- The MIPS selects GPIOLIB and the Alchemy machine is using
two local GPIO chips, one of them has a GPIO I2C. We need
to adjust the local offset from the global number space here.
The ATH79 has a proper GPIO driver in drivers/gpio/gpio-ath79.c
and AFAICT the chip is named "ath79-gpio" and the PB44
PCF857x expander spawns from this on GPIO 1 and 0. The latter
board only use the platform data to specify pins so it can be
cut altogether after this.
- The MFD Silicon Motion SM501 is a special case. It dynamically
spawns an I2C bus off the MFD using sm501_create_subdev().
We use an approach to dynamically create a machine descriptor
table and attach this to the "SM501-LOW" or "SM501-HIGH"
gpiochip. We use chip-local offsets to grab the right lines.
We can get rid of two local static inline helpers as part
of this refactoring.
Cc: Steven Miao <realmz6@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Wu, Aaron <Aaron.Wu@analog.com>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-09-10 07:30:46 +08:00
|
|
|
gpiod_add_lookup_table(&simpad_i2c_gpiod_table);
|
2005-04-17 06:20:36 +08:00
|
|
|
ret = platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
|
|
if(ret)
|
|
|
|
printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
arch_initcall(simpad_init);
|
|
|
|
|
|
|
|
|
|
|
|
MACHINE_START(SIMPAD, "Simpad")
|
2005-07-04 00:38:58 +08:00
|
|
|
/* Maintainer: Holger Freyther */
|
2011-07-06 10:38:17 +08:00
|
|
|
.atag_offset = 0x100,
|
2005-07-04 00:38:58 +08:00
|
|
|
.map_io = simpad_map_io,
|
2012-02-24 07:06:51 +08:00
|
|
|
.nr_irqs = SA1100_NR_IRQS,
|
2005-07-04 00:38:58 +08:00
|
|
|
.init_irq = sa1100_init_irq,
|
2012-04-26 21:22:45 +08:00
|
|
|
.init_late = sa11x0_init_late,
|
2012-11-09 03:40:59 +08:00
|
|
|
.init_time = sa1100_timer_init,
|
2011-11-05 18:28:50 +08:00
|
|
|
.restart = sa11x0_restart,
|
2005-04-17 06:20:36 +08:00
|
|
|
MACHINE_END
|