Home | History | Annotate | Line # | Download | only in ic
      1  1.1  jmcneill /* $NetBSD: w83l518dreg.h,v 1.1 2009/09/30 20:44:50 jmcneill Exp $ */
      2  1.1  jmcneill 
      3  1.1  jmcneill /*
      4  1.1  jmcneill  * Copyright (c) 2009 Jared D. McNeill <jmcneill (at) invisible.ca>
      5  1.1  jmcneill  * All rights reserved.
      6  1.1  jmcneill  *
      7  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8  1.1  jmcneill  * modification, are permitted provided that the following conditions
      9  1.1  jmcneill  * are met:
     10  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12  1.1  jmcneill  * 2. The name of the author may not be used to endorse or promote products
     13  1.1  jmcneill  *    derived from this software without specific prior written permission.
     14  1.1  jmcneill  *
     15  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     16  1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     17  1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     18  1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     19  1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     20  1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     21  1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     22  1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     23  1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24  1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25  1.1  jmcneill  * SUCH DAMAGE.
     26  1.1  jmcneill  */
     27  1.1  jmcneill 
     28  1.1  jmcneill #ifndef _SYS_DEV_IC_W83L518DREG_H
     29  1.1  jmcneill #define _SYS_DEV_IC_W83L518DREG_H
     30  1.1  jmcneill 
     31  1.1  jmcneill /*
     32  1.1  jmcneill  * Global Registers
     33  1.1  jmcneill  */
     34  1.1  jmcneill 
     35  1.1  jmcneill #define	WB_REG_RESET		0x02
     36  1.1  jmcneill #define	 WB_RESET_SWRST		 0x01	/* software reset */
     37  1.1  jmcneill 
     38  1.1  jmcneill #define	WB_REG_DEVNO		0x07
     39  1.1  jmcneill #define	 WB_DEVNO_SC		 0x00	/* Smart Card interface */
     40  1.1  jmcneill #define	 WB_DEVNO_MS		 0x01	/* Memory Stick interface */
     41  1.1  jmcneill #define	 WB_DEVNO_GPIO		 0x02	/* GPIO */
     42  1.1  jmcneill #define	 WB_DEVNO_SD		 0x03	/* SD memory card interface */
     43  1.1  jmcneill 
     44  1.1  jmcneill #define	WB_REG_DEVID_HI		0x20
     45  1.1  jmcneill #define	WB_REG_DEVID_LO		0x21
     46  1.1  jmcneill #define	 WB_DEVID_W83L518D	 0x7110
     47  1.1  jmcneill #define	 WB_DEVID_W83L519D	 0x7120
     48  1.1  jmcneill #define	 WB_DEVID_REVISION(id)	 ((id) & 0xf)
     49  1.1  jmcneill 
     50  1.1  jmcneill #define	WB_REG_POWER		0x22
     51  1.1  jmcneill #define	 WB_POWER_SC		 0x80	/* Smart Card interface */
     52  1.1  jmcneill #define	 WB_POWER_MS		 0x40	/* Memory Stick interface */
     53  1.1  jmcneill #define	 WB_POWER_SD		 0x20	/* SD memory card interface */
     54  1.1  jmcneill 
     55  1.1  jmcneill #define	WB_REG_PME		0x23
     56  1.1  jmcneill #define	 WB_PME_PME_EN		 0x80	/* Global PM event enable */
     57  1.1  jmcneill #define	 WB_PME_MSPME_EN	 0x40	/* MS PM event enable */
     58  1.1  jmcneill #define	 WB_PME_SDPME_EN	 0x20	/* SD PM event enable */
     59  1.1  jmcneill #define	 WB_PME_SCPME_EN	 0x10	/* SC PM event enable */
     60  1.1  jmcneill 
     61  1.1  jmcneill #define	WB_REG_PMESTS		0x24	/* PM event status */
     62  1.1  jmcneill #define	 WB_PMESTS_MSPME_STS	 0x40	/* MS PM event status */
     63  1.1  jmcneill #define	 WB_PMESTS_SDPME_STS	 0x20	/* SD PM event status */
     64  1.1  jmcneill #define	 WB_PMESTS_SCPME_STS	 0x10	/* SC PM event status */
     65  1.1  jmcneill 
     66  1.1  jmcneill #define	WB_REG_CFG		0x26
     67  1.1  jmcneill #define	 WB_CFG_HEFRAS		 0x40	/* Extended func reg addr select */
     68  1.1  jmcneill #define	 WB_CFG_LOCKREG		 0x20	/* Config register access control */
     69  1.1  jmcneill 
     70  1.1  jmcneill #define	WB_REG_MFSEL		0x29	/* Multi-function sel (518 only) */
     71  1.1  jmcneill 
     72  1.1  jmcneill /*
     73  1.1  jmcneill  * Logical Device Interface
     74  1.1  jmcneill  */
     75  1.1  jmcneill 
     76  1.1  jmcneill #define WB_REG_DEV_EN		0x30
     77  1.1  jmcneill #define	 WB_DEV_EN_ACTIVE	 0x01	/* Logical device active bit */
     78  1.1  jmcneill 
     79  1.1  jmcneill #define	WB_REG_DEV_BASE_HI	0x60
     80  1.1  jmcneill #define	WB_REG_DEV_BASE_LO	0x61
     81  1.1  jmcneill 
     82  1.1  jmcneill #define	WB_REG_DEV_IRQ		0x70
     83  1.1  jmcneill #define	 WB_DEV_IRQ_MASK	 0x0f
     84  1.1  jmcneill 
     85  1.1  jmcneill #define	WB_REG_DEV_DRQ		0x74
     86  1.1  jmcneill #define	 WB_DEV_DRQ_MASK	 0x0f
     87  1.1  jmcneill 
     88  1.1  jmcneill #define	WB_REG_DEV_MISC		0xf0
     89  1.1  jmcneill #define	 WB_DEV_MISC_SCIRQ_SHR	 0x80	/* SC: IRQ sharing control */
     90  1.1  jmcneill #define	 WB_DEV_MISC_SCPSNT_POL	 0x01	/* SC: SC present polarity */
     91  1.1  jmcneill #define	 WB_DEV_MISC_MSIRQ_POLL	 0x10	/* MS: IRQ polarity control (level) */
     92  1.1  jmcneill #define	 WB_DEV_MISC_MSIRQ_POLP	 0x08	/* MS: IRQ polarity control (pulse) */
     93  1.1  jmcneill #define	 WB_DEV_MISC_MSIRQ_SHR	 0x04	/* MS: IRQ sharing control */
     94  1.1  jmcneill #define	 WB_DEV_MISC_MS4OUT_POL	 0x02	/* MS: MS4 output polarity control */
     95  1.1  jmcneill #define	 WB_DEV_MISC_MS4OUT_EN	 0x01	/* MS: MS4 output enable */
     96  1.1  jmcneill #define	 WB_DEV_MISC_SDDATA3_HI	 0x20	/* SD: DATA3 pin will output high */
     97  1.1  jmcneill #define	 WB_DEV_MISC_SDDATA3_OUT 0x10	/* SD: DATA3 pin to output pin */
     98  1.1  jmcneill #define	 WB_DEV_MISC_SDGP11_HI	 0x04	/* SD: GP11 card-detect pin pole */
     99  1.1  jmcneill #define	 WB_DEV_MISC_SDGP11_DET	 0x02	/* SD: GP11 card-detect enable */
    100  1.1  jmcneill #define	 WB_DEV_MISC_SDDATA3_DET 0x01	/* SD: DATA3 card-detect enable */
    101  1.1  jmcneill 
    102  1.1  jmcneill #define	WB_REG_DEV_IRQCFG	0xf1
    103  1.1  jmcneill #define	 WB_DEV_IRQCFG_HI_L	 0x08
    104  1.1  jmcneill #define	 WB_DEV_IRQCFG_HI_P	 0x04
    105  1.1  jmcneill #define	 WB_DEV_IRQCFG_MODE	 0x02
    106  1.1  jmcneill #define	 WB_DEV_IRQCFG_DEBOUNCE	 0x01
    107  1.1  jmcneill 
    108  1.1  jmcneill /*
    109  1.1  jmcneill  * SD Card interface registers
    110  1.1  jmcneill  */
    111  1.1  jmcneill 
    112  1.1  jmcneill #define WB_SD_COMMAND		0x00
    113  1.1  jmcneill #define	WB_SD_FIFO		0x01
    114  1.1  jmcneill #define	WB_SD_INTCTL		0x02
    115  1.1  jmcneill #define	WB_SD_INTSTS		0x03
    116  1.1  jmcneill #define	 WB_INT_PENDING		 0x80
    117  1.1  jmcneill #define	 WB_INT_CARD		 0x40
    118  1.1  jmcneill #define	 WB_INT_FIFO		 0x20
    119  1.1  jmcneill #define	 WB_INT_CRC		 0x10
    120  1.1  jmcneill #define	 WB_INT_TIMEOUT		 0x08
    121  1.1  jmcneill #define	 WB_INT_PROGEND		 0x04
    122  1.1  jmcneill #define	 WB_INT_BUSYEND		 0x02
    123  1.1  jmcneill #define	 WB_INT_TC		 0x01
    124  1.1  jmcneill #define	 WB_INT_DEFAULT	\
    125  1.1  jmcneill 	  (WB_INT_CARD|WB_INT_FIFO|WB_INT_CRC|WB_INT_TIMEOUT)
    126  1.1  jmcneill #define	WB_SD_FIFOSTS		0x04
    127  1.1  jmcneill #define	 WB_FIFO_EMPTY		 0x80
    128  1.1  jmcneill #define	 WB_FIFO_FULL		 0x40
    129  1.1  jmcneill #define	 WB_FIFO_EMPTY_THRES	 0x20
    130  1.1  jmcneill #define	 WB_FIFO_FULL_THRES	 0x10
    131  1.1  jmcneill #define	 WB_FIFO_DEPTH_MASK	 0x0f
    132  1.1  jmcneill #define	WB_SD_INDEX		0x05
    133  1.1  jmcneill #define	 WB_INDEX_CLK		 0x01
    134  1.1  jmcneill #define	  WB_CLK_375K		  0x00
    135  1.1  jmcneill #define	  WB_CLK_12M		  0x01
    136  1.1  jmcneill #define	  WB_CLK_16M		  0x02
    137  1.1  jmcneill #define	  WB_CLK_24M		  0x03
    138  1.1  jmcneill #define	 WB_INDEX_PBSMSB	 0x02
    139  1.1  jmcneill #define	 WB_INDEX_TAAC		 0x03
    140  1.1  jmcneill #define	 WB_INDEX_NSAC		 0x04
    141  1.1  jmcneill #define	 WB_INDEX_PBSLSB	 0x05
    142  1.1  jmcneill #define	 WB_INDEX_SETUP		 0x06
    143  1.1  jmcneill #define	  WB_SETUP_DATA3_HI	  0x08
    144  1.1  jmcneill #define	  WB_SETUP_FIFO_RST	  0x04
    145  1.1  jmcneill #define	  WB_SETUP_SOFT_RST	  0x02
    146  1.1  jmcneill #define	 WB_INDEX_DMA		 0x07
    147  1.1  jmcneill #define	 WB_INDEX_FIFOEN	 0x08
    148  1.1  jmcneill #define	  WB_FIFOEN_EMPTY	  0x20
    149  1.1  jmcneill #define	  WB_FIFOEN_FULL	  0x10
    150  1.1  jmcneill #define	 WB_INDEX_STATUS	 0x10
    151  1.1  jmcneill #define	  WB_STATUS_BLOCK_READ	  0x80
    152  1.1  jmcneill #define	  WB_STATUS_BLOCK_WRITE	  0x40
    153  1.1  jmcneill #define	  WB_STATUS_BUSY	  0x20
    154  1.1  jmcneill #define	  WB_STATUS_CARD_TRAFFIC  0x04
    155  1.1  jmcneill #define	  WB_STATUS_SEND_COMMAND  0x02
    156  1.1  jmcneill #define	  WB_STATUS_RECV_RES	  0x01
    157  1.1  jmcneill #define	 WB_INDEX_RESPLEN	 0x1e
    158  1.1  jmcneill #define	 WB_INDEX_RESP(n)	 (0x1f + (n))
    159  1.1  jmcneill #define	 WB_INDEX_CRCSTS	 0x30
    160  1.1  jmcneill #define	 WB_INDEX_ISR		 0x3f
    161  1.1  jmcneill #define	WB_SD_DATA		0x06
    162  1.1  jmcneill #define	WB_SD_CSR		0x07
    163  1.1  jmcneill #define	 WB_CSR_MS_LED		 0x20
    164  1.1  jmcneill #define	 WB_CSR_POWER_N		 0x10
    165  1.1  jmcneill #define	 WB_CSR_WRITE_PROTECT	 0x04
    166  1.1  jmcneill #define	 WB_CSR_CARD_PRESENT	 0x01
    167  1.1  jmcneill 
    168  1.1  jmcneill #endif
    169