2 * linux/drivers/pcmcia/mx31ads-pcmcia.h
4 * Copyright 2005-2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 * This file contains definitions for the PCMCIA support code common to
7 * integrated SOCs like the i.Mx31 microprocessors.
9 #ifndef _ASM_ARCH_PCMCIA
10 #define _ASM_ARCH_PCMCIA
12 /* include the world */
13 #include <linux/cpufreq.h>
14 #include <pcmcia/cs_types.h>
15 #include <pcmcia/cs.h>
16 #include <pcmcia/ss.h>
17 #include <pcmcia/cistpl.h>
18 #include "cs_internal.h"
20 #define MX31ADS_PCMCIA "Mx31ads_pcmcia_socket"
23 struct pcmcia_low_level;
26 * This structure encapsulates per-socket state which we might need to
27 * use when responding to a Card Services query of some kind.
29 struct mx31ads_pcmcia_socket {
30 struct pcmcia_socket socket;
33 * Info from low level handler
44 struct pcmcia_low_level *ops;
47 unsigned int pre_stat;
48 socket_state_t cs_state;
50 unsigned short spd_io[MAX_IO_WIN];
51 unsigned short spd_mem[MAX_WIN];
52 unsigned short spd_attr[MAX_WIN];
54 struct resource res_skt;
55 struct resource res_io;
56 struct resource res_mem;
57 struct resource res_attr;
60 unsigned int irq_state;
62 struct timer_list poll_timer;
63 struct list_head node;
68 ready:1, bvd1:1, bvd2:1, wrprot:1, vs_3v:1, vs_Xv:1, poweron:1;
71 struct pcmcia_low_level {
74 /* first socket in system */
79 int (*hw_init) (struct mx31ads_pcmcia_socket *);
80 void (*hw_shutdown) (struct mx31ads_pcmcia_socket *);
82 void (*socket_state) (struct mx31ads_pcmcia_socket *,
83 struct pcmcia_state *);
84 int (*configure_socket) (struct mx31ads_pcmcia_socket *,
85 const socket_state_t *);
88 * Enable card status IRQs on (re-)initialisation. This can
89 * be called at initialisation, power management event, or
92 void (*socket_init) (struct mx31ads_pcmcia_socket *);
95 * Disable card status IRQs and PCMCIA bus on suspend.
97 void (*socket_suspend) (struct mx31ads_pcmcia_socket *);
100 * Hardware specific timing routines.
101 * If provided, the get_timing routine overrides the SOC default.
103 unsigned int (*get_timing) (struct mx31ads_pcmcia_socket *,
104 unsigned int, unsigned int);
105 int (*set_timing) (struct mx31ads_pcmcia_socket *);
106 int (*show_timing) (struct mx31ads_pcmcia_socket *, char *);
108 #ifdef CONFIG_CPU_FREQ
112 int (*frequency_change) (struct mx31ads_pcmcia_socket *, unsigned long,
113 struct cpufreq_freqs *);
117 struct mx31ads_pcmcia_timing {
129 * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
130 * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
131 * a minimum value of 165ns, as well. Section 4.7.2 (describing
132 * common and attribute memory write timing) says that twWE has a
133 * minimum value of 150ns for a 250ns cycle time (for 5V operation;
134 * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
135 * operation, also section 4.7.4). Section 4.7.3 says that taOE
136 * has a maximum value of 150ns for a 300ns cycle time (for 5V
137 * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
139 * When configuring memory maps, Card Services appears to adopt the policy
140 * that a memory access time of "0" means "use the default." The default
141 * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
142 * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
143 * memory command width time is 300ns.
145 #define PCMCIA_IO_ACCESS (165)
146 #define PCMCIA_5V_MEM_ACCESS (150)
147 #define PCMCIA_3V_MEM_ACCESS (300)
148 #define PCMCIA_ATTR_MEM_ACCESS (300)
151 * The socket driver actually works nicely in interrupt-driven form,
152 * so the (relatively infrequent) polling is "just to be sure."
154 #define PCMCIA_POLL_PERIOD (2*HZ)