Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
@@ -0,0 +1,55 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Davicom device configuration
#
config NET_VENDOR_DAVICOM
bool "Davicom devices"
default y
help
If you have a network (Ethernet) card belonging to this class, say Y.
Note that the answer to this question doesn't directly affect the
kernel: saying N will just cause the configurator to skip all
the questions about Davicom devices. If you say Y, you will be asked
for your specific card in the following selections.
if NET_VENDOR_DAVICOM
config DM9000
tristate "DM9000 support"
depends on ARM || MIPS || COLDFIRE || NIOS2 || COMPILE_TEST
select CRC32
select MII
help
Support for DM9000 chipset.
To compile this driver as a module, choose M here. The module
will be called dm9000.
config DM9000_FORCE_SIMPLE_PHY_POLL
bool "Force simple NSR based PHY polling"
depends on DM9000
help
This configuration forces the DM9000 to use the NSR's LinkStatus
bit to determine if the link is up or down instead of the more
costly MII PHY reads. Note, this will not work if the chip is
operating with an external PHY.
config DM9051
tristate "DM9051 SPI support"
depends on SPI
select CRC32
select MDIO
select PHYLIB
select REGMAP_SPI
help
Support for DM9051 SPI chipset.
To compile this driver as a module, choose M here. The module
will be called dm9051.
The SPI mode for the host's SPI master to access DM9051 is mode
0 on the SPI bus.
endif # NET_VENDOR_DAVICOM
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for the Davicom device drivers.
#
obj-$(CONFIG_DM9000) += dm9000.o
obj-$(CONFIG_DM9051) += dm9051.o
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,181 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* dm9000 Ethernet
*/
#ifndef _DM9000X_H_
#define _DM9000X_H_
#define DM9000_ID 0x90000A46
/* although the registers are 16 bit, they are 32-bit aligned.
*/
#define DM9000_NCR 0x00
#define DM9000_NSR 0x01
#define DM9000_TCR 0x02
#define DM9000_TSR1 0x03
#define DM9000_TSR2 0x04
#define DM9000_RCR 0x05
#define DM9000_RSR 0x06
#define DM9000_ROCR 0x07
#define DM9000_BPTR 0x08
#define DM9000_FCTR 0x09
#define DM9000_FCR 0x0A
#define DM9000_EPCR 0x0B
#define DM9000_EPAR 0x0C
#define DM9000_EPDRL 0x0D
#define DM9000_EPDRH 0x0E
#define DM9000_WCR 0x0F
#define DM9000_PAR 0x10
#define DM9000_MAR 0x16
#define DM9000_GPCR 0x1e
#define DM9000_GPR 0x1f
#define DM9000_TRPAL 0x22
#define DM9000_TRPAH 0x23
#define DM9000_RWPAL 0x24
#define DM9000_RWPAH 0x25
#define DM9000_VIDL 0x28
#define DM9000_VIDH 0x29
#define DM9000_PIDL 0x2A
#define DM9000_PIDH 0x2B
#define DM9000_CHIPR 0x2C
#define DM9000_SMCR 0x2F
#define DM9000_ETXCSR 0x30
#define DM9000_TCCR 0x31
#define DM9000_RCSR 0x32
#define CHIPR_DM9000A 0x19
#define CHIPR_DM9000B 0x1A
#define DM9000_MRCMDX 0xF0
#define DM9000_MRCMD 0xF2
#define DM9000_MRRL 0xF4
#define DM9000_MRRH 0xF5
#define DM9000_MWCMDX 0xF6
#define DM9000_MWCMD 0xF8
#define DM9000_MWRL 0xFA
#define DM9000_MWRH 0xFB
#define DM9000_TXPLL 0xFC
#define DM9000_TXPLH 0xFD
#define DM9000_ISR 0xFE
#define DM9000_IMR 0xFF
#define NCR_EXT_PHY (1<<7)
#define NCR_WAKEEN (1<<6)
#define NCR_FCOL (1<<4)
#define NCR_FDX (1<<3)
#define NCR_RESERVED (3<<1)
#define NCR_MAC_LBK (1<<1)
#define NCR_RST (1<<0)
#define NSR_SPEED (1<<7)
#define NSR_LINKST (1<<6)
#define NSR_WAKEST (1<<5)
#define NSR_TX2END (1<<3)
#define NSR_TX1END (1<<2)
#define NSR_RXOV (1<<1)
#define TCR_TJDIS (1<<6)
#define TCR_EXCECM (1<<5)
#define TCR_PAD_DIS2 (1<<4)
#define TCR_CRC_DIS2 (1<<3)
#define TCR_PAD_DIS1 (1<<2)
#define TCR_CRC_DIS1 (1<<1)
#define TCR_TXREQ (1<<0)
#define TSR_TJTO (1<<7)
#define TSR_LC (1<<6)
#define TSR_NC (1<<5)
#define TSR_LCOL (1<<4)
#define TSR_COL (1<<3)
#define TSR_EC (1<<2)
#define RCR_WTDIS (1<<6)
#define RCR_DIS_LONG (1<<5)
#define RCR_DIS_CRC (1<<4)
#define RCR_ALL (1<<3)
#define RCR_RUNT (1<<2)
#define RCR_PRMSC (1<<1)
#define RCR_RXEN (1<<0)
#define RSR_RF (1<<7)
#define RSR_MF (1<<6)
#define RSR_LCS (1<<5)
#define RSR_RWTO (1<<4)
#define RSR_PLE (1<<3)
#define RSR_AE (1<<2)
#define RSR_CE (1<<1)
#define RSR_FOE (1<<0)
#define WCR_LINKEN (1 << 5)
#define WCR_SAMPLEEN (1 << 4)
#define WCR_MAGICEN (1 << 3)
#define WCR_LINKST (1 << 2)
#define WCR_SAMPLEST (1 << 1)
#define WCR_MAGICST (1 << 0)
#define FCTR_HWOT(ot) (( ot & 0xf ) << 4 )
#define FCTR_LWOT(ot) ( ot & 0xf )
#define IMR_PAR (1<<7)
#define IMR_ROOM (1<<3)
#define IMR_ROM (1<<2)
#define IMR_PTM (1<<1)
#define IMR_PRM (1<<0)
#define ISR_ROOS (1<<3)
#define ISR_ROS (1<<2)
#define ISR_PTS (1<<1)
#define ISR_PRS (1<<0)
#define ISR_CLR_STATUS (ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS)
#define EPCR_REEP (1<<5)
#define EPCR_WEP (1<<4)
#define EPCR_EPOS (1<<3)
#define EPCR_ERPRR (1<<2)
#define EPCR_ERPRW (1<<1)
#define EPCR_ERRE (1<<0)
#define GPCR_GEP_CNTL (1<<0)
#define TCCR_IP (1<<0)
#define TCCR_TCP (1<<1)
#define TCCR_UDP (1<<2)
#define RCSR_UDP_BAD (1<<7)
#define RCSR_TCP_BAD (1<<6)
#define RCSR_IP_BAD (1<<5)
#define RCSR_UDP (1<<4)
#define RCSR_TCP (1<<3)
#define RCSR_IP (1<<2)
#define RCSR_CSUM (1<<1)
#define RCSR_DISCARD (1<<0)
#define DM9000_PKT_RDY 0x01 /* Packet ready to receive */
#define DM9000_PKT_ERR 0x02
#define DM9000_PKT_MAX 1536 /* Received packet max size */
/* DM9000A / DM9000B definitions */
#define IMR_LNKCHNG (1<<5)
#define IMR_UNDERRUN (1<<4)
#define ISR_LNKCHNG (1<<5)
#define ISR_UNDERRUN (1<<4)
/* Davicom MII registers.
*/
#define MII_DM_DSPCR 0x1b /* DSP Control Register */
#define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */
#endif /* _DM9000X_H_ */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,162 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022 Davicom Semiconductor,Inc.
* Davicom DM9051 SPI Fast Ethernet Linux driver
*/
#ifndef _DM9051_H_
#define _DM9051_H_
#include <linux/bits.h>
#include <linux/netdevice.h>
#include <linux/types.h>
#define DM9051_ID 0x9051
#define DM9051_NCR 0x00
#define DM9051_NSR 0x01
#define DM9051_TCR 0x02
#define DM9051_RCR 0x05
#define DM9051_BPTR 0x08
#define DM9051_FCR 0x0A
#define DM9051_EPCR 0x0B
#define DM9051_EPAR 0x0C
#define DM9051_EPDRL 0x0D
#define DM9051_EPDRH 0x0E
#define DM9051_PAR 0x10
#define DM9051_MAR 0x16
#define DM9051_GPCR 0x1E
#define DM9051_GPR 0x1F
#define DM9051_VIDL 0x28
#define DM9051_VIDH 0x29
#define DM9051_PIDL 0x2A
#define DM9051_PIDH 0x2B
#define DM9051_SMCR 0x2F
#define DM9051_ATCR 0x30
#define DM9051_SPIBCR 0x38
#define DM9051_INTCR 0x39
#define DM9051_PPCR 0x3D
#define DM9051_MPCR 0x55
#define DM9051_LMCR 0x57
#define DM9051_MBNDRY 0x5E
#define DM9051_MRRL 0x74
#define DM9051_MRRH 0x75
#define DM9051_MWRL 0x7A
#define DM9051_MWRH 0x7B
#define DM9051_TXPLL 0x7C
#define DM9051_TXPLH 0x7D
#define DM9051_ISR 0x7E
#define DM9051_IMR 0x7F
#define DM_SPI_MRCMDX 0x70
#define DM_SPI_MRCMD 0x72
#define DM_SPI_MWCMD 0x78
#define DM_SPI_WR 0x80
/* dm9051 Ethernet controller registers bits
*/
/* 0x00 */
#define NCR_WAKEEN BIT(6)
#define NCR_FDX BIT(3)
#define NCR_RST BIT(0)
/* 0x01 */
#define NSR_SPEED BIT(7)
#define NSR_LINKST BIT(6)
#define NSR_WAKEST BIT(5)
#define NSR_TX2END BIT(3)
#define NSR_TX1END BIT(2)
/* 0x02 */
#define TCR_DIS_JABBER_TIMER BIT(6) /* for Jabber Packet support */
#define TCR_TXREQ BIT(0)
/* 0x05 */
#define RCR_DIS_WATCHDOG_TIMER BIT(6) /* for Jabber Packet support */
#define RCR_DIS_LONG BIT(5)
#define RCR_DIS_CRC BIT(4)
#define RCR_ALL BIT(3)
#define RCR_PRMSC BIT(1)
#define RCR_RXEN BIT(0)
#define RCR_RX_DISABLE (RCR_DIS_LONG | RCR_DIS_CRC)
/* 0x06 */
#define RSR_RF BIT(7)
#define RSR_MF BIT(6)
#define RSR_LCS BIT(5)
#define RSR_RWTO BIT(4)
#define RSR_PLE BIT(3)
#define RSR_AE BIT(2)
#define RSR_CE BIT(1)
#define RSR_FOE BIT(0)
#define RSR_ERR_BITS (RSR_RF | RSR_LCS | RSR_RWTO | RSR_PLE | \
RSR_AE | RSR_CE | RSR_FOE)
/* 0x0A */
#define FCR_TXPEN BIT(5)
#define FCR_BKPM BIT(3)
#define FCR_FLCE BIT(0)
#define FCR_RXTX_BITS (FCR_TXPEN | FCR_BKPM | FCR_FLCE)
/* 0x0B */
#define EPCR_WEP BIT(4)
#define EPCR_EPOS BIT(3)
#define EPCR_ERPRR BIT(2)
#define EPCR_ERPRW BIT(1)
#define EPCR_ERRE BIT(0)
/* 0x1E */
#define GPCR_GEP_CNTL BIT(0)
/* 0x1F */
#define GPR_PHY_OFF BIT(0)
/* 0x30 */
#define ATCR_AUTO_TX BIT(7)
/* 0x39 */
#define INTCR_POL_LOW (1 << 0)
#define INTCR_POL_HIGH (0 << 0)
/* 0x3D */
/* Pause Packet Control Register - default = 1 */
#define PPCR_PAUSE_COUNT 0x08
/* 0x55 */
#define MPCR_RSTTX BIT(1)
#define MPCR_RSTRX BIT(0)
/* 0x57 */
/* LEDMode Control Register - LEDMode1 */
/* Value 0x81 : bit[7] = 1, bit[2] = 0, bit[1:0] = 01b */
#define LMCR_NEWMOD BIT(7)
#define LMCR_TYPED1 BIT(1)
#define LMCR_TYPED0 BIT(0)
#define LMCR_MODE1 (LMCR_NEWMOD | LMCR_TYPED0)
/* 0x5E */
#define MBNDRY_BYTE BIT(7)
/* 0xFE */
#define ISR_MBS BIT(7)
#define ISR_LNKCHG BIT(5)
#define ISR_ROOS BIT(3)
#define ISR_ROS BIT(2)
#define ISR_PTS BIT(1)
#define ISR_PRS BIT(0)
#define ISR_CLR_INT (ISR_LNKCHG | ISR_ROOS | ISR_ROS | \
ISR_PTS | ISR_PRS)
#define ISR_STOP_MRCMD (ISR_MBS)
/* 0xFF */
#define IMR_PAR BIT(7)
#define IMR_LNKCHGI BIT(5)
#define IMR_PTM BIT(1)
#define IMR_PRM BIT(0)
/* Const
*/
#define DM9051_PHY_ADDR 1 /* PHY id */
#define DM9051_PHY 0x40 /* PHY address 0x01 */
#define DM9051_PKT_RDY 0x01 /* Packet ready to receive */
#define DM9051_PKT_MAX 1536 /* Received packet max size */
#define DM9051_TX_QUE_HI_WATER 50
#define DM9051_TX_QUE_LO_WATER 25
#define DM_EEPROM_MAGIC 0x9051
#define DM_RXHDR_SIZE sizeof(struct dm9051_rxhdr)
static inline struct board_info *to_dm9051_board(struct net_device *ndev)
{
return netdev_priv(ndev);
}
#endif /* _DM9051_H_ */