[ARM] remove arch-imx
arch-imx is superseeded by the MXC architecture support. This patch removes arch/arm/mach-imx from the kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
8c8fdbc9bd
commit
1341d34ffc
|
@ -1,11 +0,0 @@
|
||||||
menu "IMX Implementations"
|
|
||||||
depends on ARCH_IMX
|
|
||||||
|
|
||||||
config ARCH_MX1ADS
|
|
||||||
bool "mx1ads"
|
|
||||||
depends on ARCH_IMX
|
|
||||||
select ISA
|
|
||||||
help
|
|
||||||
Say Y here if you are using the Motorola MX1ADS board
|
|
||||||
|
|
||||||
endmenu
|
|
|
@ -1,18 +0,0 @@
|
||||||
#
|
|
||||||
# Makefile for the linux kernel.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Object file lists.
|
|
||||||
|
|
||||||
obj-y += irq.o time.o dma.o generic.o clock.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
|
|
||||||
|
|
||||||
# Specific board support
|
|
||||||
obj-$(CONFIG_ARCH_MX1ADS) += mx1ads.o
|
|
||||||
|
|
||||||
# Support for blinky lights
|
|
||||||
led-y := leds.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_LEDS) += $(led-y)
|
|
||||||
led-$(CONFIG_ARCH_MX1ADS) += leds-mx1ads.o
|
|
|
@ -1,2 +0,0 @@
|
||||||
zreladdr-$(CONFIG_ARCH_MX1ADS) := 0x08008000
|
|
||||||
|
|
|
@ -1,210 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/device.h>
|
|
||||||
#include <linux/list.h>
|
|
||||||
#include <linux/math64.h>
|
|
||||||
#include <linux/err.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Very simple approach: We can't disable clocks, so we do
|
|
||||||
* not need refcounting
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct clk {
|
|
||||||
struct list_head node;
|
|
||||||
const char *name;
|
|
||||||
unsigned long (*get_rate)(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get the system pll clock in Hz
|
|
||||||
*
|
|
||||||
* mfi + mfn / (mfd +1)
|
|
||||||
* f = 2 * f_ref * --------------------
|
|
||||||
* pd + 1
|
|
||||||
*/
|
|
||||||
static unsigned long imx_decode_pll(unsigned int pll, u32 f_ref)
|
|
||||||
{
|
|
||||||
unsigned long long ll;
|
|
||||||
unsigned long quot;
|
|
||||||
|
|
||||||
u32 mfi = (pll >> 10) & 0xf;
|
|
||||||
u32 mfn = pll & 0x3ff;
|
|
||||||
u32 mfd = (pll >> 16) & 0x3ff;
|
|
||||||
u32 pd = (pll >> 26) & 0xf;
|
|
||||||
|
|
||||||
mfi = mfi <= 5 ? 5 : mfi;
|
|
||||||
|
|
||||||
ll = 2 * (unsigned long long)f_ref *
|
|
||||||
((mfi << 16) + (mfn << 16) / (mfd + 1));
|
|
||||||
quot = (pd + 1) * (1 << 16);
|
|
||||||
ll += quot / 2;
|
|
||||||
do_div(ll, quot);
|
|
||||||
return (unsigned long)ll;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned long imx_get_system_clk(void)
|
|
||||||
{
|
|
||||||
u32 f_ref = (CSCR & CSCR_SYSTEM_SEL) ? 16000000 : (CLK32 * 512);
|
|
||||||
|
|
||||||
return imx_decode_pll(SPCTL0, f_ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned long imx_get_mcu_clk(void)
|
|
||||||
{
|
|
||||||
return imx_decode_pll(MPCTL0, CLK32 * 512);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get peripheral clock 1 ( UART[12], Timer[12], PWM )
|
|
||||||
*/
|
|
||||||
static unsigned long imx_get_perclk1(void)
|
|
||||||
{
|
|
||||||
return imx_get_system_clk() / (((PCDR) & 0xf)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get peripheral clock 2 ( LCD, SD, SPI[12] )
|
|
||||||
*/
|
|
||||||
static unsigned long imx_get_perclk2(void)
|
|
||||||
{
|
|
||||||
return imx_get_system_clk() / (((PCDR>>4) & 0xf)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get peripheral clock 3 ( SSI )
|
|
||||||
*/
|
|
||||||
static unsigned long imx_get_perclk3(void)
|
|
||||||
{
|
|
||||||
return imx_get_system_clk() / (((PCDR>>16) & 0x7f)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get hclk ( SDRAM, CSI, Memory Stick, I2C, DMA )
|
|
||||||
*/
|
|
||||||
static unsigned long imx_get_hclk(void)
|
|
||||||
{
|
|
||||||
return imx_get_system_clk() / (((CSCR>>10) & 0xf)+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct clk clk_system_clk = {
|
|
||||||
.name = "system_clk",
|
|
||||||
.get_rate = imx_get_system_clk,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_hclk = {
|
|
||||||
.name = "hclk",
|
|
||||||
.get_rate = imx_get_hclk,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_mcu_clk = {
|
|
||||||
.name = "mcu_clk",
|
|
||||||
.get_rate = imx_get_mcu_clk,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_perclk1 = {
|
|
||||||
.name = "perclk1",
|
|
||||||
.get_rate = imx_get_perclk1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_uart_clk = {
|
|
||||||
.name = "uart_clk",
|
|
||||||
.get_rate = imx_get_perclk1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_perclk2 = {
|
|
||||||
.name = "perclk2",
|
|
||||||
.get_rate = imx_get_perclk2,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk clk_perclk3 = {
|
|
||||||
.name = "perclk3",
|
|
||||||
.get_rate = imx_get_perclk3,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct clk *clks[] = {
|
|
||||||
&clk_perclk1,
|
|
||||||
&clk_perclk2,
|
|
||||||
&clk_perclk3,
|
|
||||||
&clk_system_clk,
|
|
||||||
&clk_hclk,
|
|
||||||
&clk_mcu_clk,
|
|
||||||
&clk_uart_clk,
|
|
||||||
};
|
|
||||||
|
|
||||||
static LIST_HEAD(clocks);
|
|
||||||
static DEFINE_MUTEX(clocks_mutex);
|
|
||||||
|
|
||||||
struct clk *clk_get(struct device *dev, const char *id)
|
|
||||||
{
|
|
||||||
struct clk *p, *clk = ERR_PTR(-ENOENT);
|
|
||||||
|
|
||||||
mutex_lock(&clocks_mutex);
|
|
||||||
list_for_each_entry(p, &clocks, node) {
|
|
||||||
if (!strcmp(p->name, id)) {
|
|
||||||
clk = p;
|
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
found:
|
|
||||||
mutex_unlock(&clocks_mutex);
|
|
||||||
|
|
||||||
return clk;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_get);
|
|
||||||
|
|
||||||
void clk_put(struct clk *clk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_put);
|
|
||||||
|
|
||||||
int clk_enable(struct clk *clk)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_enable);
|
|
||||||
|
|
||||||
void clk_disable(struct clk *clk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_disable);
|
|
||||||
|
|
||||||
unsigned long clk_get_rate(struct clk *clk)
|
|
||||||
{
|
|
||||||
return clk->get_rate();
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_get_rate);
|
|
||||||
|
|
||||||
int imx_clocks_init(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
mutex_lock(&clocks_mutex);
|
|
||||||
for (i = 0; i < ARRAY_SIZE(clks); i++)
|
|
||||||
list_add(&clks[i]->node, &clocks);
|
|
||||||
mutex_unlock(&clocks_mutex);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,315 +0,0 @@
|
||||||
/*
|
|
||||||
* cpu.c: clock scaling for the iMX
|
|
||||||
*
|
|
||||||
* Copyright (C) 2000 2001, The Delft University of Technology
|
|
||||||
* Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
* Copyright (C) 2006 Inky Lung <ilung@cwlinux.com>
|
|
||||||
* Copyright (C) 2006 Pavel Pisa, PiKRON <ppisa@pikron.com>
|
|
||||||
*
|
|
||||||
* Based on SA1100 version written by:
|
|
||||||
* - Johan Pouwelse (J.A.Pouwelse@its.tudelft.nl): initial version
|
|
||||||
* - Erik Mouw (J.A.K.Mouw@its.tudelft.nl):
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*#define DEBUG*/
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/cpufreq.h>
|
|
||||||
#include <linux/clk.h>
|
|
||||||
#include <linux/err.h>
|
|
||||||
#include <asm/system.h>
|
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
|
|
||||||
#include "generic.h"
|
|
||||||
|
|
||||||
#ifndef __val2mfld
|
|
||||||
#define __val2mfld(mask,val) (((mask)&~((mask)<<1))*(val)&(mask))
|
|
||||||
#endif
|
|
||||||
#ifndef __mfld2val
|
|
||||||
#define __mfld2val(mask,val) (((val)&(mask))/((mask)&~((mask)<<1)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CR_920T_CLOCK_MODE 0xC0000000
|
|
||||||
#define CR_920T_FASTBUS_MODE 0x00000000
|
|
||||||
#define CR_920T_ASYNC_MODE 0xC0000000
|
|
||||||
|
|
||||||
static u32 mpctl0_at_boot;
|
|
||||||
static u32 bclk_div_at_boot;
|
|
||||||
|
|
||||||
static struct clk *system_clk, *mcu_clk;
|
|
||||||
|
|
||||||
static void imx_set_async_mode(void)
|
|
||||||
{
|
|
||||||
adjust_cr(CR_920T_CLOCK_MODE, CR_920T_ASYNC_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void imx_set_fastbus_mode(void)
|
|
||||||
{
|
|
||||||
adjust_cr(CR_920T_CLOCK_MODE, CR_920T_FASTBUS_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void imx_set_mpctl0(u32 mpctl0)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (mpctl0 == 0) {
|
|
||||||
local_irq_save(flags);
|
|
||||||
CSCR &= ~CSCR_MPEN;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
MPCTL0 = mpctl0;
|
|
||||||
CSCR |= CSCR_MPEN;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_compute_mpctl - compute new PLL parameters
|
|
||||||
* @new_mpctl: pointer to location assigned by new PLL control register value
|
|
||||||
* @cur_mpctl: current PLL control register parameters
|
|
||||||
* @f_ref: reference source frequency Hz
|
|
||||||
* @freq: required frequency in Hz
|
|
||||||
* @relation: is one of %CPUFREQ_RELATION_L (supremum)
|
|
||||||
* and %CPUFREQ_RELATION_H (infimum)
|
|
||||||
*/
|
|
||||||
long imx_compute_mpctl(u32 *new_mpctl, u32 cur_mpctl, u32 f_ref, unsigned long freq, int relation)
|
|
||||||
{
|
|
||||||
u32 mfi;
|
|
||||||
u32 mfn;
|
|
||||||
u32 mfd;
|
|
||||||
u32 pd;
|
|
||||||
unsigned long long ll;
|
|
||||||
long l;
|
|
||||||
long quot;
|
|
||||||
|
|
||||||
/* Fdppl=2*Fref*(MFI+MFN/(MFD+1))/(PD+1) */
|
|
||||||
/* PD=<0,15>, MFD=<1,1023>, MFI=<5,15> MFN=<0,1022> */
|
|
||||||
|
|
||||||
if (cur_mpctl) {
|
|
||||||
mfd = ((cur_mpctl >> 16) & 0x3ff) + 1;
|
|
||||||
pd = ((cur_mpctl >> 26) & 0xf) + 1;
|
|
||||||
} else {
|
|
||||||
pd=2; mfd=313;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pd=2; mfd=313; mfi=8; mfn=183; */
|
|
||||||
/* (MFI+MFN/(MFD)) = Fdppl / (2*Fref) * (PD); */
|
|
||||||
|
|
||||||
quot = (f_ref + (1 << 9)) >> 10;
|
|
||||||
l = (freq * pd + quot) / (2 * quot);
|
|
||||||
mfi = l >> 10;
|
|
||||||
mfn = ((l & ((1 << 10) - 1)) * mfd + (1 << 9)) >> 10;
|
|
||||||
|
|
||||||
mfd -= 1;
|
|
||||||
pd -= 1;
|
|
||||||
|
|
||||||
*new_mpctl = ((mfi & 0xf) << 10) | (mfn & 0x3ff) | ((mfd & 0x3ff) << 16)
|
|
||||||
| ((pd & 0xf) << 26);
|
|
||||||
|
|
||||||
ll = 2 * (unsigned long long)f_ref * ( (mfi<<16) + (mfn<<16) / (mfd+1) );
|
|
||||||
quot = (pd+1) * (1<<16);
|
|
||||||
ll += quot / 2;
|
|
||||||
do_div(ll, quot);
|
|
||||||
freq = ll;
|
|
||||||
|
|
||||||
pr_debug(KERN_DEBUG "imx: new PLL parameters pd=%d mfd=%d mfi=%d mfn=%d, freq=%ld\n",
|
|
||||||
pd, mfd, mfi, mfn, freq);
|
|
||||||
|
|
||||||
return freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int imx_verify_speed(struct cpufreq_policy *policy)
|
|
||||||
{
|
|
||||||
if (policy->cpu != 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int imx_get_speed(unsigned int cpu)
|
|
||||||
{
|
|
||||||
unsigned int freq;
|
|
||||||
unsigned int cr;
|
|
||||||
unsigned int cscr;
|
|
||||||
unsigned int bclk_div;
|
|
||||||
|
|
||||||
if (cpu)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
cscr = CSCR;
|
|
||||||
bclk_div = __mfld2val(CSCR_BCLK_DIV, cscr) + 1;
|
|
||||||
cr = get_cr();
|
|
||||||
|
|
||||||
if((cr & CR_920T_CLOCK_MODE) == CR_920T_FASTBUS_MODE) {
|
|
||||||
freq = clk_get_rate(system_clk);
|
|
||||||
freq = (freq + bclk_div/2) / bclk_div;
|
|
||||||
} else {
|
|
||||||
freq = clk_get_rate(mcu_clk);
|
|
||||||
if (cscr & CSCR_MPU_PRESC)
|
|
||||||
freq /= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
freq = (freq + 500) / 1000;
|
|
||||||
|
|
||||||
return freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int imx_set_target(struct cpufreq_policy *policy,
|
|
||||||
unsigned int target_freq,
|
|
||||||
unsigned int relation)
|
|
||||||
{
|
|
||||||
struct cpufreq_freqs freqs;
|
|
||||||
u32 mpctl0 = 0;
|
|
||||||
u32 cscr;
|
|
||||||
unsigned long flags;
|
|
||||||
long freq;
|
|
||||||
long sysclk;
|
|
||||||
unsigned int bclk_div = bclk_div_at_boot;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Some governors do not respects CPU and policy lower limits
|
|
||||||
* which leads to bad things (division by zero etc), ensure
|
|
||||||
* that such things do not happen.
|
|
||||||
*/
|
|
||||||
if(target_freq < policy->cpuinfo.min_freq)
|
|
||||||
target_freq = policy->cpuinfo.min_freq;
|
|
||||||
|
|
||||||
if(target_freq < policy->min)
|
|
||||||
target_freq = policy->min;
|
|
||||||
|
|
||||||
freq = target_freq * 1000;
|
|
||||||
|
|
||||||
pr_debug(KERN_DEBUG "imx: requested frequency %ld Hz, mpctl0 at boot 0x%08x\n",
|
|
||||||
freq, mpctl0_at_boot);
|
|
||||||
|
|
||||||
sysclk = clk_get_rate(system_clk);
|
|
||||||
|
|
||||||
if (freq > sysclk / bclk_div_at_boot + 1000000) {
|
|
||||||
freq = imx_compute_mpctl(&mpctl0, mpctl0_at_boot, CLK32 * 512, freq, relation);
|
|
||||||
if (freq < 0) {
|
|
||||||
printk(KERN_WARNING "imx: target frequency %ld Hz cannot be set\n", freq);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(freq + 1000 < sysclk) {
|
|
||||||
if (relation == CPUFREQ_RELATION_L)
|
|
||||||
bclk_div = (sysclk - 1000) / freq;
|
|
||||||
else
|
|
||||||
bclk_div = (sysclk + freq + 1000) / freq;
|
|
||||||
|
|
||||||
if(bclk_div > 16)
|
|
||||||
bclk_div = 16;
|
|
||||||
if(bclk_div < bclk_div_at_boot)
|
|
||||||
bclk_div = bclk_div_at_boot;
|
|
||||||
}
|
|
||||||
freq = (sysclk + bclk_div / 2) / bclk_div;
|
|
||||||
}
|
|
||||||
|
|
||||||
freqs.old = imx_get_speed(0);
|
|
||||||
freqs.new = (freq + 500) / 1000;
|
|
||||||
freqs.cpu = 0;
|
|
||||||
freqs.flags = 0;
|
|
||||||
|
|
||||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
|
|
||||||
imx_set_fastbus_mode();
|
|
||||||
|
|
||||||
imx_set_mpctl0(mpctl0);
|
|
||||||
|
|
||||||
cscr = CSCR;
|
|
||||||
cscr &= ~CSCR_BCLK_DIV;
|
|
||||||
cscr |= __val2mfld(CSCR_BCLK_DIV, bclk_div - 1);
|
|
||||||
CSCR = cscr;
|
|
||||||
|
|
||||||
if(mpctl0) {
|
|
||||||
CSCR |= CSCR_MPLL_RESTART;
|
|
||||||
|
|
||||||
/* Wait until MPLL is stabilized */
|
|
||||||
while( CSCR & CSCR_MPLL_RESTART );
|
|
||||||
|
|
||||||
imx_set_async_mode();
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_restore(flags);
|
|
||||||
|
|
||||||
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
|
|
||||||
|
|
||||||
pr_debug(KERN_INFO "imx: set frequency %ld Hz, running from %s\n",
|
|
||||||
freq, mpctl0? "MPLL": "SPLL");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy)
|
|
||||||
{
|
|
||||||
printk(KERN_INFO "i.MX cpu freq change driver v1.0\n");
|
|
||||||
|
|
||||||
if (policy->cpu != 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
policy->cur = policy->min = policy->max = imx_get_speed(0);
|
|
||||||
policy->cpuinfo.min_freq = 8000;
|
|
||||||
policy->cpuinfo.max_freq = 200000;
|
|
||||||
/* Manual states, that PLL stabilizes in two CLK32 periods */
|
|
||||||
policy->cpuinfo.transition_latency = 4 * 1000000000LL / CLK32;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct cpufreq_driver imx_driver = {
|
|
||||||
.flags = CPUFREQ_STICKY,
|
|
||||||
.verify = imx_verify_speed,
|
|
||||||
.target = imx_set_target,
|
|
||||||
.get = imx_get_speed,
|
|
||||||
.init = imx_cpufreq_driver_init,
|
|
||||||
.name = "imx",
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init imx_cpufreq_init(void)
|
|
||||||
{
|
|
||||||
bclk_div_at_boot = __mfld2val(CSCR_BCLK_DIV, CSCR) + 1;
|
|
||||||
mpctl0_at_boot = 0;
|
|
||||||
|
|
||||||
system_clk = clk_get(NULL, "system_clk");
|
|
||||||
if (IS_ERR(system_clk))
|
|
||||||
return PTR_ERR(system_clk);
|
|
||||||
|
|
||||||
mcu_clk = clk_get(NULL, "mcu_clk");
|
|
||||||
if (IS_ERR(mcu_clk)) {
|
|
||||||
clk_put(system_clk);
|
|
||||||
return PTR_ERR(mcu_clk);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((CSCR & CSCR_MPEN) &&
|
|
||||||
((get_cr() & CR_920T_CLOCK_MODE) != CR_920T_FASTBUS_MODE))
|
|
||||||
mpctl0_at_boot = MPCTL0;
|
|
||||||
|
|
||||||
return cpufreq_register_driver(&imx_driver);
|
|
||||||
}
|
|
||||||
|
|
||||||
arch_initcall(imx_cpufreq_init);
|
|
||||||
|
|
|
@ -1,597 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/dma.c
|
|
||||||
*
|
|
||||||
* imx DMA registration and IRQ dispatching
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 2004-03-03 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
* initial version heavily inspired by
|
|
||||||
* linux/arch/arm/mach-pxa/dma.c
|
|
||||||
*
|
|
||||||
* 2005-04-17 Pavel Pisa <pisa@cmp.felk.cvut.cz>
|
|
||||||
* Changed to support scatter gather DMA
|
|
||||||
* by taking Russell's code from RiscPC
|
|
||||||
*
|
|
||||||
* 2006-05-31 Pavel Pisa <pisa@cmp.felk.cvut.cz>
|
|
||||||
* Corrected error handling code.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef DEBUG
|
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/interrupt.h>
|
|
||||||
#include <linux/errno.h>
|
|
||||||
|
|
||||||
#include <asm/scatterlist.h>
|
|
||||||
#include <asm/system.h>
|
|
||||||
#include <asm/irq.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <mach/dma.h>
|
|
||||||
#include <mach/imx-dma.h>
|
|
||||||
|
|
||||||
struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* imx_dma_sg_next - prepare next chunk for scatter-gather DMA emulation
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @lastcount: number of bytes transferred during last transfer
|
|
||||||
*
|
|
||||||
* Functions prepares DMA controller for next sg data chunk transfer.
|
|
||||||
* The @lastcount argument informs function about number of bytes transferred
|
|
||||||
* during last block. Zero value can be used for @lastcount to setup DMA
|
|
||||||
* for the first chunk.
|
|
||||||
*/
|
|
||||||
static inline int imx_dma_sg_next(imx_dmach_t dma_ch, unsigned int lastcount)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
unsigned int nextcount;
|
|
||||||
unsigned int nextaddr;
|
|
||||||
|
|
||||||
if (!imxdma->name) {
|
|
||||||
printk(KERN_CRIT "%s: called for not allocated channel %d\n",
|
|
||||||
__func__, dma_ch);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
imxdma->resbytes -= lastcount;
|
|
||||||
|
|
||||||
if (!imxdma->sg) {
|
|
||||||
pr_debug("imxdma%d: no sg data\n", dma_ch);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
imxdma->sgbc += lastcount;
|
|
||||||
if ((imxdma->sgbc >= imxdma->sg->length) || !imxdma->resbytes) {
|
|
||||||
if ((imxdma->sgcount <= 1) || !imxdma->resbytes) {
|
|
||||||
pr_debug("imxdma%d: sg transfer limit reached\n",
|
|
||||||
dma_ch);
|
|
||||||
imxdma->sgcount=0;
|
|
||||||
imxdma->sg = NULL;
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
imxdma->sgcount--;
|
|
||||||
imxdma->sg++;
|
|
||||||
imxdma->sgbc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nextcount = imxdma->sg->length - imxdma->sgbc;
|
|
||||||
nextaddr = imxdma->sg->dma_address + imxdma->sgbc;
|
|
||||||
|
|
||||||
if(imxdma->resbytes < nextcount)
|
|
||||||
nextcount = imxdma->resbytes;
|
|
||||||
|
|
||||||
if ((imxdma->dma_mode & DMA_MODE_MASK) == DMA_MODE_READ)
|
|
||||||
DAR(dma_ch) = nextaddr;
|
|
||||||
else
|
|
||||||
SAR(dma_ch) = nextaddr;
|
|
||||||
|
|
||||||
CNTR(dma_ch) = nextcount;
|
|
||||||
pr_debug("imxdma%d: next sg chunk dst 0x%08x, src 0x%08x, size 0x%08x\n",
|
|
||||||
dma_ch, DAR(dma_ch), SAR(dma_ch), CNTR(dma_ch));
|
|
||||||
|
|
||||||
return nextcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* imx_dma_setup_sg_base - scatter-gather DMA emulation
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @sg: pointer to the scatter-gather list/vector
|
|
||||||
* @sgcount: scatter-gather list hungs count
|
|
||||||
*
|
|
||||||
* Functions sets up i.MX DMA state for emulated scatter-gather transfer
|
|
||||||
* and sets up channel registers to be ready for the first chunk
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
imx_dma_setup_sg_base(imx_dmach_t dma_ch,
|
|
||||||
struct scatterlist *sg, unsigned int sgcount)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
|
|
||||||
imxdma->sg = sg;
|
|
||||||
imxdma->sgcount = sgcount;
|
|
||||||
imxdma->sgbc = 0;
|
|
||||||
return imx_dma_sg_next(dma_ch, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_setup_single - setup i.MX DMA channel for linear memory to/from device transfer
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @dma_address: the DMA/physical memory address of the linear data block
|
|
||||||
* to transfer
|
|
||||||
* @dma_length: length of the data block in bytes
|
|
||||||
* @dev_addr: physical device port address
|
|
||||||
* @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory
|
|
||||||
* or %DMA_MODE_WRITE from memory to the device
|
|
||||||
*
|
|
||||||
* The function setups DMA channel source and destination addresses for transfer
|
|
||||||
* specified by provided parameters. The scatter-gather emulation is disabled,
|
|
||||||
* because linear data block
|
|
||||||
* form the physical address range is transferred.
|
|
||||||
* Return value: if incorrect parameters are provided -%EINVAL.
|
|
||||||
* Zero indicates success.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
|
|
||||||
unsigned int dma_length, unsigned int dev_addr,
|
|
||||||
unsigned int dmamode)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
|
|
||||||
imxdma->sg = NULL;
|
|
||||||
imxdma->sgcount = 0;
|
|
||||||
imxdma->dma_mode = dmamode;
|
|
||||||
imxdma->resbytes = dma_length;
|
|
||||||
|
|
||||||
if (!dma_address) {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_single null address\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dma_length) {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_single zero length\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) {
|
|
||||||
pr_debug("imxdma%d: mx_dma_setup_single2dev dma_addressg=0x%08x dma_length=%d dev_addr=0x%08x for read\n",
|
|
||||||
dma_ch, (unsigned int)dma_address, dma_length,
|
|
||||||
dev_addr);
|
|
||||||
SAR(dma_ch) = dev_addr;
|
|
||||||
DAR(dma_ch) = (unsigned int)dma_address;
|
|
||||||
} else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
|
|
||||||
pr_debug("imxdma%d: mx_dma_setup_single2dev dma_addressg=0x%08x dma_length=%d dev_addr=0x%08x for write\n",
|
|
||||||
dma_ch, (unsigned int)dma_address, dma_length,
|
|
||||||
dev_addr);
|
|
||||||
SAR(dma_ch) = (unsigned int)dma_address;
|
|
||||||
DAR(dma_ch) = dev_addr;
|
|
||||||
} else {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_single bad dmamode\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CNTR(dma_ch) = dma_length;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_setup_sg - setup i.MX DMA channel SG list to/from device transfer
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @sg: pointer to the scatter-gather list/vector
|
|
||||||
* @sgcount: scatter-gather list hungs count
|
|
||||||
* @dma_length: total length of the transfer request in bytes
|
|
||||||
* @dev_addr: physical device port address
|
|
||||||
* @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory
|
|
||||||
* or %DMA_MODE_WRITE from memory to the device
|
|
||||||
*
|
|
||||||
* The function sets up DMA channel state and registers to be ready for transfer
|
|
||||||
* specified by provided parameters. The scatter-gather emulation is set up
|
|
||||||
* according to the parameters.
|
|
||||||
*
|
|
||||||
* The full preparation of the transfer requires setup of more register
|
|
||||||
* by the caller before imx_dma_enable() can be called.
|
|
||||||
*
|
|
||||||
* %BLR(dma_ch) holds transfer burst length in bytes, 0 means 64 bytes
|
|
||||||
*
|
|
||||||
* %RSSR(dma_ch) has to be set to the DMA request line source %DMA_REQ_xxx
|
|
||||||
*
|
|
||||||
* %CCR(dma_ch) has to specify transfer parameters, the next settings is typical
|
|
||||||
* for linear or simple scatter-gather transfers if %DMA_MODE_READ is specified
|
|
||||||
*
|
|
||||||
* %CCR_DMOD_LINEAR | %CCR_DSIZ_32 | %CCR_SMOD_FIFO | %CCR_SSIZ_x
|
|
||||||
*
|
|
||||||
* The typical setup for %DMA_MODE_WRITE is specified by next options combination
|
|
||||||
*
|
|
||||||
* %CCR_SMOD_LINEAR | %CCR_SSIZ_32 | %CCR_DMOD_FIFO | %CCR_DSIZ_x
|
|
||||||
*
|
|
||||||
* Be careful here and do not mistakenly mix source and target device
|
|
||||||
* port sizes constants, they are really different:
|
|
||||||
* %CCR_SSIZ_8, %CCR_SSIZ_16, %CCR_SSIZ_32,
|
|
||||||
* %CCR_DSIZ_8, %CCR_DSIZ_16, %CCR_DSIZ_32
|
|
||||||
*
|
|
||||||
* Return value: if incorrect parameters are provided -%EINVAL.
|
|
||||||
* Zero indicates success.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
imx_dma_setup_sg(imx_dmach_t dma_ch,
|
|
||||||
struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length,
|
|
||||||
unsigned int dev_addr, unsigned int dmamode)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
|
|
||||||
imxdma->sg = NULL;
|
|
||||||
imxdma->sgcount = 0;
|
|
||||||
imxdma->dma_mode = dmamode;
|
|
||||||
imxdma->resbytes = dma_length;
|
|
||||||
|
|
||||||
if (!sg || !sgcount) {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_sg epty sg list\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sg->length) {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_sg zero length\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) {
|
|
||||||
pr_debug("imxdma%d: mx_dma_setup_sg2dev sg=%p sgcount=%d total length=%d dev_addr=0x%08x for read\n",
|
|
||||||
dma_ch, sg, sgcount, dma_length, dev_addr);
|
|
||||||
SAR(dma_ch) = dev_addr;
|
|
||||||
} else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
|
|
||||||
pr_debug("imxdma%d: mx_dma_setup_sg2dev sg=%p sgcount=%d total length=%d dev_addr=0x%08x for write\n",
|
|
||||||
dma_ch, sg, sgcount, dma_length, dev_addr);
|
|
||||||
DAR(dma_ch) = dev_addr;
|
|
||||||
} else {
|
|
||||||
printk(KERN_ERR "imxdma%d: imx_dma_setup_sg bad dmamode\n",
|
|
||||||
dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = imx_dma_setup_sg_base(dma_ch, sg, sgcount);
|
|
||||||
if (res <= 0) {
|
|
||||||
printk(KERN_ERR "imxdma%d: no sg chunk ready\n", dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_setup_handlers - setup i.MX DMA channel end and error notification handlers
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @irq_handler: the pointer to the function called if the transfer
|
|
||||||
* ends successfully
|
|
||||||
* @err_handler: the pointer to the function called if the premature
|
|
||||||
* end caused by error occurs
|
|
||||||
* @data: user specified value to be passed to the handlers
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
imx_dma_setup_handlers(imx_dmach_t dma_ch,
|
|
||||||
void (*irq_handler) (int, void *),
|
|
||||||
void (*err_handler) (int, void *, int),
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (!imxdma->name) {
|
|
||||||
printk(KERN_CRIT "%s: called for not allocated channel %d\n",
|
|
||||||
__func__, dma_ch);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
DISR = (1 << dma_ch);
|
|
||||||
imxdma->irq_handler = irq_handler;
|
|
||||||
imxdma->err_handler = err_handler;
|
|
||||||
imxdma->data = data;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_enable - function to start i.MX DMA channel operation
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
*
|
|
||||||
* The channel has to be allocated by driver through imx_dma_request()
|
|
||||||
* or imx_dma_request_by_prio() function.
|
|
||||||
* The transfer parameters has to be set to the channel registers through
|
|
||||||
* call of the imx_dma_setup_single() or imx_dma_setup_sg() function
|
|
||||||
* and registers %BLR(dma_ch), %RSSR(dma_ch) and %CCR(dma_ch) has to
|
|
||||||
* be set prior this function call by the channel user.
|
|
||||||
*/
|
|
||||||
void imx_dma_enable(imx_dmach_t dma_ch)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
pr_debug("imxdma%d: imx_dma_enable\n", dma_ch);
|
|
||||||
|
|
||||||
if (!imxdma->name) {
|
|
||||||
printk(KERN_CRIT "%s: called for not allocated channel %d\n",
|
|
||||||
__func__, dma_ch);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
DISR = (1 << dma_ch);
|
|
||||||
DIMR &= ~(1 << dma_ch);
|
|
||||||
CCR(dma_ch) |= CCR_CEN;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_disable - stop, finish i.MX DMA channel operatin
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
*/
|
|
||||||
void imx_dma_disable(imx_dmach_t dma_ch)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
pr_debug("imxdma%d: imx_dma_disable\n", dma_ch);
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
DIMR |= (1 << dma_ch);
|
|
||||||
CCR(dma_ch) &= ~CCR_CEN;
|
|
||||||
DISR = (1 << dma_ch);
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_request - request/allocate specified channel number
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
* @name: the driver/caller own non-%NULL identification
|
|
||||||
*/
|
|
||||||
int imx_dma_request(imx_dmach_t dma_ch, const char *name)
|
|
||||||
{
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
/* basic sanity checks */
|
|
||||||
if (!name)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (dma_ch >= IMX_DMA_CHANNELS) {
|
|
||||||
printk(KERN_CRIT "%s: called for non-existed channel %d\n",
|
|
||||||
__func__, dma_ch);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
if (imxdma->name) {
|
|
||||||
local_irq_restore(flags);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
imxdma->name = name;
|
|
||||||
imxdma->irq_handler = NULL;
|
|
||||||
imxdma->err_handler = NULL;
|
|
||||||
imxdma->data = NULL;
|
|
||||||
imxdma->sg = NULL;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_free - release previously acquired channel
|
|
||||||
* @dma_ch: i.MX DMA channel number
|
|
||||||
*/
|
|
||||||
void imx_dma_free(imx_dmach_t dma_ch)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
struct imx_dma_channel *imxdma = &imx_dma_channels[dma_ch];
|
|
||||||
|
|
||||||
if (!imxdma->name) {
|
|
||||||
printk(KERN_CRIT
|
|
||||||
"%s: trying to free channel %d which is already freed\n",
|
|
||||||
__func__, dma_ch);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
/* Disable interrupts */
|
|
||||||
DIMR |= (1 << dma_ch);
|
|
||||||
CCR(dma_ch) &= ~CCR_CEN;
|
|
||||||
imxdma->name = NULL;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* imx_dma_request_by_prio - find and request some of free channels best suiting requested priority
|
|
||||||
* @name: the driver/caller own non-%NULL identification
|
|
||||||
* @prio: one of the hardware distinguished priority level:
|
|
||||||
* %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW
|
|
||||||
*
|
|
||||||
* This function tries to find free channel in the specified priority group
|
|
||||||
* if the priority cannot be achieved it tries to look for free channel
|
|
||||||
* in the higher and then even lower priority groups.
|
|
||||||
*
|
|
||||||
* Return value: If there is no free channel to allocate, -%ENODEV is returned.
|
|
||||||
* On successful allocation channel is returned.
|
|
||||||
*/
|
|
||||||
imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int best;
|
|
||||||
|
|
||||||
switch (prio) {
|
|
||||||
case (DMA_PRIO_HIGH):
|
|
||||||
best = 8;
|
|
||||||
break;
|
|
||||||
case (DMA_PRIO_MEDIUM):
|
|
||||||
best = 4;
|
|
||||||
break;
|
|
||||||
case (DMA_PRIO_LOW):
|
|
||||||
default:
|
|
||||||
best = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = best; i < IMX_DMA_CHANNELS; i++) {
|
|
||||||
if (!imx_dma_request(i, name)) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = best - 1; i >= 0; i--) {
|
|
||||||
if (!imx_dma_request(i, name)) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printk(KERN_ERR "%s: no free DMA channel found\n", __func__);
|
|
||||||
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
static irqreturn_t dma_err_handler(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
int i, disr = DISR;
|
|
||||||
struct imx_dma_channel *channel;
|
|
||||||
unsigned int err_mask = DBTOSR | DRTOSR | DSESR | DBOSR;
|
|
||||||
int errcode;
|
|
||||||
|
|
||||||
DISR = disr & err_mask;
|
|
||||||
for (i = 0; i < IMX_DMA_CHANNELS; i++) {
|
|
||||||
if(!(err_mask & (1 << i)))
|
|
||||||
continue;
|
|
||||||
channel = &imx_dma_channels[i];
|
|
||||||
errcode = 0;
|
|
||||||
|
|
||||||
if (DBTOSR & (1 << i)) {
|
|
||||||
DBTOSR = (1 << i);
|
|
||||||
errcode |= IMX_DMA_ERR_BURST;
|
|
||||||
}
|
|
||||||
if (DRTOSR & (1 << i)) {
|
|
||||||
DRTOSR = (1 << i);
|
|
||||||
errcode |= IMX_DMA_ERR_REQUEST;
|
|
||||||
}
|
|
||||||
if (DSESR & (1 << i)) {
|
|
||||||
DSESR = (1 << i);
|
|
||||||
errcode |= IMX_DMA_ERR_TRANSFER;
|
|
||||||
}
|
|
||||||
if (DBOSR & (1 << i)) {
|
|
||||||
DBOSR = (1 << i);
|
|
||||||
errcode |= IMX_DMA_ERR_BUFFER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The cleaning of @sg field would be questionable
|
|
||||||
* there, because its value can help to compute
|
|
||||||
* remaining/transferred bytes count in the handler
|
|
||||||
*/
|
|
||||||
/*imx_dma_channels[i].sg = NULL;*/
|
|
||||||
|
|
||||||
if (channel->name && channel->err_handler) {
|
|
||||||
channel->err_handler(i, channel->data, errcode);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
imx_dma_channels[i].sg = NULL;
|
|
||||||
|
|
||||||
printk(KERN_WARNING
|
|
||||||
"DMA timeout on channel %d (%s) -%s%s%s%s\n",
|
|
||||||
i, channel->name,
|
|
||||||
errcode&IMX_DMA_ERR_BURST? " burst":"",
|
|
||||||
errcode&IMX_DMA_ERR_REQUEST? " request":"",
|
|
||||||
errcode&IMX_DMA_ERR_TRANSFER? " transfer":"",
|
|
||||||
errcode&IMX_DMA_ERR_BUFFER? " buffer":"");
|
|
||||||
}
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static irqreturn_t dma_irq_handler(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
int i, disr = DISR;
|
|
||||||
|
|
||||||
pr_debug("imxdma: dma_irq_handler called, disr=0x%08x\n",
|
|
||||||
disr);
|
|
||||||
|
|
||||||
DISR = disr;
|
|
||||||
for (i = 0; i < IMX_DMA_CHANNELS; i++) {
|
|
||||||
if (disr & (1 << i)) {
|
|
||||||
struct imx_dma_channel *channel = &imx_dma_channels[i];
|
|
||||||
if (channel->name) {
|
|
||||||
if (imx_dma_sg_next(i, CNTR(i))) {
|
|
||||||
CCR(i) &= ~CCR_CEN;
|
|
||||||
mb();
|
|
||||||
CCR(i) |= CCR_CEN;
|
|
||||||
} else {
|
|
||||||
if (channel->irq_handler)
|
|
||||||
channel->irq_handler(i,
|
|
||||||
channel->data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* IRQ for an unregistered DMA channel:
|
|
||||||
* let's clear the interrupts and disable it.
|
|
||||||
*/
|
|
||||||
printk(KERN_WARNING
|
|
||||||
"spurious IRQ for DMA channel %d\n", i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init imx_dma_init(void)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* reset DMA module */
|
|
||||||
DCR = DCR_DRST;
|
|
||||||
|
|
||||||
ret = request_irq(DMA_INT, dma_irq_handler, 0, "DMA", NULL);
|
|
||||||
if (ret) {
|
|
||||||
printk(KERN_CRIT "Wow! Can't register IRQ for DMA\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = request_irq(DMA_ERR, dma_err_handler, 0, "DMA", NULL);
|
|
||||||
if (ret) {
|
|
||||||
printk(KERN_CRIT "Wow! Can't register ERRIRQ for DMA\n");
|
|
||||||
free_irq(DMA_INT, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* enable DMA module */
|
|
||||||
DCR = DCR_DEN;
|
|
||||||
|
|
||||||
/* clear all interrupts */
|
|
||||||
DISR = (1 << IMX_DMA_CHANNELS) - 1;
|
|
||||||
|
|
||||||
/* enable interrupts */
|
|
||||||
DIMR = (1 << IMX_DMA_CHANNELS) - 1;
|
|
||||||
|
|
||||||
for (i = 0; i < IMX_DMA_CHANNELS; i++) {
|
|
||||||
imx_dma_channels[i].sg = NULL;
|
|
||||||
imx_dma_channels[i].dma_num = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
arch_initcall(imx_dma_init);
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_dma_setup_single);
|
|
||||||
EXPORT_SYMBOL(imx_dma_setup_sg);
|
|
||||||
EXPORT_SYMBOL(imx_dma_setup_handlers);
|
|
||||||
EXPORT_SYMBOL(imx_dma_enable);
|
|
||||||
EXPORT_SYMBOL(imx_dma_disable);
|
|
||||||
EXPORT_SYMBOL(imx_dma_request);
|
|
||||||
EXPORT_SYMBOL(imx_dma_free);
|
|
||||||
EXPORT_SYMBOL(imx_dma_request_by_prio);
|
|
||||||
EXPORT_SYMBOL(imx_dma_channels);
|
|
|
@ -1,271 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/generic.c
|
|
||||||
*
|
|
||||||
* author: Sascha Hauer
|
|
||||||
* Created: april 20th, 2004
|
|
||||||
* Copyright: Synertronixx GmbH
|
|
||||||
*
|
|
||||||
* Common code for i.MX machines
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <linux/platform_device.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/string.h>
|
|
||||||
|
|
||||||
#include <asm/errno.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <mach/imx-regs.h>
|
|
||||||
|
|
||||||
#include <asm/mach/map.h>
|
|
||||||
#include <mach/mmc.h>
|
|
||||||
#include <mach/gpio.h>
|
|
||||||
|
|
||||||
unsigned long imx_gpio_alloc_map[(GPIO_PORT_MAX + 1) * 32 / BITS_PER_LONG];
|
|
||||||
|
|
||||||
void imx_gpio_mode(int gpio_mode)
|
|
||||||
{
|
|
||||||
unsigned int pin = gpio_mode & GPIO_PIN_MASK;
|
|
||||||
unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
|
||||||
unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
|
|
||||||
unsigned int tmp;
|
|
||||||
|
|
||||||
/* Pullup enable */
|
|
||||||
if(gpio_mode & GPIO_PUEN)
|
|
||||||
PUEN(port) |= (1<<pin);
|
|
||||||
else
|
|
||||||
PUEN(port) &= ~(1<<pin);
|
|
||||||
|
|
||||||
/* Data direction */
|
|
||||||
if(gpio_mode & GPIO_OUT)
|
|
||||||
DDIR(port) |= 1<<pin;
|
|
||||||
else
|
|
||||||
DDIR(port) &= ~(1<<pin);
|
|
||||||
|
|
||||||
/* Primary / alternate function */
|
|
||||||
if(gpio_mode & GPIO_AF)
|
|
||||||
GPR(port) |= (1<<pin);
|
|
||||||
else
|
|
||||||
GPR(port) &= ~(1<<pin);
|
|
||||||
|
|
||||||
/* use as gpio? */
|
|
||||||
if(gpio_mode & GPIO_GIUS)
|
|
||||||
GIUS(port) |= (1<<pin);
|
|
||||||
else
|
|
||||||
GIUS(port) &= ~(1<<pin);
|
|
||||||
|
|
||||||
/* Output / input configuration */
|
|
||||||
/* FIXME: I'm not very sure about OCR and ICONF, someone
|
|
||||||
* should have a look over it
|
|
||||||
*/
|
|
||||||
if(pin<16) {
|
|
||||||
tmp = OCR1(port);
|
|
||||||
tmp &= ~( 3<<(pin*2));
|
|
||||||
tmp |= (ocr << (pin*2));
|
|
||||||
OCR1(port) = tmp;
|
|
||||||
|
|
||||||
ICONFA1(port) &= ~( 3<<(pin*2));
|
|
||||||
ICONFA1(port) |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << (pin * 2);
|
|
||||||
ICONFB1(port) &= ~( 3<<(pin*2));
|
|
||||||
ICONFB1(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << (pin * 2);
|
|
||||||
} else {
|
|
||||||
tmp = OCR2(port);
|
|
||||||
tmp &= ~( 3<<((pin-16)*2));
|
|
||||||
tmp |= (ocr << ((pin-16)*2));
|
|
||||||
OCR2(port) = tmp;
|
|
||||||
|
|
||||||
ICONFA2(port) &= ~( 3<<((pin-16)*2));
|
|
||||||
ICONFA2(port) |= ((gpio_mode >> GPIO_AOUT_SHIFT) & 3) << ((pin-16) * 2);
|
|
||||||
ICONFB2(port) &= ~( 3<<((pin-16)*2));
|
|
||||||
ICONFB2(port) |= ((gpio_mode >> GPIO_BOUT_SHIFT) & 3) << ((pin-16) * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_mode);
|
|
||||||
|
|
||||||
int imx_gpio_request(unsigned gpio, const char *label)
|
|
||||||
{
|
|
||||||
if(gpio >= (GPIO_PORT_MAX + 1) * 32) {
|
|
||||||
printk(KERN_ERR "imx_gpio: Attempt to request nonexistent GPIO %d for \"%s\"\n",
|
|
||||||
gpio, label ? label : "?");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(test_and_set_bit(gpio, imx_gpio_alloc_map)) {
|
|
||||||
printk(KERN_ERR "imx_gpio: GPIO %d already used. Allocation for \"%s\" failed\n",
|
|
||||||
gpio, label ? label : "?");
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_request);
|
|
||||||
|
|
||||||
void imx_gpio_free(unsigned gpio)
|
|
||||||
{
|
|
||||||
if(gpio >= (GPIO_PORT_MAX + 1) * 32)
|
|
||||||
return;
|
|
||||||
|
|
||||||
clear_bit(gpio, imx_gpio_alloc_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_free);
|
|
||||||
|
|
||||||
int imx_gpio_direction_input(unsigned gpio)
|
|
||||||
{
|
|
||||||
imx_gpio_mode(gpio | GPIO_IN | GPIO_GIUS | GPIO_DR);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_direction_input);
|
|
||||||
|
|
||||||
int imx_gpio_direction_output(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
imx_gpio_set_value(gpio, value);
|
|
||||||
imx_gpio_mode(gpio | GPIO_OUT | GPIO_GIUS | GPIO_DR);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_direction_output);
|
|
||||||
|
|
||||||
int imx_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
|
|
||||||
int alloc_mode, const char *label)
|
|
||||||
{
|
|
||||||
const int *p = pin_list;
|
|
||||||
int i;
|
|
||||||
unsigned gpio;
|
|
||||||
unsigned mode;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
|
|
||||||
mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK);
|
|
||||||
|
|
||||||
if (gpio >= (GPIO_PORT_MAX + 1) * 32)
|
|
||||||
goto setup_error;
|
|
||||||
|
|
||||||
if (alloc_mode & IMX_GPIO_ALLOC_MODE_RELEASE)
|
|
||||||
imx_gpio_free(gpio);
|
|
||||||
else if (!(alloc_mode & IMX_GPIO_ALLOC_MODE_NO_ALLOC))
|
|
||||||
if (imx_gpio_request(gpio, label))
|
|
||||||
if (!(alloc_mode & IMX_GPIO_ALLOC_MODE_TRY_ALLOC))
|
|
||||||
goto setup_error;
|
|
||||||
|
|
||||||
if (!(alloc_mode & (IMX_GPIO_ALLOC_MODE_ALLOC_ONLY |
|
|
||||||
IMX_GPIO_ALLOC_MODE_RELEASE)))
|
|
||||||
imx_gpio_mode(gpio | mode);
|
|
||||||
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
setup_error:
|
|
||||||
if(alloc_mode & (IMX_GPIO_ALLOC_MODE_NO_ALLOC |
|
|
||||||
IMX_GPIO_ALLOC_MODE_TRY_ALLOC))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
while (p != pin_list) {
|
|
||||||
p--;
|
|
||||||
gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
|
|
||||||
imx_gpio_free(gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_setup_multiple_pins);
|
|
||||||
|
|
||||||
void __imx_gpio_set_value(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
imx_gpio_set_value_inline(gpio, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(__imx_gpio_set_value);
|
|
||||||
|
|
||||||
int imx_gpio_to_irq(unsigned gpio)
|
|
||||||
{
|
|
||||||
return IRQ_GPIOA(0) + gpio;
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_gpio_to_irq);
|
|
||||||
|
|
||||||
int imx_irq_to_gpio(unsigned irq)
|
|
||||||
{
|
|
||||||
if (irq < IRQ_GPIOA(0))
|
|
||||||
return -EINVAL;
|
|
||||||
return irq - IRQ_GPIOA(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT_SYMBOL(imx_irq_to_gpio);
|
|
||||||
|
|
||||||
static struct resource imx_mmc_resources[] = {
|
|
||||||
[0] = {
|
|
||||||
.start = 0x00214000,
|
|
||||||
.end = 0x002140FF,
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
},
|
|
||||||
[1] = {
|
|
||||||
.start = (SDHC_INT),
|
|
||||||
.end = (SDHC_INT),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static u64 imxmmmc_dmamask = 0xffffffffUL;
|
|
||||||
|
|
||||||
static struct platform_device imx_mmc_device = {
|
|
||||||
.name = "imx-mmc",
|
|
||||||
.id = 0,
|
|
||||||
.dev = {
|
|
||||||
.dma_mask = &imxmmmc_dmamask,
|
|
||||||
.coherent_dma_mask = 0xffffffff,
|
|
||||||
},
|
|
||||||
.num_resources = ARRAY_SIZE(imx_mmc_resources),
|
|
||||||
.resource = imx_mmc_resources,
|
|
||||||
};
|
|
||||||
|
|
||||||
void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
|
|
||||||
{
|
|
||||||
imx_mmc_device.dev.platform_data = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_device *devices[] __initdata = {
|
|
||||||
&imx_mmc_device,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct map_desc imx_io_desc[] __initdata = {
|
|
||||||
{
|
|
||||||
.virtual = IMX_IO_BASE,
|
|
||||||
.pfn = __phys_to_pfn(IMX_IO_PHYS),
|
|
||||||
.length = IMX_IO_SIZE,
|
|
||||||
.type = MT_DEVICE
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void __init
|
|
||||||
imx_map_io(void)
|
|
||||||
{
|
|
||||||
iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init imx_init(void)
|
|
||||||
{
|
|
||||||
return platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
||||||
}
|
|
||||||
|
|
||||||
subsys_initcall(imx_init);
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/generic.h
|
|
||||||
*
|
|
||||||
* Author: Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
* Copyright: Synertronixx GmbH
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void __init imx_map_io(void);
|
|
||||||
extern void __init imx_init_irq(void);
|
|
||||||
|
|
||||||
struct sys_timer;
|
|
||||||
extern struct sys_timer imx_timer;
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* arch/arm/mach-imx/include/mach/debug-macro.S
|
|
||||||
*
|
|
||||||
* Debugging macro include header
|
|
||||||
*
|
|
||||||
* Copyright (C) 1994-1999 Russell King
|
|
||||||
* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
.macro addruart,rx
|
|
||||||
mrc p15, 0, \rx, c1, c0
|
|
||||||
tst \rx, #1 @ MMU enabled?
|
|
||||||
moveq \rx, #0x00000000 @ physical
|
|
||||||
movne \rx, #0xe0000000 @ virtual
|
|
||||||
orreq \rx, \rx, #0x00200000 @ physical
|
|
||||||
orr \rx, \rx, #0x00006000 @ UART1 offset
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro senduart,rd,rx
|
|
||||||
str \rd, [\rx, #0x40] @ TXDATA
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro waituart,rd,rx
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro busyuart,rd,rx
|
|
||||||
1002: ldr \rd, [\rx, #0x98] @ SR2
|
|
||||||
tst \rd, #1 << 3 @ TXDC
|
|
||||||
beq 1002b @ wait until transmit done
|
|
||||||
.endm
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/include/asm-arm/imxads/dma.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1997,1998 Russell King
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ASM_ARCH_DMA_H
|
|
||||||
#define __ASM_ARCH_DMA_H
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DMA_PRIO_HIGH = 0,
|
|
||||||
DMA_PRIO_MEDIUM = 1,
|
|
||||||
DMA_PRIO_LOW = 2
|
|
||||||
} imx_dma_prio;
|
|
||||||
|
|
||||||
#define DMA_REQ_UART3_T 2
|
|
||||||
#define DMA_REQ_UART3_R 3
|
|
||||||
#define DMA_REQ_SSI2_T 4
|
|
||||||
#define DMA_REQ_SSI2_R 5
|
|
||||||
#define DMA_REQ_CSI_STAT 6
|
|
||||||
#define DMA_REQ_CSI_R 7
|
|
||||||
#define DMA_REQ_MSHC 8
|
|
||||||
#define DMA_REQ_DSPA_DCT_DOUT 9
|
|
||||||
#define DMA_REQ_DSPA_DCT_DIN 10
|
|
||||||
#define DMA_REQ_DSPA_MAC 11
|
|
||||||
#define DMA_REQ_EXT 12
|
|
||||||
#define DMA_REQ_SDHC 13
|
|
||||||
#define DMA_REQ_SPI1_R 14
|
|
||||||
#define DMA_REQ_SPI1_T 15
|
|
||||||
#define DMA_REQ_SSI_T 16
|
|
||||||
#define DMA_REQ_SSI_R 17
|
|
||||||
#define DMA_REQ_ASP_DAC 18
|
|
||||||
#define DMA_REQ_ASP_ADC 19
|
|
||||||
#define DMA_REQ_USP_EP(x) (20+(x))
|
|
||||||
#define DMA_REQ_SPI2_R 26
|
|
||||||
#define DMA_REQ_SPI2_T 27
|
|
||||||
#define DMA_REQ_UART2_T 28
|
|
||||||
#define DMA_REQ_UART2_R 29
|
|
||||||
#define DMA_REQ_UART1_T 30
|
|
||||||
#define DMA_REQ_UART1_R 31
|
|
||||||
|
|
||||||
#endif /* _ASM_ARCH_DMA_H */
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/entry-macro.S
|
|
||||||
*
|
|
||||||
* Low-level IRQ helper macros for iMX-based platforms
|
|
||||||
*
|
|
||||||
* This file is licensed under the terms of the GNU General Public
|
|
||||||
* License version 2. This program is licensed "as is" without any
|
|
||||||
* warranty of any kind, whether express or implied.
|
|
||||||
*/
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
|
|
||||||
.macro disable_fiq
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro get_irqnr_preamble, base, tmp
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro arch_ret_to_user, tmp1, tmp2
|
|
||||||
.endm
|
|
||||||
|
|
||||||
#define AITC_NIVECSR 0x40
|
|
||||||
.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
|
|
||||||
ldr \base, =IO_ADDRESS(IMX_AITC_BASE)
|
|
||||||
@ Load offset & priority of the highest priority
|
|
||||||
@ interrupt pending.
|
|
||||||
ldr \irqstat, [\base, #AITC_NIVECSR]
|
|
||||||
@ Shift off the priority leaving the offset or
|
|
||||||
@ "interrupt number", use arithmetic shift to
|
|
||||||
@ transform illegal source (0xffff) as -1
|
|
||||||
mov \irqnr, \irqstat, asr #16
|
|
||||||
adds \tmp, \irqnr, #1
|
|
||||||
.endm
|
|
|
@ -1,106 +0,0 @@
|
||||||
#ifndef _IMX_GPIO_H
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <mach/imx-regs.h>
|
|
||||||
|
|
||||||
#define IMX_GPIO_ALLOC_MODE_NORMAL 0
|
|
||||||
#define IMX_GPIO_ALLOC_MODE_NO_ALLOC 1
|
|
||||||
#define IMX_GPIO_ALLOC_MODE_TRY_ALLOC 2
|
|
||||||
#define IMX_GPIO_ALLOC_MODE_ALLOC_ONLY 4
|
|
||||||
#define IMX_GPIO_ALLOC_MODE_RELEASE 8
|
|
||||||
|
|
||||||
extern int imx_gpio_request(unsigned gpio, const char *label);
|
|
||||||
|
|
||||||
extern void imx_gpio_free(unsigned gpio);
|
|
||||||
|
|
||||||
extern int imx_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
|
|
||||||
int alloc_mode, const char *label);
|
|
||||||
|
|
||||||
extern int imx_gpio_direction_input(unsigned gpio);
|
|
||||||
|
|
||||||
extern int imx_gpio_direction_output(unsigned gpio, int value);
|
|
||||||
|
|
||||||
extern void __imx_gpio_set_value(unsigned gpio, int value);
|
|
||||||
|
|
||||||
static inline int imx_gpio_get_value(unsigned gpio)
|
|
||||||
{
|
|
||||||
return SSR(gpio >> GPIO_PORT_SHIFT) & (1 << (gpio & GPIO_PIN_MASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void imx_gpio_set_value_inline(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
raw_local_irq_save(flags);
|
|
||||||
if(value)
|
|
||||||
DR(gpio >> GPIO_PORT_SHIFT) |= (1 << (gpio & GPIO_PIN_MASK));
|
|
||||||
else
|
|
||||||
DR(gpio >> GPIO_PORT_SHIFT) &= ~(1 << (gpio & GPIO_PIN_MASK));
|
|
||||||
raw_local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void imx_gpio_set_value(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
if(__builtin_constant_p(gpio))
|
|
||||||
imx_gpio_set_value_inline(gpio, value);
|
|
||||||
else
|
|
||||||
__imx_gpio_set_value(gpio, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int imx_gpio_to_irq(unsigned gpio);
|
|
||||||
|
|
||||||
extern int imx_irq_to_gpio(unsigned irq);
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Wrappers for "new style" GPIO calls. These calls i.MX specific versions
|
|
||||||
* to allow future extension of GPIO logic.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline int gpio_request(unsigned gpio, const char *label)
|
|
||||||
{
|
|
||||||
return imx_gpio_request(gpio, label);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void gpio_free(unsigned gpio)
|
|
||||||
{
|
|
||||||
might_sleep();
|
|
||||||
|
|
||||||
imx_gpio_free(gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int gpio_direction_input(unsigned gpio)
|
|
||||||
{
|
|
||||||
return imx_gpio_direction_input(gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int gpio_direction_output(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
return imx_gpio_direction_output(gpio, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int gpio_get_value(unsigned gpio)
|
|
||||||
{
|
|
||||||
return imx_gpio_get_value(gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void gpio_set_value(unsigned gpio, int value)
|
|
||||||
{
|
|
||||||
imx_gpio_set_value(gpio, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <asm-generic/gpio.h> /* cansleep wrappers */
|
|
||||||
|
|
||||||
static inline int gpio_to_irq(unsigned gpio)
|
|
||||||
{
|
|
||||||
return imx_gpio_to_irq(gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int irq_to_gpio(unsigned irq)
|
|
||||||
{
|
|
||||||
return imx_irq_to_gpio(irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/hardware.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_ARCH_HARDWARE_H
|
|
||||||
#define __ASM_ARCH_HARDWARE_H
|
|
||||||
|
|
||||||
#include <asm/sizes.h>
|
|
||||||
#include "imx-regs.h"
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
# define __REG(x) (*((volatile u32 *)IO_ADDRESS(x)))
|
|
||||||
|
|
||||||
# define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Memory map
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define IMX_IO_PHYS 0x00200000
|
|
||||||
#define IMX_IO_SIZE 0x00100000
|
|
||||||
#define IMX_IO_BASE 0xe0000000
|
|
||||||
|
|
||||||
#define IMX_CS0_PHYS 0x10000000
|
|
||||||
#define IMX_CS0_SIZE 0x02000000
|
|
||||||
#define IMX_CS0_VIRT 0xe8000000
|
|
||||||
|
|
||||||
#define IMX_CS1_PHYS 0x12000000
|
|
||||||
#define IMX_CS1_SIZE 0x01000000
|
|
||||||
#define IMX_CS1_VIRT 0xea000000
|
|
||||||
|
|
||||||
#define IMX_CS2_PHYS 0x13000000
|
|
||||||
#define IMX_CS2_SIZE 0x01000000
|
|
||||||
#define IMX_CS2_VIRT 0xeb000000
|
|
||||||
|
|
||||||
#define IMX_CS3_PHYS 0x14000000
|
|
||||||
#define IMX_CS3_SIZE 0x01000000
|
|
||||||
#define IMX_CS3_VIRT 0xec000000
|
|
||||||
|
|
||||||
#define IMX_CS4_PHYS 0x15000000
|
|
||||||
#define IMX_CS4_SIZE 0x01000000
|
|
||||||
#define IMX_CS4_VIRT 0xed000000
|
|
||||||
|
|
||||||
#define IMX_CS5_PHYS 0x16000000
|
|
||||||
#define IMX_CS5_SIZE 0x01000000
|
|
||||||
#define IMX_CS5_VIRT 0xee000000
|
|
||||||
|
|
||||||
#define IMX_FB_VIRT 0xF1000000
|
|
||||||
#define IMX_FB_SIZE (256*1024)
|
|
||||||
|
|
||||||
/* macro to get at IO space when running virtually */
|
|
||||||
#define IO_ADDRESS(x) ((x) | IMX_IO_BASE)
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
/*
|
|
||||||
* Handy routine to set GPIO functions
|
|
||||||
*/
|
|
||||||
extern void imx_gpio_mode( int gpio_mode );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAXIRQNUM 62
|
|
||||||
#define MAXFIQNUM 62
|
|
||||||
#define MAXSWINUM 62
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Use SDRAM for memory
|
|
||||||
*/
|
|
||||||
#define MEM_SIZE 0x01000000
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_MX1ADS
|
|
||||||
#include "mx1ads.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,98 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/include/asm-arm/imxads/dma.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1997,1998 Russell King
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <mach/dma.h>
|
|
||||||
|
|
||||||
#ifndef __ASM_ARCH_IMX_DMA_H
|
|
||||||
#define __ASM_ARCH_IMX_DMA_H
|
|
||||||
|
|
||||||
#define IMX_DMA_CHANNELS 11
|
|
||||||
|
|
||||||
/*
|
|
||||||
* struct imx_dma_channel - i.MX specific DMA extension
|
|
||||||
* @name: name specified by DMA client
|
|
||||||
* @irq_handler: client callback for end of transfer
|
|
||||||
* @err_handler: client callback for error condition
|
|
||||||
* @data: clients context data for callbacks
|
|
||||||
* @dma_mode: direction of the transfer %DMA_MODE_READ or %DMA_MODE_WRITE
|
|
||||||
* @sg: pointer to the actual read/written chunk for scatter-gather emulation
|
|
||||||
* @sgbc: counter of processed bytes in the actual read/written chunk
|
|
||||||
* @resbytes: total residual number of bytes to transfer
|
|
||||||
* (it can be lower or same as sum of SG mapped chunk sizes)
|
|
||||||
* @sgcount: number of chunks to be read/written
|
|
||||||
*
|
|
||||||
* Structure is used for IMX DMA processing. It would be probably good
|
|
||||||
* @struct dma_struct in the future for external interfacing and use
|
|
||||||
* @struct imx_dma_channel only as extension to it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct imx_dma_channel {
|
|
||||||
const char *name;
|
|
||||||
void (*irq_handler) (int, void *);
|
|
||||||
void (*err_handler) (int, void *, int errcode);
|
|
||||||
void *data;
|
|
||||||
unsigned int dma_mode;
|
|
||||||
struct scatterlist *sg;
|
|
||||||
unsigned int sgbc;
|
|
||||||
unsigned int sgcount;
|
|
||||||
unsigned int resbytes;
|
|
||||||
int dma_num;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
|
|
||||||
|
|
||||||
#define IMX_DMA_ERR_BURST 1
|
|
||||||
#define IMX_DMA_ERR_REQUEST 2
|
|
||||||
#define IMX_DMA_ERR_TRANSFER 4
|
|
||||||
#define IMX_DMA_ERR_BUFFER 8
|
|
||||||
|
|
||||||
/* The type to distinguish channel numbers parameter from ordinal int type */
|
|
||||||
typedef int imx_dmach_t;
|
|
||||||
|
|
||||||
#define DMA_MODE_READ 0
|
|
||||||
#define DMA_MODE_WRITE 1
|
|
||||||
#define DMA_MODE_MASK 1
|
|
||||||
|
|
||||||
int
|
|
||||||
imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address,
|
|
||||||
unsigned int dma_length, unsigned int dev_addr, unsigned int dmamode);
|
|
||||||
|
|
||||||
int
|
|
||||||
imx_dma_setup_sg(imx_dmach_t dma_ch,
|
|
||||||
struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length,
|
|
||||||
unsigned int dev_addr, unsigned int dmamode);
|
|
||||||
|
|
||||||
int
|
|
||||||
imx_dma_setup_handlers(imx_dmach_t dma_ch,
|
|
||||||
void (*irq_handler) (int, void *),
|
|
||||||
void (*err_handler) (int, void *, int), void *data);
|
|
||||||
|
|
||||||
void imx_dma_enable(imx_dmach_t dma_ch);
|
|
||||||
|
|
||||||
void imx_dma_disable(imx_dmach_t dma_ch);
|
|
||||||
|
|
||||||
int imx_dma_request(imx_dmach_t dma_ch, const char *name);
|
|
||||||
|
|
||||||
void imx_dma_free(imx_dmach_t dma_ch);
|
|
||||||
|
|
||||||
imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _ASM_ARCH_IMX_DMA_H */
|
|
|
@ -1,376 +0,0 @@
|
||||||
#ifndef _IMX_REGS_H
|
|
||||||
#define _IMX_REGS_H
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
* Motorola IMX system registers
|
|
||||||
* ------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register BASEs, based on OFFSETs
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define IMX_AIPI1_BASE (0x00000 + IMX_IO_BASE)
|
|
||||||
#define IMX_WDT_BASE (0x01000 + IMX_IO_BASE)
|
|
||||||
#define IMX_TIM1_BASE (0x02000 + IMX_IO_BASE)
|
|
||||||
#define IMX_TIM2_BASE (0x03000 + IMX_IO_BASE)
|
|
||||||
#define IMX_RTC_BASE (0x04000 + IMX_IO_BASE)
|
|
||||||
#define IMX_LCDC_BASE (0x05000 + IMX_IO_BASE)
|
|
||||||
#define IMX_UART1_BASE (0x06000 + IMX_IO_BASE)
|
|
||||||
#define IMX_UART2_BASE (0x07000 + IMX_IO_BASE)
|
|
||||||
#define IMX_PWM_BASE (0x08000 + IMX_IO_BASE)
|
|
||||||
#define IMX_DMAC_BASE (0x09000 + IMX_IO_BASE)
|
|
||||||
#define IMX_AIPI2_BASE (0x10000 + IMX_IO_BASE)
|
|
||||||
#define IMX_SIM_BASE (0x11000 + IMX_IO_BASE)
|
|
||||||
#define IMX_USBD_BASE (0x12000 + IMX_IO_BASE)
|
|
||||||
#define IMX_SPI1_BASE (0x13000 + IMX_IO_BASE)
|
|
||||||
#define IMX_MMC_BASE (0x14000 + IMX_IO_BASE)
|
|
||||||
#define IMX_ASP_BASE (0x15000 + IMX_IO_BASE)
|
|
||||||
#define IMX_BTA_BASE (0x16000 + IMX_IO_BASE)
|
|
||||||
#define IMX_I2C_BASE (0x17000 + IMX_IO_BASE)
|
|
||||||
#define IMX_SSI_BASE (0x18000 + IMX_IO_BASE)
|
|
||||||
#define IMX_SPI2_BASE (0x19000 + IMX_IO_BASE)
|
|
||||||
#define IMX_MSHC_BASE (0x1A000 + IMX_IO_BASE)
|
|
||||||
#define IMX_PLL_BASE (0x1B000 + IMX_IO_BASE)
|
|
||||||
#define IMX_GPIO_BASE (0x1C000 + IMX_IO_BASE)
|
|
||||||
#define IMX_EIM_BASE (0x20000 + IMX_IO_BASE)
|
|
||||||
#define IMX_SDRAMC_BASE (0x21000 + IMX_IO_BASE)
|
|
||||||
#define IMX_MMA_BASE (0x22000 + IMX_IO_BASE)
|
|
||||||
#define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
|
|
||||||
#define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
|
|
||||||
|
|
||||||
/* PLL registers */
|
|
||||||
#define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
|
|
||||||
#define CSCR_SPLL_RESTART (1<<22)
|
|
||||||
#define CSCR_MPLL_RESTART (1<<21)
|
|
||||||
#define CSCR_SYSTEM_SEL (1<<16)
|
|
||||||
#define CSCR_BCLK_DIV (0xf<<10)
|
|
||||||
#define CSCR_MPU_PRESC (1<<15)
|
|
||||||
#define CSCR_SPEN (1<<1)
|
|
||||||
#define CSCR_MPEN (1<<0)
|
|
||||||
|
|
||||||
#define MPCTL0 __REG(IMX_PLL_BASE + 0x4) /* MCU PLL Control Register 0 */
|
|
||||||
#define MPCTL1 __REG(IMX_PLL_BASE + 0x8) /* MCU PLL and System Clock Register 1 */
|
|
||||||
#define SPCTL0 __REG(IMX_PLL_BASE + 0xc) /* System PLL Control Register 0 */
|
|
||||||
#define SPCTL1 __REG(IMX_PLL_BASE + 0x10) /* System PLL Control Register 1 */
|
|
||||||
#define PCDR __REG(IMX_PLL_BASE + 0x20) /* Peripheral Clock Divider Register */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO Module and I/O Multiplexer
|
|
||||||
* x = 0..3 for reg_A, reg_B, reg_C, reg_D
|
|
||||||
*/
|
|
||||||
#define DDIR(x) __REG2(IMX_GPIO_BASE + 0x00, ((x) & 3) << 8)
|
|
||||||
#define OCR1(x) __REG2(IMX_GPIO_BASE + 0x04, ((x) & 3) << 8)
|
|
||||||
#define OCR2(x) __REG2(IMX_GPIO_BASE + 0x08, ((x) & 3) << 8)
|
|
||||||
#define ICONFA1(x) __REG2(IMX_GPIO_BASE + 0x0c, ((x) & 3) << 8)
|
|
||||||
#define ICONFA2(x) __REG2(IMX_GPIO_BASE + 0x10, ((x) & 3) << 8)
|
|
||||||
#define ICONFB1(x) __REG2(IMX_GPIO_BASE + 0x14, ((x) & 3) << 8)
|
|
||||||
#define ICONFB2(x) __REG2(IMX_GPIO_BASE + 0x18, ((x) & 3) << 8)
|
|
||||||
#define DR(x) __REG2(IMX_GPIO_BASE + 0x1c, ((x) & 3) << 8)
|
|
||||||
#define GIUS(x) __REG2(IMX_GPIO_BASE + 0x20, ((x) & 3) << 8)
|
|
||||||
#define SSR(x) __REG2(IMX_GPIO_BASE + 0x24, ((x) & 3) << 8)
|
|
||||||
#define ICR1(x) __REG2(IMX_GPIO_BASE + 0x28, ((x) & 3) << 8)
|
|
||||||
#define ICR2(x) __REG2(IMX_GPIO_BASE + 0x2c, ((x) & 3) << 8)
|
|
||||||
#define IMR(x) __REG2(IMX_GPIO_BASE + 0x30, ((x) & 3) << 8)
|
|
||||||
#define ISR(x) __REG2(IMX_GPIO_BASE + 0x34, ((x) & 3) << 8)
|
|
||||||
#define GPR(x) __REG2(IMX_GPIO_BASE + 0x38, ((x) & 3) << 8)
|
|
||||||
#define SWR(x) __REG2(IMX_GPIO_BASE + 0x3c, ((x) & 3) << 8)
|
|
||||||
#define PUEN(x) __REG2(IMX_GPIO_BASE + 0x40, ((x) & 3) << 8)
|
|
||||||
|
|
||||||
#define GPIO_PORT_MAX 3
|
|
||||||
|
|
||||||
#define GPIO_PIN_MASK 0x1f
|
|
||||||
#define GPIO_PORT_MASK (0x3 << 5)
|
|
||||||
|
|
||||||
#define GPIO_PORT_SHIFT 5
|
|
||||||
#define GPIO_PORTA (0<<5)
|
|
||||||
#define GPIO_PORTB (1<<5)
|
|
||||||
#define GPIO_PORTC (2<<5)
|
|
||||||
#define GPIO_PORTD (3<<5)
|
|
||||||
|
|
||||||
#define GPIO_OUT (1<<7)
|
|
||||||
#define GPIO_IN (0<<7)
|
|
||||||
#define GPIO_PUEN (1<<8)
|
|
||||||
|
|
||||||
#define GPIO_PF (0<<9)
|
|
||||||
#define GPIO_AF (1<<9)
|
|
||||||
|
|
||||||
#define GPIO_OCR_SHIFT 10
|
|
||||||
#define GPIO_OCR_MASK (3<<10)
|
|
||||||
#define GPIO_AIN (0<<10)
|
|
||||||
#define GPIO_BIN (1<<10)
|
|
||||||
#define GPIO_CIN (2<<10)
|
|
||||||
#define GPIO_DR (3<<10)
|
|
||||||
|
|
||||||
#define GPIO_AOUT_SHIFT 12
|
|
||||||
#define GPIO_AOUT_MASK (3<<12)
|
|
||||||
#define GPIO_AOUT (0<<12)
|
|
||||||
#define GPIO_AOUT_ISR (1<<12)
|
|
||||||
#define GPIO_AOUT_0 (2<<12)
|
|
||||||
#define GPIO_AOUT_1 (3<<12)
|
|
||||||
|
|
||||||
#define GPIO_BOUT_SHIFT 14
|
|
||||||
#define GPIO_BOUT_MASK (3<<14)
|
|
||||||
#define GPIO_BOUT (0<<14)
|
|
||||||
#define GPIO_BOUT_ISR (1<<14)
|
|
||||||
#define GPIO_BOUT_0 (2<<14)
|
|
||||||
#define GPIO_BOUT_1 (3<<14)
|
|
||||||
|
|
||||||
#define GPIO_GIUS (1<<16)
|
|
||||||
|
|
||||||
/* assignements for GPIO alternate/primary functions */
|
|
||||||
|
|
||||||
/* FIXME: This list is not completed. The correct directions are
|
|
||||||
* missing on some (many) pins
|
|
||||||
*/
|
|
||||||
#define PA0_AIN_SPI2_CLK ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0 )
|
|
||||||
#define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 )
|
|
||||||
#define PA1_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1 )
|
|
||||||
#define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 )
|
|
||||||
#define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 )
|
|
||||||
#define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 )
|
|
||||||
#define PA4_PF_CSI_D0 ( GPIO_PORTA | GPIO_PF | 4 )
|
|
||||||
#define PA5_PF_CSI_D1 ( GPIO_PORTA | GPIO_PF | 5 )
|
|
||||||
#define PA6_PF_CSI_D2 ( GPIO_PORTA | GPIO_PF | 6 )
|
|
||||||
#define PA7_PF_CSI_D3 ( GPIO_PORTA | GPIO_PF | 7 )
|
|
||||||
#define PA8_PF_CSI_D4 ( GPIO_PORTA | GPIO_PF | 8 )
|
|
||||||
#define PA9_PF_CSI_D5 ( GPIO_PORTA | GPIO_PF | 9 )
|
|
||||||
#define PA10_PF_CSI_D6 ( GPIO_PORTA | GPIO_PF | 10 )
|
|
||||||
#define PA11_PF_CSI_D7 ( GPIO_PORTA | GPIO_PF | 11 )
|
|
||||||
#define PA12_PF_CSI_VSYNC ( GPIO_PORTA | GPIO_PF | 12 )
|
|
||||||
#define PA13_PF_CSI_HSYNC ( GPIO_PORTA | GPIO_PF | 13 )
|
|
||||||
#define PA14_PF_CSI_PIXCLK ( GPIO_PORTA | GPIO_PF | 14 )
|
|
||||||
#define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 )
|
|
||||||
#define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 )
|
|
||||||
#define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 )
|
|
||||||
#define PA17_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17 )
|
|
||||||
#define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 )
|
|
||||||
#define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 )
|
|
||||||
#define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 )
|
|
||||||
#define PA21_PF_A0 ( GPIO_PORTA | GPIO_PF | 21 )
|
|
||||||
#define PA22_PF_CS4 ( GPIO_PORTA | GPIO_PF | 22 )
|
|
||||||
#define PA23_PF_CS5 ( GPIO_PORTA | GPIO_PF | 23 )
|
|
||||||
#define PA24_PF_A16 ( GPIO_PORTA | GPIO_PF | 24 )
|
|
||||||
#define PA24_AF_ETMTRACEPKT0 ( GPIO_PORTA | GPIO_AF | 24 )
|
|
||||||
#define PA25_PF_A17 ( GPIO_PORTA | GPIO_PF | 25 )
|
|
||||||
#define PA25_AF_ETMTRACEPKT1 ( GPIO_PORTA | GPIO_AF | 25 )
|
|
||||||
#define PA26_PF_A18 ( GPIO_PORTA | GPIO_PF | 26 )
|
|
||||||
#define PA26_AF_ETMTRACEPKT2 ( GPIO_PORTA | GPIO_AF | 26 )
|
|
||||||
#define PA27_PF_A19 ( GPIO_PORTA | GPIO_PF | 27 )
|
|
||||||
#define PA27_AF_ETMTRACEPKT3 ( GPIO_PORTA | GPIO_AF | 27 )
|
|
||||||
#define PA28_PF_A20 ( GPIO_PORTA | GPIO_PF | 28 )
|
|
||||||
#define PA28_AF_ETMPIPESTAT0 ( GPIO_PORTA | GPIO_AF | 28 )
|
|
||||||
#define PA29_PF_A21 ( GPIO_PORTA | GPIO_PF | 29 )
|
|
||||||
#define PA29_AF_ETMPIPESTAT1 ( GPIO_PORTA | GPIO_AF | 29 )
|
|
||||||
#define PA30_PF_A22 ( GPIO_PORTA | GPIO_PF | 30 )
|
|
||||||
#define PA30_AF_ETMPIPESTAT2 ( GPIO_PORTA | GPIO_AF | 30 )
|
|
||||||
#define PA31_PF_A23 ( GPIO_PORTA | GPIO_PF | 31 )
|
|
||||||
#define PA31_AF_ETMTRACECLK ( GPIO_PORTA | GPIO_AF | 31 )
|
|
||||||
#define PB8_PF_SD_DAT0 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 8 )
|
|
||||||
#define PB8_AF_MS_PIO ( GPIO_PORTB | GPIO_AF | 8 )
|
|
||||||
#define PB9_PF_SD_DAT1 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 9 )
|
|
||||||
#define PB9_AF_MS_PI1 ( GPIO_PORTB | GPIO_AF | 9 )
|
|
||||||
#define PB10_PF_SD_DAT2 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 10 )
|
|
||||||
#define PB10_AF_MS_SCLKI ( GPIO_PORTB | GPIO_AF | 10 )
|
|
||||||
#define PB11_PF_SD_DAT3 ( GPIO_PORTB | GPIO_PF | 11 )
|
|
||||||
#define PB11_AF_MS_SDIO ( GPIO_PORTB | GPIO_AF | 11 )
|
|
||||||
#define PB12_PF_SD_CLK ( GPIO_PORTB | GPIO_PF | 12 )
|
|
||||||
#define PB12_AF_MS_SCLK0 ( GPIO_PORTB | GPIO_AF | 12 )
|
|
||||||
#define PB13_PF_SD_CMD ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 13 )
|
|
||||||
#define PB13_AF_MS_BS ( GPIO_PORTB | GPIO_AF | 13 )
|
|
||||||
#define PB14_AF_SSI_RXFS ( GPIO_PORTB | GPIO_AF | 14 )
|
|
||||||
#define PB15_AF_SSI_RXCLK ( GPIO_PORTB | GPIO_AF | 15 )
|
|
||||||
#define PB16_AF_SSI_RXDAT ( GPIO_PORTB | GPIO_IN | GPIO_AF | 16 )
|
|
||||||
#define PB17_AF_SSI_TXDAT ( GPIO_PORTB | GPIO_OUT | GPIO_AF | 17 )
|
|
||||||
#define PB18_AF_SSI_TXFS ( GPIO_PORTB | GPIO_AF | 18 )
|
|
||||||
#define PB19_AF_SSI_TXCLK ( GPIO_PORTB | GPIO_AF | 19 )
|
|
||||||
#define PB20_PF_USBD_AFE ( GPIO_PORTB | GPIO_PF | 20 )
|
|
||||||
#define PB21_PF_USBD_OE ( GPIO_PORTB | GPIO_PF | 21 )
|
|
||||||
#define PB22_PFUSBD_RCV ( GPIO_PORTB | GPIO_PF | 22 )
|
|
||||||
#define PB23_PF_USBD_SUSPND ( GPIO_PORTB | GPIO_PF | 23 )
|
|
||||||
#define PB24_PF_USBD_VP ( GPIO_PORTB | GPIO_PF | 24 )
|
|
||||||
#define PB25_PF_USBD_VM ( GPIO_PORTB | GPIO_PF | 25 )
|
|
||||||
#define PB26_PF_USBD_VPO ( GPIO_PORTB | GPIO_PF | 26 )
|
|
||||||
#define PB27_PF_USBD_VMO ( GPIO_PORTB | GPIO_PF | 27 )
|
|
||||||
#define PB28_PF_UART2_CTS ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 28 )
|
|
||||||
#define PB29_PF_UART2_RTS ( GPIO_PORTB | GPIO_IN | GPIO_PF | 29 )
|
|
||||||
#define PB30_PF_UART2_TXD ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 30 )
|
|
||||||
#define PB31_PF_UART2_RXD ( GPIO_PORTB | GPIO_IN | GPIO_PF | 31 )
|
|
||||||
#define PC3_PF_SSI_RXFS ( GPIO_PORTC | GPIO_PF | 3 )
|
|
||||||
#define PC4_PF_SSI_RXCLK ( GPIO_PORTC | GPIO_PF | 4 )
|
|
||||||
#define PC5_PF_SSI_RXDAT ( GPIO_PORTC | GPIO_IN | GPIO_PF | 5 )
|
|
||||||
#define PC6_PF_SSI_TXDAT ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 6 )
|
|
||||||
#define PC7_PF_SSI_TXFS ( GPIO_PORTC | GPIO_PF | 7 )
|
|
||||||
#define PC8_PF_SSI_TXCLK ( GPIO_PORTC | GPIO_PF | 8 )
|
|
||||||
#define PC9_PF_UART1_CTS ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 9 )
|
|
||||||
#define PC10_PF_UART1_RTS ( GPIO_PORTC | GPIO_IN | GPIO_PF | 10 )
|
|
||||||
#define PC11_PF_UART1_TXD ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 11 )
|
|
||||||
#define PC12_PF_UART1_RXD ( GPIO_PORTC | GPIO_IN | GPIO_PF | 12 )
|
|
||||||
#define PC13_PF_SPI1_SPI_RDY ( GPIO_PORTC | GPIO_PF | 13 )
|
|
||||||
#define PC14_PF_SPI1_SCLK ( GPIO_PORTC | GPIO_PF | 14 )
|
|
||||||
#define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 )
|
|
||||||
#define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 )
|
|
||||||
#define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 )
|
|
||||||
#define PC24_BIN_UART3_RI ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24 )
|
|
||||||
#define PC25_BIN_UART3_DSR ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25 )
|
|
||||||
#define PC26_AOUT_UART3_DTR ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26 )
|
|
||||||
#define PC27_BIN_UART3_DCD ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27 )
|
|
||||||
#define PC28_BIN_UART3_CTS ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28 )
|
|
||||||
#define PC29_AOUT_UART3_RTS ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29 )
|
|
||||||
#define PC30_BIN_UART3_TX ( GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30 )
|
|
||||||
#define PC31_AOUT_UART3_RX ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31)
|
|
||||||
#define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
|
|
||||||
#define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
|
|
||||||
#define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
|
|
||||||
#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
|
|
||||||
#define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
|
|
||||||
#define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
|
|
||||||
#define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
|
|
||||||
#define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 )
|
|
||||||
#define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 )
|
|
||||||
#define PD9_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9 )
|
|
||||||
#define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 )
|
|
||||||
#define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 )
|
|
||||||
#define PD10_AIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10 )
|
|
||||||
#define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 )
|
|
||||||
#define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 )
|
|
||||||
#define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 )
|
|
||||||
#define PD14_PF_FLM_VSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 14 )
|
|
||||||
#define PD15_PF_LD0 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 15 )
|
|
||||||
#define PD16_PF_LD1 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 16 )
|
|
||||||
#define PD17_PF_LD2 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 17 )
|
|
||||||
#define PD18_PF_LD3 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 18 )
|
|
||||||
#define PD19_PF_LD4 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 19 )
|
|
||||||
#define PD20_PF_LD5 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 20 )
|
|
||||||
#define PD21_PF_LD6 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 21 )
|
|
||||||
#define PD22_PF_LD7 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 22 )
|
|
||||||
#define PD23_PF_LD8 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 23 )
|
|
||||||
#define PD24_PF_LD9 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 24 )
|
|
||||||
#define PD25_PF_LD10 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 25 )
|
|
||||||
#define PD26_PF_LD11 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 26 )
|
|
||||||
#define PD27_PF_LD12 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 27 )
|
|
||||||
#define PD28_PF_LD13 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 28 )
|
|
||||||
#define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 )
|
|
||||||
#define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 )
|
|
||||||
#define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 )
|
|
||||||
#define PD31_BIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31 )
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PWM controller
|
|
||||||
*/
|
|
||||||
#define PWMC __REG(IMX_PWM_BASE + 0x00) /* PWM Control Register */
|
|
||||||
#define PWMS __REG(IMX_PWM_BASE + 0x04) /* PWM Sample Register */
|
|
||||||
#define PWMP __REG(IMX_PWM_BASE + 0x08) /* PWM Period Register */
|
|
||||||
#define PWMCNT __REG(IMX_PWM_BASE + 0x0C) /* PWM Counter Register */
|
|
||||||
|
|
||||||
#define PWMC_HCTR (0x01<<18) /* Halfword FIFO Data Swapping */
|
|
||||||
#define PWMC_BCTR (0x01<<17) /* Byte FIFO Data Swapping */
|
|
||||||
#define PWMC_SWR (0x01<<16) /* Software Reset */
|
|
||||||
#define PWMC_CLKSRC (0x01<<15) /* Clock Source */
|
|
||||||
#define PWMC_PRESCALER(x) (((x-1) & 0x7F) << 8) /* PRESCALER */
|
|
||||||
#define PWMC_IRQ (0x01<< 7) /* Interrupt Request */
|
|
||||||
#define PWMC_IRQEN (0x01<< 6) /* Interrupt Request Enable */
|
|
||||||
#define PWMC_FIFOAV (0x01<< 5) /* FIFO Available */
|
|
||||||
#define PWMC_EN (0x01<< 4) /* Enables/Disables the PWM */
|
|
||||||
#define PWMC_REPEAT(x) (((x) & 0x03) << 2) /* Sample Repeats */
|
|
||||||
#define PWMC_CLKSEL(x) (((x) & 0x03) << 0) /* Clock Selection */
|
|
||||||
|
|
||||||
#define PWMS_SAMPLE(x) ((x) & 0xFFFF) /* Contains a two-sample word */
|
|
||||||
#define PWMP_PERIOD(x) ((x) & 0xFFFF) /* Represents the PWM's period */
|
|
||||||
#define PWMC_COUNTER(x) ((x) & 0xFFFF) /* Represents the current count value */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DMA Controller
|
|
||||||
*/
|
|
||||||
#define DCR __REG(IMX_DMAC_BASE +0x00) /* DMA Control Register */
|
|
||||||
#define DISR __REG(IMX_DMAC_BASE +0x04) /* DMA Interrupt status Register */
|
|
||||||
#define DIMR __REG(IMX_DMAC_BASE +0x08) /* DMA Interrupt mask Register */
|
|
||||||
#define DBTOSR __REG(IMX_DMAC_BASE +0x0c) /* DMA Burst timeout status Register */
|
|
||||||
#define DRTOSR __REG(IMX_DMAC_BASE +0x10) /* DMA Request timeout Register */
|
|
||||||
#define DSESR __REG(IMX_DMAC_BASE +0x14) /* DMA Transfer Error Status Register */
|
|
||||||
#define DBOSR __REG(IMX_DMAC_BASE +0x18) /* DMA Buffer overflow status Register */
|
|
||||||
#define DBTOCR __REG(IMX_DMAC_BASE +0x1c) /* DMA Burst timeout control Register */
|
|
||||||
#define WSRA __REG(IMX_DMAC_BASE +0x40) /* W-Size Register A */
|
|
||||||
#define XSRA __REG(IMX_DMAC_BASE +0x44) /* X-Size Register A */
|
|
||||||
#define YSRA __REG(IMX_DMAC_BASE +0x48) /* Y-Size Register A */
|
|
||||||
#define WSRB __REG(IMX_DMAC_BASE +0x4c) /* W-Size Register B */
|
|
||||||
#define XSRB __REG(IMX_DMAC_BASE +0x50) /* X-Size Register B */
|
|
||||||
#define YSRB __REG(IMX_DMAC_BASE +0x54) /* Y-Size Register B */
|
|
||||||
#define SAR(x) __REG2( IMX_DMAC_BASE + 0x80, (x) << 6) /* Source Address Registers */
|
|
||||||
#define DAR(x) __REG2( IMX_DMAC_BASE + 0x84, (x) << 6) /* Destination Address Registers */
|
|
||||||
#define CNTR(x) __REG2( IMX_DMAC_BASE + 0x88, (x) << 6) /* Count Registers */
|
|
||||||
#define CCR(x) __REG2( IMX_DMAC_BASE + 0x8c, (x) << 6) /* Control Registers */
|
|
||||||
#define RSSR(x) __REG2( IMX_DMAC_BASE + 0x90, (x) << 6) /* Request source select Registers */
|
|
||||||
#define BLR(x) __REG2( IMX_DMAC_BASE + 0x94, (x) << 6) /* Burst length Registers */
|
|
||||||
#define RTOR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Request timeout Registers */
|
|
||||||
#define BUCR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Bus Utilization Registers */
|
|
||||||
|
|
||||||
#define DCR_DRST (1<<1)
|
|
||||||
#define DCR_DEN (1<<0)
|
|
||||||
#define DBTOCR_EN (1<<15)
|
|
||||||
#define DBTOCR_CNT(x) ((x) & 0x7fff )
|
|
||||||
#define CNTR_CNT(x) ((x) & 0xffffff )
|
|
||||||
#define CCR_DMOD_LINEAR ( 0x0 << 12 )
|
|
||||||
#define CCR_DMOD_2D ( 0x1 << 12 )
|
|
||||||
#define CCR_DMOD_FIFO ( 0x2 << 12 )
|
|
||||||
#define CCR_DMOD_EOBFIFO ( 0x3 << 12 )
|
|
||||||
#define CCR_SMOD_LINEAR ( 0x0 << 10 )
|
|
||||||
#define CCR_SMOD_2D ( 0x1 << 10 )
|
|
||||||
#define CCR_SMOD_FIFO ( 0x2 << 10 )
|
|
||||||
#define CCR_SMOD_EOBFIFO ( 0x3 << 10 )
|
|
||||||
#define CCR_MDIR_DEC (1<<9)
|
|
||||||
#define CCR_MSEL_B (1<<8)
|
|
||||||
#define CCR_DSIZ_32 ( 0x0 << 6 )
|
|
||||||
#define CCR_DSIZ_8 ( 0x1 << 6 )
|
|
||||||
#define CCR_DSIZ_16 ( 0x2 << 6 )
|
|
||||||
#define CCR_SSIZ_32 ( 0x0 << 4 )
|
|
||||||
#define CCR_SSIZ_8 ( 0x1 << 4 )
|
|
||||||
#define CCR_SSIZ_16 ( 0x2 << 4 )
|
|
||||||
#define CCR_REN (1<<3)
|
|
||||||
#define CCR_RPT (1<<2)
|
|
||||||
#define CCR_FRC (1<<1)
|
|
||||||
#define CCR_CEN (1<<0)
|
|
||||||
#define RTOR_EN (1<<15)
|
|
||||||
#define RTOR_CLK (1<<14)
|
|
||||||
#define RTOR_PSC (1<<13)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interrupt controller
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define IMX_INTCNTL __REG(IMX_AITC_BASE+0x00)
|
|
||||||
#define INTCNTL_FIAD (1<<19)
|
|
||||||
#define INTCNTL_NIAD (1<<20)
|
|
||||||
|
|
||||||
#define IMX_NIMASK __REG(IMX_AITC_BASE+0x04)
|
|
||||||
#define IMX_INTENNUM __REG(IMX_AITC_BASE+0x08)
|
|
||||||
#define IMX_INTDISNUM __REG(IMX_AITC_BASE+0x0c)
|
|
||||||
#define IMX_INTENABLEH __REG(IMX_AITC_BASE+0x10)
|
|
||||||
#define IMX_INTENABLEL __REG(IMX_AITC_BASE+0x14)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* General purpose timers
|
|
||||||
*/
|
|
||||||
#define IMX_TCTL(x) __REG( 0x00 + (x))
|
|
||||||
#define TCTL_SWR (1<<15)
|
|
||||||
#define TCTL_FRR (1<<8)
|
|
||||||
#define TCTL_CAP_RIS (1<<6)
|
|
||||||
#define TCTL_CAP_FAL (2<<6)
|
|
||||||
#define TCTL_CAP_RIS_FAL (3<<6)
|
|
||||||
#define TCTL_OM (1<<5)
|
|
||||||
#define TCTL_IRQEN (1<<4)
|
|
||||||
#define TCTL_CLK_PCLK1 (1<<1)
|
|
||||||
#define TCTL_CLK_PCLK1_16 (2<<1)
|
|
||||||
#define TCTL_CLK_TIN (3<<1)
|
|
||||||
#define TCTL_CLK_32 (4<<1)
|
|
||||||
#define TCTL_TEN (1<<0)
|
|
||||||
|
|
||||||
#define IMX_TPRER(x) __REG( 0x04 + (x))
|
|
||||||
#define IMX_TCMP(x) __REG( 0x08 + (x))
|
|
||||||
#define IMX_TCR(x) __REG( 0x0C + (x))
|
|
||||||
#define IMX_TCN(x) __REG( 0x10 + (x))
|
|
||||||
#define IMX_TSTAT(x) __REG( 0x14 + (x))
|
|
||||||
#define TSTAT_CAPT (1<<1)
|
|
||||||
#define TSTAT_COMP (1<<0)
|
|
||||||
|
|
||||||
#endif // _IMX_REGS_H
|
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef ASMARM_ARCH_UART_H
|
|
||||||
#define ASMARM_ARCH_UART_H
|
|
||||||
|
|
||||||
#define IMXUART_HAVE_RTSCTS (1<<0)
|
|
||||||
|
|
||||||
struct imxuart_platform_data {
|
|
||||||
int (*init)(struct platform_device *pdev);
|
|
||||||
void (*exit)(struct platform_device *pdev);
|
|
||||||
unsigned int flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imxads/include/mach/io.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_ARM_ARCH_IO_H
|
|
||||||
#define __ASM_ARM_ARCH_IO_H
|
|
||||||
|
|
||||||
#define IO_SPACE_LIMIT 0xffffffff
|
|
||||||
|
|
||||||
#define __io(a) __typesafe_io(a)
|
|
||||||
#define __mem_pci(a) (a)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,121 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imxads/include/mach/irqs.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
* Copyright (C) 2000 Deep Blue Solutions Ltd.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ARM_IRQS_H__
|
|
||||||
#define __ARM_IRQS_H__
|
|
||||||
|
|
||||||
/* Use the imx definitions */
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IMX Interrupt numbers
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define INT_SOFTINT 0
|
|
||||||
#define CSI_INT 6
|
|
||||||
#define DSPA_MAC_INT 7
|
|
||||||
#define DSPA_INT 8
|
|
||||||
#define COMP_INT 9
|
|
||||||
#define MSHC_XINT 10
|
|
||||||
#define GPIO_INT_PORTA 11
|
|
||||||
#define GPIO_INT_PORTB 12
|
|
||||||
#define GPIO_INT_PORTC 13
|
|
||||||
#define LCDC_INT 14
|
|
||||||
#define SIM_INT 15
|
|
||||||
#define SIM_DATA_INT 16
|
|
||||||
#define RTC_INT 17
|
|
||||||
#define RTC_SAMINT 18
|
|
||||||
#define UART2_MINT_PFERR 19
|
|
||||||
#define UART2_MINT_RTS 20
|
|
||||||
#define UART2_MINT_DTR 21
|
|
||||||
#define UART2_MINT_UARTC 22
|
|
||||||
#define UART2_MINT_TX 23
|
|
||||||
#define UART2_MINT_RX 24
|
|
||||||
#define UART1_MINT_PFERR 25
|
|
||||||
#define UART1_MINT_RTS 26
|
|
||||||
#define UART1_MINT_DTR 27
|
|
||||||
#define UART1_MINT_UARTC 28
|
|
||||||
#define UART1_MINT_TX 29
|
|
||||||
#define UART1_MINT_RX 30
|
|
||||||
#define VOICE_DAC_INT 31
|
|
||||||
#define VOICE_ADC_INT 32
|
|
||||||
#define PEN_DATA_INT 33
|
|
||||||
#define PWM_INT 34
|
|
||||||
#define SDHC_INT 35
|
|
||||||
#define I2C_INT 39
|
|
||||||
#define CSPI_INT 41
|
|
||||||
#define SSI_TX_INT 42
|
|
||||||
#define SSI_TX_ERR_INT 43
|
|
||||||
#define SSI_RX_INT 44
|
|
||||||
#define SSI_RX_ERR_INT 45
|
|
||||||
#define TOUCH_INT 46
|
|
||||||
#define USBD_INT0 47
|
|
||||||
#define USBD_INT1 48
|
|
||||||
#define USBD_INT2 49
|
|
||||||
#define USBD_INT3 50
|
|
||||||
#define USBD_INT4 51
|
|
||||||
#define USBD_INT5 52
|
|
||||||
#define USBD_INT6 53
|
|
||||||
#define BTSYS_INT 55
|
|
||||||
#define BTTIM_INT 56
|
|
||||||
#define BTWUI_INT 57
|
|
||||||
#define TIM2_INT 58
|
|
||||||
#define TIM1_INT 59
|
|
||||||
#define DMA_ERR 60
|
|
||||||
#define DMA_INT 61
|
|
||||||
#define GPIO_INT_PORTD 62
|
|
||||||
|
|
||||||
#define IMX_IRQS (64)
|
|
||||||
|
|
||||||
/* note: the IMX has four gpio ports (A-D), but only
|
|
||||||
* the following pins are connected to the outside
|
|
||||||
* world:
|
|
||||||
*
|
|
||||||
* PORT A: bits 0-31
|
|
||||||
* PORT B: bits 8-31
|
|
||||||
* PORT C: bits 3-17
|
|
||||||
* PORT D: bits 6-31
|
|
||||||
*
|
|
||||||
* We map these interrupts straight on. As a result we have
|
|
||||||
* several holes in the interrupt mapping. We do this for two
|
|
||||||
* reasons:
|
|
||||||
* - mapping the interrupts without holes would get
|
|
||||||
* far more complicated
|
|
||||||
* - Motorola could well decide to bring some processor
|
|
||||||
* with more pins connected
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define IRQ_GPIOA(x) (IMX_IRQS + x)
|
|
||||||
#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x)
|
|
||||||
#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
|
|
||||||
#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
|
|
||||||
|
|
||||||
/* decode irq number to use with IMR(x), ISR(x) and friends */
|
|
||||||
#define IRQ_TO_REG(irq) ((irq - IMX_IRQS) >> 5)
|
|
||||||
|
|
||||||
/* all normal IRQs can be FIQs */
|
|
||||||
#define FIQ_START 0
|
|
||||||
/* switch betwean IRQ and FIQ */
|
|
||||||
extern int imx_set_irq_fiq(unsigned int irq, unsigned int type);
|
|
||||||
|
|
||||||
#define NR_IRQS (IRQ_GPIOD(32) + 1)
|
|
||||||
#define IRQ_GPIO(x)
|
|
||||||
#endif
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/memory.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
* Copyright (C) 2002 Shane Nay (shane@minirl.com)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_ARCH_MMU_H
|
|
||||||
#define __ASM_ARCH_MMU_H
|
|
||||||
|
|
||||||
#define PHYS_OFFSET UL(0x08000000)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef ASMARM_ARCH_MMC_H
|
|
||||||
#define ASMARM_ARCH_MMC_H
|
|
||||||
|
|
||||||
#include <linux/mmc/host.h>
|
|
||||||
|
|
||||||
struct device;
|
|
||||||
|
|
||||||
struct imxmmc_platform_data {
|
|
||||||
int (*card_present)(struct device *);
|
|
||||||
int (*get_ro)(struct device *);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void imx_set_mmc_info(struct imxmmc_platform_data *info);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/mx1ads.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2004 Robert Schwebel, Pengutronix
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ASM_ARCH_MX1ADS_H
|
|
||||||
#define __ASM_ARCH_MX1ADS_H
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
/* Memory Map for the M9328MX1ADS (MX1ADS) Board */
|
|
||||||
/* ------------------------------------------------------------------------ */
|
|
||||||
|
|
||||||
#define MX1ADS_FLASH_PHYS 0x10000000
|
|
||||||
#define MX1ADS_FLASH_SIZE (16*1024*1024)
|
|
||||||
|
|
||||||
#define IMX_FB_PHYS (0x0C000000 - 0x40000)
|
|
||||||
|
|
||||||
#define CLK32 32000
|
|
||||||
|
|
||||||
#endif /* __ASM_ARCH_MX1ADS_H */
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/spi_imx.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 SWAPP
|
|
||||||
* Andrea Paterniani <a.paterniani@swapp-eng.it>
|
|
||||||
*
|
|
||||||
* Initial version inspired by:
|
|
||||||
* linux-2.6.17-rc3-mm1/arch/arm/mach-pxa/include/mach/pxa2xx_spi.h
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SPI_IMX_H_
|
|
||||||
#define SPI_IMX_H_
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* struct spi_imx_master - device.platform_data for SPI controller devices.
|
|
||||||
* @num_chipselect: chipselects are used to distinguish individual
|
|
||||||
* SPI slaves, and are numbered from zero to num_chipselects - 1.
|
|
||||||
* each slave has a chipselect signal, but it's common that not
|
|
||||||
* every chipselect is connected to a slave.
|
|
||||||
* @enable_dma: if true enables DMA driven transfers.
|
|
||||||
*/
|
|
||||||
struct spi_imx_master {
|
|
||||||
u8 num_chipselect;
|
|
||||||
u8 enable_dma:1;
|
|
||||||
};
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* struct spi_imx_chip - spi_board_info.controller_data for SPI
|
|
||||||
* slave devices, copied to spi_device.controller_data.
|
|
||||||
* @enable_loopback : used for test purpouse to internally connect RX and TX
|
|
||||||
* sections.
|
|
||||||
* @enable_dma : enables dma transfer (provided that controller driver has
|
|
||||||
* dma enabled too).
|
|
||||||
* @ins_ss_pulse : enable /SS pulse insertion between SPI burst.
|
|
||||||
* @bclk_wait : number of bclk waits between each bits_per_word SPI burst.
|
|
||||||
* @cs_control : function pointer to board-specific function to assert/deassert
|
|
||||||
* I/O port to control HW generation of devices chip-select.
|
|
||||||
*/
|
|
||||||
struct spi_imx_chip {
|
|
||||||
u8 enable_loopback:1;
|
|
||||||
u8 enable_dma:1;
|
|
||||||
u8 ins_ss_pulse:1;
|
|
||||||
u16 bclk_wait:15;
|
|
||||||
void (*cs_control)(u32 control);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Chip-select state */
|
|
||||||
#define SPI_CS_ASSERT (1 << 0)
|
|
||||||
#define SPI_CS_DEASSERT (1 << 1)
|
|
||||||
/*-------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SPI_IMX_H_*/
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imxads/include/mach/system.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
* Copyright (C) 2000 Deep Blue Solutions Ltd
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_ARCH_SYSTEM_H
|
|
||||||
#define __ASM_ARCH_SYSTEM_H
|
|
||||||
|
|
||||||
static void
|
|
||||||
arch_idle(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* This should do all the clock switching
|
|
||||||
* and wait for interrupt tricks
|
|
||||||
*/
|
|
||||||
cpu_do_idle();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
arch_reset(char mode, const char *cmd)
|
|
||||||
{
|
|
||||||
cpu_reset(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/include/asm-arm/imx/timex.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ASM_ARCH_TIMEX_H
|
|
||||||
#define __ASM_ARCH_TIMEX_H
|
|
||||||
|
|
||||||
#define CLOCK_TICK_RATE (16000000)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imxads/include/mach/uncompress.h
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
* Copyright (C) Shane Nay (shane@minirl.com)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
|
|
||||||
|
|
||||||
#define UART1_BASE 0x206000
|
|
||||||
#define UART2_BASE 0x207000
|
|
||||||
#define USR2 0x98
|
|
||||||
#define USR2_TXFE (1<<14)
|
|
||||||
#define TXR 0x40
|
|
||||||
#define UCR1 0x80
|
|
||||||
#define UCR1_UARTEN 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following code assumes the serial port has already been
|
|
||||||
* initialized by the bootloader. We search for the first enabled
|
|
||||||
* port in the most probable order. If you didn't setup a port in
|
|
||||||
* your bootloader then nothing will appear (which might be desired).
|
|
||||||
*
|
|
||||||
* This does not append a newline
|
|
||||||
*/
|
|
||||||
static void putc(int c)
|
|
||||||
{
|
|
||||||
unsigned long serial_port;
|
|
||||||
|
|
||||||
do {
|
|
||||||
serial_port = UART1_BASE;
|
|
||||||
if ( UART(UCR1) & UCR1_UARTEN )
|
|
||||||
break;
|
|
||||||
serial_port = UART2_BASE;
|
|
||||||
if ( UART(UCR1) & UCR1_UARTEN )
|
|
||||||
break;
|
|
||||||
return;
|
|
||||||
} while(0);
|
|
||||||
|
|
||||||
while (!(UART(USR2) & USR2_TXFE))
|
|
||||||
barrier();
|
|
||||||
|
|
||||||
UART(TXR) = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void flush(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nothing to do
|
|
||||||
*/
|
|
||||||
#define arch_decomp_setup()
|
|
||||||
|
|
||||||
#define arch_decomp_wdog()
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/include/mach/vmalloc.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2000 Russell King.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
|
|
|
@ -1,311 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/irq.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 1999 ARM Limited
|
|
||||||
* Copyright (C) 2002 Shane Nay (shane@minirl.com)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* 03/03/2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
* Copied from the motorola bsp package and added gpio demux
|
|
||||||
* interrupt handler
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/list.h>
|
|
||||||
#include <linux/timer.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <asm/irq.h>
|
|
||||||
|
|
||||||
#include <asm/mach/irq.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* We simply use the ENABLE DISABLE registers inside of the IMX
|
|
||||||
* to turn on/off specific interrupts.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define INTCNTL_OFF 0x00
|
|
||||||
#define NIMASK_OFF 0x04
|
|
||||||
#define INTENNUM_OFF 0x08
|
|
||||||
#define INTDISNUM_OFF 0x0C
|
|
||||||
#define INTENABLEH_OFF 0x10
|
|
||||||
#define INTENABLEL_OFF 0x14
|
|
||||||
#define INTTYPEH_OFF 0x18
|
|
||||||
#define INTTYPEL_OFF 0x1C
|
|
||||||
#define NIPRIORITY_OFF(x) (0x20+4*(7-(x)))
|
|
||||||
#define NIVECSR_OFF 0x40
|
|
||||||
#define FIVECSR_OFF 0x44
|
|
||||||
#define INTSRCH_OFF 0x48
|
|
||||||
#define INTSRCL_OFF 0x4C
|
|
||||||
#define INTFRCH_OFF 0x50
|
|
||||||
#define INTFRCL_OFF 0x54
|
|
||||||
#define NIPNDH_OFF 0x58
|
|
||||||
#define NIPNDL_OFF 0x5C
|
|
||||||
#define FIPNDH_OFF 0x60
|
|
||||||
#define FIPNDL_OFF 0x64
|
|
||||||
|
|
||||||
#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE)
|
|
||||||
#define IMX_AITC_INTCNTL (VA_AITC_BASE + INTCNTL_OFF)
|
|
||||||
#define IMX_AITC_NIMASK (VA_AITC_BASE + NIMASK_OFF)
|
|
||||||
#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF)
|
|
||||||
#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF)
|
|
||||||
#define IMX_AITC_INTENABLEH (VA_AITC_BASE + INTENABLEH_OFF)
|
|
||||||
#define IMX_AITC_INTENABLEL (VA_AITC_BASE + INTENABLEL_OFF)
|
|
||||||
#define IMX_AITC_INTTYPEH (VA_AITC_BASE + INTTYPEH_OFF)
|
|
||||||
#define IMX_AITC_INTTYPEL (VA_AITC_BASE + INTTYPEL_OFF)
|
|
||||||
#define IMX_AITC_NIPRIORITY(x) (VA_AITC_BASE + NIPRIORITY_OFF(x))
|
|
||||||
#define IMX_AITC_NIVECSR (VA_AITC_BASE + NIVECSR_OFF)
|
|
||||||
#define IMX_AITC_FIVECSR (VA_AITC_BASE + FIVECSR_OFF)
|
|
||||||
#define IMX_AITC_INTSRCH (VA_AITC_BASE + INTSRCH_OFF)
|
|
||||||
#define IMX_AITC_INTSRCL (VA_AITC_BASE + INTSRCL_OFF)
|
|
||||||
#define IMX_AITC_INTFRCH (VA_AITC_BASE + INTFRCH_OFF)
|
|
||||||
#define IMX_AITC_INTFRCL (VA_AITC_BASE + INTFRCL_OFF)
|
|
||||||
#define IMX_AITC_NIPNDH (VA_AITC_BASE + NIPNDH_OFF)
|
|
||||||
#define IMX_AITC_NIPNDL (VA_AITC_BASE + NIPNDL_OFF)
|
|
||||||
#define IMX_AITC_FIPNDH (VA_AITC_BASE + FIPNDH_OFF)
|
|
||||||
#define IMX_AITC_FIPNDL (VA_AITC_BASE + FIPNDL_OFF)
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define DEBUG_IRQ(fmt...) printk(fmt)
|
|
||||||
#else
|
|
||||||
#define DEBUG_IRQ(fmt...) do { } while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_mask_irq(unsigned int irq)
|
|
||||||
{
|
|
||||||
__raw_writel(irq, IMX_AITC_INTDISNUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_unmask_irq(unsigned int irq)
|
|
||||||
{
|
|
||||||
__raw_writel(irq, IMX_AITC_INTENNUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_FIQ
|
|
||||||
int imx_set_irq_fiq(unsigned int irq, unsigned int type)
|
|
||||||
{
|
|
||||||
unsigned int irqt;
|
|
||||||
|
|
||||||
if (irq >= IMX_IRQS)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (irq < IMX_IRQS / 2) {
|
|
||||||
irqt = __raw_readl(IMX_AITC_INTTYPEL) & ~(1 << irq);
|
|
||||||
__raw_writel(irqt | (!!type << irq), IMX_AITC_INTTYPEL);
|
|
||||||
} else {
|
|
||||||
irq -= IMX_IRQS / 2;
|
|
||||||
irqt = __raw_readl(IMX_AITC_INTTYPEH) & ~(1 << irq);
|
|
||||||
__raw_writel(irqt | (!!type << irq), IMX_AITC_INTTYPEH);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(imx_set_irq_fiq);
|
|
||||||
#endif /* CONFIG_FIQ */
|
|
||||||
|
|
||||||
static int
|
|
||||||
imx_gpio_irq_type(unsigned int _irq, unsigned int type)
|
|
||||||
{
|
|
||||||
unsigned int irq_type = 0, irq, reg, bit;
|
|
||||||
|
|
||||||
irq = _irq - IRQ_GPIOA(0);
|
|
||||||
reg = irq >> 5;
|
|
||||||
bit = 1 << (irq % 32);
|
|
||||||
|
|
||||||
if (type == IRQ_TYPE_PROBE) {
|
|
||||||
/* Don't mess with enabled GPIOs using preconfigured edges or
|
|
||||||
GPIOs set to alternate function during probe */
|
|
||||||
/* TODO: support probe */
|
|
||||||
// if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx]) &
|
|
||||||
// GPIO_bit(gpio))
|
|
||||||
// return 0;
|
|
||||||
// if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))
|
|
||||||
// return 0;
|
|
||||||
// type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
|
|
||||||
}
|
|
||||||
|
|
||||||
GIUS(reg) |= bit;
|
|
||||||
DDIR(reg) &= ~(bit);
|
|
||||||
|
|
||||||
DEBUG_IRQ("setting type of irq %d to ", _irq);
|
|
||||||
|
|
||||||
if (type & IRQ_TYPE_EDGE_RISING) {
|
|
||||||
DEBUG_IRQ("rising edges\n");
|
|
||||||
irq_type = 0x0;
|
|
||||||
}
|
|
||||||
if (type & IRQ_TYPE_EDGE_FALLING) {
|
|
||||||
DEBUG_IRQ("falling edges\n");
|
|
||||||
irq_type = 0x1;
|
|
||||||
}
|
|
||||||
if (type & IRQ_TYPE_LEVEL_LOW) {
|
|
||||||
DEBUG_IRQ("low level\n");
|
|
||||||
irq_type = 0x3;
|
|
||||||
}
|
|
||||||
if (type & IRQ_TYPE_LEVEL_HIGH) {
|
|
||||||
DEBUG_IRQ("high level\n");
|
|
||||||
irq_type = 0x2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (irq % 32 < 16) {
|
|
||||||
ICR1(reg) = (ICR1(reg) & ~(0x3 << ((irq % 16) * 2))) |
|
|
||||||
(irq_type << ((irq % 16) * 2));
|
|
||||||
} else {
|
|
||||||
ICR2(reg) = (ICR2(reg) & ~(0x3 << ((irq % 16) * 2))) |
|
|
||||||
(irq_type << ((irq % 16) * 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpio_ack_irq(unsigned int irq)
|
|
||||||
{
|
|
||||||
DEBUG_IRQ("%s: irq %d\n", __func__, irq);
|
|
||||||
ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpio_mask_irq(unsigned int irq)
|
|
||||||
{
|
|
||||||
DEBUG_IRQ("%s: irq %d\n", __func__, irq);
|
|
||||||
IMR(IRQ_TO_REG(irq)) &= ~( 1 << ((irq - IRQ_GPIOA(0)) % 32));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpio_unmask_irq(unsigned int irq)
|
|
||||||
{
|
|
||||||
DEBUG_IRQ("%s: irq %d\n", __func__, irq);
|
|
||||||
IMR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpio_handler(unsigned int mask, unsigned int irq,
|
|
||||||
struct irq_desc *desc)
|
|
||||||
{
|
|
||||||
while (mask) {
|
|
||||||
if (mask & 1) {
|
|
||||||
DEBUG_IRQ("handling irq %d\n", irq);
|
|
||||||
generic_handle_irq(irq);
|
|
||||||
}
|
|
||||||
irq++;
|
|
||||||
mask >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpioa_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
|
|
||||||
{
|
|
||||||
unsigned int mask, irq;
|
|
||||||
|
|
||||||
mask = ISR(0);
|
|
||||||
irq = IRQ_GPIOA(0);
|
|
||||||
imx_gpio_handler(mask, irq, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpiob_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
|
|
||||||
{
|
|
||||||
unsigned int mask, irq;
|
|
||||||
|
|
||||||
mask = ISR(1);
|
|
||||||
irq = IRQ_GPIOB(0);
|
|
||||||
imx_gpio_handler(mask, irq, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpioc_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
|
|
||||||
{
|
|
||||||
unsigned int mask, irq;
|
|
||||||
|
|
||||||
mask = ISR(2);
|
|
||||||
irq = IRQ_GPIOC(0);
|
|
||||||
imx_gpio_handler(mask, irq, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
imx_gpiod_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
|
|
||||||
{
|
|
||||||
unsigned int mask, irq;
|
|
||||||
|
|
||||||
mask = ISR(3);
|
|
||||||
irq = IRQ_GPIOD(0);
|
|
||||||
imx_gpio_handler(mask, irq, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct irq_chip imx_internal_chip = {
|
|
||||||
.name = "MPU",
|
|
||||||
.ack = imx_mask_irq,
|
|
||||||
.mask = imx_mask_irq,
|
|
||||||
.unmask = imx_unmask_irq,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct irq_chip imx_gpio_chip = {
|
|
||||||
.name = "GPIO",
|
|
||||||
.ack = imx_gpio_ack_irq,
|
|
||||||
.mask = imx_gpio_mask_irq,
|
|
||||||
.unmask = imx_gpio_unmask_irq,
|
|
||||||
.set_type = imx_gpio_irq_type,
|
|
||||||
};
|
|
||||||
|
|
||||||
void __init
|
|
||||||
imx_init_irq(void)
|
|
||||||
{
|
|
||||||
unsigned int irq;
|
|
||||||
|
|
||||||
DEBUG_IRQ("Initializing imx interrupts\n");
|
|
||||||
|
|
||||||
/* Disable all interrupts initially. */
|
|
||||||
/* Do not rely on the bootloader. */
|
|
||||||
__raw_writel(0, IMX_AITC_INTENABLEH);
|
|
||||||
__raw_writel(0, IMX_AITC_INTENABLEL);
|
|
||||||
|
|
||||||
/* Mask all GPIO interrupts as well */
|
|
||||||
IMR(0) = 0;
|
|
||||||
IMR(1) = 0;
|
|
||||||
IMR(2) = 0;
|
|
||||||
IMR(3) = 0;
|
|
||||||
|
|
||||||
for (irq = 0; irq < IMX_IRQS; irq++) {
|
|
||||||
set_irq_chip(irq, &imx_internal_chip);
|
|
||||||
set_irq_handler(irq, handle_level_irq);
|
|
||||||
set_irq_flags(irq, IRQF_VALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (irq = IRQ_GPIOA(0); irq < IRQ_GPIOD(32); irq++) {
|
|
||||||
set_irq_chip(irq, &imx_gpio_chip);
|
|
||||||
set_irq_handler(irq, handle_edge_irq);
|
|
||||||
set_irq_flags(irq, IRQF_VALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_irq_chained_handler(GPIO_INT_PORTA, imx_gpioa_demux_handler);
|
|
||||||
set_irq_chained_handler(GPIO_INT_PORTB, imx_gpiob_demux_handler);
|
|
||||||
set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler);
|
|
||||||
set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler);
|
|
||||||
|
|
||||||
/* Release masking of interrupts according to priority */
|
|
||||||
__raw_writel(-1, IMX_AITC_NIMASK);
|
|
||||||
|
|
||||||
#ifdef CONFIG_FIQ
|
|
||||||
/* Initialize FIQ */
|
|
||||||
init_FIQ();
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/leds-mx1ads.c
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
*
|
|
||||||
* Original (leds-footbridge.c) by Russell King
|
|
||||||
*
|
|
||||||
* 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/kernel.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <asm/system.h>
|
|
||||||
#include <asm/leds.h>
|
|
||||||
#include "leds.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The MX1ADS Board has only one usable LED,
|
|
||||||
* so select only the timer led or the
|
|
||||||
* cpu usage led
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
mx1ads_leds_event(led_event_t ledevt)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
|
||||||
|
|
||||||
switch (ledevt) {
|
|
||||||
#ifdef CONFIG_LEDS_CPU
|
|
||||||
case led_idle_start:
|
|
||||||
DR(0) &= ~(1<<2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case led_idle_end:
|
|
||||||
DR(0) |= 1<<2;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_LEDS_TIMER
|
|
||||||
case led_timer:
|
|
||||||
DR(0) ^= 1<<2;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/leds.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 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/kernel.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
|
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/mach-types.h>
|
|
||||||
|
|
||||||
#include "leds.h"
|
|
||||||
|
|
||||||
static int __init
|
|
||||||
leds_init(void)
|
|
||||||
{
|
|
||||||
if (machine_is_mx1ads()) {
|
|
||||||
leds_event = mx1ads_leds_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__initcall(leds_init);
|
|
|
@ -1,9 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/leds.h
|
|
||||||
*
|
|
||||||
* Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
*
|
|
||||||
* blinky lights for IMX-based systems
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
extern void mx1ads_leds_event(led_event_t evt);
|
|
|
@ -1,180 +0,0 @@
|
||||||
/*
|
|
||||||
* arch/arm/mach-imx/mx1ads.c
|
|
||||||
*
|
|
||||||
* Initially based on:
|
|
||||||
* linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
|
|
||||||
* Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
|
|
||||||
*
|
|
||||||
* 2004 (c) MontaVista Software, Inc.
|
|
||||||
*
|
|
||||||
* This file is licensed under the terms of the GNU General Public
|
|
||||||
* License version 2. This program is licensed "as is" without any
|
|
||||||
* warranty of any kind, whether express or implied.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/device.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/platform_device.h>
|
|
||||||
#include <asm/system.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <asm/irq.h>
|
|
||||||
#include <asm/pgtable.h>
|
|
||||||
#include <asm/page.h>
|
|
||||||
|
|
||||||
#include <asm/mach/map.h>
|
|
||||||
#include <asm/mach-types.h>
|
|
||||||
|
|
||||||
#include <asm/mach/arch.h>
|
|
||||||
#include <mach/mmc.h>
|
|
||||||
#include <mach/imx-uart.h>
|
|
||||||
#include <linux/interrupt.h>
|
|
||||||
#include "generic.h"
|
|
||||||
|
|
||||||
static struct resource cs89x0_resources[] = {
|
|
||||||
[0] = {
|
|
||||||
.start = IMX_CS4_PHYS + 0x300,
|
|
||||||
.end = IMX_CS4_PHYS + 0x300 + 16,
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
},
|
|
||||||
[1] = {
|
|
||||||
.start = IRQ_GPIOC(17),
|
|
||||||
.end = IRQ_GPIOC(17),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device cs89x0_device = {
|
|
||||||
.name = "cirrus-cs89x0",
|
|
||||||
.num_resources = ARRAY_SIZE(cs89x0_resources),
|
|
||||||
.resource = cs89x0_resources,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct imxuart_platform_data uart_pdata = {
|
|
||||||
.flags = IMXUART_HAVE_RTSCTS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct resource imx_uart1_resources[] = {
|
|
||||||
[0] = {
|
|
||||||
.start = 0x00206000,
|
|
||||||
.end = 0x002060FF,
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
},
|
|
||||||
[1] = {
|
|
||||||
.start = (UART1_MINT_RX),
|
|
||||||
.end = (UART1_MINT_RX),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
[2] = {
|
|
||||||
.start = (UART1_MINT_TX),
|
|
||||||
.end = (UART1_MINT_TX),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
[3] = {
|
|
||||||
.start = UART1_MINT_RTS,
|
|
||||||
.end = UART1_MINT_RTS,
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device imx_uart1_device = {
|
|
||||||
.name = "imx-uart",
|
|
||||||
.id = 0,
|
|
||||||
.num_resources = ARRAY_SIZE(imx_uart1_resources),
|
|
||||||
.resource = imx_uart1_resources,
|
|
||||||
.dev = {
|
|
||||||
.platform_data = &uart_pdata,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct resource imx_uart2_resources[] = {
|
|
||||||
[0] = {
|
|
||||||
.start = 0x00207000,
|
|
||||||
.end = 0x002070FF,
|
|
||||||
.flags = IORESOURCE_MEM,
|
|
||||||
},
|
|
||||||
[1] = {
|
|
||||||
.start = (UART2_MINT_RX),
|
|
||||||
.end = (UART2_MINT_RX),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
[2] = {
|
|
||||||
.start = (UART2_MINT_TX),
|
|
||||||
.end = (UART2_MINT_TX),
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
[3] = {
|
|
||||||
.start = UART2_MINT_RTS,
|
|
||||||
.end = UART2_MINT_RTS,
|
|
||||||
.flags = IORESOURCE_IRQ,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device imx_uart2_device = {
|
|
||||||
.name = "imx-uart",
|
|
||||||
.id = 1,
|
|
||||||
.num_resources = ARRAY_SIZE(imx_uart2_resources),
|
|
||||||
.resource = imx_uart2_resources,
|
|
||||||
.dev = {
|
|
||||||
.platform_data = &uart_pdata,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_device *devices[] __initdata = {
|
|
||||||
&cs89x0_device,
|
|
||||||
&imx_uart1_device,
|
|
||||||
&imx_uart2_device,
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
|
|
||||||
static int mx1ads_mmc_card_present(struct device *dev)
|
|
||||||
{
|
|
||||||
/* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
|
|
||||||
return (SSR(1) & (1 << 20) ? 0 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct imxmmc_platform_data mx1ads_mmc_info = {
|
|
||||||
.card_present = mx1ads_mmc_card_present,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void __init
|
|
||||||
mx1ads_init(void)
|
|
||||||
{
|
|
||||||
#ifdef CONFIG_LEDS
|
|
||||||
imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
|
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE)
|
|
||||||
/* SD/MMC card detect */
|
|
||||||
imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
|
|
||||||
imx_set_mmc_info(&mx1ads_mmc_info);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
imx_gpio_mode(PC9_PF_UART1_CTS);
|
|
||||||
imx_gpio_mode(PC10_PF_UART1_RTS);
|
|
||||||
imx_gpio_mode(PC11_PF_UART1_TXD);
|
|
||||||
imx_gpio_mode(PC12_PF_UART1_RXD);
|
|
||||||
|
|
||||||
imx_gpio_mode(PB28_PF_UART2_CTS);
|
|
||||||
imx_gpio_mode(PB29_PF_UART2_RTS);
|
|
||||||
imx_gpio_mode(PB30_PF_UART2_TXD);
|
|
||||||
imx_gpio_mode(PB31_PF_UART2_RXD);
|
|
||||||
|
|
||||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __init
|
|
||||||
mx1ads_map_io(void)
|
|
||||||
{
|
|
||||||
imx_map_io();
|
|
||||||
}
|
|
||||||
|
|
||||||
MACHINE_START(MX1ADS, "Motorola MX1ADS")
|
|
||||||
/* Maintainer: Sascha Hauer, Pengutronix */
|
|
||||||
.phys_io = 0x00200000,
|
|
||||||
.io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
|
|
||||||
.boot_params = 0x08000100,
|
|
||||||
.map_io = mx1ads_map_io,
|
|
||||||
.init_irq = imx_init_irq,
|
|
||||||
.timer = &imx_timer,
|
|
||||||
.init_machine = mx1ads_init,
|
|
||||||
MACHINE_END
|
|
|
@ -1,220 +0,0 @@
|
||||||
/*
|
|
||||||
* linux/arch/arm/mach-imx/time.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2000-2001 Deep Blue Solutions
|
|
||||||
* Copyright (C) 2002 Shane Nay (shane@minirl.com)
|
|
||||||
* Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com)
|
|
||||||
*
|
|
||||||
* 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/kernel.h>
|
|
||||||
#include <linux/sched.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/interrupt.h>
|
|
||||||
#include <linux/irq.h>
|
|
||||||
#include <linux/time.h>
|
|
||||||
#include <linux/clocksource.h>
|
|
||||||
#include <linux/clockchips.h>
|
|
||||||
#include <linux/clk.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/irq.h>
|
|
||||||
#include <asm/mach/time.h>
|
|
||||||
|
|
||||||
/* Use timer 1 as system timer */
|
|
||||||
#define TIMER_BASE IMX_TIM1_BASE
|
|
||||||
|
|
||||||
static struct clock_event_device clockevent_imx;
|
|
||||||
static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IRQ handler for the timer
|
|
||||||
*/
|
|
||||||
static irqreturn_t
|
|
||||||
imx_timer_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
struct clock_event_device *evt = &clockevent_imx;
|
|
||||||
uint32_t tstat;
|
|
||||||
irqreturn_t ret = IRQ_NONE;
|
|
||||||
|
|
||||||
/* clear the interrupt */
|
|
||||||
tstat = IMX_TSTAT(TIMER_BASE);
|
|
||||||
IMX_TSTAT(TIMER_BASE) = 0;
|
|
||||||
|
|
||||||
if (tstat & TSTAT_COMP) {
|
|
||||||
evt->event_handler(evt);
|
|
||||||
ret = IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct irqaction imx_timer_irq = {
|
|
||||||
.name = "i.MX Timer Tick",
|
|
||||||
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
|
|
||||||
.handler = imx_timer_interrupt,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set up timer hardware into expected mode and state.
|
|
||||||
*/
|
|
||||||
static void __init imx_timer_hardware_init(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Initialise to a known state (all timers off, and timing reset)
|
|
||||||
*/
|
|
||||||
IMX_TCTL(TIMER_BASE) = 0;
|
|
||||||
IMX_TPRER(TIMER_BASE) = 0;
|
|
||||||
|
|
||||||
IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
cycle_t imx_get_cycles(struct clocksource *cs)
|
|
||||||
{
|
|
||||||
return IMX_TCN(TIMER_BASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct clocksource clocksource_imx = {
|
|
||||||
.name = "imx_timer1",
|
|
||||||
.rating = 200,
|
|
||||||
.read = imx_get_cycles,
|
|
||||||
.mask = 0xFFFFFFFF,
|
|
||||||
.shift = 20,
|
|
||||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init imx_clocksource_init(unsigned long rate)
|
|
||||||
{
|
|
||||||
clocksource_imx.mult =
|
|
||||||
clocksource_hz2mult(rate, clocksource_imx.shift);
|
|
||||||
clocksource_register(&clocksource_imx);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int imx_set_next_event(unsigned long evt,
|
|
||||||
struct clock_event_device *unused)
|
|
||||||
{
|
|
||||||
unsigned long tcmp;
|
|
||||||
|
|
||||||
tcmp = IMX_TCN(TIMER_BASE) + evt;
|
|
||||||
IMX_TCMP(TIMER_BASE) = tcmp;
|
|
||||||
|
|
||||||
return (int32_t)(tcmp - IMX_TCN(TIMER_BASE)) < 0 ? -ETIME : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
static const char *clock_event_mode_label[]={
|
|
||||||
[CLOCK_EVT_MODE_PERIODIC] = "CLOCK_EVT_MODE_PERIODIC",
|
|
||||||
[CLOCK_EVT_MODE_ONESHOT] = "CLOCK_EVT_MODE_ONESHOT",
|
|
||||||
[CLOCK_EVT_MODE_SHUTDOWN] = "CLOCK_EVT_MODE_SHUTDOWN",
|
|
||||||
[CLOCK_EVT_MODE_UNUSED] = "CLOCK_EVT_MODE_UNUSED"
|
|
||||||
};
|
|
||||||
#endif /*DEBUG*/
|
|
||||||
|
|
||||||
static void imx_set_mode(enum clock_event_mode mode, struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The timer interrupt generation is disabled at least
|
|
||||||
* for enough time to call imx_set_next_event()
|
|
||||||
*/
|
|
||||||
local_irq_save(flags);
|
|
||||||
/* Disable interrupt in GPT module */
|
|
||||||
IMX_TCTL(TIMER_BASE) &= ~TCTL_IRQEN;
|
|
||||||
if (mode != clockevent_mode) {
|
|
||||||
/* Set event time into far-far future */
|
|
||||||
IMX_TCMP(TIMER_BASE) = IMX_TCN(TIMER_BASE) - 3;
|
|
||||||
/* Clear pending interrupt */
|
|
||||||
IMX_TSTAT(TIMER_BASE) &= ~TSTAT_COMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printk(KERN_INFO "imx_set_mode: changing mode from %s to %s\n",
|
|
||||||
clock_event_mode_label[clockevent_mode], clock_event_mode_label[mode]);
|
|
||||||
#endif /*DEBUG*/
|
|
||||||
|
|
||||||
/* Remember timer mode */
|
|
||||||
clockevent_mode = mode;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
printk(KERN_ERR "imx_set_mode: Periodic mode is not supported for i.MX\n");
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
/*
|
|
||||||
* Do not put overhead of interrupt enable/disable into
|
|
||||||
* imx_set_next_event(), the core has about 4 minutes
|
|
||||||
* to call imx_set_next_event() or shutdown clock after
|
|
||||||
* mode switching
|
|
||||||
*/
|
|
||||||
local_irq_save(flags);
|
|
||||||
IMX_TCTL(TIMER_BASE) |= TCTL_IRQEN;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
/* Left event sources disabled, no more interrupts appears */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct clock_event_device clockevent_imx = {
|
|
||||||
.name = "imx_timer1",
|
|
||||||
.features = CLOCK_EVT_FEAT_ONESHOT,
|
|
||||||
.shift = 32,
|
|
||||||
.set_mode = imx_set_mode,
|
|
||||||
.set_next_event = imx_set_next_event,
|
|
||||||
.rating = 200,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init imx_clockevent_init(unsigned long rate)
|
|
||||||
{
|
|
||||||
clockevent_imx.mult = div_sc(rate, NSEC_PER_SEC,
|
|
||||||
clockevent_imx.shift);
|
|
||||||
clockevent_imx.max_delta_ns =
|
|
||||||
clockevent_delta2ns(0xfffffffe, &clockevent_imx);
|
|
||||||
clockevent_imx.min_delta_ns =
|
|
||||||
clockevent_delta2ns(0xf, &clockevent_imx);
|
|
||||||
|
|
||||||
clockevent_imx.cpumask = cpumask_of(0);
|
|
||||||
|
|
||||||
clockevents_register_device(&clockevent_imx);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int imx_clocks_init(void);
|
|
||||||
|
|
||||||
static void __init imx_timer_init(void)
|
|
||||||
{
|
|
||||||
struct clk *clk;
|
|
||||||
unsigned long rate;
|
|
||||||
|
|
||||||
imx_clocks_init();
|
|
||||||
|
|
||||||
clk = clk_get(NULL, "perclk1");
|
|
||||||
clk_enable(clk);
|
|
||||||
rate = clk_get_rate(clk);
|
|
||||||
|
|
||||||
imx_timer_hardware_init();
|
|
||||||
imx_clocksource_init(rate);
|
|
||||||
|
|
||||||
imx_clockevent_init(rate);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make irqs happen for the system timer
|
|
||||||
*/
|
|
||||||
setup_irq(TIM1_INT, &imx_timer_irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sys_timer imx_timer = {
|
|
||||||
.init = imx_timer_init,
|
|
||||||
};
|
|
Reference in New Issue