18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * This file contains defines for the 58c2ecf20Sopenharmony_ci * Micro Memory MM5415 68c2ecf20Sopenharmony_ci * family PCI Memory Module with Battery Backup. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright Micro Memory INC 2001. All rights reserved. 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef _DRIVERS_BLOCK_MM_H 128c2ecf20Sopenharmony_ci#define _DRIVERS_BLOCK_MM_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define IRQ_TIMEOUT (1 * HZ) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* CSR register definition */ 188c2ecf20Sopenharmony_ci#define MEMCTRLSTATUS_MAGIC 0x00 198c2ecf20Sopenharmony_ci#define MM_MAGIC_VALUE (unsigned char)0x59 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define MEMCTRLSTATUS_BATTERY 0x04 228c2ecf20Sopenharmony_ci#define BATTERY_1_DISABLED 0x01 238c2ecf20Sopenharmony_ci#define BATTERY_1_FAILURE 0x02 248c2ecf20Sopenharmony_ci#define BATTERY_2_DISABLED 0x04 258c2ecf20Sopenharmony_ci#define BATTERY_2_FAILURE 0x08 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define MEMCTRLSTATUS_MEMORY 0x07 288c2ecf20Sopenharmony_ci#define MEM_128_MB 0xfe 298c2ecf20Sopenharmony_ci#define MEM_256_MB 0xfc 308c2ecf20Sopenharmony_ci#define MEM_512_MB 0xf8 318c2ecf20Sopenharmony_ci#define MEM_1_GB 0xf0 328c2ecf20Sopenharmony_ci#define MEM_2_GB 0xe0 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define MEMCTRLCMD_LEDCTRL 0x08 358c2ecf20Sopenharmony_ci#define LED_REMOVE 2 368c2ecf20Sopenharmony_ci#define LED_FAULT 4 378c2ecf20Sopenharmony_ci#define LED_POWER 6 388c2ecf20Sopenharmony_ci#define LED_FLIP 255 398c2ecf20Sopenharmony_ci#define LED_OFF 0x00 408c2ecf20Sopenharmony_ci#define LED_ON 0x01 418c2ecf20Sopenharmony_ci#define LED_FLASH_3_5 0x02 428c2ecf20Sopenharmony_ci#define LED_FLASH_7_0 0x03 438c2ecf20Sopenharmony_ci#define LED_POWER_ON 0x00 448c2ecf20Sopenharmony_ci#define LED_POWER_OFF 0x01 458c2ecf20Sopenharmony_ci#define USER_BIT1 0x01 468c2ecf20Sopenharmony_ci#define USER_BIT2 0x02 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define MEMORY_INITIALIZED USER_BIT1 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define MEMCTRLCMD_ERRCTRL 0x0C 518c2ecf20Sopenharmony_ci#define EDC_NONE_DEFAULT 0x00 528c2ecf20Sopenharmony_ci#define EDC_NONE 0x01 538c2ecf20Sopenharmony_ci#define EDC_STORE_READ 0x02 548c2ecf20Sopenharmony_ci#define EDC_STORE_CORRECT 0x03 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define MEMCTRLCMD_ERRCNT 0x0D 578c2ecf20Sopenharmony_ci#define MEMCTRLCMD_ERRSTATUS 0x0E 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define ERROR_DATA_LOG 0x20 608c2ecf20Sopenharmony_ci#define ERROR_ADDR_LOG 0x28 618c2ecf20Sopenharmony_ci#define ERROR_COUNT 0x3D 628c2ecf20Sopenharmony_ci#define ERROR_SYNDROME 0x3E 638c2ecf20Sopenharmony_ci#define ERROR_CHECK 0x3F 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define DMA_PCI_ADDR 0x40 668c2ecf20Sopenharmony_ci#define DMA_LOCAL_ADDR 0x48 678c2ecf20Sopenharmony_ci#define DMA_TRANSFER_SIZE 0x50 688c2ecf20Sopenharmony_ci#define DMA_DESCRIPTOR_ADDR 0x58 698c2ecf20Sopenharmony_ci#define DMA_SEMAPHORE_ADDR 0x60 708c2ecf20Sopenharmony_ci#define DMA_STATUS_CTRL 0x68 718c2ecf20Sopenharmony_ci#define DMASCR_GO 0x00001 728c2ecf20Sopenharmony_ci#define DMASCR_TRANSFER_READ 0x00002 738c2ecf20Sopenharmony_ci#define DMASCR_CHAIN_EN 0x00004 748c2ecf20Sopenharmony_ci#define DMASCR_SEM_EN 0x00010 758c2ecf20Sopenharmony_ci#define DMASCR_DMA_COMP_EN 0x00020 768c2ecf20Sopenharmony_ci#define DMASCR_CHAIN_COMP_EN 0x00040 778c2ecf20Sopenharmony_ci#define DMASCR_ERR_INT_EN 0x00080 788c2ecf20Sopenharmony_ci#define DMASCR_PARITY_INT_EN 0x00100 798c2ecf20Sopenharmony_ci#define DMASCR_ANY_ERR 0x00800 808c2ecf20Sopenharmony_ci#define DMASCR_MBE_ERR 0x01000 818c2ecf20Sopenharmony_ci#define DMASCR_PARITY_ERR_REP 0x02000 828c2ecf20Sopenharmony_ci#define DMASCR_PARITY_ERR_DET 0x04000 838c2ecf20Sopenharmony_ci#define DMASCR_SYSTEM_ERR_SIG 0x08000 848c2ecf20Sopenharmony_ci#define DMASCR_TARGET_ABT 0x10000 858c2ecf20Sopenharmony_ci#define DMASCR_MASTER_ABT 0x20000 868c2ecf20Sopenharmony_ci#define DMASCR_DMA_COMPLETE 0x40000 878c2ecf20Sopenharmony_ci#define DMASCR_CHAIN_COMPLETE 0x80000 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* 908c2ecf20Sopenharmony_ci3.SOME PCs HAVE HOST BRIDGES WHICH APPARENTLY DO NOT CORRECTLY HANDLE 918c2ecf20Sopenharmony_ciREAD-LINE (0xE) OR READ-MULTIPLE (0xC) PCI COMMAND CODES DURING DMA 928c2ecf20Sopenharmony_ciTRANSFERS. IN OTHER SYSTEMS THESE COMMAND CODES WILL CAUSE THE HOST BRIDGE 938c2ecf20Sopenharmony_ciTO ALLOW LONGER BURSTS DURING DMA READ OPERATIONS. THE UPPER FOUR BITS 948c2ecf20Sopenharmony_ci(31..28) OF THE DMA CSR HAVE BEEN MADE PROGRAMMABLE, SO THAT EITHER A 0x6, 958c2ecf20Sopenharmony_ciAN 0xE OR A 0xC CAN BE WRITTEN TO THEM TO SET THE COMMAND CODE USED DURING 968c2ecf20Sopenharmony_ciDMA READ OPERATIONS. 978c2ecf20Sopenharmony_ci*/ 988c2ecf20Sopenharmony_ci#define DMASCR_READ 0x60000000 998c2ecf20Sopenharmony_ci#define DMASCR_READLINE 0xE0000000 1008c2ecf20Sopenharmony_ci#define DMASCR_READMULTI 0xC0000000 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define DMASCR_ERROR_MASK (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR | DMASCR_ANY_ERR) 1048c2ecf20Sopenharmony_ci#define DMASCR_HARD_ERROR (DMASCR_MASTER_ABT | DMASCR_TARGET_ABT | DMASCR_SYSTEM_ERR_SIG | DMASCR_PARITY_ERR_DET | DMASCR_MBE_ERR) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define WINDOWMAP_WINNUM 0x7B 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define DMA_READ_FROM_HOST 0 1098c2ecf20Sopenharmony_ci#define DMA_WRITE_TO_HOST 1 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistruct mm_dma_desc { 1128c2ecf20Sopenharmony_ci __le64 pci_addr; 1138c2ecf20Sopenharmony_ci __le64 local_addr; 1148c2ecf20Sopenharmony_ci __le32 transfer_size; 1158c2ecf20Sopenharmony_ci u32 zero1; 1168c2ecf20Sopenharmony_ci __le64 next_desc_addr; 1178c2ecf20Sopenharmony_ci __le64 sem_addr; 1188c2ecf20Sopenharmony_ci __le32 control_bits; 1198c2ecf20Sopenharmony_ci u32 zero2; 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci dma_addr_t data_dma_handle; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci /* Copy of the bits */ 1248c2ecf20Sopenharmony_ci __le64 sem_control_bits; 1258c2ecf20Sopenharmony_ci} __attribute__((aligned(8))); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* bits for card->flags */ 1288c2ecf20Sopenharmony_ci#define UM_FLAG_DMA_IN_REGS 1 1298c2ecf20Sopenharmony_ci#define UM_FLAG_NO_BYTE_STATUS 2 1308c2ecf20Sopenharmony_ci#define UM_FLAG_NO_BATTREG 4 1318c2ecf20Sopenharmony_ci#define UM_FLAG_NO_BATT 8 1328c2ecf20Sopenharmony_ci#endif 133