blob: 2b4e05af3bf3de799e12fa7d066de02b9a443a8f [file] [log] [blame]
goda.yusukeeb3def62008-03-05 17:08:33 +09001/*
2 * AX88796L(NE2000) support
3 *
4 * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
goda.yusukeeb3def62008-03-05 17:08:33 +09007 */
8
9#ifndef __DRIVERS_AX88796L_H__
10#define __DRIVERS_AX88796L_H__
11
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020012#define DP_DATA (0x10 << 1)
13#define START_PG 0x40 /* First page of TX buffer */
14#define START_PG2 0x48
15#define STOP_PG 0x80 /* Last page +1 of RX ring */
16#define TX_PAGES 12
17#define RX_START (START_PG+TX_PAGES)
18#define RX_END STOP_PG
goda.yusukeeb3def62008-03-05 17:08:33 +090019
20#define AX88796L_BASE_ADDRESS CONFIG_DRIVER_NE2000_BASE
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020021#define AX88796L_BYTE_ACCESS 0x00001000
22#define AX88796L_OFFSET 0x00000400
23#define AX88796L_ADDRESS_BYTE AX88796L_BASE_ADDRESS + \
goda.yusukeeb3def62008-03-05 17:08:33 +090024 AX88796L_BYTE_ACCESS + AX88796L_OFFSET
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020025#define AX88796L_REG_MEMR AX88796L_ADDRESS_BYTE + (0x14<<1)
26#define AX88796L_REG_CR AX88796L_ADDRESS_BYTE + (0x00<<1)
goda.yusukeeb3def62008-03-05 17:08:33 +090027
28#define AX88796L_CR (*(vu_short *)(AX88796L_REG_CR))
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020029#define AX88796L_MEMR (*(vu_short *)(AX88796L_REG_MEMR))
goda.yusukeeb3def62008-03-05 17:08:33 +090030
31#define EECS_HIGH (AX88796L_MEMR |= 0x10)
32#define EECS_LOW (AX88796L_MEMR &= 0xef)
33#define EECLK_HIGH (AX88796L_MEMR |= 0x80)
34#define EECLK_LOW (AX88796L_MEMR &= 0x7f)
35#define EEDI_HIGH (AX88796L_MEMR |= 0x20)
36#define EEDI_LOW (AX88796L_MEMR &= 0xdf)
37#define EEDO ((AX88796L_MEMR & 0x40)>>6)
38
39#define PAGE0_SET (AX88796L_CR &= 0x3f)
40#define PAGE1_SET (AX88796L_CR = (AX88796L_CR & 0x3f) | 0x40)
41
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020042#define BIT_DUMMY 0
goda.yusukeeb3def62008-03-05 17:08:33 +090043#define MAC_EEP_READ 1
44#define MAC_EEP_WRITE 2
45#define MAC_EEP_ERACE 3
46#define MAC_EEP_EWEN 4
47#define MAC_EEP_EWDS 5
48
49/* R7780MP Specific code */
50#if defined(CONFIG_R7780MP)
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020051#define ISA_OFFSET 0x1400
52#define DP_IN(_b_, _o_, _d_) (_d_) = \
goda.yusukeeb3def62008-03-05 17:08:33 +090053 *( (vu_short *) ((_b_) + ((_o_) * 2) + ISA_OFFSET))
54#define DP_OUT(_b_, _o_, _d_) \
55 *((vu_short *)((_b_) + ((_o_) * 2) + ISA_OFFSET)) = (_d_)
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020056#define DP_IN_DATA(_b_, _d_) (_d_) = *( (vu_short *) ((_b_) + ISA_OFFSET))
57#define DP_OUT_DATA(_b_, _d_) *( (vu_short *) ((_b_)+ISA_OFFSET)) = (_d_)
goda.yusukeeb3def62008-03-05 17:08:33 +090058#else
59/* Please change for your target boards */
Jean-Christophe PLAGNIOL-VILLARD8ec5fcb2008-04-24 07:57:16 +020060#define ISA_OFFSET 0x0000
61#define DP_IN(_b_, _o_, _d_) (_d_) = *( (vu_short *)((_b_)+(_o_ )+ISA_OFFSET))
62#define DP_OUT(_b_, _o_, _d_) *((vu_short *)((_b_)+(_o_)+ISA_OFFSET)) = (_d_)
63#define DP_IN_DATA(_b_, _d_) (_d_) = *( (vu_short *) ((_b_)+ISA_OFFSET))
64#define DP_OUT_DATA(_b_, _d_) *( (vu_short *) ((_b_)+ISA_OFFSET)) = (_d_)
goda.yusukeeb3def62008-03-05 17:08:33 +090065#endif
66
goda.yusukeeb3def62008-03-05 17:08:33 +090067#endif /* __DRIVERS_AX88796L_H__ */