1*cbab9cadSchs /* $Id: imx_pcic.h,v 1.3 2012/10/27 17:17:39 chs Exp $ */ 2825088edSmatt 3825088edSmatt /* 4825088edSmatt * IMX CF interface to pcic/pcmcia 5825088edSmatt * derived from pxa2x0_pcic 6825088edSmatt * Sun Apr 1 21:42:37 PDT 2007 7825088edSmatt */ 8825088edSmatt 9*cbab9cadSchs /* $NetBSD: imx_pcic.h,v 1.3 2012/10/27 17:17:39 chs Exp $ */ 10825088edSmatt /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */ 11825088edSmatt 12825088edSmatt /* 13825088edSmatt * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> 14825088edSmatt * 15825088edSmatt * Permission to use, copy, modify, and distribute this software for any 16825088edSmatt * purpose with or without fee is hereby granted, provided that the above 17825088edSmatt * copyright notice and this permission notice appear in all copies. 18825088edSmatt * 19825088edSmatt * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20825088edSmatt * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21825088edSmatt * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22825088edSmatt * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23825088edSmatt * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24825088edSmatt * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 25825088edSmatt * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26825088edSmatt */ 27825088edSmatt 28825088edSmatt #ifndef _IMX_PCIC_H_ 29825088edSmatt #define _IMX_PCIC_H_ 30825088edSmatt 31825088edSmatt struct imx_pcic_socket { 32825088edSmatt struct imx_pcic_softc *sc; 33825088edSmatt int socket; /* socket number */ 34*cbab9cadSchs device_t pcmcia; 35825088edSmatt struct lwp *event_thread; 36825088edSmatt 37825088edSmatt int flags; 38825088edSmatt int power_capability; /* IMX_PCIC_POWER_3V | IMX_PCIC_POWER_5V */ 39825088edSmatt 40825088edSmatt int irqpin; 41825088edSmatt void *irq; 42825088edSmatt 43825088edSmatt void *pcictag_cookie; /* opaque data for pcictag functions */ 44825088edSmatt struct imx_pcic_tag *pcictag; 45825088edSmatt }; 46825088edSmatt 47825088edSmatt /* event */ 48825088edSmatt #define IMX_PCIC_EVENT_INSERTION 0 49825088edSmatt #define IMX_PCIC_EVENT_REMOVAL 1 50825088edSmatt 51825088edSmatt /* flags */ 52825088edSmatt #define IMX_PCIC_FLAG_CARDD 0 53825088edSmatt #define IMX_PCIC_FLAG_CARDP 1 54825088edSmatt 55825088edSmatt struct imx_pcic_tag { 56825088edSmatt u_int (*read)(struct imx_pcic_socket *, int); 57825088edSmatt void (*write)(struct imx_pcic_socket *, int, u_int); 58825088edSmatt void (*set_power)(struct imx_pcic_socket *, int); 59825088edSmatt void (*clear_intr)(struct imx_pcic_socket *); 60825088edSmatt void *(*intr_establish)(struct imx_pcic_socket *, int, 61825088edSmatt int (*)(void *), void *); 62825088edSmatt void (*intr_disestablish)(struct imx_pcic_socket *, void *); 63825088edSmatt }; 64825088edSmatt 65825088edSmatt #ifdef NOTYET 66825088edSmatt /* pcictag registers and their values */ 67825088edSmatt #define IMX_PCIC_CARD_STATUS 0 68825088edSmatt #define IMX_PCIC_CARD_INVALID 0 69825088edSmatt #define IMX_PCIC_CARD_VALID 1 70825088edSmatt #define IMX_PCIC_CARD_READY 1 71825088edSmatt #define IMX_PCIC_CARD_POWER 2 72825088edSmatt #define IMX_PCIC_POWER_OFF 0 73825088edSmatt #define IMX_PCIC_POWER_3V 1 74825088edSmatt #define IMX_PCIC_POWER_5V 2 75825088edSmatt #define IMX_PCIC_CARD_RESET 3 76825088edSmatt #endif 77825088edSmatt 78825088edSmatt #define IMX_PCIC_NSLOT 1 /* ??? */ 79825088edSmatt 80825088edSmatt struct imx_pcic_softc { 81*cbab9cadSchs device_t sc_dev; 82825088edSmatt struct imx_pcic_socket sc_socket[IMX_PCIC_NSLOT]; 83825088edSmatt 84825088edSmatt bus_space_tag_t sc_iot; 85825088edSmatt bus_space_handle_t sc_memctl_ioh; 86825088edSmatt 87825088edSmatt bus_addr_t sc_pa; 88825088edSmatt 89825088edSmatt void *sc_irq; 90825088edSmatt int sc_shutdown; 91825088edSmatt int sc_nslots; 92825088edSmatt int sc_irqpin[IMX_PCIC_NSLOT]; 93825088edSmatt int sc_irqcfpin[IMX_PCIC_NSLOT]; 94825088edSmatt 95825088edSmatt u_int sc_flags; 96825088edSmatt #define PPF_REVERSE_ORDER (1 << 0) 97825088edSmatt }; 98825088edSmatt 99825088edSmatt void imx_pcic_attach_common(struct imx_pcic_softc *, 100825088edSmatt void (*socket_setup_hook)(struct imx_pcic_socket *)); 101825088edSmatt int imx_pcic_intr(void *); 102825088edSmatt void imx_pcic_create_event_thread(void *); 103825088edSmatt 104825088edSmatt #endif /* _IMX_PCIC_H_ */ 105