Commit 741249e9 authored by Frank Becker's avatar Frank Becker Committed by Russell King

[ARM PATCH] 1748/1: SA Cerfcube update (base+pcmica)

Patch from Frank Becker

Resubmit with updates according to review notes from 1701/1.
parent 123c725f
This diff is collapsed.
/*
* linux/arch/arm/mach-sa1100/cerf.c
*
* 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.
*
* Apr-2003 : Removed some old PDA crud [FB]
* Oct-2003 : Added uart2 resource [FB]
* Jan-2004 : Removed io map for flash [FB]
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/device.h>
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/serial_sa1100.h>
#include <asm/arch/cerf.h>
#include "generic.h"
static struct resource cerfuart2_resources[] = {
[0] = {
.start = 0x80030000,
.end = 0x8003ffff,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device cerfuart2_device = {
.name = "sa11x0-uart",
.id = 2,
.num_resources = ARRAY_SIZE(cerfuart2_resources),
.resource = cerfuart2_resources,
};
static struct platform_device *cerf_devices[] __initdata = {
&cerfuart2_device,
};
static void __init cerf_init_irq(void)
{
sa1100_init_irq();
/* Need to register these as rising edge interrupts
* For standard 16550 serial driver support
* Basically - I copied it from pfs168.c :)
*/
#ifdef CONFIG_SA1100_CERF_CPLD
/* PDA Full serial port */
set_irq_type(IRQ_GPIO3, IRQT_RISING);
/* PDA Bluetooth */
set_irq_type(IRQ_GPIO2, IRQT_RISING);
#endif /* CONFIG_SA1100_CERF_CPLD */
set_irq_type(IRQ_GPIO_UCB1200_IRQ, IRQT_RISING);
set_irq_type(CERF_ETH_IRQ, IRQT_RISING);
}
static struct map_desc cerf_io_desc[] __initdata = {
/* virtual physical length type */
{ 0xf0000000, 0x08000000, 0x00100000, MT_DEVICE } /* Crystal Ethernet Chip */
#ifdef CONFIG_SA1100_CERF_CPLD
,{ 0xf1000000, 0x40000000, 0x00100000, MT_DEVICE }, /* CPLD Chip */
{ 0xf2000000, 0x10000000, 0x00100000, MT_DEVICE }, /* CerfPDA Bluetooth */
{ 0xf3000000, 0x18000000, 0x00100000, MT_DEVICE } /* CerfPDA Serial */
#endif
};
static void __init cerf_map_io(void)
......@@ -51,21 +64,30 @@ static void __init cerf_map_io(void)
iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
sa1100_register_uart(0, 3);
#ifdef CONFIG_SA1100_CERF_IRDA_ENABLED
sa1100_register_uart(1, 1);
#else
sa1100_register_uart(1, 2);
sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
sa1100_register_uart(2, 1);
#endif
/* set some GPDR bits here while it's safe */
GPDR |= GPIO_CF_RESET;
#ifdef CONFIG_SA1100_CERF_CPLD
GPDR |= GPIO_PWR_SHUTDOWN;
#endif
GPDR |= CERF_GPIO_CF_RESET;
}
MACHINE_START(CERF, "Intrinsyc's Cerf Family of Products")
static int __init cerf_init(void)
{
int ret;
if (!machine_is_cerf())
return -ENODEV;
ret = platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
if (ret < 0)
return ret;
return 0;
}
arch_initcall(cerf_init);
MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
MAINTAINER("support@intrinsyc.com")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(cerf_map_io)
......
......@@ -11,27 +11,25 @@
#include <linux/sched.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/arch/cerf.h>
#include "sa1100_generic.h"
#ifdef CONFIG_SA1100_CERF_CPLD
#define CERF_SOCKET 0
#else
#define CERF_SOCKET 1
#endif
static struct pcmcia_irqs irqs[] = {
{ CERF_SOCKET, IRQ_GPIO_CF_CD, "CF_CD" },
{ CERF_SOCKET, IRQ_GPIO_CF_BVD2, "CF_BVD2" },
{ CERF_SOCKET, IRQ_GPIO_CF_BVD1, "CF_BVD1" }
{ CERF_SOCKET, CERF_IRQ_GPIO_CF_CD, "CF_CD" },
{ CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD2, "CF_BVD2" },
{ CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD1, "CF_BVD1" }
};
static int cerf_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
{
skt->irq = IRQ_GPIO_CF_IRQ;
skt->irq = CERF_IRQ_GPIO_CF_IRQ;
return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
......@@ -46,13 +44,13 @@ cerf_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *
{
unsigned long levels = GPLR;
state->detect=((levels & GPIO_CF_CD)==0)?1:0;
state->ready=(levels & GPIO_CF_IRQ)?1:0;
state->bvd1=(levels & GPIO_CF_BVD1)?1:0;
state->bvd2=(levels & GPIO_CF_BVD2)?1:0;
state->wrprot=0;
state->vs_3v=1;
state->vs_Xv=0;
state->detect = (levels & CERF_GPIO_CF_CD) ?0:1;
state->ready = (levels & CERF_GPIO_CF_IRQ) ?1:0;
state->bvd1 = (levels & CERF_GPIO_CF_BVD1)?1:0;
state->bvd2 = (levels & CERF_GPIO_CF_BVD2)?1:0;
state->wrprot = 0;
state->vs_3v = 1;
state->vs_Xv = 0;
}
static int
......@@ -61,13 +59,8 @@ cerf_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
{
switch (state->Vcc) {
case 0:
break;
case 50:
case 33:
#ifdef CONFIG_SA1100_CERF_CPLD
GPCR = GPIO_PWR_SHUTDOWN;
#endif
break;
default:
......@@ -77,13 +70,9 @@ cerf_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
}
if (state->flags & SS_RESET) {
#ifdef CONFIG_SA1100_CERF_CPLD
GPSR = GPIO_CF_RESET;
#endif
GPSR = CERF_GPIO_CF_RESET;
} else {
#ifdef CONFIG_SA1100_CERF_CPLD
GPCR = GPIO_CF_RESET;
#endif
GPCR = CERF_GPIO_CF_RESET;
}
return 0;
......@@ -101,8 +90,8 @@ static void cerf_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
static struct pcmcia_low_level cerf_pcmcia_ops = {
.owner = THIS_MODULE,
.init = cerf_pcmcia_hw_init,
.shutdown = cerf_pcmcia_hw_shutdown,
.hw_init = cerf_pcmcia_hw_init,
.hw_shutdown = cerf_pcmcia_hw_shutdown,
.socket_state = cerf_pcmcia_socket_state,
.configure_socket = cerf_pcmcia_configure_socket,
......
/*
* include/asm-arm/arch-sa1100/cerf.h
*
* 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.
*
* Apr-2003 : Removed some old PDA crud [FB]
*/
#ifndef _INCLUDE_CERF_H_
#define _INCLUDE_CERF_H_
#include <linux/config.h>
#ifdef CONFIG_SA1100_CERF_CPLD
#define CERF_ETH_IO 0xf0000000
#define CERF_ETH_IRQ IRQ_GPIO26
#define CERF_GPIO_CF_BVD2 GPIO_GPIO (19)
#define CERF_GPIO_CF_BVD1 GPIO_GPIO (20)
#define CERF_GPIO_CF_RESET GPIO_GPIO (21)
#define CERF_GPIO_CF_IRQ GPIO_GPIO (22)
#define CERF_GPIO_CF_CD GPIO_GPIO (23)
// Map sa1100fb.c to sa1100_frontlight.c - Not pretty, but necessary.
#define CERF_BACKLIGHT_ENABLE sa1100_fl_enable
#define CERF_BACKLIGHT_DISABLE sa1100_fl_disable
//
// IO Pins for devices
//
#define CERF_PDA_CPLD 0xf1000000
#define CERF_PDA_CPLD_WRCLRINT (0x0)
#define CERF_PDA_CPLD_BACKLIGHT (0x2)
#define CERF_PDA_CPLD_SOUND_FREQ (0x4)
#define CERF_PDA_CPLD_KEYPAD_A (0x6)
#define CERF_PDA_CPLD_BATTFAULT (0x8)
#define CERF_PDA_CPLD_KEYPAD_B (0xa)
#define CERF_PDA_CPLD_SOUND_ENA (0xc)
#define CERF_PDA_CPLD_SOUND_RESET (0xe)
#define GPIO_CF_BVD2 GPIO_GPIO (5)
#define GPIO_CF_BVD1 GPIO_GPIO (6)
#define GPIO_CF_RESET GPIO_GPIO (7)
#define GPIO_CF_IRQ GPIO_GPIO (8)
#define GPIO_CF_CD GPIO_GPIO (9)
#define GPIO_PWR_SHUTDOWN GPIO_GPIO (25)
#define UCB1200_GPIO_CONT_CS 0x0001
#define UCB1200_GPIO_CONT_DOWN 0x0002
#define UCB1200_GPIO_CONT_INC 0x0004
#define UCB1200_GPIO_CONT_ENA 0x0008
#define UCB1200_GPIO_LCD_RESET 0x0010
#define UCB1200_GPIO_IRDA_ENABLE 0x0020
#define UCB1200_GPIO_BT_ENABLE 0x0040
#define UCB1200_GPIO_L3_DATA 0x0080
#define UCB1200_GPIO_L3_CLOCK 0x0100
#define UCB1200_GPIO_L3_MODE 0x0200
//
// IRQ for devices
//
#define IRQ_UCB1200_CONT_CS IRQ_UCB1200_IO0
#define IRQ_UCB1200_CONT_DOWN IRQ_UCB1200_IO1
#define IRQ_UCB1200_CONT_INC IRQ_UCB1200_IO2
#define IRQ_UCB1200_CONT_ENA IRQ_UCB1200_IO3
#define IRQ_UCB1200_LCD_RESET IRQ_UCB1200_IO4
#define IRQ_UCB1200_IRDA_ENABLE IRQ_UCB1200_IO5
#define IRQ_UCB1200_BT_ENABLE IRQ_UCB1200_IO6
#define IRQ_UCB1200_L3_DATA IRQ_UCB1200_IO7
#define IRQ_UCB1200_L3_CLOCK IRQ_UCB1200_IO8
#define IRQ_UCB1200_L3_MODE IRQ_UCB1200_IO9
#define IRQ_GPIO_CF_BVD2 IRQ_GPIO5
#define IRQ_GPIO_CF_BVD1 IRQ_GPIO6
#define IRQ_GPIO_CF_IRQ IRQ_GPIO8
#define IRQ_GPIO_CF_CD IRQ_GPIO9
//
// Device parameters
//
#define CERF_PDA_CPLD_SOUND_FREQ_8000 (0x01)
#define CERF_PDA_CPLD_SOUND_FREQ_11025 (0x05)
#define CERF_PDA_CPLD_SOUND_FREQ_16000 (0x02)
#define CERF_PDA_CPLD_SOUND_FREQ_22050 (0x06)
#define CERF_PDA_CPLD_SOUND_FREQ_32000 (0x03)
#define CERF_PDA_CPLD_SOUND_FREQ_44100 (0x07)
#define CERF_PDA_CPLD_SOUND_FREQ_48000 (0x0b)
//
// General Functions
//
#define CERF_PDA_CPLD_Get(x, y) (*((char*)(CERF_PDA_CPLD + (x))) & (y))
#define CERF_PDA_CPLD_Set(x, y, z) (*((char*)(CERF_PDA_CPLD + (x))) = (*((char*)(CERF_PDA_CPLD + (x))) & ~(z)) | (y))
#define CERF_PDA_CPLD_UnSet(x, y, z) (*((char*)(CERF_PDA_CPLD + (x))) = (*((char*)(CERF_PDA_CPLD + (x))) & ~(z)) & ~(y))
#else // CONFIG_SA1100_CERF_CPLD
#define GPIO_CF_BVD2 GPIO_GPIO (19)
#define GPIO_CF_BVD1 GPIO_GPIO (20)
#define GPIO_CF_RESET 0
#define GPIO_CF_IRQ GPIO_GPIO (22)
#define GPIO_CF_CD GPIO_GPIO (23)
#define GPIO_LCD_RESET GPIO_GPIO (15)
#define IRQ_GPIO_CF_BVD2 IRQ_GPIO19
#define IRQ_GPIO_CF_BVD1 IRQ_GPIO20
#define IRQ_GPIO_CF_IRQ IRQ_GPIO22
#define IRQ_GPIO_CF_CD IRQ_GPIO23
#endif // CONFIG_SA1100_CERF_CPLD
#define GPIO_UCB1200_IRQ GPIO_GPIO (18)
#define IRQ_GPIO_UCB1200_IRQ IRQ_GPIO18
#define CERF_IRQ_GPIO_CF_BVD2 IRQ_GPIO19
#define CERF_IRQ_GPIO_CF_BVD1 IRQ_GPIO20
#define CERF_IRQ_GPIO_CF_IRQ IRQ_GPIO22
#define CERF_IRQ_GPIO_CF_CD IRQ_GPIO23
#endif // _INCLUDE_CERF_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment