bool
default y
select RTC_LIB
+ select SYS_SUPPORTS_APM_EMULATION
help
The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and
Europe. There is an ARM Linux project with a web page at
<http://www.arm.linux.org.uk/>.
+config SYS_SUPPORTS_APM_EMULATION
+ bool
+
config GENERIC_TIME
bool
default n
bool
default y
+config NO_IOPORT
+ bool
+ default n
+
config EISA
bool
---help---
config ARCH_MAY_HAVE_PC_FDC
bool
+config ZONE_DMA
+ bool
+ default y
+
config GENERIC_ISA_DMA
bool
config ARCH_IOP13XX
bool "IOP13xx-based"
+ depends on MMU
+ select PLAT_IOP
select PCI
help
Support for Intel's IOP13XX (XScale) family of processors.
If you have any questions or comments about the Linux kernel port
to this board, send e-mail to <sjhill@cotw.com>.
+ config ARCH_NS9XXX
+ bool "NetSilicon NS9xxx"
+ help
+ Say Y here if you intend to run this kernel on a NetSilicon NS9xxx
+ System.
+
+ <http://www.digi.com/products/microprocessors/index.jsp>
+
config ARCH_PNX4008
bool "Philips Nexperia PNX4008 Mobile"
help
bool "PXA2xx-based"
depends on MMU
select ARCH_MTD_XIP
+ select GENERIC_TIME
help
Support for Intel's PXA2XX processor line.
select TIMER_ACORN
select ARCH_MAY_HAVE_PC_FDC
select ISA_DMA_API
+ select NO_IOPORT
help
On the Acorn Risc-PC, Linux can support the internal IDE disk and
CD-ROM interface, serial and parallel port, and the floppy drive.
Support for StrongARM 11x0 based boards.
config ARCH_S3C2410
- bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442"
+ bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443"
help
Samsung S3C2410X CPU based systems, such as the Simtec Electronics
BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
source "arch/arm/mach-omap2/Kconfig"
+ source "arch/arm/plat-s3c24xx/Kconfig"
+
+ if ARCH_S3C2410
+ source "arch/arm/mach-s3c2400/Kconfig"
source "arch/arm/mach-s3c2410/Kconfig"
+ source "arch/arm/mach-s3c2412/Kconfig"
+ source "arch/arm/mach-s3c2440/Kconfig"
+ source "arch/arm/mach-s3c2442/Kconfig"
+ source "arch/arm/mach-s3c2443/Kconfig"
+ endif
source "arch/arm/mach-lh7a40x/Kconfig"
source "arch/arm/mach-realview/Kconfig"
- source "arch/arm/mach-at91rm9200/Kconfig"
+ source "arch/arm/mach-at91/Kconfig"
source "arch/arm/mach-netx/Kconfig"
+ source "arch/arm/mach-ns9xxx/Kconfig"
+
# Definitions to make life easier
config ARCH_ACORN
bool
be linked for and stored to. This address is dependent on your
own flash usage.
+ config KEXEC
+ bool "Kexec system call (EXPERIMENTAL)"
+ depends on EXPERIMENTAL
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
+ but it is indepedent of the system firmware. And like a reboot
+ you can start any kernel with it, not just Linux.
+
+ It is an ongoing process to be certain the hardware in a machine
+ is properly shutdown, so do not be surprised if this code does not
+ initially work for you. It may help to enable device hotplugging
+ support.
+
endmenu
if (ARCH_SA1100 || ARCH_INTEGRATOR || ARCH_OMAP || ARCH_IMX )
source "kernel/power/Kconfig"
-config APM
- tristate "Advanced Power Management Emulation"
- ---help---
- APM is a BIOS specification for saving power using several different
- techniques. This is mostly useful for battery powered laptops with
- APM compliant BIOSes. If you say Y here, the system time will be
- reset after a RESUME operation, the /proc/apm device will provide
- battery status information, and user-space programs will receive
- notification of APM "events" (e.g. battery status change).
-
- In order to use APM, you will need supporting software. For location
- and more information, read <file:Documentation/pm.txt> and the
- Battery Powered Linux mini-HOWTO, available from
- <http://www.tldp.org/docs.html#howto>.
-
- This driver does not spin down disk drives (see the hdparm(8)
- manpage ("man 8 hdparm") for that), and it doesn't turn off
- VESA-compliant "green" monitors.
-
- Generally, if you don't have a battery in your machine, there isn't
- much point in using this driver and you should say N. If you get
- random kernel OOPSes or reboots that don't seem to be related to
- anything, try disabling/enabling this option (or disabling/enabling
- APM in your BIOS).
-
endmenu
source "net/Kconfig"
process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
time.o traps.o
-obj-$(CONFIG_APM) += apm.o
obj-$(CONFIG_ISA_DMA_API) += dma.o
obj-$(CONFIG_ARCH_ACORN) += ecard.o
obj-$(CONFIG_FIQ) += fiq.o
obj-$(CONFIG_ISA_DMA) += dma-isa.o
obj-$(CONFIG_PCI) += bios32.o isa.o
obj-$(CONFIG_SMP) += smp.o
+ obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
#ifdef MULTI_CACHE
struct cpu_cache_fns cpu_cache;
#endif
+ #ifdef CONFIG_OUTER_CACHE
+ struct outer_cache_fns outer_cache;
+ #endif
struct stack {
u32 irq[3];
static struct meminfo meminfo __initdata = { 0, };
static const char *cpu_name;
static const char *machine_name;
-static char command_line[COMMAND_LINE_SIZE];
+static char __initdata command_line[COMMAND_LINE_SIZE];
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
init_mm.end_data = (unsigned long) &_edata;
init_mm.brk = (unsigned long) &_end;
- memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
- saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+ memcpy(boot_command_line, from, COMMAND_LINE_SIZE);
+ boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
parse_cmdline(cmdline_p, from);
paging_init(&meminfo, mdesc);
request_standard_resources(&meminfo, mdesc);
*/
struct sys_timer *system_timer;
+ #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
/* this needs a better home */
DEFINE_SPINLOCK(rtc_lock);
- #ifdef CONFIG_SA1100_RTC_MODULE
+ #ifdef CONFIG_RTC_DRV_CMOS_MODULE
EXPORT_SYMBOL(rtc_lock);
#endif
+ #endif /* pc-style 'CMOS' RTC support */
/* change this if you have some constant time drift */
#define USECS_PER_JIFFY (1000000/HZ)
}
#endif
-/*
- * Scheduler clock - returns current time in nanosec units.
- * This is the default implementation. Sub-architecture
- * implementations can override this.
- */
-unsigned long long __attribute__((weak)) sched_clock(void)
-{
- return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
/*
* An implementation of printk_clock() independent from
* sched_clock(). This avoids non-bootable kernels when
--- /dev/null
-static struct file_operations at91_clk_operations = {
+ /*
+ * linux/arch/arm/mach-at91/clock.c
+ *
+ * Copyright (C) 2005 David Brownell
+ * Copyright (C) 2005 Ivan Kokshaysky
+ *
+ * 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.
+ */
+
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/fs.h>
+ #include <linux/debugfs.h>
+ #include <linux/seq_file.h>
+ #include <linux/list.h>
+ #include <linux/errno.h>
+ #include <linux/err.h>
+ #include <linux/spinlock.h>
+ #include <linux/delay.h>
+ #include <linux/clk.h>
+
+ #include <asm/semaphore.h>
+ #include <asm/io.h>
+ #include <asm/mach-types.h>
+
+ #include <asm/hardware.h>
+ #include <asm/arch/at91_pmc.h>
+ #include <asm/arch/cpu.h>
+
+ #include "clock.h"
+
+
+ /*
+ * There's a lot more which can be done with clocks, including cpufreq
+ * integration, slow clock mode support (for system suspend), letting
+ * PLLB be used at other rates (on boards that don't need USB), etc.
+ */
+
+ #define clk_is_primary(x) ((x)->type & CLK_TYPE_PRIMARY)
+ #define clk_is_programmable(x) ((x)->type & CLK_TYPE_PROGRAMMABLE)
+ #define clk_is_peripheral(x) ((x)->type & CLK_TYPE_PERIPHERAL)
+ #define clk_is_sys(x) ((x)->type & CLK_TYPE_SYSTEM)
+
+
+ static LIST_HEAD(clocks);
+ static DEFINE_SPINLOCK(clk_lock);
+
+ static u32 at91_pllb_usb_init;
+
+ /*
+ * Four primary clock sources: two crystal oscillators (32K, main), and
+ * two PLLs. PLLA usually runs the master clock; and PLLB must run at
+ * 48 MHz (unless no USB function clocks are needed). The main clock and
+ * both PLLs are turned off to run in "slow clock mode" (system suspend).
+ */
+ static struct clk clk32k = {
+ .name = "clk32k",
+ .rate_hz = AT91_SLOW_CLOCK,
+ .users = 1, /* always on */
+ .id = 0,
+ .type = CLK_TYPE_PRIMARY,
+ };
+ static struct clk main_clk = {
+ .name = "main",
+ .pmc_mask = AT91_PMC_MOSCS, /* in PMC_SR */
+ .id = 1,
+ .type = CLK_TYPE_PRIMARY,
+ };
+ static struct clk plla = {
+ .name = "plla",
+ .parent = &main_clk,
+ .pmc_mask = AT91_PMC_LOCKA, /* in PMC_SR */
+ .id = 2,
+ .type = CLK_TYPE_PRIMARY | CLK_TYPE_PLL,
+ };
+
+ static void pllb_mode(struct clk *clk, int is_on)
+ {
+ u32 value;
+
+ if (is_on) {
+ is_on = AT91_PMC_LOCKB;
+ value = at91_pllb_usb_init;
+ } else
+ value = 0;
+
+ // REVISIT: Add work-around for AT91RM9200 Errata #26 ?
+ at91_sys_write(AT91_CKGR_PLLBR, value);
+
+ do {
+ cpu_relax();
+ } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on);
+ }
+
+ static struct clk pllb = {
+ .name = "pllb",
+ .parent = &main_clk,
+ .pmc_mask = AT91_PMC_LOCKB, /* in PMC_SR */
+ .mode = pllb_mode,
+ .id = 3,
+ .type = CLK_TYPE_PRIMARY | CLK_TYPE_PLL,
+ };
+
+ static void pmc_sys_mode(struct clk *clk, int is_on)
+ {
+ if (is_on)
+ at91_sys_write(AT91_PMC_SCER, clk->pmc_mask);
+ else
+ at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask);
+ }
+
+ /* USB function clocks (PLLB must be 48 MHz) */
+ static struct clk udpck = {
+ .name = "udpck",
+ .parent = &pllb,
+ .mode = pmc_sys_mode,
+ };
+ static struct clk uhpck = {
+ .name = "uhpck",
+ .parent = &pllb,
+ .mode = pmc_sys_mode,
+ };
+
+
+ /*
+ * The master clock is divided from the CPU clock (by 1-4). It's used for
+ * memory, interfaces to on-chip peripherals, the AIC, and sometimes more
+ * (e.g baud rate generation). It's sourced from one of the primary clocks.
+ */
+ static struct clk mck = {
+ .name = "mck",
+ .pmc_mask = AT91_PMC_MCKRDY, /* in PMC_SR */
+ };
+
+ static void pmc_periph_mode(struct clk *clk, int is_on)
+ {
+ if (is_on)
+ at91_sys_write(AT91_PMC_PCER, clk->pmc_mask);
+ else
+ at91_sys_write(AT91_PMC_PCDR, clk->pmc_mask);
+ }
+
+ static struct clk __init *at91_css_to_clk(unsigned long css)
+ {
+ switch (css) {
+ case AT91_PMC_CSS_SLOW:
+ return &clk32k;
+ case AT91_PMC_CSS_MAIN:
+ return &main_clk;
+ case AT91_PMC_CSS_PLLA:
+ return &plla;
+ case AT91_PMC_CSS_PLLB:
+ return &pllb;
+ }
+
+ return NULL;
+ }
+
+ /*
+ * Associate a particular clock with a function (eg, "uart") and device.
+ * The drivers can then request the same 'function' with several different
+ * devices and not care about which clock name to use.
+ */
+ void __init at91_clock_associate(const char *id, struct device *dev, const char *func)
+ {
+ struct clk *clk = clk_get(NULL, id);
+
+ if (!dev || !clk || !IS_ERR(clk_get(dev, func)))
+ return;
+
+ clk->function = func;
+ clk->dev = dev;
+ }
+
+ /* clocks cannot be de-registered no refcounting necessary */
+ struct clk *clk_get(struct device *dev, const char *id)
+ {
+ struct clk *clk;
+
+ list_for_each_entry(clk, &clocks, node) {
+ if (strcmp(id, clk->name) == 0)
+ return clk;
+ if (clk->function && (dev == clk->dev) && strcmp(id, clk->function) == 0)
+ return clk;
+ }
+
+ return ERR_PTR(-ENOENT);
+ }
+ EXPORT_SYMBOL(clk_get);
+
+ void clk_put(struct clk *clk)
+ {
+ }
+ EXPORT_SYMBOL(clk_put);
+
+ static void __clk_enable(struct clk *clk)
+ {
+ if (clk->parent)
+ __clk_enable(clk->parent);
+ if (clk->users++ == 0 && clk->mode)
+ clk->mode(clk, 1);
+ }
+
+ int clk_enable(struct clk *clk)
+ {
+ unsigned long flags;
+
+ spin_lock_irqsave(&clk_lock, flags);
+ __clk_enable(clk);
+ spin_unlock_irqrestore(&clk_lock, flags);
+ return 0;
+ }
+ EXPORT_SYMBOL(clk_enable);
+
+ static void __clk_disable(struct clk *clk)
+ {
+ BUG_ON(clk->users == 0);
+ if (--clk->users == 0 && clk->mode)
+ clk->mode(clk, 0);
+ if (clk->parent)
+ __clk_disable(clk->parent);
+ }
+
+ void clk_disable(struct clk *clk)
+ {
+ unsigned long flags;
+
+ spin_lock_irqsave(&clk_lock, flags);
+ __clk_disable(clk);
+ spin_unlock_irqrestore(&clk_lock, flags);
+ }
+ EXPORT_SYMBOL(clk_disable);
+
+ unsigned long clk_get_rate(struct clk *clk)
+ {
+ unsigned long flags;
+ unsigned long rate;
+
+ spin_lock_irqsave(&clk_lock, flags);
+ for (;;) {
+ rate = clk->rate_hz;
+ if (rate || !clk->parent)
+ break;
+ clk = clk->parent;
+ }
+ spin_unlock_irqrestore(&clk_lock, flags);
+ return rate;
+ }
+ EXPORT_SYMBOL(clk_get_rate);
+
+ /*------------------------------------------------------------------------*/
+
+ #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
+
+ /*
+ * For now, only the programmable clocks support reparenting (MCK could
+ * do this too, with care) or rate changing (the PLLs could do this too,
+ * ditto MCK but that's more for cpufreq). Drivers may reparent to get
+ * a better rate match; we don't.
+ */
+
+ long clk_round_rate(struct clk *clk, unsigned long rate)
+ {
+ unsigned long flags;
+ unsigned prescale;
+ unsigned long actual;
+
+ if (!clk_is_programmable(clk))
+ return -EINVAL;
+ spin_lock_irqsave(&clk_lock, flags);
+
+ actual = clk->parent->rate_hz;
+ for (prescale = 0; prescale < 7; prescale++) {
+ if (actual && actual <= rate)
+ break;
+ actual >>= 1;
+ }
+
+ spin_unlock_irqrestore(&clk_lock, flags);
+ return (prescale < 7) ? actual : -ENOENT;
+ }
+ EXPORT_SYMBOL(clk_round_rate);
+
+ int clk_set_rate(struct clk *clk, unsigned long rate)
+ {
+ unsigned long flags;
+ unsigned prescale;
+ unsigned long actual;
+
+ if (!clk_is_programmable(clk))
+ return -EINVAL;
+ if (clk->users)
+ return -EBUSY;
+ spin_lock_irqsave(&clk_lock, flags);
+
+ actual = clk->parent->rate_hz;
+ for (prescale = 0; prescale < 7; prescale++) {
+ if (actual && actual <= rate) {
+ u32 pckr;
+
+ pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
+ pckr &= AT91_PMC_CSS_PLLB; /* clock selection */
+ pckr |= prescale << 2;
+ at91_sys_write(AT91_PMC_PCKR(clk->id), pckr);
+ clk->rate_hz = actual;
+ break;
+ }
+ actual >>= 1;
+ }
+
+ spin_unlock_irqrestore(&clk_lock, flags);
+ return (prescale < 7) ? actual : -ENOENT;
+ }
+ EXPORT_SYMBOL(clk_set_rate);
+
+ struct clk *clk_get_parent(struct clk *clk)
+ {
+ return clk->parent;
+ }
+ EXPORT_SYMBOL(clk_get_parent);
+
+ int clk_set_parent(struct clk *clk, struct clk *parent)
+ {
+ unsigned long flags;
+
+ if (clk->users)
+ return -EBUSY;
+ if (!clk_is_primary(parent) || !clk_is_programmable(clk))
+ return -EINVAL;
+ spin_lock_irqsave(&clk_lock, flags);
+
+ clk->rate_hz = parent->rate_hz;
+ clk->parent = parent;
+ at91_sys_write(AT91_PMC_PCKR(clk->id), parent->id);
+
+ spin_unlock_irqrestore(&clk_lock, flags);
+ return 0;
+ }
+ EXPORT_SYMBOL(clk_set_parent);
+
+ /* establish PCK0..PCK3 parentage and rate */
+ static void init_programmable_clock(struct clk *clk)
+ {
+ struct clk *parent;
+ u32 pckr;
+
+ pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
+ parent = at91_css_to_clk(pckr & AT91_PMC_CSS);
+ clk->parent = parent;
+ clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3));
+ }
+
+ #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
+
+ /*------------------------------------------------------------------------*/
+
+ #ifdef CONFIG_DEBUG_FS
+
+ static int at91_clk_show(struct seq_file *s, void *unused)
+ {
+ u32 scsr, pcsr, sr;
+ struct clk *clk;
+ unsigned i;
+
+ seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
+ seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR));
+
+ seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
+ seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
+ seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
+ seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
+
+ seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
+ for (i = 0; i < 4; i++)
+ seq_printf(s, "PCK%d = %8x\n", i, at91_sys_read(AT91_PMC_PCKR(i)));
+ seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
+
+ seq_printf(s, "\n");
+
+ list_for_each_entry(clk, &clocks, node) {
+ char *state;
+
+ if (clk->mode == pmc_sys_mode)
+ state = (scsr & clk->pmc_mask) ? "on" : "off";
+ else if (clk->mode == pmc_periph_mode)
+ state = (pcsr & clk->pmc_mask) ? "on" : "off";
+ else if (clk->pmc_mask)
+ state = (sr & clk->pmc_mask) ? "on" : "off";
+ else if (clk == &clk32k || clk == &main_clk)
+ state = "on";
+ else
+ state = "";
+
+ seq_printf(s, "%-10s users=%2d %-3s %9ld Hz %s\n",
+ clk->name, clk->users, state, clk_get_rate(clk),
+ clk->parent ? clk->parent->name : "");
+ }
+ return 0;
+ }
+
+ static int at91_clk_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, at91_clk_show, NULL);
+ }
+
++static const struct file_operations at91_clk_operations = {
+ .open = at91_clk_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+ };
+
+ static int __init at91_clk_debugfs_init(void)
+ {
+ /* /sys/kernel/debug/at91_clk */
+ (void) debugfs_create_file("at91_clk", S_IFREG | S_IRUGO, NULL, NULL, &at91_clk_operations);
+
+ return 0;
+ }
+ postcore_initcall(at91_clk_debugfs_init);
+
+ #endif
+
+ /*------------------------------------------------------------------------*/
+
+ /* Register a new clock */
+ int __init clk_register(struct clk *clk)
+ {
+ if (clk_is_peripheral(clk)) {
+ clk->parent = &mck;
+ clk->mode = pmc_periph_mode;
+ list_add_tail(&clk->node, &clocks);
+ }
+ else if (clk_is_sys(clk)) {
+ clk->parent = &mck;
+ clk->mode = pmc_sys_mode;
+
+ list_add_tail(&clk->node, &clocks);
+ }
+ #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
+ else if (clk_is_programmable(clk)) {
+ clk->mode = pmc_sys_mode;
+ init_programmable_clock(clk);
+ list_add_tail(&clk->node, &clocks);
+ }
+ #endif
+
+ return 0;
+ }
+
+
+ /*------------------------------------------------------------------------*/
+
+ static u32 __init at91_pll_rate(struct clk *pll, u32 freq, u32 reg)
+ {
+ unsigned mul, div;
+
+ div = reg & 0xff;
+ mul = (reg >> 16) & 0x7ff;
+ if (div && mul) {
+ freq /= div;
+ freq *= mul + 1;
+ } else
+ freq = 0;
+
+ return freq;
+ }
+
+ static u32 __init at91_usb_rate(struct clk *pll, u32 freq, u32 reg)
+ {
+ if (pll == &pllb && (reg & AT91_PMC_USB96M))
+ return freq / 2;
+ else
+ return freq;
+ }
+
+ static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq)
+ {
+ unsigned i, div = 0, mul = 0, diff = 1 << 30;
+ unsigned ret = (out_freq > 155000000) ? 0xbe00 : 0x3e00;
+
+ /* PLL output max 240 MHz (or 180 MHz per errata) */
+ if (out_freq > 240000000)
+ goto fail;
+
+ for (i = 1; i < 256; i++) {
+ int diff1;
+ unsigned input, mul1;
+
+ /*
+ * PLL input between 1MHz and 32MHz per spec, but lower
+ * frequences seem necessary in some cases so allow 100K.
+ */
+ input = main_freq / i;
+ if (input < 100000)
+ continue;
+ if (input > 32000000)
+ continue;
+
+ mul1 = out_freq / input;
+ if (mul1 > 2048)
+ continue;
+ if (mul1 < 2)
+ goto fail;
+
+ diff1 = out_freq - input * mul1;
+ if (diff1 < 0)
+ diff1 = -diff1;
+ if (diff > diff1) {
+ diff = diff1;
+ div = i;
+ mul = mul1;
+ if (diff == 0)
+ break;
+ }
+ }
+ if (i == 256 && diff > (out_freq >> 5))
+ goto fail;
+ return ret | ((mul - 1) << 16) | div;
+ fail:
+ return 0;
+ }
+
+ static struct clk *const standard_pmc_clocks[] __initdata = {
+ /* four primary clocks */
+ &clk32k,
+ &main_clk,
+ &plla,
+ &pllb,
+
+ /* PLLB children (USB) */
+ &udpck,
+ &uhpck,
+
+ /* MCK */
+ &mck
+ };
+
+ int __init at91_clock_init(unsigned long main_clock)
+ {
+ unsigned tmp, freq, mckr;
+ int i;
+
+ /*
+ * When the bootloader initialized the main oscillator correctly,
+ * there's no problem using the cycle counter. But if it didn't,
+ * or when using oscillator bypass mode, we must be told the speed
+ * of the main clock.
+ */
+ if (!main_clock) {
+ do {
+ tmp = at91_sys_read(AT91_CKGR_MCFR);
+ } while (!(tmp & AT91_PMC_MAINRDY));
+ main_clock = (tmp & AT91_PMC_MAINF) * (AT91_SLOW_CLOCK / 16);
+ }
+ main_clk.rate_hz = main_clock;
+
+ /* report if PLLA is more than mildly overclocked */
+ plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR));
+ if (plla.rate_hz > 209000000)
+ pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
+
+ /*
+ * USB clock init: choose 48 MHz PLLB value,
+ * disable 48MHz clock during usb peripheral suspend.
+ *
+ * REVISIT: assumes MCK doesn't derive from PLLB!
+ */
+ at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) | AT91_PMC_USB96M;
+ pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init);
+ if (cpu_is_at91rm9200()) {
+ uhpck.pmc_mask = AT91RM9200_PMC_UHP;
+ udpck.pmc_mask = AT91RM9200_PMC_UDP;
+ at91_sys_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
+ } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) {
+ uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
+ udpck.pmc_mask = AT91SAM926x_PMC_UDP;
+ }
+ at91_sys_write(AT91_CKGR_PLLBR, 0);
+
+ udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
+ uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
+
+ /*
+ * MCK and CPU derive from one of those primary clocks.
+ * For now, assume this parentage won't change.
+ */
+ mckr = at91_sys_read(AT91_PMC_MCKR);
+ mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
+ freq = mck.parent->rate_hz;
+ freq /= (1 << ((mckr >> 2) & 3)); /* prescale */
+ mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */
+
+ /* Register the PMC's standard clocks */
+ for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
+ list_add_tail(&standard_pmc_clocks[i]->node, &clocks);
+
+ /* MCK and CPU clock are "always on" */
+ clk_enable(&mck);
+
+ printk("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n",
+ freq / 1000000, (unsigned) mck.rate_hz / 1000000,
+ (unsigned) main_clock / 1000000,
+ ((unsigned) main_clock % 1000000) / 1000);
+
+ return 0;
+ }
+
+ /*
+ * Several unused clocks may be active. Turn them off.
+ */
+ static int __init at91_clock_reset(void)
+ {
+ unsigned long pcdr = 0;
+ unsigned long scdr = 0;
+ struct clk *clk;
+
+ list_for_each_entry(clk, &clocks, node) {
+ if (clk->users > 0)
+ continue;
+
+ if (clk->mode == pmc_periph_mode)
+ pcdr |= clk->pmc_mask;
+
+ if (clk->mode == pmc_sys_mode)
+ scdr |= clk->pmc_mask;
+
+ pr_debug("Clocks: disable unused %s\n", clk->name);
+ }
+
+ at91_sys_write(AT91_PMC_PCDR, pcdr);
+ at91_sys_write(AT91_PMC_SCDR, scdr);
+
+ return 0;
+ }
+ late_initcall(at91_clock_reset);
--- /dev/null
+ /*
+ * linux/arch/arm/mach-at91/gpio.c
+ *
+ * Copyright (C) 2005 HP Labs
+ *
+ * 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.
+ */
+
+ #include <linux/clk.h>
+ #include <linux/errno.h>
+ #include <linux/interrupt.h>
+ #include <linux/irq.h>
+ #include <linux/kernel.h>
+ #include <linux/list.h>
+ #include <linux/module.h>
+
+ #include <asm/io.h>
+ #include <asm/hardware.h>
+ #include <asm/arch/at91_pio.h>
+ #include <asm/arch/gpio.h>
+
+ #include "generic.h"
+
+
+ static struct at91_gpio_bank *gpio;
+ static int gpio_banks;
+
+
+ static inline void __iomem *pin_to_controller(unsigned pin)
+ {
+ void __iomem *sys_base = (void __iomem *) AT91_VA_BASE_SYS;
+
+ pin -= PIN_BASE;
+ pin /= 32;
+ if (likely(pin < gpio_banks))
+ return sys_base + gpio[pin].offset;
+
+ return NULL;
+ }
+
+ static inline unsigned pin_to_mask(unsigned pin)
+ {
+ pin -= PIN_BASE;
+ return 1 << (pin % 32);
+ }
+
+
+ /*--------------------------------------------------------------------------*/
+
+ /* Not all hardware capabilities are exposed through these calls; they
+ * only encapsulate the most common features and modes. (So if you
+ * want to change signals in groups, do it directly.)
+ *
+ * Bootloaders will usually handle some of the pin multiplexing setup.
+ * The intent is certainly that by the time Linux is fully booted, all
+ * pins should have been fully initialized. These setup calls should
+ * only be used by board setup routines, or possibly in driver probe().
+ *
+ * For bootloaders doing all that setup, these calls could be inlined
+ * as NOPs so Linux won't duplicate any setup code
+ */
+
+
++/*
++ * mux the pin to the "GPIO" peripheral role.
++ */
++int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup)
++{
++ void __iomem *pio = pin_to_controller(pin);
++ unsigned mask = pin_to_mask(pin);
++
++ if (!pio)
++ return -EINVAL;
++ __raw_writel(mask, pio + PIO_IDR);
++ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
++ __raw_writel(mask, pio + PIO_PER);
++ return 0;
++}
++EXPORT_SYMBOL(at91_set_GPIO_periph);
++
++
+ /*
+ * mux the pin to the "A" internal peripheral role.
+ */
+ int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + PIO_IDR);
+ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
+ __raw_writel(mask, pio + PIO_ASR);
+ __raw_writel(mask, pio + PIO_PDR);
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_A_periph);
+
+
+ /*
+ * mux the pin to the "B" internal peripheral role.
+ */
+ int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + PIO_IDR);
+ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
+ __raw_writel(mask, pio + PIO_BSR);
+ __raw_writel(mask, pio + PIO_PDR);
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_B_periph);
+
+
+ /*
+ * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and
+ * configure it for an input.
+ */
+ int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + PIO_IDR);
+ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
+ __raw_writel(mask, pio + PIO_ODR);
+ __raw_writel(mask, pio + PIO_PER);
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_gpio_input);
+
+
+ /*
+ * mux the pin to the gpio controller (instead of "A" or "B" peripheral),
+ * and configure it for an output.
+ */
+ int __init_or_module at91_set_gpio_output(unsigned pin, int value)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + PIO_IDR);
+ __raw_writel(mask, pio + PIO_PUDR);
+ __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
+ __raw_writel(mask, pio + PIO_OER);
+ __raw_writel(mask, pio + PIO_PER);
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_gpio_output);
+
+
+ /*
+ * enable/disable the glitch filter; mostly used with IRQ handling.
+ */
+ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+ __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_deglitch);
+
+ /*
+ * enable/disable the multi-driver; This is only valid for output and
+ * allows the output pin to run as an open collector output.
+ */
+ int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_multi_drive);
+
+ /*--------------------------------------------------------------------------*/
+
++/* new-style GPIO calls; these expect at91_set_GPIO_periph to have been
++ * called, and maybe at91_set_multi_drive() for putout pins.
++ */
++
++int gpio_direction_input(unsigned pin)
++{
++ void __iomem *pio = pin_to_controller(pin);
++ unsigned mask = pin_to_mask(pin);
++
++ if (!pio || !(__raw_readl(pio + PIO_PSR) & mask))
++ return -EINVAL;
++ __raw_writel(mask, pio + PIO_OER);
++ return 0;
++}
++EXPORT_SYMBOL(gpio_direction_input);
++
++int gpio_direction_output(unsigned pin)
++{
++ void __iomem *pio = pin_to_controller(pin);
++ unsigned mask = pin_to_mask(pin);
++
++ if (!pio || !(__raw_readl(pio + PIO_PSR) & mask))
++ return -EINVAL;
++ __raw_writel(mask, pio + PIO_OER);
++ return 0;
++}
++EXPORT_SYMBOL(gpio_direction_output);
++
++/*--------------------------------------------------------------------------*/
++
+ /*
+ * assuming the pin is muxed as a gpio output, set its value.
+ */
+ int at91_set_gpio_value(unsigned pin, int value)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+ __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
+ return 0;
+ }
+ EXPORT_SYMBOL(at91_set_gpio_value);
+
+
+ /*
+ * read the pin's value (works even if it's not muxed as a gpio).
+ */
+ int at91_get_gpio_value(unsigned pin)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+ u32 pdsr;
+
+ if (!pio)
+ return -EINVAL;
+ pdsr = __raw_readl(pio + PIO_PDSR);
+ return (pdsr & mask) != 0;
+ }
+ EXPORT_SYMBOL(at91_get_gpio_value);
+
+ /*--------------------------------------------------------------------------*/
+
+ #ifdef CONFIG_PM
+
+ static u32 wakeups[MAX_GPIO_BANKS];
+ static u32 backups[MAX_GPIO_BANKS];
+
+ static int gpio_irq_set_wake(unsigned pin, unsigned state)
+ {
+ unsigned mask = pin_to_mask(pin);
+ unsigned bank = (pin - PIN_BASE) / 32;
+
+ if (unlikely(bank >= MAX_GPIO_BANKS))
+ return -EINVAL;
+
+ if (state)
+ wakeups[bank] |= mask;
+ else
+ wakeups[bank] &= ~mask;
+
+ set_irq_wake(gpio[bank].id, state);
+
+ return 0;
+ }
+
+ void at91_gpio_suspend(void)
+ {
+ int i;
+
+ for (i = 0; i < gpio_banks; i++) {
+ u32 pio = gpio[i].offset;
+
+ backups[i] = at91_sys_read(pio + PIO_IMR);
+ at91_sys_write(pio + PIO_IDR, backups[i]);
+ at91_sys_write(pio + PIO_IER, wakeups[i]);
+
+ if (!wakeups[i])
+ clk_disable(gpio[i].clock);
+ else {
+ #ifdef CONFIG_PM_DEBUG
+ printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]);
+ #endif
+ }
+ }
+ }
+
+ void at91_gpio_resume(void)
+ {
+ int i;
+
+ for (i = 0; i < gpio_banks; i++) {
+ u32 pio = gpio[i].offset;
+
+ if (!wakeups[i])
+ clk_enable(gpio[i].clock);
+
+ at91_sys_write(pio + PIO_IDR, wakeups[i]);
+ at91_sys_write(pio + PIO_IER, backups[i]);
+ }
+ }
+
+ #else
+ #define gpio_irq_set_wake NULL
+ #endif
+
+
+ /* Several AIC controller irqs are dispatched through this GPIO handler.
+ * To use any AT91_PIN_* as an externally triggered IRQ, first call
+ * at91_set_gpio_input() then maybe enable its glitch filter.
+ * Then just request_irq() with the pin ID; it works like any ARM IRQ
+ * handler, though it always triggers on rising and falling edges.
+ *
+ * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
+ * configuring them with at91_set_a_periph() or at91_set_b_periph().
+ * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
+ */
+
+ static void gpio_irq_mask(unsigned pin)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (pio)
+ __raw_writel(mask, pio + PIO_IDR);
+ }
+
+ static void gpio_irq_unmask(unsigned pin)
+ {
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (pio)
+ __raw_writel(mask, pio + PIO_IER);
+ }
+
+ static int gpio_irq_type(unsigned pin, unsigned type)
+ {
+ return (type == IRQT_BOTHEDGE) ? 0 : -EINVAL;
+ }
+
+ static struct irq_chip gpio_irqchip = {
+ .name = "GPIO",
+ .mask = gpio_irq_mask,
+ .unmask = gpio_irq_unmask,
+ .set_type = gpio_irq_type,
+ .set_wake = gpio_irq_set_wake,
+ };
+
+ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
+ {
+ unsigned pin;
+ struct irq_desc *gpio;
+ void __iomem *pio;
+ u32 isr;
+
+ pio = get_irq_chip_data(irq);
+
+ /* temporarily mask (level sensitive) parent IRQ */
+ desc->chip->ack(irq);
+ for (;;) {
+ /* reading ISR acks the pending (edge triggered) GPIO interrupt */
+ isr = __raw_readl(pio + PIO_ISR) & __raw_readl(pio + PIO_IMR);
+ if (!isr)
+ break;
+
+ pin = (unsigned) get_irq_data(irq);
+ gpio = &irq_desc[pin];
+
+ while (isr) {
+ if (isr & 1) {
+ if (unlikely(gpio->depth)) {
+ /*
+ * The core ARM interrupt handler lazily disables IRQs so
+ * another IRQ must be generated before it actually gets
+ * here to be disabled on the GPIO controller.
+ */
+ gpio_irq_mask(pin);
+ }
+ else
+ desc_handle_irq(pin, gpio);
+ }
+ pin++;
+ gpio++;
+ isr >>= 1;
+ }
+ }
+ desc->chip->unmask(irq);
+ /* now it may re-trigger */
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /*
+ * Called from the processor-specific init to enable GPIO interrupt support.
+ */
+ void __init at91_gpio_irq_setup(void)
+ {
+ unsigned pioc, pin;
+
+ for (pioc = 0, pin = PIN_BASE;
+ pioc < gpio_banks;
+ pioc++) {
+ void __iomem *controller;
+ unsigned id = gpio[pioc].id;
+ unsigned i;
+
+ clk_enable(gpio[pioc].clock); /* enable PIO controller's clock */
+
+ controller = (void __iomem *) AT91_VA_BASE_SYS + gpio[pioc].offset;
+ __raw_writel(~0, controller + PIO_IDR);
+
+ set_irq_data(id, (void *) pin);
+ set_irq_chip_data(id, controller);
+
+ for (i = 0; i < 32; i++, pin++) {
+ /*
+ * Can use the "simple" and not "edge" handler since it's
+ * shorter, and the AIC handles interupts sanely.
+ */
+ set_irq_chip(pin, &gpio_irqchip);
+ set_irq_handler(pin, handle_simple_irq);
+ set_irq_flags(pin, IRQF_VALID);
+ }
+
+ set_irq_chained_handler(id, gpio_irq_handler);
+ }
+ pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, gpio_banks);
+ }
+
+ /*
+ * Called from the processor-specific init to enable GPIO pin support.
+ */
+ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
+ {
+ BUG_ON(nr_banks > MAX_GPIO_BANKS);
+
+ gpio = data;
+ gpio_banks = nr_banks;
+ }
*
* Copyright (C) 2006 Atmel Corporation
*
- * Based on arch/arm/mach-at91rm9200/clock.c
+ * Based on arch/arm/mach-at91/clock.c
* Copyright (C) 2005 David Brownell
* Copyright (C) 2005 Ivan Kokshaysky
*
static void __clk_disable(struct clk *clk)
{
- BUG_ON(clk->users == 0);
+ if (clk->users == 0) {
+ printk(KERN_ERR "%s: mismatched disable\n", clk->name);
+ WARN_ON(1);
+ return;
+ }
if (--clk->users == 0 && clk->mode)
clk->mode(clk, 0);
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/sched.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
* Every time unit enable is asserted, GPOD needs to be cleared
* on IOP3XX to avoid data corruption on the bus.
*/
- #ifdef CONFIG_PLAT_IOP
+ #if defined(CONFIG_ARCH_IOP32X) || defined(CONFIG_ARCH_IOP33X)
if (iop3xx_adap->id == 0) {
gpio_line_set(IOP3XX_GPIO_LINE(7), GPIO_LOW);
gpio_line_set(IOP3XX_GPIO_LINE(6), GPIO_LOW);
#include <linux/err.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
+ #include <linux/atmel_pdc.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
#include <asm/arch/cpu.h>
#include <asm/arch/gpio.h>
#include <asm/arch/at91_mci.h>
- #include <asm/arch/at91_pdc.h>
#define DRIVER_NAME "at91_mci"
/* Check to see if this needs filling */
if (i == 0) {
- if (at91_mci_read(host, AT91_PDC_RCR) != 0) {
+ if (at91_mci_read(host, ATMEL_PDC_RCR) != 0) {
pr_debug("Transfer active in current\n");
continue;
}
}
else {
- if (at91_mci_read(host, AT91_PDC_RNCR) != 0) {
+ if (at91_mci_read(host, ATMEL_PDC_RNCR) != 0) {
pr_debug("Transfer active in next\n");
continue;
}
pr_debug("dma address = %08X, length = %d\n", sg->dma_address, sg->length);
if (i == 0) {
- at91_mci_write(host, AT91_PDC_RPR, sg->dma_address);
- at91_mci_write(host, AT91_PDC_RCR, sg->length / 4);
+ at91_mci_write(host, ATMEL_PDC_RPR, sg->dma_address);
+ at91_mci_write(host, ATMEL_PDC_RCR, sg->length / 4);
}
else {
- at91_mci_write(host, AT91_PDC_RNPR, sg->dma_address);
- at91_mci_write(host, AT91_PDC_RNCR, sg->length / 4);
+ at91_mci_write(host, ATMEL_PDC_RNPR, sg->dma_address);
+ at91_mci_write(host, ATMEL_PDC_RNCR, sg->length / 4);
}
}
at91mci_pre_dma_read(host);
else {
at91_mci_write(host, AT91_MCI_IER, AT91_MCI_RXBUFF);
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_RXTDIS | AT91_PDC_TXTDIS);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS);
}
pr_debug("post dma read done\n");
pr_debug("Handling the transmit\n");
/* Disable the transfer */
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_RXTDIS | AT91_PDC_TXTDIS);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS);
/* Now wait for cmd ready */
at91_mci_write(host, AT91_MCI_IDR, AT91_MCI_TXBUFE);
cmd->opcode, cmdr, cmd->arg, blocks, block_length, at91_mci_read(host, AT91_MCI_MR));
if (!data) {
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_TXTDIS | AT91_PDC_RXTDIS);
- at91_mci_write(host, AT91_PDC_RPR, 0);
- at91_mci_write(host, AT91_PDC_RCR, 0);
- at91_mci_write(host, AT91_PDC_RNPR, 0);
- at91_mci_write(host, AT91_PDC_RNCR, 0);
- at91_mci_write(host, AT91_PDC_TPR, 0);
- at91_mci_write(host, AT91_PDC_TCR, 0);
- at91_mci_write(host, AT91_PDC_TNPR, 0);
- at91_mci_write(host, AT91_PDC_TNCR, 0);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS | ATMEL_PDC_RXTDIS);
+ at91_mci_write(host, ATMEL_PDC_RPR, 0);
+ at91_mci_write(host, ATMEL_PDC_RCR, 0);
+ at91_mci_write(host, ATMEL_PDC_RNPR, 0);
+ at91_mci_write(host, ATMEL_PDC_RNCR, 0);
+ at91_mci_write(host, ATMEL_PDC_TPR, 0);
+ at91_mci_write(host, ATMEL_PDC_TCR, 0);
+ at91_mci_write(host, ATMEL_PDC_TNPR, 0);
+ at91_mci_write(host, ATMEL_PDC_TNCR, 0);
at91_mci_write(host, AT91_MCI_ARGR, cmd->arg);
at91_mci_write(host, AT91_MCI_CMDR, cmdr);
/*
* Disable the PDC controller
*/
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_RXTDIS | AT91_PDC_TXTDIS);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS);
if (cmdr & AT91_MCI_TRCMD_START) {
data->bytes_xfered = 0;
pr_debug("Transmitting %d bytes\n", host->total_length);
- at91_mci_write(host, AT91_PDC_TPR, host->physical_address);
- at91_mci_write(host, AT91_PDC_TCR, host->total_length / 4);
+ at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address);
+ at91_mci_write(host, ATMEL_PDC_TCR, host->total_length / 4);
ier = AT91_MCI_TXBUFE;
}
}
if (cmdr & AT91_MCI_TRCMD_START) {
if (cmdr & AT91_MCI_TRDIR)
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_RXTEN);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTEN);
else
- at91_mci_write(host, AT91_PDC_PTCR, AT91_PDC_TXTEN);
+ at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN);
}
return ier;
}
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
mmc->caps = MMC_CAP_BYTEBLOCK;
+ mmc->max_blk_size = 4095;
+ mmc->max_blk_count = mmc->max_req_size;
+
host = mmc_priv(mmc);
host->mmc = mmc;
host->buffer = NULL;
select SERIAL_CORE
help
This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
- an Integrator/AP or Integrator/PP2 platform, say Y or M here.
+ an Integrator/AP or Integrator/PP2 platform, or if you have a
+ Cirrus Logic EP93xx CPU, say Y or M here.
If unsure, say N.
depends on SERIAL_SH_SCI=y
select SERIAL_CORE_CONSOLE
+config SERIAL_PNX8XXX
+ bool "Enable PNX8XXX SoCs' UART Support"
+ depends on MIPS && SOC_PNX8550
+ select SERIAL_CORE
+ help
+ If you have a MIPS-based Philips SoC such as PNX8550 or PNX8330
+ and you want to use serial ports, say Y. Otherwise, say N.
+
+config SERIAL_PNX8XXX_CONSOLE
+ bool "Enable PNX8XX0 serial console"
+ depends on SERIAL_PNX8XXX
+ select SERIAL_CORE_CONSOLE
+ help
+ If you have a MIPS-based Philips SoC such as PNX8550 or PNX8330
+ and you want to use serial console, say Y. Otherwise, say N.
+
config SERIAL_CORE
tristate
config HAS_TXX9_SERIAL
bool
+config SERIAL_TXX9_NR_UARTS
+ int "Maximum number of TMPTX39XX/49XX SIO ports"
+ depends on SERIAL_TXX9
+ default "6"
+
config SERIAL_TXX9_CONSOLE
bool "TMPTX39XX/49XX SIO Console support"
depends on SERIAL_TXX9=y
If you have enabled the serial port on the Motorola IMX
CPU you can make it the console by answering Y to this option.
+config SERIAL_OF_PLATFORM
+ tristate "Serial port on Open Firmware platform bus"
+ depends on PPC_OF
+ depends on SERIAL_8250
+ help
+ If you have a PowerPC based system that has serial ports
+ on a platform specific bus, you should enable this option.
+ Currently, only 8250 compatible ports are supported, but
+ others can easily be added.
+
endmenu
#include <linux/sysrq.h>
#include <linux/tty_flip.h>
#include <linux/platform_device.h>
+ #include <linux/atmel_pdc.h>
#include <asm/io.h>
#include <asm/mach/serial_at91.h>
#include <asm/arch/board.h>
- #include <asm/arch/at91_pdc.h>
+
#ifdef CONFIG_ARM
#include <asm/arch/cpu.h>
#include <asm/arch/gpio.h>
#define ATMEL_ISR_PASS_LIMIT 256
-#define UART_PUT_CR(port,v) writel(v, (port)->membase + ATMEL_US_CR)
-#define UART_GET_MR(port) readl((port)->membase + ATMEL_US_MR)
-#define UART_PUT_MR(port,v) writel(v, (port)->membase + ATMEL_US_MR)
-#define UART_PUT_IER(port,v) writel(v, (port)->membase + ATMEL_US_IER)
-#define UART_PUT_IDR(port,v) writel(v, (port)->membase + ATMEL_US_IDR)
-#define UART_GET_IMR(port) readl((port)->membase + ATMEL_US_IMR)
-#define UART_GET_CSR(port) readl((port)->membase + ATMEL_US_CSR)
-#define UART_GET_CHAR(port) readl((port)->membase + ATMEL_US_RHR)
-#define UART_PUT_CHAR(port,v) writel(v, (port)->membase + ATMEL_US_THR)
-#define UART_GET_BRGR(port) readl((port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_BRGR(port,v) writel(v, (port)->membase + ATMEL_US_BRGR)
-#define UART_PUT_RTOR(port,v) writel(v, (port)->membase + ATMEL_US_RTOR)
-
-// #define UART_GET_CR(port) readl((port)->membase + ATMEL_US_CR) // is write-only
+#define UART_PUT_CR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_CR)
+#define UART_GET_MR(port) __raw_readl((port)->membase + ATMEL_US_MR)
+#define UART_PUT_MR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_MR)
+#define UART_PUT_IER(port,v) __raw_writel(v, (port)->membase + ATMEL_US_IER)
+#define UART_PUT_IDR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_IDR)
+#define UART_GET_IMR(port) __raw_readl((port)->membase + ATMEL_US_IMR)
+#define UART_GET_CSR(port) __raw_readl((port)->membase + ATMEL_US_CSR)
+#define UART_GET_CHAR(port) __raw_readl((port)->membase + ATMEL_US_RHR)
+#define UART_PUT_CHAR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_THR)
+#define UART_GET_BRGR(port) __raw_readl((port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_BRGR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR)
+#define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)
+
+// #define UART_GET_CR(port) __raw_readl((port)->membase + ATMEL_US_CR) // is write-only
/* PDC registers */
-#define UART_PUT_PTCR(port,v) writel(v, (port)->membase + ATMEL_PDC_PTCR)
-#define UART_GET_PTSR(port) readl((port)->membase + ATMEL_PDC_PTSR)
-
-#define UART_PUT_RPR(port,v) writel(v, (port)->membase + ATMEL_PDC_RPR)
-#define UART_GET_RPR(port) readl((port)->membase + ATMEL_PDC_RPR)
-#define UART_PUT_RCR(port,v) writel(v, (port)->membase + ATMEL_PDC_RCR)
-#define UART_PUT_RNPR(port,v) writel(v, (port)->membase + ATMEL_PDC_RNPR)
-#define UART_PUT_RNCR(port,v) writel(v, (port)->membase + ATMEL_PDC_RNCR)
-
-#define UART_PUT_TPR(port,v) writel(v, (port)->membase + ATMEL_PDC_TPR)
-#define UART_PUT_TCR(port,v) writel(v, (port)->membase + ATMEL_PDC_TCR)
-//#define UART_PUT_TNPR(port,v) writel(v, (port)->membase + ATMEL_PDC_TNPR)
-//#define UART_PUT_TNCR(port,v) writel(v, (port)->membase + ATMEL_PDC_TNCR)
+#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
+#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR)
+
+#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR)
+#define UART_GET_RPR(port) __raw_readl((port)->membase + ATMEL_PDC_RPR)
+#define UART_PUT_RCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RCR)
+#define UART_PUT_RNPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RNPR)
+#define UART_PUT_RNCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RNCR)
+
+#define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR)
+#define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR)
+//#define UART_PUT_TNPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNPR)
+//#define UART_PUT_TNCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNCR)
static int (*atmel_open_hook)(struct uart_port *);
static void (*atmel_close_hook)(struct uart_port *);
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/ioport.h>
-#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/proc_fs.h>
#include <linux/clk.h>
-#include <linux/usb_ch9.h>
+#include <linux/usb/ch9.h>
#include <linux/usb_gadget.h>
#include <asm/byteorder.h>
return status;
}
-static struct usb_ep_ops at91_ep_ops = {
+static const struct usb_ep_ops at91_ep_ops = {
.enable = at91_ep_enable,
.disable = at91_ep_disable,
.alloc_request = at91_ep_alloc_request,
at91_udp_write(udc, AT91_UDP_TXVC, 0);
if (cpu_is_at91rm9200())
at91_set_gpio_value(udc->board.pullup_pin, 1);
- else if (cpu_is_at91sam9260()) {
+ else if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) {
u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
txvc |= AT91_UDP_TXVC_PUON;
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
if (cpu_is_at91rm9200())
at91_set_gpio_value(udc->board.pullup_pin, 0);
- else if (cpu_is_at91sam9260()) {
+ else if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) {
u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
txvc &= ~AT91_UDP_TXVC_PUON;
pullup(platform_get_drvdata(dev), 0);
}
-static int __devinit at91udc_probe(struct platform_device *pdev)
+static int __init at91udc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct at91_udc *udc;
return retval;
}
-static int __devexit at91udc_remove(struct platform_device *pdev)
+static int __exit at91udc_remove(struct platform_device *pdev)
{
struct at91_udc *udc = platform_get_drvdata(pdev);
struct resource *res;
|| !wake
|| at91_suspend_entering_slow_clock()) {
pullup(udc, 0);
- disable_irq_wake(udc->udp_irq);
+ wake = 0;
} else
enable_irq_wake(udc->udp_irq);
- if (udc->board.vbus_pin > 0) {
- if (wake)
- enable_irq_wake(udc->board.vbus_pin);
- else
- disable_irq_wake(udc->board.vbus_pin);
- }
+ udc->active_suspend = wake;
+ if (udc->board.vbus_pin > 0 && wake)
+ enable_irq_wake(udc->board.vbus_pin);
return 0;
}
{
struct at91_udc *udc = platform_get_drvdata(pdev);
+ if (udc->board.vbus_pin > 0 && udc->active_suspend)
+ disable_irq_wake(udc->board.vbus_pin);
+
/* maybe reconnect to host; if so, clocks on */
- pullup(udc, 1);
+ if (udc->active_suspend)
+ disable_irq_wake(udc->udp_irq);
+ else
+ pullup(udc, 1);
return 0;
}
#else
#endif
static struct platform_driver at91_udc = {
- .probe = at91udc_probe,
- .remove = __devexit_p(at91udc_remove),
+ .remove = __exit_p(at91udc_remove),
.shutdown = at91udc_shutdown,
.suspend = at91udc_suspend,
.resume = at91udc_resume,
},
};
-static int __devinit udc_init_module(void)
+static int __init udc_init_module(void)
{
- return platform_driver_register(&at91_udc);
+ return platform_driver_probe(&at91_udc, at91udc_probe);
}
module_init(udc_init_module);
-static void __devexit udc_exit_module(void)
+static void __exit udc_exit_module(void)
{
platform_driver_unregister(&at91_udc);
}
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/delay.h>
-#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <asm/arch/pxa-regs.h>
#endif
-#include <linux/usb_ch9.h>
+#include <linux/usb/ch9.h>
#include <linux/usb_gadget.h>
#include <asm/arch/udc.h>
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
if (mach->gpio_vbus)
- return pxa_gpio_get(mach->gpio_vbus);
+ return udc_gpio_get(mach->gpio_vbus);
if (mach->udc_is_connected)
return mach->udc_is_connected();
return 1;
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
if (mach->gpio_pullup)
- pxa_gpio_set(mach->gpio_pullup, 0);
+ udc_gpio_set(mach->gpio_pullup, 0);
else if (mach->udc_command)
mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
}
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
if (mach->gpio_pullup)
- pxa_gpio_set(mach->gpio_pullup, 1);
+ udc_gpio_set(mach->gpio_pullup, 1);
else if (mach->udc_command)
mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
}
static irqreturn_t udc_vbus_irq(int irq, void *_dev)
{
struct pxa2xx_udc *dev = _dev;
- int vbus = pxa_gpio_get(dev->mach->gpio_vbus);
+ int vbus = udc_gpio_get(dev->mach->gpio_vbus);
pxa2xx_udc_vbus_session(&dev->gadget, vbus);
return IRQ_HANDLED;
dev->dev = &pdev->dev;
dev->mach = pdev->dev.platform_data;
if (dev->mach->gpio_vbus) {
- vbus_irq = IRQ_GPIO(dev->mach->gpio_vbus & GPIO_MD_MASK_NR);
- pxa_gpio_mode((dev->mach->gpio_vbus & GPIO_MD_MASK_NR)
- | GPIO_IN);
+ udc_gpio_init_vbus(dev->mach->gpio_vbus);
+ vbus_irq = udc_gpio_to_irq(dev->mach->gpio_vbus);
set_irq_type(vbus_irq, IRQT_BOTHEDGE);
} else
vbus_irq = 0;
if (dev->mach->gpio_pullup)
- pxa_gpio_mode((dev->mach->gpio_pullup & GPIO_MD_MASK_NR)
- | GPIO_OUT | GPIO_DFLT_LOW);
+ udc_gpio_init_pullup(dev->mach->gpio_pullup);
init_timer(&dev->timer);
dev->timer.function = udc_watchdog;
#endif
if (vbus_irq) {
retval = request_irq(vbus_irq, udc_vbus_irq,
- SA_INTERRUPT | SA_SAMPLE_RANDOM,
+ IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
driver_name, dev);
if (retval != 0) {
printk(KERN_ERR "%s: can't get irq %i, err %d\n",
--- /dev/null
-#endif
+ /*
+ * include/asm-arm/arch-at91/gpio.h
+ *
+ * Copyright (C) 2005 HP Labs
+ *
+ * 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.
+ *
+ */
+
+ #ifndef __ASM_ARCH_AT91RM9200_GPIO_H
+ #define __ASM_ARCH_AT91RM9200_GPIO_H
+
+ #include <asm/irq.h>
+
+ #define PIN_BASE NR_AIC_IRQS
+
+ #define MAX_GPIO_BANKS 5
+
+ /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
+
+ #define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0)
+ #define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1)
+ #define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2)
+ #define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3)
+ #define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4)
+ #define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5)
+ #define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6)
+ #define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7)
+ #define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8)
+ #define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9)
+ #define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10)
+ #define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11)
+ #define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12)
+ #define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13)
+ #define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14)
+ #define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15)
+ #define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16)
+ #define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17)
+ #define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18)
+ #define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19)
+ #define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20)
+ #define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21)
+ #define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22)
+ #define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23)
+ #define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24)
+ #define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25)
+ #define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26)
+ #define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27)
+ #define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28)
+ #define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29)
+ #define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30)
+ #define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31)
+
+ #define AT91_PIN_PB0 (PIN_BASE + 0x20 + 0)
+ #define AT91_PIN_PB1 (PIN_BASE + 0x20 + 1)
+ #define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2)
+ #define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3)
+ #define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4)
+ #define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5)
+ #define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6)
+ #define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7)
+ #define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8)
+ #define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9)
+ #define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10)
+ #define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11)
+ #define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12)
+ #define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13)
+ #define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14)
+ #define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15)
+ #define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16)
+ #define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17)
+ #define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18)
+ #define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19)
+ #define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20)
+ #define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21)
+ #define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22)
+ #define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23)
+ #define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24)
+ #define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25)
+ #define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26)
+ #define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27)
+ #define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28)
+ #define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29)
+ #define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30)
+ #define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31)
+
+ #define AT91_PIN_PC0 (PIN_BASE + 0x40 + 0)
+ #define AT91_PIN_PC1 (PIN_BASE + 0x40 + 1)
+ #define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2)
+ #define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3)
+ #define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4)
+ #define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5)
+ #define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6)
+ #define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7)
+ #define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8)
+ #define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9)
+ #define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10)
+ #define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11)
+ #define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12)
+ #define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13)
+ #define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14)
+ #define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15)
+ #define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16)
+ #define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17)
+ #define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18)
+ #define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19)
+ #define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20)
+ #define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21)
+ #define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22)
+ #define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23)
+ #define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24)
+ #define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25)
+ #define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26)
+ #define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27)
+ #define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28)
+ #define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29)
+ #define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30)
+ #define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31)
+
+ #define AT91_PIN_PD0 (PIN_BASE + 0x60 + 0)
+ #define AT91_PIN_PD1 (PIN_BASE + 0x60 + 1)
+ #define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2)
+ #define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3)
+ #define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4)
+ #define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5)
+ #define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6)
+ #define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7)
+ #define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8)
+ #define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9)
+ #define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10)
+ #define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11)
+ #define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12)
+ #define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13)
+ #define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14)
+ #define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15)
+ #define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16)
+ #define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17)
+ #define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18)
+ #define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19)
+ #define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20)
+ #define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21)
+ #define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22)
+ #define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23)
+ #define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24)
+ #define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25)
+ #define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26)
+ #define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27)
+ #define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28)
+ #define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29)
+ #define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30)
+ #define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31)
+
+ #define AT91_PIN_PE0 (PIN_BASE + 0x80 + 0)
+ #define AT91_PIN_PE1 (PIN_BASE + 0x80 + 1)
+ #define AT91_PIN_PE2 (PIN_BASE + 0x80 + 2)
+ #define AT91_PIN_PE3 (PIN_BASE + 0x80 + 3)
+ #define AT91_PIN_PE4 (PIN_BASE + 0x80 + 4)
+ #define AT91_PIN_PE5 (PIN_BASE + 0x80 + 5)
+ #define AT91_PIN_PE6 (PIN_BASE + 0x80 + 6)
+ #define AT91_PIN_PE7 (PIN_BASE + 0x80 + 7)
+ #define AT91_PIN_PE8 (PIN_BASE + 0x80 + 8)
+ #define AT91_PIN_PE9 (PIN_BASE + 0x80 + 9)
+ #define AT91_PIN_PE10 (PIN_BASE + 0x80 + 10)
+ #define AT91_PIN_PE11 (PIN_BASE + 0x80 + 11)
+ #define AT91_PIN_PE12 (PIN_BASE + 0x80 + 12)
+ #define AT91_PIN_PE13 (PIN_BASE + 0x80 + 13)
+ #define AT91_PIN_PE14 (PIN_BASE + 0x80 + 14)
+ #define AT91_PIN_PE15 (PIN_BASE + 0x80 + 15)
+ #define AT91_PIN_PE16 (PIN_BASE + 0x80 + 16)
+ #define AT91_PIN_PE17 (PIN_BASE + 0x80 + 17)
+ #define AT91_PIN_PE18 (PIN_BASE + 0x80 + 18)
+ #define AT91_PIN_PE19 (PIN_BASE + 0x80 + 19)
+ #define AT91_PIN_PE20 (PIN_BASE + 0x80 + 20)
+ #define AT91_PIN_PE21 (PIN_BASE + 0x80 + 21)
+ #define AT91_PIN_PE22 (PIN_BASE + 0x80 + 22)
+ #define AT91_PIN_PE23 (PIN_BASE + 0x80 + 23)
+ #define AT91_PIN_PE24 (PIN_BASE + 0x80 + 24)
+ #define AT91_PIN_PE25 (PIN_BASE + 0x80 + 25)
+ #define AT91_PIN_PE26 (PIN_BASE + 0x80 + 26)
+ #define AT91_PIN_PE27 (PIN_BASE + 0x80 + 27)
+ #define AT91_PIN_PE28 (PIN_BASE + 0x80 + 28)
+ #define AT91_PIN_PE29 (PIN_BASE + 0x80 + 29)
+ #define AT91_PIN_PE30 (PIN_BASE + 0x80 + 30)
+ #define AT91_PIN_PE31 (PIN_BASE + 0x80 + 31)
+
+ #ifndef __ASSEMBLY__
+ /* setup setup routines, called from board init or driver probe() */
++extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup);
+ extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
+ extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
+ extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
+ extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
+ extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
+ extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
+
+ /* callable at any time */
+ extern int at91_set_gpio_value(unsigned pin, int value);
+ extern int at91_get_gpio_value(unsigned pin);
+
+ /* callable only from core power-management code */
+ extern void at91_gpio_suspend(void);
+ extern void at91_gpio_resume(void);
-#endif
+
++/*-------------------------------------------------------------------------*/
++
++/* wrappers for "new style" GPIO calls. the old AT91-specfic ones should
++ * eventually be removed (along with this errno.h inclusion), and the
++ * gpio request/free calls should probably be implemented.
++ */
++
++#include <asm/errno.h>
++
++static inline int gpio_request(unsigned gpio, const char *label)
++{
++ return 0;
++}
++
++static inline void gpio_free(unsigned gpio)
++{
++}
++
++extern int gpio_direction_input(unsigned gpio);
++extern int gpio_direction_output(unsigned gpio);
+
++static inline int gpio_get_value(unsigned gpio)
++{
++ return at91_get_gpio_value(gpio);
++}
++
++static inline void gpio_set_value(unsigned gpio, int value)
++{
++ at91_set_gpio_value(gpio, value);
++}
++
++#include <asm-generic/gpio.h> /* cansleep wrappers */
++
++static inline int gpio_to_irq(unsigned gpio)
++{
++ return gpio;
++}
++
++static inline int irq_to_gpio(unsigned irq)
++{
++ return irq;
++}
++
++#endif /* __ASSEMBLY__ */
++
++#endif
#define AACI_DR4 0x0f0 /* data read/written fifo 4 */
/*
- * transmit fifo control register. P48
+ * TX/RX fifo control register (CR). P48
*/
- #define TXCR_FEN (1 << 16) /* fifo enable */
- #define TXCR_COMPACT (1 << 15) /* compact mode */
- #define TXCR_TSZ16 (0 << 13) /* 16 bits */
- #define TXCR_TSZ18 (1 << 13) /* 18 bits */
- #define TXCR_TSZ20 (2 << 13) /* 20 bits */
- #define TXCR_TSZ12 (3 << 13) /* 12 bits */
- #define TXCR_TX12 (1 << 12) /* transmits slot 12 */
- #define TXCR_TX11 (1 << 11) /* transmits slot 12 */
- #define TXCR_TX10 (1 << 10) /* transmits slot 12 */
- #define TXCR_TX9 (1 << 9) /* transmits slot 12 */
- #define TXCR_TX8 (1 << 8) /* transmits slot 12 */
- #define TXCR_TX7 (1 << 7) /* transmits slot 12 */
- #define TXCR_TX6 (1 << 6) /* transmits slot 12 */
- #define TXCR_TX5 (1 << 5) /* transmits slot 12 */
- #define TXCR_TX4 (1 << 4) /* transmits slot 12 */
- #define TXCR_TX3 (1 << 3) /* transmits slot 12 */
- #define TXCR_TX2 (1 << 2) /* transmits slot 12 */
- #define TXCR_TX1 (1 << 1) /* transmits slot 12 */
- #define TXCR_TXEN (1 << 0) /* transmit enable */
+ #define CR_FEN (1 << 16) /* fifo enable */
+ #define CR_COMPACT (1 << 15) /* compact mode */
+ #define CR_SZ16 (0 << 13) /* 16 bits */
+ #define CR_SZ18 (1 << 13) /* 18 bits */
+ #define CR_SZ20 (2 << 13) /* 20 bits */
+ #define CR_SZ12 (3 << 13) /* 12 bits */
+ #define CR_SL12 (1 << 12)
+ #define CR_SL11 (1 << 11)
+ #define CR_SL10 (1 << 10)
+ #define CR_SL9 (1 << 9)
+ #define CR_SL8 (1 << 8)
+ #define CR_SL7 (1 << 7)
+ #define CR_SL6 (1 << 6)
+ #define CR_SL5 (1 << 5)
+ #define CR_SL4 (1 << 4)
+ #define CR_SL3 (1 << 3)
+ #define CR_SL2 (1 << 2)
+ #define CR_SL1 (1 << 1)
+ #define CR_EN (1 << 0) /* transmit enable */
/*
* status register bits. P49
/* AC'97 */
struct mutex ac97_sem;
- ac97_bus_t *ac97_bus;
- ac97_t *ac97;
+ struct snd_ac97_bus *ac97_bus;
++ struct snd_ac97 *ac97;
u32 maincr;
spinlock_t lock;