3 * Alchemy Semi Hydrogen III board specific pcmcia routines.
7 * Alchemy Semi Hyd1100 board specific pcmcia routines.
9 * Copyright 2002 MontaVista Software Inc.
10 * Author: MontaVista Software, Inc.
11 * ppopov@mvista.com or source@mvista.com
13 * ########################################################################
15 * This program is free software; you can distribute it and/or modify it
16 * under the terms of the GNU General Public License (Version 2) as
17 * published by the Free Software Foundation.
19 * This program is distributed in the hope it will be useful, but WITHOUT
20 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 * ########################################################################
32 #include <linux/module.h>
33 #include <linux/init.h>
34 #include <linux/config.h>
35 #include <linux/delay.h>
36 #include <linux/ioport.h>
37 #include <linux/kernel.h>
38 #include <linux/tqueue.h>
39 #include <linux/timer.h>
41 #include <linux/proc_fs.h>
42 #include <linux/version.h>
43 #include <linux/types.h>
45 #include <pcmcia/version.h>
46 #include <pcmcia/cs_types.h>
47 #include <pcmcia/cs.h>
48 #include <pcmcia/ss.h>
49 #include <pcmcia/bulkmem.h>
50 #include <pcmcia/cistpl.h>
51 #include <pcmcia/bus_ops.h>
52 #include "cs_internal.h"
56 #include <asm/system.h>
58 #include <asm/au1000.h>
59 #include <asm/au1000_pcmcia.h>
61 #include <asm/db1x00.h>
63 #define PCMCIA_MAX_SOCK 0
64 //#include <asm/hyd1100.h>
67 static int hydrogen3_pcmcia_init(struct pcmcia_init *init)
70 writel(0x00020002, GPIO2_OUTPUT); // GPIO_201 CF_PWR
74 static int hydrogen3_pcmcia_shutdown(void)
77 writel(0x00020000, GPIO2_OUTPUT); // GPIO_201 CF_PWR
82 hydrogen3_pcmcia_socket_state(unsigned sock, struct pcmcia_state *state)
85 inserted = (readl(SYS_PINSTATERD) & (1<<22)) ? 0 : 1; // GPIO_22 is CF_DETECT
106 static int hydrogen3_pcmcia_get_irq_info(struct pcmcia_irq_info *info)
109 if(info->sock > PCMCIA_MAX_SOCK) return -1;
112 info->irq = AU1000_GPIO_21;
121 hydrogen3_pcmcia_configure_socket(const struct pcmcia_configure *configure)
123 if(configure->sock > PCMCIA_MAX_SOCK) return -1;
127 if (!configure->reset) {
129 writel(0x00010000, GPIO2_OUTPUT); // GPIO_200 CF_RESET
134 writel(0x00010001, GPIO2_OUTPUT); // GPIO_200 CF_RESET
140 struct pcmcia_low_level au1x00_pcmcia_ops = {
141 hydrogen3_pcmcia_init,
142 hydrogen3_pcmcia_shutdown,
143 hydrogen3_pcmcia_socket_state,
144 hydrogen3_pcmcia_get_irq_info,
145 hydrogen3_pcmcia_configure_socket
148 struct pcmcia_low_level *
149 hydrogen3_get_pcmcia_ops(void)
151 return &au1x00_pcmcia_ops;