You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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:
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user