18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * topic.h 1.8 1999/08/28 04:01:47 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * The contents of this file are subject to the Mozilla Public License 58c2ecf20Sopenharmony_ci * Version 1.1 (the "License"); you may not use this file except in 68c2ecf20Sopenharmony_ci * compliance with the License. You may obtain a copy of the License 78c2ecf20Sopenharmony_ci * at http://www.mozilla.org/MPL/ 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Software distributed under the License is distributed on an "AS IS" 108c2ecf20Sopenharmony_ci * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 118c2ecf20Sopenharmony_ci * the License for the specific language governing rights and 128c2ecf20Sopenharmony_ci * limitations under the License. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * The initial developer of the original code is David A. Hinds 158c2ecf20Sopenharmony_ci * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 168c2ecf20Sopenharmony_ci * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * Alternatively, the contents of this file may be used under the 198c2ecf20Sopenharmony_ci * terms of the GNU General Public License version 2 (the "GPL"), in which 208c2ecf20Sopenharmony_ci * case the provisions of the GPL are applicable instead of the 218c2ecf20Sopenharmony_ci * above. If you wish to allow the use of your version of this file 228c2ecf20Sopenharmony_ci * only under the terms of the GPL and not to allow others to use 238c2ecf20Sopenharmony_ci * your version of this file under the MPL, indicate your decision by 248c2ecf20Sopenharmony_ci * deleting the provisions above and replace them with the notice and 258c2ecf20Sopenharmony_ci * other provisions required by the GPL. If you do not delete the 268c2ecf20Sopenharmony_ci * provisions above, a recipient may use your version of this file 278c2ecf20Sopenharmony_ci * under either the MPL or the GPL. 288c2ecf20Sopenharmony_ci * topic.h $Release$ 1999/08/28 04:01:47 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifndef _LINUX_TOPIC_H 328c2ecf20Sopenharmony_ci#define _LINUX_TOPIC_H 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* Register definitions for Toshiba ToPIC95/97/100 controllers */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define TOPIC_SOCKET_CONTROL 0x0090 /* 32 bit */ 378c2ecf20Sopenharmony_ci#define TOPIC_SCR_IRQSEL 0x00000001 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define TOPIC_SLOT_CONTROL 0x00a0 /* 8 bit */ 408c2ecf20Sopenharmony_ci#define TOPIC_SLOT_SLOTON 0x80 418c2ecf20Sopenharmony_ci#define TOPIC_SLOT_SLOTEN 0x40 428c2ecf20Sopenharmony_ci#define TOPIC_SLOT_ID_LOCK 0x20 438c2ecf20Sopenharmony_ci#define TOPIC_SLOT_ID_WP 0x10 448c2ecf20Sopenharmony_ci#define TOPIC_SLOT_PORT_MASK 0x0c 458c2ecf20Sopenharmony_ci#define TOPIC_SLOT_PORT_SHIFT 2 468c2ecf20Sopenharmony_ci#define TOPIC_SLOT_OFS_MASK 0x03 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define TOPIC_CARD_CONTROL 0x00a1 /* 8 bit */ 498c2ecf20Sopenharmony_ci#define TOPIC_CCR_INTB 0x20 508c2ecf20Sopenharmony_ci#define TOPIC_CCR_INTA 0x10 518c2ecf20Sopenharmony_ci#define TOPIC_CCR_CLOCK 0x0c 528c2ecf20Sopenharmony_ci#define TOPIC_CCR_PCICLK 0x0c 538c2ecf20Sopenharmony_ci#define TOPIC_CCR_PCICLK_2 0x08 548c2ecf20Sopenharmony_ci#define TOPIC_CCR_CCLK 0x04 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define TOPIC97_INT_CONTROL 0x00a1 /* 8 bit */ 578c2ecf20Sopenharmony_ci#define TOPIC97_ICR_INTB 0x20 588c2ecf20Sopenharmony_ci#define TOPIC97_ICR_INTA 0x10 598c2ecf20Sopenharmony_ci#define TOPIC97_ICR_STSIRQNP 0x04 608c2ecf20Sopenharmony_ci#define TOPIC97_ICR_IRQNP 0x02 618c2ecf20Sopenharmony_ci#define TOPIC97_ICR_IRQSEL 0x01 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define TOPIC_CARD_DETECT 0x00a3 /* 8 bit */ 648c2ecf20Sopenharmony_ci#define TOPIC_CDR_MODE_PC32 0x80 658c2ecf20Sopenharmony_ci#define TOPIC_CDR_VS1 0x04 668c2ecf20Sopenharmony_ci#define TOPIC_CDR_VS2 0x02 678c2ecf20Sopenharmony_ci#define TOPIC_CDR_SW_DETECT 0x01 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define TOPIC_REGISTER_CONTROL 0x00a4 /* 32 bit */ 708c2ecf20Sopenharmony_ci#define TOPIC_RCR_RESUME_RESET 0x80000000 718c2ecf20Sopenharmony_ci#define TOPIC_RCR_REMOVE_RESET 0x40000000 728c2ecf20Sopenharmony_ci#define TOPIC97_RCR_CLKRUN_ENA 0x20000000 738c2ecf20Sopenharmony_ci#define TOPIC97_RCR_TESTMODE 0x10000000 748c2ecf20Sopenharmony_ci#define TOPIC97_RCR_IOPLUP 0x08000000 758c2ecf20Sopenharmony_ci#define TOPIC_RCR_BUFOFF_PWROFF 0x02000000 768c2ecf20Sopenharmony_ci#define TOPIC_RCR_BUFOFF_SIGOFF 0x01000000 778c2ecf20Sopenharmony_ci#define TOPIC97_RCR_CB_DEV_MASK 0x0000f800 788c2ecf20Sopenharmony_ci#define TOPIC97_RCR_CB_DEV_SHIFT 11 798c2ecf20Sopenharmony_ci#define TOPIC97_RCR_RI_DISABLE 0x00000004 808c2ecf20Sopenharmony_ci#define TOPIC97_RCR_CAUDIO_OFF 0x00000002 818c2ecf20Sopenharmony_ci#define TOPIC_RCR_CAUDIO_INVERT 0x00000001 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define TOPIC97_MISC1 0x00ad /* 8bit */ 848c2ecf20Sopenharmony_ci#define TOPIC97_MISC1_CLOCKRUN_ENABLE 0x80 858c2ecf20Sopenharmony_ci#define TOPIC97_MISC1_CLOCKRUN_MODE 0x40 868c2ecf20Sopenharmony_ci#define TOPIC97_MISC1_DETECT_REQ_ENA 0x10 878c2ecf20Sopenharmony_ci#define TOPIC97_MISC1_SCK_CLEAR_DIS 0x04 888c2ecf20Sopenharmony_ci#define TOPIC97_MISC1_R2_LOW_ENABLE 0x10 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define TOPIC97_MISC2 0x00ae /* 8 bit */ 918c2ecf20Sopenharmony_ci#define TOPIC97_MISC2_SPWRCLK_MASK 0x70 928c2ecf20Sopenharmony_ci#define TOPIC97_MISC2_SPWRMOD 0x08 938c2ecf20Sopenharmony_ci#define TOPIC97_MISC2_SPWR_ENABLE 0x04 948c2ecf20Sopenharmony_ci#define TOPIC97_MISC2_ZV_MODE 0x02 958c2ecf20Sopenharmony_ci#define TOPIC97_MISC2_ZV_ENABLE 0x01 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define TOPIC97_ZOOM_VIDEO_CONTROL 0x009c /* 8 bit */ 988c2ecf20Sopenharmony_ci#define TOPIC97_ZV_CONTROL_ENABLE 0x01 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define TOPIC97_AUDIO_VIDEO_SWITCH 0x003c /* 8 bit */ 1018c2ecf20Sopenharmony_ci#define TOPIC97_AVS_AUDIO_CONTROL 0x02 1028c2ecf20Sopenharmony_ci#define TOPIC97_AVS_VIDEO_CONTROL 0x01 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define TOPIC_EXCA_IF_CONTROL 0x3e /* 8 bit */ 1058c2ecf20Sopenharmony_ci#define TOPIC_EXCA_IFC_33V_ENA 0x01 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define TOPIC_PCI_CFG_PPBCN 0x3e /* 16-bit */ 1088c2ecf20Sopenharmony_ci#define TOPIC_PCI_CFG_PPBCN_WBEN 0x0400 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_cistatic void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) 1118c2ecf20Sopenharmony_ci{ 1128c2ecf20Sopenharmony_ci struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); 1138c2ecf20Sopenharmony_ci u8 reg_zv, reg; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci reg_zv = config_readb(socket, TOPIC97_ZOOM_VIDEO_CONTROL); 1168c2ecf20Sopenharmony_ci if (onoff) { 1178c2ecf20Sopenharmony_ci reg_zv |= TOPIC97_ZV_CONTROL_ENABLE; 1188c2ecf20Sopenharmony_ci config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); 1218c2ecf20Sopenharmony_ci reg |= TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL; 1228c2ecf20Sopenharmony_ci config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); 1238c2ecf20Sopenharmony_ci } else { 1248c2ecf20Sopenharmony_ci reg_zv &= ~TOPIC97_ZV_CONTROL_ENABLE; 1258c2ecf20Sopenharmony_ci config_writeb(socket, TOPIC97_ZOOM_VIDEO_CONTROL, reg_zv); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci reg = config_readb(socket, TOPIC97_AUDIO_VIDEO_SWITCH); 1288c2ecf20Sopenharmony_ci reg &= ~(TOPIC97_AVS_AUDIO_CONTROL | TOPIC97_AVS_VIDEO_CONTROL); 1298c2ecf20Sopenharmony_ci config_writeb(socket, TOPIC97_AUDIO_VIDEO_SWITCH, reg); 1308c2ecf20Sopenharmony_ci } 1318c2ecf20Sopenharmony_ci} 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic int topic97_override(struct yenta_socket *socket) 1348c2ecf20Sopenharmony_ci{ 1358c2ecf20Sopenharmony_ci /* ToPIC97/100 support ZV */ 1368c2ecf20Sopenharmony_ci socket->socket.zoom_video = topic97_zoom_video; 1378c2ecf20Sopenharmony_ci return 0; 1388c2ecf20Sopenharmony_ci} 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_cistatic int topic95_override(struct yenta_socket *socket) 1428c2ecf20Sopenharmony_ci{ 1438c2ecf20Sopenharmony_ci u8 fctrl; 1448c2ecf20Sopenharmony_ci u16 ppbcn; 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* enable 3.3V support for 16bit cards */ 1478c2ecf20Sopenharmony_ci fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL); 1488c2ecf20Sopenharmony_ci exca_writeb(socket, TOPIC_EXCA_IF_CONTROL, fctrl | TOPIC_EXCA_IFC_33V_ENA); 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /* tell yenta to use exca registers to power 16bit cards */ 1518c2ecf20Sopenharmony_ci socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci /* Disable write buffers to prevent lockups under load with numerous 1548c2ecf20Sopenharmony_ci Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the 1558c2ecf20Sopenharmony_ci net. This is not a power-on default according to the datasheet 1568c2ecf20Sopenharmony_ci but some BIOSes seem to set it. */ 1578c2ecf20Sopenharmony_ci if (pci_read_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, &ppbcn) == 0 1588c2ecf20Sopenharmony_ci && socket->dev->revision <= 7 1598c2ecf20Sopenharmony_ci && (ppbcn & TOPIC_PCI_CFG_PPBCN_WBEN)) { 1608c2ecf20Sopenharmony_ci ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN; 1618c2ecf20Sopenharmony_ci pci_write_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, ppbcn); 1628c2ecf20Sopenharmony_ci dev_info(&socket->dev->dev, "Disabled ToPIC95 Cardbus write buffers.\n"); 1638c2ecf20Sopenharmony_ci } 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci return 0; 1668c2ecf20Sopenharmony_ci} 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#endif /* _LINUX_TOPIC_H */ 169