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