18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __YENTA_H 38c2ecf20Sopenharmony_ci#define __YENTA_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/io.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define CB_SOCKET_EVENT 0x00 88c2ecf20Sopenharmony_ci#define CB_CSTSEVENT 0x00000001 /* Card status event */ 98c2ecf20Sopenharmony_ci#define CB_CD1EVENT 0x00000002 /* Card detect 1 change event */ 108c2ecf20Sopenharmony_ci#define CB_CD2EVENT 0x00000004 /* Card detect 2 change event */ 118c2ecf20Sopenharmony_ci#define CB_PWREVENT 0x00000008 /* PWRCYCLE change event */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define CB_SOCKET_MASK 0x04 148c2ecf20Sopenharmony_ci#define CB_CSTSMASK 0x00000001 /* Card status mask */ 158c2ecf20Sopenharmony_ci#define CB_CDMASK 0x00000006 /* Card detect 1&2 mask */ 168c2ecf20Sopenharmony_ci#define CB_PWRMASK 0x00000008 /* PWRCYCLE change mask */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define CB_SOCKET_STATE 0x08 198c2ecf20Sopenharmony_ci#define CB_CARDSTS 0x00000001 /* CSTSCHG status */ 208c2ecf20Sopenharmony_ci#define CB_CDETECT1 0x00000002 /* Card detect status 1 */ 218c2ecf20Sopenharmony_ci#define CB_CDETECT2 0x00000004 /* Card detect status 2 */ 228c2ecf20Sopenharmony_ci#define CB_PWRCYCLE 0x00000008 /* Socket powered */ 238c2ecf20Sopenharmony_ci#define CB_16BITCARD 0x00000010 /* 16-bit card detected */ 248c2ecf20Sopenharmony_ci#define CB_CBCARD 0x00000020 /* CardBus card detected */ 258c2ecf20Sopenharmony_ci#define CB_IREQCINT 0x00000040 /* READY(xIRQ)/xCINT high */ 268c2ecf20Sopenharmony_ci#define CB_NOTACARD 0x00000080 /* Unrecognizable PC card detected */ 278c2ecf20Sopenharmony_ci#define CB_DATALOST 0x00000100 /* Potential data loss due to card removal */ 288c2ecf20Sopenharmony_ci#define CB_BADVCCREQ 0x00000200 /* Invalid Vcc request by host software */ 298c2ecf20Sopenharmony_ci#define CB_5VCARD 0x00000400 /* Card Vcc at 5.0 volts? */ 308c2ecf20Sopenharmony_ci#define CB_3VCARD 0x00000800 /* Card Vcc at 3.3 volts? */ 318c2ecf20Sopenharmony_ci#define CB_XVCARD 0x00001000 /* Card Vcc at X.X volts? */ 328c2ecf20Sopenharmony_ci#define CB_YVCARD 0x00002000 /* Card Vcc at Y.Y volts? */ 338c2ecf20Sopenharmony_ci#define CB_5VSOCKET 0x10000000 /* Socket Vcc at 5.0 volts? */ 348c2ecf20Sopenharmony_ci#define CB_3VSOCKET 0x20000000 /* Socket Vcc at 3.3 volts? */ 358c2ecf20Sopenharmony_ci#define CB_XVSOCKET 0x40000000 /* Socket Vcc at X.X volts? */ 368c2ecf20Sopenharmony_ci#define CB_YVSOCKET 0x80000000 /* Socket Vcc at Y.Y volts? */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define CB_SOCKET_FORCE 0x0C 398c2ecf20Sopenharmony_ci#define CB_FCARDSTS 0x00000001 /* Force CSTSCHG */ 408c2ecf20Sopenharmony_ci#define CB_FCDETECT1 0x00000002 /* Force CD1EVENT */ 418c2ecf20Sopenharmony_ci#define CB_FCDETECT2 0x00000004 /* Force CD2EVENT */ 428c2ecf20Sopenharmony_ci#define CB_FPWRCYCLE 0x00000008 /* Force PWREVENT */ 438c2ecf20Sopenharmony_ci#define CB_F16BITCARD 0x00000010 /* Force 16-bit PCMCIA card */ 448c2ecf20Sopenharmony_ci#define CB_FCBCARD 0x00000020 /* Force CardBus line */ 458c2ecf20Sopenharmony_ci#define CB_FNOTACARD 0x00000080 /* Force NOTACARD */ 468c2ecf20Sopenharmony_ci#define CB_FDATALOST 0x00000100 /* Force data lost */ 478c2ecf20Sopenharmony_ci#define CB_FBADVCCREQ 0x00000200 /* Force bad Vcc request */ 488c2ecf20Sopenharmony_ci#define CB_F5VCARD 0x00000400 /* Force 5.0 volt card */ 498c2ecf20Sopenharmony_ci#define CB_F3VCARD 0x00000800 /* Force 3.3 volt card */ 508c2ecf20Sopenharmony_ci#define CB_FXVCARD 0x00001000 /* Force X.X volt card */ 518c2ecf20Sopenharmony_ci#define CB_FYVCARD 0x00002000 /* Force Y.Y volt card */ 528c2ecf20Sopenharmony_ci#define CB_CVSTEST 0x00004000 /* Card VS test */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define CB_SOCKET_CONTROL 0x10 558c2ecf20Sopenharmony_ci#define CB_SC_VPP_MASK 0x00000007 568c2ecf20Sopenharmony_ci#define CB_SC_VPP_OFF 0x00000000 578c2ecf20Sopenharmony_ci#define CB_SC_VPP_12V 0x00000001 588c2ecf20Sopenharmony_ci#define CB_SC_VPP_5V 0x00000002 598c2ecf20Sopenharmony_ci#define CB_SC_VPP_3V 0x00000003 608c2ecf20Sopenharmony_ci#define CB_SC_VPP_XV 0x00000004 618c2ecf20Sopenharmony_ci#define CB_SC_VPP_YV 0x00000005 628c2ecf20Sopenharmony_ci#define CB_SC_VCC_MASK 0x00000070 638c2ecf20Sopenharmony_ci#define CB_SC_VCC_OFF 0x00000000 648c2ecf20Sopenharmony_ci#define CB_SC_VCC_5V 0x00000020 658c2ecf20Sopenharmony_ci#define CB_SC_VCC_3V 0x00000030 668c2ecf20Sopenharmony_ci#define CB_SC_VCC_XV 0x00000040 678c2ecf20Sopenharmony_ci#define CB_SC_VCC_YV 0x00000050 688c2ecf20Sopenharmony_ci#define CB_SC_CCLK_STOP 0x00000080 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define CB_SOCKET_POWER 0x20 718c2ecf20Sopenharmony_ci#define CB_SKTACCES 0x02000000 /* A PC card access has occurred (clear on read) */ 728c2ecf20Sopenharmony_ci#define CB_SKTMODE 0x01000000 /* Clock frequency has changed (clear on read) */ 738c2ecf20Sopenharmony_ci#define CB_CLKCTRLEN 0x00010000 /* Clock control enabled (RW) */ 748c2ecf20Sopenharmony_ci#define CB_CLKCTRL 0x00000001 /* Stop(0) or slow(1) CB clock (RW) */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* 778c2ecf20Sopenharmony_ci * Cardbus configuration space 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci#define CB_BRIDGE_BASE(m) (0x1c + 8*(m)) 808c2ecf20Sopenharmony_ci#define CB_BRIDGE_LIMIT(m) (0x20 + 8*(m)) 818c2ecf20Sopenharmony_ci#define CB_BRIDGE_CONTROL 0x3e 828c2ecf20Sopenharmony_ci#define CB_BRIDGE_CPERREN 0x00000001 838c2ecf20Sopenharmony_ci#define CB_BRIDGE_CSERREN 0x00000002 848c2ecf20Sopenharmony_ci#define CB_BRIDGE_ISAEN 0x00000004 858c2ecf20Sopenharmony_ci#define CB_BRIDGE_VGAEN 0x00000008 868c2ecf20Sopenharmony_ci#define CB_BRIDGE_MABTMODE 0x00000020 878c2ecf20Sopenharmony_ci#define CB_BRIDGE_CRST 0x00000040 888c2ecf20Sopenharmony_ci#define CB_BRIDGE_INTR 0x00000080 898c2ecf20Sopenharmony_ci#define CB_BRIDGE_PREFETCH0 0x00000100 908c2ecf20Sopenharmony_ci#define CB_BRIDGE_PREFETCH1 0x00000200 918c2ecf20Sopenharmony_ci#define CB_BRIDGE_POSTEN 0x00000400 928c2ecf20Sopenharmony_ci#define CB_LEGACY_MODE_BASE 0x44 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* 958c2ecf20Sopenharmony_ci * ExCA area extensions in Yenta 968c2ecf20Sopenharmony_ci */ 978c2ecf20Sopenharmony_ci#define CB_MEM_PAGE(map) (0x40 + (map)) 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* control how 16bit cards are powered */ 1018c2ecf20Sopenharmony_ci#define YENTA_16BIT_POWER_EXCA 0x00000001 1028c2ecf20Sopenharmony_ci#define YENTA_16BIT_POWER_DF 0x00000002 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cistruct yenta_socket; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistruct cardbus_type { 1088c2ecf20Sopenharmony_ci int (*override)(struct yenta_socket *); 1098c2ecf20Sopenharmony_ci void (*save_state)(struct yenta_socket *); 1108c2ecf20Sopenharmony_ci void (*restore_state)(struct yenta_socket *); 1118c2ecf20Sopenharmony_ci int (*sock_init)(struct yenta_socket *); 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistruct yenta_socket { 1158c2ecf20Sopenharmony_ci struct pci_dev *dev; 1168c2ecf20Sopenharmony_ci int cb_irq, io_irq; 1178c2ecf20Sopenharmony_ci void __iomem *base; 1188c2ecf20Sopenharmony_ci struct timer_list poll_timer; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci struct pcmcia_socket socket; 1218c2ecf20Sopenharmony_ci struct cardbus_type *type; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci u32 flags; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci /* for PCI interrupt probing */ 1268c2ecf20Sopenharmony_ci unsigned int probe_status; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci /* A few words of private data for special stuff of overrides... */ 1298c2ecf20Sopenharmony_ci unsigned int private[8]; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* PCI saved state */ 1328c2ecf20Sopenharmony_ci u32 saved_state[2]; 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#endif 137