fbae5cbb43
Improved and new platform support for various SoCs: - New SoC support: - Broadcom BCM23550 - Freescale i.MX7Solo - Qualcomm MDM9615 - Renesas r8a7792 - Conversion of clps711x to multiplatform - debug uart improvements for Atmel platforms - Tango platform improvements: HOTPLUG_CPU, Suspend-to-ram - OMAP tweaks and improvements to hwmod - OMAP support for kexec on SMP -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJXnaibAAoJEIwa5zzehBx3h6AP/0TBATiDuYXTcX3V8zZ/ia9y 7dWbP7gVX7DN39b5qdjLTa+DUx3Y3msxW9qsuUQR8RWijbqjCH7b/fyPwGA0fmpP 3uZpFpyzs+6/3TiMDN1yw1T+/2YbVyM+4rOeNsCwncdXjGSx0FaMJAqLBrppiWLH 1S9HhD/314znibl8skOy8QIDWwlW011sS2mNUIN+JelvnS/VDjtCDfpphpNrAQF9 MZB6LhT9itvf6mIEGIsaDq/Ii7fgIAnA9WCtwv9tJkAZHzbS0cWkiJzb7hF1GzFO Q5HBAyzn+CkeTQ3+9NQU0G0vhfa3Ea0g1gfw6qRmAw+z8Qdiamjh8SSve6zm1fE8 GmIewsMAWWIUYykEIi9hbWCTYq06Pw/Nn6KWRAuQ/lpt++jzMQ82qk6cxELLW15e uAC1JjFOCIFNBZhkrdQDU0qx6Ew/AUH4wCYqu4Xh7pW0MHu0V9NgsmooeoTmCkpd WtgKp8Wh5dsK3SdsbTjdR/IeHSQkeSdgNY/6TBTjpRwCIlEMwHlKbvwvRExk1xzi nLQJsR49MsjeSdPflzO6WUzOjJhQfuw2jCtAQjlom15EgkEZ569MT4RsAQIgvNCI PeUWkvIW1uCtW7Y6ADPRBKMIrajPs8YW4E/xTItuhrqLHp8z6efvRmVNdpzqBTVj tT2t2bRXF0cGiUvOeU7U =Kh9P -----END PGP SIGNATURE----- Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC platform updates from Olof Johansson: "Improved and new platform support for various SoCs: New SoC support: - Broadcom BCM23550 - Freescale i.MX7Solo - Qualcomm MDM9615 - Renesas r8a7792 Improvements: - convert clps711x to multiplatform - debug uart improvements for Atmel platforms - Tango platform improvements: HOTPLUG_CPU, Suspend-to-ram - OMAP tweaks and improvements to hwmod - OMAP support for kexec on SMP" * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (109 commits) ARM: davinci: fix build break because of undeclared dm365_evm_snd_data ARM: s3c64xx: smartq: Avoid sparse warnings ARM: sti: Implement dummy L2 cache's write_sec ARM: STi: Update machine _namestr to be more generic. arm: meson: explicitly select clk drivers ARM: tango: add Suspend-to-RAM support ARM: hisi: consolidate the hisilicon machine entries ARM: tango: fix CONFIG_HOTPLUG_CPU=n build MAINTAINERS: Update BCM281XX/BCM11XXX/BCM216XX entry MAINTAINERS: Update BCM63XX entry MAINTAINERS: Add NS2 entry MAINTAINERS: Fix nsp false-positives MAINTAINERS: Change L to M for Broadcom ARM/ARM64 SoC entries ARM: debug: Enable DEBUG_BCM_5301X for Northstar Plus SoCs ARM: clps711x: Switch to MULTIPLATFORM ARM: clps711x: Remove boards support ARM: clps711x: Add basic DT support ARM: clps711x: Reduce static map size ARM: SAMSUNG: Constify iomem address passed to s5p_init_cpu ARM: oxnas: Change OX810SE default driver config ...
157 lines
4.3 KiB
C
157 lines
4.3 KiB
C
/*
|
|
* Amstrad E3 FIQ handling
|
|
*
|
|
* Copyright (C) 2009 Janusz Krzysztofik
|
|
* Copyright (c) 2006 Matt Callow
|
|
* Copyright (c) 2004 Amstrad Plc
|
|
* Copyright (C) 2001 RidgeRun, Inc.
|
|
*
|
|
* Parts of this code are taken from linux/arch/arm/mach-omap/irq.c
|
|
* in the MontaVista 2.4 kernel (and the Amstrad changes therein)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
* the Free Software Foundation.
|
|
*/
|
|
#include <linux/gpio.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/module.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <mach/board-ams-delta.h>
|
|
|
|
#include <asm/fiq.h>
|
|
|
|
#include <mach/ams-delta-fiq.h>
|
|
|
|
static struct fiq_handler fh = {
|
|
.name = "ams-delta-fiq"
|
|
};
|
|
|
|
/*
|
|
* This buffer is shared between FIQ and IRQ contexts.
|
|
* The FIQ and IRQ isrs can both read and write it.
|
|
* It is structured as a header section several 32bit slots,
|
|
* followed by the circular buffer where the FIQ isr stores
|
|
* keystrokes received from the qwerty keyboard.
|
|
* See ams-delta-fiq.h for details of offsets.
|
|
*/
|
|
unsigned int fiq_buffer[1024];
|
|
EXPORT_SYMBOL(fiq_buffer);
|
|
|
|
static unsigned int irq_counter[16];
|
|
|
|
static irqreturn_t deferred_fiq(int irq, void *dev_id)
|
|
{
|
|
int gpio, irq_num, fiq_count;
|
|
struct irq_chip *irq_chip;
|
|
|
|
irq_chip = irq_get_chip(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
|
|
|
|
/*
|
|
* For each handled GPIO interrupt, keep calling its interrupt handler
|
|
* until the IRQ counter catches the FIQ incremented interrupt counter.
|
|
*/
|
|
for (gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK;
|
|
gpio <= AMS_DELTA_GPIO_PIN_HOOK_SWITCH; gpio++) {
|
|
irq_num = gpio_to_irq(gpio);
|
|
fiq_count = fiq_buffer[FIQ_CNT_INT_00 + gpio];
|
|
|
|
while (irq_counter[gpio] < fiq_count) {
|
|
if (gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) {
|
|
struct irq_data *d = irq_get_irq_data(irq_num);
|
|
|
|
/*
|
|
* It looks like handle_edge_irq() that
|
|
* OMAP GPIO edge interrupts default to,
|
|
* expects interrupt already unmasked.
|
|
*/
|
|
if (irq_chip && irq_chip->irq_unmask)
|
|
irq_chip->irq_unmask(d);
|
|
}
|
|
generic_handle_irq(irq_num);
|
|
|
|
irq_counter[gpio]++;
|
|
}
|
|
}
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
void __init ams_delta_init_fiq(void)
|
|
{
|
|
void *fiqhandler_start;
|
|
unsigned int fiqhandler_length;
|
|
struct pt_regs FIQ_regs;
|
|
unsigned long val, offset;
|
|
int i, retval;
|
|
|
|
fiqhandler_start = &qwerty_fiqin_start;
|
|
fiqhandler_length = &qwerty_fiqin_end - &qwerty_fiqin_start;
|
|
pr_info("Installing fiq handler from %p, length 0x%x\n",
|
|
fiqhandler_start, fiqhandler_length);
|
|
|
|
retval = claim_fiq(&fh);
|
|
if (retval) {
|
|
pr_err("ams_delta_init_fiq(): couldn't claim FIQ, ret=%d\n",
|
|
retval);
|
|
return;
|
|
}
|
|
|
|
retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq,
|
|
IRQ_TYPE_EDGE_RISING, "deferred_fiq", NULL);
|
|
if (retval < 0) {
|
|
pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval);
|
|
release_fiq(&fh);
|
|
return;
|
|
}
|
|
/*
|
|
* Since no set_type() method is provided by OMAP irq chip,
|
|
* switch to edge triggered interrupt type manually.
|
|
*/
|
|
offset = IRQ_ILR0_REG_OFFSET +
|
|
((INT_DEFERRED_FIQ - NR_IRQS_LEGACY) & 0x1f) * 0x4;
|
|
val = omap_readl(DEFERRED_FIQ_IH_BASE + offset) & ~(1 << 1);
|
|
omap_writel(val, DEFERRED_FIQ_IH_BASE + offset);
|
|
|
|
set_fiq_handler(fiqhandler_start, fiqhandler_length);
|
|
|
|
/*
|
|
* Initialise the buffer which is shared
|
|
* between FIQ mode and IRQ mode
|
|
*/
|
|
fiq_buffer[FIQ_GPIO_INT_MASK] = 0;
|
|
fiq_buffer[FIQ_MASK] = 0;
|
|
fiq_buffer[FIQ_STATE] = 0;
|
|
fiq_buffer[FIQ_KEY] = 0;
|
|
fiq_buffer[FIQ_KEYS_CNT] = 0;
|
|
fiq_buffer[FIQ_KEYS_HICNT] = 0;
|
|
fiq_buffer[FIQ_TAIL_OFFSET] = 0;
|
|
fiq_buffer[FIQ_HEAD_OFFSET] = 0;
|
|
fiq_buffer[FIQ_BUF_LEN] = 256;
|
|
fiq_buffer[FIQ_MISSED_KEYS] = 0;
|
|
fiq_buffer[FIQ_BUFFER_START] =
|
|
(unsigned int) &fiq_buffer[FIQ_CIRC_BUFF];
|
|
|
|
for (i = FIQ_CNT_INT_00; i <= FIQ_CNT_INT_15; i++)
|
|
fiq_buffer[i] = 0;
|
|
|
|
/*
|
|
* FIQ mode r9 always points to the fiq_buffer, because the FIQ isr
|
|
* will run in an unpredictable context. The fiq_buffer is the FIQ isr's
|
|
* only means of communication with the IRQ level and other kernel
|
|
* context code.
|
|
*/
|
|
FIQ_regs.ARM_r9 = (unsigned int)fiq_buffer;
|
|
set_fiq_regs(&FIQ_regs);
|
|
|
|
pr_info("request_fiq(): fiq_buffer = %p\n", fiq_buffer);
|
|
|
|
/*
|
|
* Redirect GPIO interrupts to FIQ
|
|
*/
|
|
offset = IRQ_ILR0_REG_OFFSET + (INT_GPIO_BANK1 - NR_IRQS_LEGACY) * 0x4;
|
|
val = omap_readl(OMAP_IH1_BASE + offset) | 1;
|
|
omap_writel(val, OMAP_IH1_BASE + offset);
|
|
}
|