if_cpswreg.h revision 246276
1239281Sgonzo/*- 2239281Sgonzo * Copyright (c) 2012 Damjan Marion <dmarion@Freebsd.org> 3239281Sgonzo * All rights reserved. 4239281Sgonzo * 5239281Sgonzo * Redistribution and use in source and binary forms, with or without 6239281Sgonzo * modification, are permitted provided that the following conditions 7239281Sgonzo * are met: 8239281Sgonzo * 1. Redistributions of source code must retain the above copyright 9239281Sgonzo * notice, this list of conditions and the following disclaimer. 10239281Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 11239281Sgonzo * notice, this list of conditions and the following disclaimer in the 12239281Sgonzo * documentation and/or other materials provided with the distribution. 13239281Sgonzo * 14239281Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15239281Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16239281Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17239281Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18239281Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19239281Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20239281Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21239281Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22239281Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23239281Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24239281Sgonzo * SUCH DAMAGE. 25239281Sgonzo * 26239281Sgonzo * $FreeBSD: head/sys/arm/ti/cpsw/if_cpswreg.h 246276 2013-02-03 01:08:01Z kientzle $ 27239281Sgonzo */ 28239281Sgonzo 29239281Sgonzo#ifndef _IF_CPSWREG_H 30239281Sgonzo#define _IF_CPSWREG_H 31239281Sgonzo 32239281Sgonzo#define CPSW_SS_OFFSET 0x0000 33239281Sgonzo#define CPSW_SS_IDVER (CPSW_SS_OFFSET + 0x00) 34239281Sgonzo#define CPSW_SS_SOFT_RESET (CPSW_SS_OFFSET + 0x08) 35239281Sgonzo#define CPSW_SS_STAT_PORT_EN (CPSW_SS_OFFSET + 0x0C) 36239281Sgonzo#define CPSW_SS_PTYPE (CPSW_SS_OFFSET + 0x10) 37246276Skientzle#define CPSW_SS_FLOW_CONTROL (CPSW_SS_OFFSET + 0x24) 38239281Sgonzo 39239281Sgonzo#define CPSW_PORT_OFFSET 0x0100 40246276Skientzle#define CPSW_PORT_P_MAX_BLKS(p) (CPSW_PORT_OFFSET + 0x08 + ((p) * 0x100)) 41246276Skientzle#define CPSW_PORT_P_BLK_CNT(p) (CPSW_PORT_OFFSET + 0x0C + ((p) * 0x100)) 42239281Sgonzo#define CPSW_PORT_P_TX_PRI_MAP(p) (CPSW_PORT_OFFSET + 0x118 + ((p-1) * 0x100)) 43239281Sgonzo#define CPSW_PORT_P0_CPDMA_TX_PRI_MAP (CPSW_PORT_OFFSET + 0x01C) 44239281Sgonzo#define CPSW_PORT_P0_CPDMA_RX_CH_MAP (CPSW_PORT_OFFSET + 0x020) 45239281Sgonzo#define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100)) 46239281Sgonzo#define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100)) 47239281Sgonzo 48239281Sgonzo#define CPSW_CPDMA_OFFSET 0x0800 49239281Sgonzo#define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04) 50244939Skientzle#define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08) 51239281Sgonzo#define CPSW_CPDMA_RX_CONTROL (CPSW_CPDMA_OFFSET + 0x14) 52244939Skientzle#define CPSW_CPDMA_RX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x18) 53239281Sgonzo#define CPSW_CPDMA_SOFT_RESET (CPSW_CPDMA_OFFSET + 0x1c) 54239281Sgonzo#define CPSW_CPDMA_DMACONTROL (CPSW_CPDMA_OFFSET + 0x20) 55239281Sgonzo#define CPSW_CPDMA_DMASTATUS (CPSW_CPDMA_OFFSET + 0x24) 56239281Sgonzo#define CPSW_CPDMA_RX_BUFFER_OFFSET (CPSW_CPDMA_OFFSET + 0x28) 57239281Sgonzo#define CPSW_CPDMA_TX_INTSTAT_RAW (CPSW_CPDMA_OFFSET + 0x80) 58239281Sgonzo#define CPSW_CPDMA_TX_INTSTAT_MASKED (CPSW_CPDMA_OFFSET + 0x84) 59239281Sgonzo#define CPSW_CPDMA_TX_INTMASK_SET (CPSW_CPDMA_OFFSET + 0x88) 60239281Sgonzo#define CPSW_CPDMA_TX_INTMASK_CLEAR (CPSW_CPDMA_OFFSET + 0x8C) 61239281Sgonzo#define CPSW_CPDMA_CPDMA_EOI_VECTOR (CPSW_CPDMA_OFFSET + 0x94) 62239281Sgonzo#define CPSW_CPDMA_RX_INTSTAT_RAW (CPSW_CPDMA_OFFSET + 0xA0) 63239281Sgonzo#define CPSW_CPDMA_RX_INTSTAT_MASKED (CPSW_CPDMA_OFFSET + 0xA4) 64239281Sgonzo#define CPSW_CPDMA_RX_INTMASK_SET (CPSW_CPDMA_OFFSET + 0xA8) 65239281Sgonzo#define CPSW_CPDMA_RX_INTMASK_CLEAR (CPSW_CPDMA_OFFSET + 0xAc) 66239281Sgonzo#define CPSW_CPDMA_DMA_INTSTAT_RAW (CPSW_CPDMA_OFFSET + 0xB0) 67239281Sgonzo#define CPSW_CPDMA_DMA_INTSTAT_MASKED (CPSW_CPDMA_OFFSET + 0xB4) 68239281Sgonzo#define CPSW_CPDMA_DMA_INTMASK_SET (CPSW_CPDMA_OFFSET + 0xB8) 69239281Sgonzo#define CPSW_CPDMA_DMA_INTMASK_CLEAR (CPSW_CPDMA_OFFSET + 0xBC) 70239281Sgonzo#define CPSW_CPDMA_RX_FREEBUFFER(p) (CPSW_CPDMA_OFFSET + 0x0e0 + ((p) * 0x04)) 71239281Sgonzo 72244939Skientzle#define CPSW_STATS_OFFSET 0x0900 73244939Skientzle 74244939Skientzle#define CPSW_STATERAM_OFFSET 0x0A00 75244939Skientzle#define CPSW_CPDMA_TX_HDP(p) (CPSW_STATERAM_OFFSET + 0x00 + ((p) * 0x04)) 76244939Skientzle#define CPSW_CPDMA_RX_HDP(p) (CPSW_STATERAM_OFFSET + 0x20 + ((p) * 0x04)) 77244939Skientzle#define CPSW_CPDMA_TX_CP(p) (CPSW_STATERAM_OFFSET + 0x40 + ((p) * 0x04)) 78244939Skientzle#define CPSW_CPDMA_RX_CP(p) (CPSW_STATERAM_OFFSET + 0x60 + ((p) * 0x04)) 79244939Skientzle 80239281Sgonzo#define CPSW_CPTS_OFFSET 0x0C00 81239281Sgonzo 82239281Sgonzo#define CPSW_ALE_OFFSET 0x0D00 83239281Sgonzo#define CPSW_ALE_CONTROL (CPSW_ALE_OFFSET + 0x08) 84239281Sgonzo#define CPSW_ALE_TBLCTL (CPSW_ALE_OFFSET + 0x20) 85239281Sgonzo#define CPSW_ALE_TBLW2 (CPSW_ALE_OFFSET + 0x34) 86239281Sgonzo#define CPSW_ALE_TBLW1 (CPSW_ALE_OFFSET + 0x38) 87239281Sgonzo#define CPSW_ALE_TBLW0 (CPSW_ALE_OFFSET + 0x3C) 88239281Sgonzo#define CPSW_ALE_PORTCTL(p) (CPSW_ALE_OFFSET + 0x40 + ((p) * 0x04)) 89239281Sgonzo 90246276Skientzle/* SL1 is at 0x0D80, SL2 is at 0x0DC0 */ 91239281Sgonzo#define CPSW_SL_OFFSET 0x0D80 92239281Sgonzo#define CPSW_SL_MACCONTROL(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x04) 93246276Skientzle#define CPSW_SL_MACSTATUS(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x08) 94239281Sgonzo#define CPSW_SL_SOFT_RESET(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x0C) 95239281Sgonzo#define CPSW_SL_RX_MAXLEN(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x10) 96246276Skientzle#define CPSW_SL_RX_PAUSE(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x18) 97246276Skientzle#define CPSW_SL_TX_PAUSE(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x1C) 98239281Sgonzo#define CPSW_SL_RX_PRI_MAP(p) (CPSW_SL_OFFSET + (0x40 * (p)) + 0x24) 99239281Sgonzo 100239281Sgonzo#define MDIO_OFFSET 0x1000 101239281Sgonzo#define MDIOCONTROL (MDIO_OFFSET + 0x04) 102239281Sgonzo#define MDIOUSERACCESS0 (MDIO_OFFSET + 0x80) 103239281Sgonzo#define MDIOUSERPHYSEL0 (MDIO_OFFSET + 0x84) 104239281Sgonzo 105239281Sgonzo#define CPSW_WR_OFFSET 0x1200 106239281Sgonzo#define CPSW_WR_SOFT_RESET (CPSW_WR_OFFSET + 0x04) 107239281Sgonzo#define CPSW_WR_CONTROL (CPSW_WR_OFFSET + 0x08) 108239281Sgonzo#define CPSW_WR_INT_CONTROL (CPSW_WR_OFFSET + 0x0c) 109239281Sgonzo#define CPSW_WR_C_RX_THRESH_EN(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x10) 110239281Sgonzo#define CPSW_WR_C_RX_EN(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x14) 111239281Sgonzo#define CPSW_WR_C_TX_EN(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x18) 112239281Sgonzo#define CPSW_WR_C_MISC_EN(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x1C) 113239281Sgonzo#define CPSW_WR_C_RX_THRESH_STAT(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x40) 114239281Sgonzo#define CPSW_WR_C_RX_STAT(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x44) 115239281Sgonzo#define CPSW_WR_C_TX_STAT(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x48) 116239281Sgonzo#define CPSW_WR_C_MISC_STAT(p) (CPSW_WR_OFFSET + (0x10 * (p)) + 0x4C) 117239281Sgonzo 118239281Sgonzo#define CPSW_CPPI_RAM_OFFSET 0x2000 119246276Skientzle#define CPSW_CPPI_RAM_SIZE 0x2000 120239281Sgonzo 121246276Skientzle#define CPDMA_BD_SOP (1<<15) 122246276Skientzle#define CPDMA_BD_EOP (1<<14) 123246276Skientzle#define CPDMA_BD_OWNER (1<<13) 124246276Skientzle#define CPDMA_BD_EOQ (1<<12) 125246276Skientzle#define CPDMA_BD_TDOWNCMPLT (1<<11) 126246276Skientzle#define CPDMA_BD_PKT_ERR_MASK (3<< 4) 127246276Skientzle 128246276Skientzlestruct cpsw_cpdma_bd { 129246276Skientzle volatile uint32_t next; 130246276Skientzle volatile uint32_t bufptr; 131246276Skientzle volatile uint16_t buflen; 132246276Skientzle volatile uint16_t bufoff; 133246276Skientzle volatile uint16_t pktlen; 134246276Skientzle volatile uint16_t flags; 135246276Skientzle}; 136246276Skientzle 137239281Sgonzo#endif /*_IF_CPSWREG_H */ 138