18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * FILE NAME 38c2ecf20Sopenharmony_ci * drivers/pcmcia/vrc4173_cardu.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * BRIEF MODULE DESCRIPTION 68c2ecf20Sopenharmony_ci * Include file for NEC VRC4173 CARDU. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright 2002 Yoichi Yuasa <yuasa@linux-mips.org> 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 118c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 128c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 138c2ecf20Sopenharmony_ci * option) any later version. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 168c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 178c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 188c2ecf20Sopenharmony_ci * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 198c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 208c2ecf20Sopenharmony_ci * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 218c2ecf20Sopenharmony_ci * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 228c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 238c2ecf20Sopenharmony_ci * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 248c2ecf20Sopenharmony_ci * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 278c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 288c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci#ifndef _VRC4173_CARDU_H 318c2ecf20Sopenharmony_ci#define _VRC4173_CARDU_H 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include <linux/pci.h> 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#include <pcmcia/ss.h> 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define CARDU_MAX_SOCKETS 2 388c2ecf20Sopenharmony_ci#define CARDU1 0 398c2ecf20Sopenharmony_ci#define CARDU2 1 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* 428c2ecf20Sopenharmony_ci * PCI Configuration Registers 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci#define BRGCNT 0x3e 458c2ecf20Sopenharmony_ci #define POST_WR_EN 0x0400 468c2ecf20Sopenharmony_ci #define MEM1_PREF_EN 0x0200 478c2ecf20Sopenharmony_ci #define MEM0_PREF_EN 0x0100 488c2ecf20Sopenharmony_ci #define IREQ_INT 0x0080 498c2ecf20Sopenharmony_ci #define CARD_RST 0x0040 508c2ecf20Sopenharmony_ci #define MABORT_MODE 0x0020 518c2ecf20Sopenharmony_ci #define VGA_EN 0x0008 528c2ecf20Sopenharmony_ci #define ISA_EN 0x0004 538c2ecf20Sopenharmony_ci #define SERR_EN 0x0002 548c2ecf20Sopenharmony_ci #define PERR_EN 0x0001 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define SYSCNT 0x80 578c2ecf20Sopenharmony_ci #define BAD_VCC_REQ_DISB 0x00200000 588c2ecf20Sopenharmony_ci #define PCPCI_EN 0x00080000 598c2ecf20Sopenharmony_ci #define CH_ASSIGN_MASK 0x00070000 608c2ecf20Sopenharmony_ci #define CH_ASSIGN_NODMA 0x00040000 618c2ecf20Sopenharmony_ci #define SUB_ID_WR_EN 0x00000008 628c2ecf20Sopenharmony_ci #define ASYN_INT_MODE 0x00000004 638c2ecf20Sopenharmony_ci #define PCI_CLK_RIN 0x00000002 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define DEVCNT 0x91 668c2ecf20Sopenharmony_ci #define ZOOM_VIDEO_EN 0x40 678c2ecf20Sopenharmony_ci #define SR_PCI_INT_SEL_MASK 0x18 688c2ecf20Sopenharmony_ci #define SR_PCI_INT_SEL_NONE 0x00 698c2ecf20Sopenharmony_ci #define PCI_INT_MODE 0x04 708c2ecf20Sopenharmony_ci #define IRQ_MODE 0x02 718c2ecf20Sopenharmony_ci #define IFG 0x01 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define CHIPCNT 0x9c 748c2ecf20Sopenharmony_ci #define S_PREF_DISB 0x10 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define SERRDIS 0x9f 778c2ecf20Sopenharmony_ci #define SERR_DIS_MAB 0x10 788c2ecf20Sopenharmony_ci #define SERR_DIS_TAB 0x08 798c2ecf20Sopenharmony_ci #define SERR_DIS_DT_PERR 0x04 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* 828c2ecf20Sopenharmony_ci * ExCA Registers 838c2ecf20Sopenharmony_ci */ 848c2ecf20Sopenharmony_ci#define EXCA_REGS_BASE 0x800 858c2ecf20Sopenharmony_ci#define EXCA_REGS_SIZE 0x800 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define ID_REV 0x000 888c2ecf20Sopenharmony_ci #define IF_TYPE_16BIT 0x80 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define IF_STATUS 0x001 918c2ecf20Sopenharmony_ci #define CARD_PWR 0x40 928c2ecf20Sopenharmony_ci #define READY 0x20 938c2ecf20Sopenharmony_ci #define CARD_WP 0x10 948c2ecf20Sopenharmony_ci #define CARD_DETECT2 0x08 958c2ecf20Sopenharmony_ci #define CARD_DETECT1 0x04 968c2ecf20Sopenharmony_ci #define BV_DETECT_MASK 0x03 978c2ecf20Sopenharmony_ci #define BV_DETECT_GOOD 0x03 /* Memory card */ 988c2ecf20Sopenharmony_ci #define BV_DETECT_WARN 0x02 998c2ecf20Sopenharmony_ci #define BV_DETECT_BAD1 0x01 1008c2ecf20Sopenharmony_ci #define BV_DETECT_BAD0 0x00 1018c2ecf20Sopenharmony_ci #define STSCHG 0x02 /* I/O card */ 1028c2ecf20Sopenharmony_ci #define SPKR 0x01 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define PWR_CNT 0x002 1058c2ecf20Sopenharmony_ci #define CARD_OUT_EN 0x80 1068c2ecf20Sopenharmony_ci #define VCC_MASK 0x18 1078c2ecf20Sopenharmony_ci #define VCC_3V 0x18 1088c2ecf20Sopenharmony_ci #define VCC_5V 0x10 1098c2ecf20Sopenharmony_ci #define VCC_0V 0x00 1108c2ecf20Sopenharmony_ci #define VPP_MASK 0x03 1118c2ecf20Sopenharmony_ci #define VPP_12V 0x02 1128c2ecf20Sopenharmony_ci #define VPP_VCC 0x01 1138c2ecf20Sopenharmony_ci #define VPP_0V 0x00 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define INT_GEN_CNT 0x003 1168c2ecf20Sopenharmony_ci #define CARD_REST0 0x40 1178c2ecf20Sopenharmony_ci #define CARD_TYPE_MASK 0x20 1188c2ecf20Sopenharmony_ci #define CARD_TYPE_IO 0x20 1198c2ecf20Sopenharmony_ci #define CARD_TYPE_MEM 0x00 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define CARD_SC 0x004 1228c2ecf20Sopenharmony_ci #define CARD_DT_CHG 0x08 1238c2ecf20Sopenharmony_ci #define RDY_CHG 0x04 1248c2ecf20Sopenharmony_ci #define BAT_WAR_CHG 0x02 1258c2ecf20Sopenharmony_ci #define BAT_DEAD_ST_CHG 0x01 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define CARD_SCI 0x005 1288c2ecf20Sopenharmony_ci #define CARD_DT_EN 0x08 1298c2ecf20Sopenharmony_ci #define RDY_EN 0x04 1308c2ecf20Sopenharmony_ci #define BAT_WAR_EN 0x02 1318c2ecf20Sopenharmony_ci #define BAT_DEAD_EN 0x01 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define ADR_WIN_EN 0x006 1348c2ecf20Sopenharmony_ci #define IO_WIN_EN(x) (0x40 << (x)) 1358c2ecf20Sopenharmony_ci #define MEM_WIN_EN(x) (0x01 << (x)) 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define IO_WIN_CNT 0x007 1388c2ecf20Sopenharmony_ci #define IO_WIN_CNT_MASK(x) (0x03 << ((x) << 2)) 1398c2ecf20Sopenharmony_ci #define IO_WIN_DATA_AUTOSZ(x) (0x02 << ((x) << 2)) 1408c2ecf20Sopenharmony_ci #define IO_WIN_DATA_16BIT(x) (0x01 << ((x) << 2)) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define IO_WIN_SA(x) (0x008 + ((x) << 2)) 1438c2ecf20Sopenharmony_ci#define IO_WIN_EA(x) (0x00a + ((x) << 2)) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define MEM_WIN_SA(x) (0x010 + ((x) << 3)) 1468c2ecf20Sopenharmony_ci #define MEM_WIN_DSIZE 0x8000 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define MEM_WIN_EA(x) (0x012 + ((x) << 3)) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define MEM_WIN_OA(x) (0x014 + ((x) << 3)) 1518c2ecf20Sopenharmony_ci #define MEM_WIN_WP 0x8000 1528c2ecf20Sopenharmony_ci #define MEM_WIN_REGSET 0x4000 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define GEN_CNT 0x016 1558c2ecf20Sopenharmony_ci #define VS2_STATUS 0x80 1568c2ecf20Sopenharmony_ci #define VS1_STATUS 0x40 1578c2ecf20Sopenharmony_ci #define EXCA_REG_RST_EN 0x02 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define GLO_CNT 0x01e 1608c2ecf20Sopenharmony_ci #define FUN_INT_LEV 0x08 1618c2ecf20Sopenharmony_ci #define INT_WB_CLR 0x04 1628c2ecf20Sopenharmony_ci #define CSC_INT_LEV 0x02 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci#define IO_WIN_OAL(x) (0x036 + ((x) << 1)) 1658c2ecf20Sopenharmony_ci#define IO_WIN_OAH(x) (0x037 + ((x) << 1)) 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#define MEM_WIN_SAU(x) (0x040 + (x)) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci#define IO_SETUP_TIM 0x080 1708c2ecf20Sopenharmony_ci#define IO_CMD_TIM 0x081 1718c2ecf20Sopenharmony_ci#define IO_HOLD_TIM 0x082 1728c2ecf20Sopenharmony_ci#define MEM_SETUP_TIM(x) (0x084 + ((x) << 2)) 1738c2ecf20Sopenharmony_ci#define MEM_CMD_TIM(x) (0x085 + ((x) << 2)) 1748c2ecf20Sopenharmony_ci#define MEM_HOLD_TIM(x) (0x086 + ((x) << 2)) 1758c2ecf20Sopenharmony_ci #define TIM_CLOCKS(x) ((x) - 1) 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci#define MEM_TIM_SEL1 0x08c 1788c2ecf20Sopenharmony_ci#define MEM_TIM_SEL2 0x08d 1798c2ecf20Sopenharmony_ci #define MEM_WIN_TIMSEL1(x) (0x03 << (((x) & 3) << 1)) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci#define MEM_WIN_PWEN 0x091 1828c2ecf20Sopenharmony_ci #define POSTWEN 0x01 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci/* 1858c2ecf20Sopenharmony_ci * CardBus Socket Registers 1868c2ecf20Sopenharmony_ci */ 1878c2ecf20Sopenharmony_ci#define CARDBUS_SOCKET_REGS_BASE 0x000 1888c2ecf20Sopenharmony_ci#define CARDBUS_SOCKET_REGS_SIZE 0x800 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define SKT_EV 0x000 1918c2ecf20Sopenharmony_ci #define POW_CYC_EV 0x00000008 1928c2ecf20Sopenharmony_ci #define CCD2_EV 0x00000004 1938c2ecf20Sopenharmony_ci #define CCD1_EV 0x00000002 1948c2ecf20Sopenharmony_ci #define CSTSCHG_EV 0x00000001 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define SKT_MASK 0x004 1978c2ecf20Sopenharmony_ci #define POW_CYC_MASK 0x00000008 1988c2ecf20Sopenharmony_ci #define CCD_MASK 0x00000006 1998c2ecf20Sopenharmony_ci #define CSC_MASK 0x00000001 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define SKT_PRE_STATE 0x008 2028c2ecf20Sopenharmony_ci#define SKT_FORCE_EV 0x00c 2038c2ecf20Sopenharmony_ci #define VOL_3V_SKT 0x20000000 2048c2ecf20Sopenharmony_ci #define VOL_5V_SKT 0x10000000 2058c2ecf20Sopenharmony_ci #define CVS_TEST 0x00004000 2068c2ecf20Sopenharmony_ci #define VOL_YV_CARD_DT 0x00002000 2078c2ecf20Sopenharmony_ci #define VOL_XV_CARD_DT 0x00001000 2088c2ecf20Sopenharmony_ci #define VOL_3V_CARD_DT 0x00000800 2098c2ecf20Sopenharmony_ci #define VOL_5V_CARD_DT 0x00000400 2108c2ecf20Sopenharmony_ci #define BAD_VCC_REQ 0x00000200 2118c2ecf20Sopenharmony_ci #define DATA_LOST 0x00000100 2128c2ecf20Sopenharmony_ci #define NOT_A_CARD 0x00000080 2138c2ecf20Sopenharmony_ci #define CREADY 0x00000040 2148c2ecf20Sopenharmony_ci #define CB_CARD_DT 0x00000020 2158c2ecf20Sopenharmony_ci #define R2_CARD_DT 0x00000010 2168c2ecf20Sopenharmony_ci #define POW_UP 0x00000008 2178c2ecf20Sopenharmony_ci #define CCD20 0x00000004 2188c2ecf20Sopenharmony_ci #define CCD10 0x00000002 2198c2ecf20Sopenharmony_ci #define CSTSCHG 0x00000001 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci#define SKT_CNT 0x010 2228c2ecf20Sopenharmony_ci #define STP_CLK_EN 0x00000080 2238c2ecf20Sopenharmony_ci #define VCC_CNT_MASK 0x00000070 2248c2ecf20Sopenharmony_ci #define VCC_CNT_3V 0x00000030 2258c2ecf20Sopenharmony_ci #define VCC_CNT_5V 0x00000020 2268c2ecf20Sopenharmony_ci #define VCC_CNT_0V 0x00000000 2278c2ecf20Sopenharmony_ci #define VPP_CNT_MASK 0x00000007 2288c2ecf20Sopenharmony_ci #define VPP_CNT_3V 0x00000003 2298c2ecf20Sopenharmony_ci #define VPP_CNT_5V 0x00000002 2308c2ecf20Sopenharmony_ci #define VPP_CNT_12V 0x00000001 2318c2ecf20Sopenharmony_ci #define VPP_CNT_0V 0x00000000 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_citypedef struct vrc4173_socket { 2348c2ecf20Sopenharmony_ci int noprobe; 2358c2ecf20Sopenharmony_ci struct pci_dev *dev; 2368c2ecf20Sopenharmony_ci void *base; 2378c2ecf20Sopenharmony_ci void (*handler)(void *, unsigned int); 2388c2ecf20Sopenharmony_ci void *info; 2398c2ecf20Sopenharmony_ci socket_cap_t cap; 2408c2ecf20Sopenharmony_ci spinlock_t event_lock; 2418c2ecf20Sopenharmony_ci uint16_t events; 2428c2ecf20Sopenharmony_ci struct socket_info_t *pcmcia_socket; 2438c2ecf20Sopenharmony_ci struct work_struct tq_work; 2448c2ecf20Sopenharmony_ci char name[20]; 2458c2ecf20Sopenharmony_ci} vrc4173_socket_t; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci#endif /* _VRC4173_CARDU_H */ 248