1 /* $Id: imx_pcic.h,v 1.2 2008/04/27 18:58:44 matt Exp $ */ 2 3 /* 4 * IMX CF interface to pcic/pcmcia 5 * derived from pxa2x0_pcic 6 * Sun Apr 1 21:42:37 PDT 2007 7 */ 8 9 /* $NetBSD: imx_pcic.h,v 1.2 2008/04/27 18:58:44 matt Exp $ */ 10 /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */ 11 12 /* 13 * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> 14 * 15 * Permission to use, copy, modify, and distribute this software for any 16 * purpose with or without fee is hereby granted, provided that the above 17 * copyright notice and this permission notice appear in all copies. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 25 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 */ 27 28 #ifndef _IMX_PCIC_H_ 29 #define _IMX_PCIC_H_ 30 31 struct imx_pcic_socket { 32 struct imx_pcic_softc *sc; 33 int socket; /* socket number */ 34 struct device *pcmcia; 35 struct lwp *event_thread; 36 37 int flags; 38 int power_capability; /* IMX_PCIC_POWER_3V | IMX_PCIC_POWER_5V */ 39 40 int irqpin; 41 void *irq; 42 43 void *pcictag_cookie; /* opaque data for pcictag functions */ 44 struct imx_pcic_tag *pcictag; 45 }; 46 47 /* event */ 48 #define IMX_PCIC_EVENT_INSERTION 0 49 #define IMX_PCIC_EVENT_REMOVAL 1 50 51 /* flags */ 52 #define IMX_PCIC_FLAG_CARDD 0 53 #define IMX_PCIC_FLAG_CARDP 1 54 55 struct imx_pcic_tag { 56 u_int (*read)(struct imx_pcic_socket *, int); 57 void (*write)(struct imx_pcic_socket *, int, u_int); 58 void (*set_power)(struct imx_pcic_socket *, int); 59 void (*clear_intr)(struct imx_pcic_socket *); 60 void *(*intr_establish)(struct imx_pcic_socket *, int, 61 int (*)(void *), void *); 62 void (*intr_disestablish)(struct imx_pcic_socket *, void *); 63 }; 64 65 #ifdef NOTYET 66 /* pcictag registers and their values */ 67 #define IMX_PCIC_CARD_STATUS 0 68 #define IMX_PCIC_CARD_INVALID 0 69 #define IMX_PCIC_CARD_VALID 1 70 #define IMX_PCIC_CARD_READY 1 71 #define IMX_PCIC_CARD_POWER 2 72 #define IMX_PCIC_POWER_OFF 0 73 #define IMX_PCIC_POWER_3V 1 74 #define IMX_PCIC_POWER_5V 2 75 #define IMX_PCIC_CARD_RESET 3 76 #endif 77 78 #define IMX_PCIC_NSLOT 1 /* ??? */ 79 80 struct imx_pcic_softc { 81 struct device sc_dev; 82 struct imx_pcic_socket sc_socket[IMX_PCIC_NSLOT]; 83 84 bus_space_tag_t sc_iot; 85 bus_space_handle_t sc_memctl_ioh; 86 87 bus_addr_t sc_pa; 88 89 void *sc_irq; 90 int sc_shutdown; 91 int sc_nslots; 92 int sc_irqpin[IMX_PCIC_NSLOT]; 93 int sc_irqcfpin[IMX_PCIC_NSLOT]; 94 95 u_int sc_flags; 96 #define PPF_REVERSE_ORDER (1 << 0) 97 }; 98 99 void imx_pcic_attach_common(struct imx_pcic_softc *, 100 void (*socket_setup_hook)(struct imx_pcic_socket *)); 101 int imx_pcic_intr(void *); 102 void imx_pcic_create_event_thread(void *); 103 104 #endif /* _IMX_PCIC_H_ */ 105