요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
=====================
DM9000 Network driver
=====================
Copyright 2008 Simtec Electronics,
Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>
Introduction
------------
This file describes how to use the DM9000 platform-device based network driver
that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h.
The driver supports three DM9000 variants, the DM9000E which is the first chip
supported as well as the newer DM9000A and DM9000B devices. It is currently
maintained and tested by Ben Dooks, who should be CC: to any patches for this
driver.
Defining the platform device
----------------------------
The minimum set of resources attached to the platform device are as follows:
1) The physical address of the address register
2) The physical address of the data register
3) The IRQ line the device's interrupt pin is connected to.
These resources should be specified in that order, as the ordering of the
two address regions is important (the driver expects these to be address
and then data).
An example from arch/arm/mach-s3c/mach-bast.c is::
static struct resource bast_dm9k_resource[] = {
[0] = {
.start = S3C2410_CS5 + BAST_PA_DM9000,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_DM9000,
.end = IRQ_DM9000,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
};
Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags,
as this will generate a warning if it is not present. The trigger from
the flags field will be passed to request_irq() when registering the IRQ
handler to ensure that the IRQ is setup correctly.
This shows a typical platform device, without the optional configuration
platform data supplied. The next example uses the same resources, but adds
the optional platform data to pass extra configuration data::
static struct dm9000_plat_data bast_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
.dev = {
.platform_data = &bast_dm9k_platdata,
}
};
The platform data is defined in include/linux/dm9000.h and described below.
Platform data
-------------
Extra platform data for the DM9000 can describe the IO bus width to the
device, whether or not an external PHY is attached to the device and
the availability of an external configuration EEPROM.
The flags for the platform data .flags field are as follows:
DM9000_PLATF_8BITONLY
The IO should be done with 8bit operations.
DM9000_PLATF_16BITONLY
The IO should be done with 16bit operations.
DM9000_PLATF_32BITONLY
The IO should be done with 32bit operations.
DM9000_PLATF_EXT_PHY
The chip is connected to an external PHY.
DM9000_PLATF_NO_EEPROM
This can be used to signify that the board does not have an
EEPROM, or that the EEPROM should be hidden from the user.
DM9000_PLATF_SIMPLE_PHY
Switch to using the simpler PHY polling method which does not
try and read the MII PHY state regularly. This is only available
when using the internal PHY. See the section on link state polling
for more information.
The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry
"Force simple NSR based PHY polling" allows this flag to be
forced on at build time.
PHY Link state polling
----------------------
The driver keeps track of the link state and informs the network core
about link (carrier) availability. This is managed by several methods
depending on the version of the chip and on which PHY is being used.
For the internal PHY, the original (and currently default) method is
to read the MII state, either when the status changes if we have the
necessary interrupt support in the chip or every two seconds via a
periodic timer.
To reduce the overhead for the internal PHY, there is now the option
of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY
platform data option to read the summary information without the
expensive MII accesses. This method is faster, but does not print
as much information.
When using an external PHY, the driver currently has to poll the MII
link status as there is no method for getting an interrupt on link change.
DM9000A / DM9000B
-----------------
These chips are functionally similar to the DM9000E and are supported easily
by the same driver. The features are:
1) Interrupt on internal PHY state change. This means that the periodic
polling of the PHY status may be disabled on these devices when using
the internal PHY.
2) TCP/UDP checksum offloading, which the driver does not currently support.
ethtool
-------
The driver supports the ethtool interface for access to the driver
state information, the PHY state and the EEPROM.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
드라이버 소개와 지원 칩
1-23DM9000 네트워크 드라이버
Copyright 2008 Simtec Electronics
Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>
소개
이 문서는 `drivers/net/dm9000.c`와 `drivers/net/dm9000.h`에 들어 있는 platform device 기반 DM9000 네트워크 드라이버를 사용하는 방법을 설명합니다.
드라이버는 처음 지원한 DM9000E와 이후의 DM9000A, DM9000B까지 세 가지 변형을 지원합니다. 당시 Ben Dooks가 드라이버를 관리하고 시험했으며 이 드라이버의 패치를 보낼 때 참조(`CC`)에 포함해야 합니다.
.. SPDX-License-Identifier: GPL-2.0
=====================
DM9000 Network driver
=====================
Copyright 2008 Simtec Electronics,
Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>
Introduction
------------
This file describes how to use the DM9000 platform-device based network driver
that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h.
The driver supports three DM9000 variants, the DM9000E which is the first chip
supported as well as the newer DM9000A and DM9000B devices. It is currently
maintained and tested by Ben Dooks, who should be CC: to any patches for this
driver.
platform device 자원과 구성 데이터
24-89platform device 정의
platform device에 연결해야 하는 최소 자원은 다음과 같습니다.
- 1. 주소 레지스터의 물리 주소
- 2. 데이터 레지스터의 물리 주소
- 3. 장치 인터럽트 핀이 연결된 IRQ 선
자원은 반드시 이 순서로 지정해야 합니다. 두 주소 영역의 순서가 중요하며 드라이버는 첫 번째 영역을 주소 레지스터, 두 번째 영역을 데이터 레지스터로 해석합니다.
`arch/arm/mach-s3c/mach-bast.c`의 예
static struct resource bast_dm9k_resource[] = {
[0] = {
.start = S3C2410_CS5 + BAST_PA_DM9000,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_DM9000,
.end = IRQ_DM9000,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
};
`bast_dm9k_resource[2].flags`의 IRQ 트리거 플래그를 확인하십시오. 플래그가 없으면 경고가 발생합니다. `flags` 필드의 트리거 값은 IRQ 핸들러를 등록할 때 `request_irq()`에 전달되어 IRQ가 올바르게 설정되게 합니다.
위 예는 선택적 platform data를 제공하지 않은 일반적인 platform device입니다. 다음 예는 같은 자원을 사용하면서 추가 구성 정보를 전달할 선택적 platform data를 더합니다.
static struct dm9000_plat_data bast_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
.dev = {
.platform_data = &bast_dm9k_platdata,
}
};
platform data는 `include/linux/dm9000.h`에 정의되어 있으며 다음 절에서 설명합니다.
Defining the platform device
----------------------------
The minimum set of resources attached to the platform device are as follows:
1) The physical address of the address register
2) The physical address of the data register
3) The IRQ line the device's interrupt pin is connected to.
These resources should be specified in that order, as the ordering of the
two address regions is important (the driver expects these to be address
and then data).
An example from arch/arm/mach-s3c/mach-bast.c is::
static struct resource bast_dm9k_resource[] = {
[0] = {
.start = S3C2410_CS5 + BAST_PA_DM9000,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_DM9000,
.end = IRQ_DM9000,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
};
Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags,
as this will generate a warning if it is not present. The trigger from
the flags field will be passed to request_irq() when registering the IRQ
handler to ensure that the IRQ is setup correctly.
This shows a typical platform device, without the optional configuration
platform data supplied. The next example uses the same resources, but adds
the optional platform data to pass extra configuration data::
static struct dm9000_plat_data bast_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
.dev = {
.platform_data = &bast_dm9k_platdata,
}
};
The platform data is defined in include/linux/dm9000.h and described below.
platform data 플래그
90-131Platform data
DM9000의 추가 platform data는 장치의 I/O 버스 폭, 외부 PHY 연결 여부와 외부 구성 EEPROM 사용 가능 여부를 나타낼 수 있습니다.
platform data의 `.flags` 필드에 사용할 수 있는 플래그는 다음과 같습니다.
`DM9000_PLATF_8BITONLY`
I/O를 8비트 연산으로 수행합니다.
`DM9000_PLATF_16BITONLY`
I/O를 16비트 연산으로 수행합니다.
`DM9000_PLATF_32BITONLY`
I/O를 32비트 연산으로 수행합니다.
`DM9000_PLATF_EXT_PHY`
칩이 외부 PHY에 연결되어 있음을 나타냅니다.
`DM9000_PLATF_NO_EEPROM`
보드에 EEPROM이 없거나 사용자에게 EEPROM을 숨겨야 함을 나타낼 때 사용합니다.
`DM9000_PLATF_SIMPLE_PHY`
MII PHY 상태를 주기적으로 읽지 않는 단순 PHY 폴링 방식으로 전환합니다. 내부 PHY를 사용할 때만 쓸 수 있습니다. 자세한 내용은 링크 상태 폴링 절을 참조하십시오.
Kconfig 항목 `Force simple NSR based PHY polling`에 해당하는 `DM9000_FORCE_SIMPLE_PHY_POLL` 구성 심볼을 사용하면 빌드 시 이 플래그를 강제로 활성화할 수 있습니다.
Platform data
-------------
Extra platform data for the DM9000 can describe the IO bus width to the
device, whether or not an external PHY is attached to the device and
the availability of an external configuration EEPROM.
The flags for the platform data .flags field are as follows:
DM9000_PLATF_8BITONLY
The IO should be done with 8bit operations.
DM9000_PLATF_16BITONLY
The IO should be done with 16bit operations.
DM9000_PLATF_32BITONLY
The IO should be done with 32bit operations.
DM9000_PLATF_EXT_PHY
The chip is connected to an external PHY.
DM9000_PLATF_NO_EEPROM
This can be used to signify that the board does not have an
EEPROM, or that the EEPROM should be hidden from the user.
DM9000_PLATF_SIMPLE_PHY
Switch to using the simpler PHY polling method which does not
try and read the MII PHY state regularly. This is only available
when using the internal PHY. See the section on link state polling
for more information.
The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry
"Force simple NSR based PHY polling" allows this flag to be
forced on at build time.
PHY 링크 상태 폴링
132-153PHY 링크 상태 폴링
드라이버는 링크 상태를 추적하고 네트워크 코어에 링크, 즉 carrier 사용 가능 여부를 알립니다. 칩 버전과 사용 중인 PHY에 따라 여러 방식으로 관리합니다.
내부 PHY의 원래 방식이자 현재 기본 방식은 MII 상태를 읽는 것입니다. 칩에 필요한 인터럽트 지원이 있으면 상태가 바뀔 때 읽고, 그렇지 않으면 주기 타이머로 2초마다 읽습니다.
내부 PHY의 부담을 줄이기 위해 `DM9000_FORCE_SIMPLE_PHY_POLL` 구성 또는 `DM9000_PLATF_SIMPLE_PHY` platform data 옵션을 사용할 수 있습니다. 비용이 큰 MII 접근 없이 요약 정보를 읽으므로 더 빠르지만 출력하는 정보가 적습니다.
외부 PHY는 링크 변화 인터럽트를 받는 방법이 없으므로 현재 드라이버가 MII 링크 상태를 폴링해야 합니다.
PHY Link state polling
----------------------
The driver keeps track of the link state and informs the network core
about link (carrier) availability. This is managed by several methods
depending on the version of the chip and on which PHY is being used.
For the internal PHY, the original (and currently default) method is
to read the MII state, either when the status changes if we have the
necessary interrupt support in the chip or every two seconds via a
periodic timer.
To reduce the overhead for the internal PHY, there is now the option
of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY
platform data option to read the summary information without the
expensive MII accesses. This method is faster, but does not print
as much information.
When using an external PHY, the driver currently has to poll the MII
link status as there is no method for getting an interrupt on link change.
DM9000A·DM9000B 기능과 ethtool
154-171DM9000A / DM9000B
이 칩들은 기능상 DM9000E와 유사하며 같은 드라이버로 쉽게 지원할 수 있습니다. 추가 기능은 다음과 같습니다.
- 1. 내부 PHY 상태 변화 인터럽트: 내부 PHY를 사용할 때 이 장치에서는 주기적인 PHY 상태 폴링을 비활성화할 수 있습니다.
- 2. TCP/UDP 체크섬 오프로딩: 당시 드라이버는 이 기능을 지원하지 않았습니다.
ethtool
드라이버는 드라이버 상태 정보, PHY 상태와 EEPROM에 접근할 수 있도록 ethtool 인터페이스를 지원합니다.
DM9000A / DM9000B
-----------------
These chips are functionally similar to the DM9000E and are supported easily
by the same driver. The features are:
1) Interrupt on internal PHY state change. This means that the periodic
polling of the PHY status may be disabled on these devices when using
the internal PHY.
2) TCP/UDP checksum offloading, which the driver does not currently support.
ethtool
-------
The driver supports the ethtool interface for access to the driver
state information, the PHY state and the EEPROM.
요약·해설
dm9000.rst:1-171이 문서의 핵심은 platform device 자원 배열의 순서가 ABI처럼 중요하다는 점입니다. 주소 레지스터, 데이터 레지스터, IRQ 순서를 지켜야 하며 IRQ 트리거 속성도 자원 플래그에 명시해야 합니다. platform data는 실제 보드 배선과 PHY 구성을 드라이버에 전달합니다.
하나의 드라이버가 세 DM9000 변형을 다룹니다.
드라이버가 배열 위치로 주소 영역의 의미를 구분합니다.
자원 플래그의 트리거 정보가 IRQ 설정으로 이어집니다.
보드별 추가 정보는 장치의 `.dev.platform_data`로 전달합니다.
보드 버스에 맞는 단일 접근 폭을 지정합니다.
PHY와 EEPROM의 실제 연결 상태를 설명합니다.
칩 기능에 따라 상태 변화 IRQ 또는 2초 타이머를 사용합니다.
비용과 진단 정보량 사이의 선택입니다.
링크 변화 IRQ를 받을 수 없어 MII 상태를 계속 확인합니다.
실리콘 기능과 당시 드라이버 지원 여부를 구분합니다.
사용자 공간에서 조회할 수 있는 상태입니다.