Path: blob/master/arch/sh/include/mach-se/mach/mrshpc.h
26552 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __MACH_SE_MRSHPC_H2#define __MACH_SE_MRSHPC_H34#include <linux/io.h>56static inline void __init mrshpc_setup_windows(void)7{8if ((__raw_readw(MRSHPC_CSR) & 0x000c) != 0)9return; /* Not detected */1011if ((__raw_readw(MRSHPC_CSR) & 0x0080) == 0) {12__raw_writew(0x0674, MRSHPC_CPWCR); /* Card Vcc is 3.3v? */13} else {14__raw_writew(0x0678, MRSHPC_CPWCR); /* Card Vcc is 5V */15}1617/*18* PC-Card window open19* flag == COMMON/ATTRIBUTE/IO20*/21/* common window open */22__raw_writew(0x8a84, MRSHPC_MW0CR1);23if((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)24/* common mode & bus width 16bit SWAP = 1*/25__raw_writew(0x0b00, MRSHPC_MW0CR2);26else27/* common mode & bus width 16bit SWAP = 0*/28__raw_writew(0x0300, MRSHPC_MW0CR2);2930/* attribute window open */31__raw_writew(0x8a85, MRSHPC_MW1CR1);32if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)33/* attribute mode & bus width 16bit SWAP = 1*/34__raw_writew(0x0a00, MRSHPC_MW1CR2);35else36/* attribute mode & bus width 16bit SWAP = 0*/37__raw_writew(0x0200, MRSHPC_MW1CR2);3839/* I/O window open */40__raw_writew(0x8a86, MRSHPC_IOWCR1);41__raw_writew(0x0008, MRSHPC_CDCR); /* I/O card mode */42if ((__raw_readw(MRSHPC_CSR) & 0x4000) != 0)43__raw_writew(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/44else45__raw_writew(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/4647__raw_writew(0x2000, MRSHPC_ICR);48__raw_writeb(0x00, PA_MRSHPC_MW2 + 0x206);49__raw_writeb(0x42, PA_MRSHPC_MW2 + 0x200);50}5152#endif /* __MACH_SE_MRSHPC_H */535455