ENC28J60 NIC driver module added to Linux kernel, kconfig,makefile configuration process

Source: Internet
Author: User

This is to add the Enc28j60 NIC driver module in the http://www.cnblogs.com/hackfun/p/6260396.html to the 2.6.22.6 kernel, the module code does not need any modification. Only the relevant configuration script files in the kernel directory, such as Makefile,kconfig,.config, are required to modify certain configurations.

Several files used by the ENC28J60 NIC driver module:

Enc28j60.c

Enc28j60_hw.h

Spi_bitbang.c

Spi_s3c24xx.c

Spi_platform_dev.c

In fact, SPI_BITBANG.C,SPI_S3C24XX.C is a kernel native file and does not require any changes. In the case of http://www.cnblogs.com/hackfun/p/6260396.html, my kernel did not compile these two files. So you need to manually load the two files into it.

Here, we add in the kernel

Enc28j60.c

Enc28j60_hw.h

Spi_platform_dev.c

These 3 files can be.

Enc28j60.c,enc28j60_hw.h These two files are platform-independent network drivers, so put them in the Linux-2.6.22.6/drivers/net directory.

SPI_PLATFORM_DEV.C is directly related to the platform hardware, so put it in the linux-2.6.22.6/arch/arm/plat-s3c24xx directory.

1. Add the SPI module into the kernel

A. Enter into the linux-2.6.22.6 source directory

Make Makeconfig

In this way, the kernel configuration menu of the graphical interface is displayed on the midrange to find the SPI-related configuration:

Device Drivers--->

SPI Support--->

[*] SPI Support

[*] SPI Master Support

<*> bitbanging SPI Master

<*> Samsung s3c24xx Series SPI

<M> Samsung s3c24xx series SPI by GPIO

In the [] or <> entries by the space bar, * indicates that the relevant module files are added to the kernel, m for the relevant files compiled into a module, not added to the kernel, space means not configured:

[*] SPI Support Settings Add the LINUX-2.6.22.6\DRIVERS\SPI directory to the upper drivers Directory

[*] SPI Master Support Settings Add SPI.C to the kernel

<*> bitbanging SPI Master Settings add spi_bitbang.c to the kernel

<*> Samsung s3c24xx Series SPI settings add spi_s3c24xx.c to the kernel, hardware SPI

<M> Samsung s3c24xx Series SPI by GPIO sets the SPI_S3C24XX_GPIO.C generation module to simulate SPI

B. Exit the configuration menu, save and generate the. config file in the linux-2.6.22.6 source directory.

vi. config

Find the relevant configuration of the SPI:

# # SPI Support#config_spi= issetconfig_spi_master=y## SPI MASTER Controller Drivers#config_spi_bitbang=issetconfig_spi_s3c24xx=  Yconfig_spi_s3c24xx_gpio=issetisset


Correspondence Relationship:

[*] SPI support corresponds to the build configuration config_spi=y

[*] SPI Master support corresponds to the build configuration config_spi_master=y

<*> bitbanging SPI Master corresponds to the build configuration config_spi_bitbang=y

... ....

[] or <> inside is a space, corresponding to generate config_xxx is not set

This means that if you do not use the Make Menuconfig graphical interface, you can modify the. config file directly.

C. Configuration relationships at various levels of kconfig and makefile

Linux-2.6.22.6\drivers\kconfig

" Drivers/spi/kconfig " ... ...

Linux-2.6.22.6\drivers\makefile

.... obj-$ (config_spi)        + = spi/ ...

Linux-2.6.22.6\drivers\spi\kconfig, the configuration in this file is for the menu item display in make Menuconfig, such as after make Menuconfig. The config SPI generates CONFIG_SPI macros in the Linux-2.6.22.6\.config,

Make Menuconfig the [*] SPI support corresponds to the build configuration config_spi=y

... config SPIBOOL "SPI Support" Help the"Serial Peripheral Interface"  isa low level synchronous protocol. Chips that support SPI can has data transfer rates up to several tens of Mbit/sec.  Chips is addressed with a controller and a chipselect. Most SPI slaves Don'T supportDynamic device discovery; Some is even write-only or read-Only . SPI iswidely used by microcontrollers to talk with sensors, EEPROM and flash memory, codecs and various other controll Er chips, analog to digital (and D-to-a) converters, and more. MMC and SD cards can be accessedusingSPI Protocol; and fordataflash cards usedinchMMC sockets, SPI must always be used. SPI isOne of a family of similar protocolsusinga four wireInterface(Select, Clock, datainch, the data out) including microwire (half duplex), SSP, SSI, and PSP. This driver framework should work with the most such devices and Controllers ... config Spi_master boolean"SPI Master Support"Help If Your system have an master-capable SPI controller (which provides the clock and chipselect), you can enable this controller and the pro Tocol Drivers forThe SPI slave chips that is connected .... config Spi_bitbang tristate"bitbanging SPI Master"depends on Spi_master&&experimental help with a few GPIO pins, your system can bitbang the SPI protocol. Select ThisToGetSPI support through i/O pins (GPIO, parallel port, etc). Or, some systems'SPI Master Controller drivers use       ThisCode to manage the Per-word or per-transfer accesses to the hardware shift registers. this isLibrary code, and isautomatically selected by drivers that need it. Need toSelect  Thisexplicitly to support driver modules that aren'T part of this kernel tree.... config spi_s3c24xx tristate"Samsung s3c24xx Series SPI"depends on Spi_master&& arch_s3c2410 &&Experimental help SPI driver forSamsung s3c24xx series ARM SoCs ...

Linux-2.6.22.6\drivers\spi\makefile

... obj-$ (config_spi_master)        + = spi.o ... obj-$ (config_spi_bitbang)        + = spi_ BITBANG.O.... obj-$ (config_spi_s3c24xx)        + = spi_s3c24xx.o ...


D. After modifying the above configuration, enter the following in the linux-2.6.22.6 directory:

Make Uimage

To compile, to wait patiently .......

After compiling, by observing the compilation output information, verify that there is no compile into the kernel, the first compile output too much information is not good to find. can open

Spi_bitbang.c

Spi_s3c24xx.c

These two files, respectively, in the blank space inside the input a blank, save, and then compile, you will see the following information:

... ...  CC      drivers/spi/spi_bitbang.o  cc      drivers/spi/spi_s3c24xx.o ...

Here, the SPI driver has been added to the kernel.

2. Enc28j60 's driver addition method is similar, here only the JZ2440 with the kernel-based modification where the kconfig and makefile no longer analyze the matching relationship.

Linux-2.6.22.6\drivers\net\kconfig

... config enc28j60     " enc28j60 Support "     depends on net_ethernet    ---help---      for  enc28j60 chipset.        This  as a module, choose M here and read       <file:Documentation/networking/net-modules.txt>.  The module would be      called Enc28j60 ....

Linux-2.6.22.6\drivers\net\makefile

.... obj-$ (config_enc28j60) + = enc28j60.o ...

Make Menuconfig

Device Drivers  --->  Network deviceSupport--->         Ethernet (ten or 100Mbit)  --->             

Linux-2.6.22.6\arch\arm\plat-s3c24xx\makefile

..... obj-$ (config_cpu_s3c244x)    + =


3. Recompile

Make Uimage

4. Burn Write

Burn write Uimage to the Development Board

5. Start

A. After starting up, look at the information that the kernel prints:

View driver Load conditions

B. After you have the system mount the system files, configure eth1 (ENC28J60)

Vi/etc/init.d/rcs

Add to:

Ifconfig eth1 192.168.1.12 netmask 255.255.255.0 up

Reboot to see network configuration

Turn off eth0, automatically switch to eth1 Mount NFS

Here, Enc28j60 is ready to work.

ENC28J60 NIC driver module added to Linux kernel, kconfig,makefile configuration process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.