Study Notes on AM335x (TQ335x) -- Nand & amp; NIC Driver porting, am335xtq335x

Source: Internet
Author: User
Tags spl

Study Notes of AM335x (TQ335x) -- Nand & NIC Driver porting, am335xtq335x

After the sound card driver was transplanted, I wanted to continue and transplant the NIC Driver. However, I did not expect that the kernel maintained by TI is too robust. porting the NIC Driver is as simple as porting the key driver. The same is true for the Nand driver, I will introduce Nand and nic in the same article. Before the introduction, I would like to express my feelings: TI's kernel is really robust, and DTS is really powerful.

1. Nand driver porting

According to the principle diagram of TQ335x, the Nand of TQ335x is connected to the gpmc and the MODE0 reuse function of the corresponding pins is used. After the power-on reset of AM335x, the default States of these pins are in the MODE0 mode, therefore, you do not need to set pinmux. In the original DTS, pinmux only has one:

0x160 (PIN_INPUT | MUX_MODE7)       /* spi0_cs1.gpio0_6 */
No modification is made here. Compile the kernel directly and put it on the Development Board. The operation will find that the kernel can recognize Nand, but because the omap bch function is not enabled, this configuration must be configured in the Kernel configuration item, the configuration method is as follows:

Device Drivers  ---><*> Memory Technology Device (MTD) support  ---><*>   NAND Device Support  ---><*>     Support hardware based BCH error correction
Save the configuration and exit menuconfig, re-compile the kernel, and run it on the Development Board. Now the kernel can recognize the Nand normally. The complete startup Log will be provided at the end of the article. It can be seen from this that TI's kernel maintenance is really good, much easier than the previous Samsung chip transplantation.

2. NIC Driver porting

The NIC Driver porting method is the same as the Nand driver porting method. Logically, you should first confirm the NIC pin connection and set the pinmux in DTS. However, after the Nand is transplanted, check the kernel startup Log. The NIC has been properly identified. Therefore, you can directly execute the command:

udhcpc
To dynamically obtain the ip address (you need to connect the development board to the vrodhcp through a network cable and enable the dhcp function of the vrodhcp, which is usually enabled by default). You will find that the Development Board can be allocated to the IP address from the vro, but no DNS is assigned, because dhcp settings are not performed only when the file system is used. The setting method is simple. Copy examples/udhcp/simple. script in busybox to the usr/share/udhcpc/directory of the root file system and change it to default. script. Then run the following command again:

udhcpc

You will find that the Development Board can get the IP address and DNS normally, but there is still an error, details are as follows:

@tq335x #udhcpc udhcpc (v1.22.1) startedSetting IP address 0.0.0.0 on eth0[   11.489311] net eth0: initializing cpsw version 1.12 (0)[   11.576237] net eth0: phy found : id is : 0x1cc915<span style="color:#ff0000;">[   11.581418] libphy: PHY 4a101000.mdio:01 not found[   11.586480] net eth0: phy 4a101000.mdio:01 not found on slave 1</span>Sending discover...[   13.576458] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/txSending discover...Sending select for 192.168.0.103...Lease of 192.168.0.103 obtained, lease time 86400Setting IP address 192.168.0.103 on eth0Deleting routersroute: SIOCDELRT: No such processAdding router 192.168.0.1Recreating /etc/resolv.conf Adding DNS server 10.0.0.1
Mark the red text as the error. Refer to dts of the evm Development Board provided by TI official website. This article modifies tq335x. dts as follows:

&mac {    <span style="color:#ff0000;">slaves = <1>;</span>    pinctrl-names = "default", "sleep";    pinctrl-0 = <&cpsw_default>;    pinctrl-1 = <&cpsw_sleep>;    status = "okay";};
Delete the following nodes:
&cpsw_emac1 {    phy_id = <&davinci_mdio>, <1>;    phy-mode = "rgmii-txid";};
Recompile tq335x. dtb:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- tq335x.dtb
Start the Development Board with the new tq335x. dtb:
load mmc 0:1 0x88000000 /boot/tq335x.dtbload mmc 0:1 0x82000000 /boot/zImagebootz 0x82000000 - 0x88000000
Finally, run the following command again:

udhcpc
After testing, you will find that the Development Board can normally obtain the IP address and DNS. If your router has been connected to the Internet, you can also use the ping command to test the connection to the Internet, such as ping Google's DNS Server:
ping 8.8.8.8
So far, we have completed the transplantation of the TQ335x Nand and nic drivers, without having to have a deep understanding of the internal working principles. If you have any questions, please leave a message to discuss them. If you want to understand the working principles of these two modules, we strongly recommend that you watch the embedded teaching video by Dr. Wei Dongshan. This video still requires a certain degree of hardware and software skills. If you cannot understand it, you can study the C language, basic schematic reading, and other knowledge.

3. Start Log

The complete startup Log is as follows:

Starting kernel... [0.000000] Booting Linux on physical CPU 0x0 [0.000000] Linux version 3.17.2 (lilianrong @ smarter) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1 )) #73 SMP Tue Dec 23 22:06:01 CST 2014 [0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr = 10c5387d [0.000000] CPU: PIPT/VIPT nonaliasing data cache, VIPT aliasing instruction cache [0.000000] Machine model: TI AM335x EVM [0.000000] cma: Reserved 16 MiB at 9e800000 [0.000000] Memory policy: Data cache writeback [0.000000] HighMem zone: 1048574 pages exceeds freesize 0 [0.000000] CPU: All CPU (s) started in SVC mode. [0.000000] AM335X ES2.1 (sgx neon) [0.000000] PERCPU: Embedded 9 pages/cpu @ dfa99000 s14336 r8192 d14336 u000064 [0.000000] Built 1 zonelists in Zone order, mobility grouping on. total pages: 129792 [0.000000] Kernel command line: console = ttyO0, 115200n8 root =/dev/mmcblk0p2 rw rootfstype = ext3 rootwait [0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes) [0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) [0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) [0.000000] Memory: 484108 K/523264 K available (6082 K kernel code, 667 K rwdata, 2448 K rodata, 410 K init, 8214 K bss, 39156 K reserved, 0 K highmem) [0.000000] Virtual kernel memory layout: [0.000000] vector: 0xffff0000-0xffff1000 (4 kB) [0.000000] fixmap: 0xffc00000-0xffe00000 (2048 kB) [0.000000] vmalloc: 0xe0800000-0xff000000 (488 MB) [0.000000] lowmem: 0xc0000000-0xe0000000 (512 MB) [0.000000] pkmap: 0xbfe00000-0xc0000000 (2 MB) [0.000000] modules: 0xbf000000-0xbfe00000 (14 MB) [0.000000]. text: 0xc0008000-0xc085cc80 (8532 kB) [0.000000]. init: 0xc085d000-0xc08c3800 (410 kB) [0.000000]. data: 0xc08c4000-0xc096ac10 (668 kB) [0.000000]. bss: 0xc096ac10-0xc11707a0 (8215 kB) [0.000000] Hierarchical RCU implementation. [1, 0.000000] RCU restricting CPUs from NR_CPUS = 2 to nr_cpu_ids = 1. [0.000000] RCU: Adjusting geometry for rcu_fanout_leaf = 16, nr_cpu_ids = 1 [0.000000] NR_IRQS: 16 nr_irqs: 16 16 16 [0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts [0.000000] Total of 128 interrupts on 1 active controller [0.000000] OMAP clockevent source: timer2 at 24000000Hz [0.000013] sched_clock: 32 bits at 24 MHz, resolution 41ns, wraps every 178956969942ns [0.000062] OMAP clocksource: timer1 at 24000000Hz [0.000794] Console: color dummy device 80x30 [0.000846] Lock dependency validator: Copyright (c) 2006 Red Hat, inc ., ingo Molnar [0.000855]... MAX_LOCKDEP_SUBCLASSES: 8 [0.000863]... MAX_LOCK_DEPTH: 48 [0.000870]... MAX_LOCKDEP_KEYS: 8191 [0.000877]... CLASSHASH_SIZE: 4096 [0.000884]... MAX_LOCKDEP_ENTRIES: 32768 [0.000891]... MAX_LOCKDEP_CHAINS: 65536 [0.000898]... CHAINHASH_SIZE: 32768 [0.000906] memory used by lock dependency info: 5167 kB [0.000914] per task-struct memory footprint: 1152 bytes [0.000956] Calibrating delay loop... 996.14 BogoMIPS (lpj = 4980736) [0.079052] pid_max: default: 32768 minimum: 301 [0.079452] Security Framework initialized [0.079577] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) [0.079589] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) [0.081767] CPU: Testing write buffer coherency: OK [0.082936] CPU0: thread-1, cpu 0, socket-1, mpidr 0 [0.083055] Setting up static identity map for 0x805c3270-0x805c32e0 [0.086292] Brought up 1 CPUs [0.086313] SMP: total of 1 processors activated. [2, 0.086323] CPU: All CPU (s) started in SVC mode. [0.088953] devtmpfs: initialized [0.097712] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3 [0.133428] omap_hwmod: tptc0 using broken dt data from edma [0.133784] omap_hwmod: tptc1 using broken dt data from edma [0.134117] omap_hwmod: tptc2 using broken dt data from edma [0.141998] omap_hwmod: debugss: _ wait_target_disable failed [0.199949] pinctrl core: initialized pinctrl subsystem [0.202465] regulator-dummy: no parameters [0.232121] NET: Registered protocol family 16 [0.240699] DMA: preallocated 256 KiB pool for atomic coherent allocations [0.242951] cpuidle: using governor ladder [0.242981] cpuidle: using governor menu [0.254980] omap gpio hardware version 0.1 [0.270240] omap-gpmc 50000000. gpmc: cocould not find pctldev for node/pinmux @ 44e10800/nandflash_pins_s0, deferring probe [0.270283] platform 50000000. gpmc: Driver omap-gpmc requests probe deferral [0.274806] hw-breakpoint: debug architecture 0x4 unsupported. [0.319718] edma-dma-engine edma-dma-engine.0: ti edma dma engine driver [0.321050] vbat: 5000 mV [0.321878] lis3_reg: no parameters [0.325259] SCSI subsystem initialized [0.326052] usbcore: registered new interface driver usbfs [0.326223] usbcore: registered new interface driver hub [0.330168] usbcore: registered new device driver usb [0.330998] omap_i2c 44e0b000. i2c: cocould not find pctldev for node/pinmux @ 44e10800/pinmux_i2c0_pins, deferring probe [0.331037] platform 44e0b000. i2c: Driver omap_i2c requests probe deferral [0.331092] omap_i2c 4802a000. i2c: cocould not find pctldev for node/pinmux @ 44e10800/pinmux_i2c1_pins, deferring probe [0.331116] platform 4802a000. i2c: Driver omap_i2c requests probe deferral [0.332291] Advanced Linux Sound Architecture Driver Initialized. [0.335642] Switched to clocksource timer1 [0.487189] NET: Registered protocol family 2 [0.489058] TCP established hash table entries: 4096 (order: 2, 16384 bytes) [0.489243] TCP bind hash table entries: 4096 (order: 5, 147456 bytes) [0.490606] TCP: Hash tables configured (established 4096 bind 4096) [0.490797] TCP: reno registered [0.490823] UDP hash table entries: 256 (order: 2, 20480 bytes) [0.491013] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes) [0.492039] NET: Registered protocol family 1 [0.493915] RPC: Registered named UNIX socket transport module. [2, 0.493936] RPC: Registered udp transport module. [0.493946] RPC: Registered tcp transport module. [0.493955] RPC: Registered tcp NFSv4.1 backchannel transport module. [0.495229] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available [0.499735] futex hash table entries: 256 (order: 2, 16384 bytes) [0.504791] VFS: disk quotas dquot_6.5.2 [0.504950] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [0.507753] NFS: registering the id_resolver key type [0.508115] Key type id_resolver registered [0.508132] Key type id_legacy registered [0.508279] jffs2: version 2.2. (NAND) (SUMMARY) leakage 2001-2006 Red Hat, Inc. [0.508729] msgmni has been set to 977 [0.513651] io scheduler noop registered [0.513685] io scheduler deadline registered [0.513753] io scheduler cfq registered (default) [2, 0.516150] pinctrl-single 44e10800. pinmux: 142 pins at pa f9e10800 size 568 [0.521255] backlight supply power not found, using dummy regulator [0.524492] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [1, 0.530892] omap_uart 44e09000. serial: no wakeirq for uart0 [0.531504] 44e09000. serial: ttyO0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a OMAP UART0 [1.232153] console [ttyO0] enabled [1.241558] omap_rng 4832.16.rng: OMAP Random Number Generator. 20 [1.249198] [drm] Initialized drm 1.1.0 20060810 [1.261409] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013 ). [2, 1.268521] [drm] No driver support for vblank timestamp query. [1.331152] Console: switching to color frame buffer device 100x30 [1.342247] tilcdc 4830e000. lcdc: fb0: frame buffer device [1.348135] tilcdc 4830e000. lcdc: registered panic notifier [1.354036] [drm] Initialized tilcdc 1.0.0 20121205 on minor 0 [1.389964] brd: module loaded [1.408309] loop: module loaded [1.414443] mtdoops: mtd device (mtddev = name/number) must be supplied [1.425081] usbcore: registered new interface driver asix [1.430985] usbcore: registered new interface driver ax88179_178a [1.437512] usbcore: registered new interface driver cdc_ether [1.443772] usbcore: registered new interface driver smsc95xx [1.449928] usbcore: registered new interface driver net1080 [1.455981] usbcore: registered new interface driver cdc_subset [1.462281] usbcore: registered new interface driver zaurus [1.468354] usbcore: registered new interface driver cdc_ncm [1.476438] usbcore: registered new interface driver cdc_wdm [1.482554] usbcore: registered new interface driver usb-storage [1.489102] usbcore: registered new interface driver usbtest [1.497261] mousedev: PS/2 mouse device common for all mice [1.508204] omap_rtc 44e3e000. rtc: rtc core: registered 44e3e000. rtc as rtc0 [1.516418] i2c/dev entries driver [1.520156] Driver for 1-wire Dallas network protocol. [1.533123] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec [1.543243] omap_hsmmc 48060000.mmc: unable to get vmmc regulator-517 [1.550707] platform extends Driver omap_hsmmc requests probe deferral [1.560219] ledtrig-cpu: registered to indicate activity on CPUs [1.567132] usbcore: registered new interface driver usbhid [1.572953] usbhid: usb hid core driver [1.584275] davinci_evm sound: ASoC: CODEC (null) not registered [1.591095] davinci_evm sound: snd_soc_register_card failed (-517) [1.597727] platform sound: Driver davinci_evm requests probe deferral [1.605542] oprofile: using arm/armv7 [1.610156] TCP: cubic registered [1.613633] Initializing XFRM netlink socket [1.618345] NET: Registered protocol family 17 [1.623080] NET: Registered protocol family 15 [1.628155] Key type dns_resolver registered [1.632833] protocol: voltage driver support not added [1.639539] handle: No voltage domain specified for smartreflex0.cannot initialize [1.648011] handle: No voltage domain specified for smartreflex1. Cannot initialize [1.657602] ThumbEE CPU extension supported. [1.662123] Registering SWP/SWPB emulation handler [1.667204] SmartReflex Class3 initialized [1.679204] omap-gpmc 50000000. gpmc: GPMC revision 6.0 [1.686359] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd3 [1.693006] nand: Samsung NAND 1GiB 3,3 V 8-bit [1.697702] nand: 1024MiB, SLC, page size: 2048, OOB size: 64 [1.703702] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme [1.709544] 10 ofpart partitions found on MTD device omap2-nand.0 [1.715935] Creating 10 MTD partitions on "omap2-nand.0": [1.721581] 0x000000000000-0x000000020000: "NAND. SPL "[1.738760] 0x000000020000-0x000000040000:" NAND. SPL. backup1 "[1.750072] 0x000000040000-0x000000060000:" NAND. SPL. backup2 "[1.759540] 0x000000060000-0x000000080000:" NAND. SPL. backup3 "[1.770709] 0x000000080000-0x0000000c0000:" NAND. u- boot-spl "[1.780999] 0x0000000c0000-0x0000001c0000:" NAND. u-boot "[1.794193] 0x0000001c0000-0x0000001e0000:" NAND. u-boot-env "[1.803810] 0x0000001e0000-0x000000200000:" NAND. u-boot-env.backup1 "[1.815705] 0x000000200000-0x000000a00000:" NAND. kernel "[1.831741] 0x000000a00000-0x00000000000:" NAND. file-system "[2.128744] tps65910 0-002d: No interrupt support, no core IRQ [2.145804] vrtc: 1800 mV [2.149201] vrtc: supplied by vbat [2.156403] vio: at 1500 mV [2.159674] vio: supplied by vbat [2.166535] vdd_mpu: 912 <--> 1312 mV at 1325 mV [2.171674] vdd_mpu: supplied by vbat [2.178847] vdd_core: 912 <--> 1150 mV at 1137 mV [2.184071] vdd_core: supplied by vbat [2.190808] vdd3: 5000 mV [2.196352] vdig1: at 1800 mV [2.199763] vdig1: supplied by vbat [2.206242] vdig2: at 1800 mV [2.209646] vdig2: supplied by vbat [2.216312] vpll: at 1800 mV [2.219632] vpll: supplied by vbat [2.226021] vdac: at 1800 mV [2.229339] vdac: supplied by vbat [2.235593] vaux1: at 1800 mV [2.238998] vaux1: supplied by vbat [2.245289] vaux2: at 3300 mV [2.248809] vaux2: supplied by vbat [2.255223] vaux33: at 3300 mV [2.258804] vaux33: supplied by vbat [2.265220] vmmc: 1800 <--> 3300 mV at 3300 mV [2.270279] vmmc: supplied by vbat [2.276822] vbb: at 3000 mV [2.280309] vbb: supplied by vbat [2.288030] omap_i2c 44e0b000. i2c: bus 0 rev0.11 at 400 kHz [2.301649] omap_i2c 4802a000. i2c: bus 1 rev0.11 at 100 kHz [2.347377] wm8960 0-001a: No platform data supplied [2.424716] mmc0: host does not support reading read-only switch. assuming write-enable. [2.436373] mmc0: new high speed SDHC card at address aaaa [2.444716] mmcblk0: mmc0: aaaa SL16G 14.8 GiB [2.456727] mmcblk0: p1 p2 [2.471831] davinci_evm sound: wm8960-hifi <-> 4803c000. mcasp mapping OK [2.555784] davinci_mdio 4a101000. mdio: davinci mdio revision 1.6 [2.562174] davinci_mdio 4a101000. mdio: detected phy mask ffffffde [2.572385] libphy: 4a101000. mdio: probed [2.576709] davinci_mdio 4a101000. mdio: phy [0]: device 4a101000. mdio: 00, driver unknown [2.585071] davinci_mdio 4a101000. mdio: phy [5]: device 4a101000. mdio: 05, driver unknown [1, 2.594702] cpsw 4a100000. ethernet: Detected MACID = c4: ed: ba: 88: b5: e4 [2.606568] input: gpio_keyad @ 0 as/devices/gpio_keyad @ 0/input/input0 [2.616308] omap_rtc 44e3e000. rtc: setting system clock to 00:00:00 UTC (946684800) [2.625329] sr_init: No PMIC hook to init smartreflex [2.630961] sr_init: platform driver register failed for SR [2.653937] lis3_reg: disabling [2.657604] ALSA device list: [2.660710] #0: AM335x-EVM [2.779242] kjournald starting. commit interval 5 seconds [2.787736] EXT3-fs (mmcblk0p2): using internal journal [2.795710] EXT3-fs (mmcblk0p2): recovery complete [2.800726] EXT3-fs (mmcblk0p2 ): mounted filesystem with ordered data mode [2.808089] VFS: Mounted root (ext3 filesystem) on device 179: 2. [2.818461] devtmpfs: mounted [2.822292] Freeing unused kernel memory: 408 K (c085d000-c08c3000) -------- mount all .......... ---------- Starting mdev ...... please press Enter to activate this console. @ tq335x # @ tq335x # udhcpc (v1.22.1) startedSetting IP address 0.0.0.0 on eth0 [11.489311] net eth0: initializing cpsw version 1.12 (0) [11.576237] net eth0: phy found: id is: 0x1cc915 [11.581418] libphy: PHY 4a101000. mdio: 01 not found [11.586480] net eth0: phy 4a101000. mdio: 01 not found on slave 1 Sending discover... [1, 13.576458] cpsw 4a100000. ethernet eth0: Link is Up-100 Mbps/Full-flow control rx/txSending discover... sending select for 192.168.0.103... lease of 192.168.0.103 obtained, lease time 86400 Setting IP address 192.168.0.103 on eth0Deleting routersroute: SIOCDELRT: No such processAdding router 192.168.0.1Recreating/etc/resolv. conf Adding DNS server 10.0.0.1 @ tq335x # ping 8.8.8.8PING 8.8.8.8 (8.8.8.8): 56 data bytes64 bytes from 8.8.8.8: seq = 0 ttl = 38 time = 471.858 ms64 bytes from 8.8.8.8.8: seq = 1 ttl = 38 time = 479.178 ms64 bytes from 8.8.8.8: seq = 3 ttl = 38 time = 574.362 ms64 bytes from 8.8.8.8.8: seq = 4 ttl = 38 time = 476.201 ms ^ C --- 8.8.8.8 ping statistics --- 5 packets transmitted, 4 packets received, 20% packet lossround-trip min/avg/max = 471.858/500.399/574.362 ms @ tq335x #






Author: girlkoo

Connection: http://blog.csdn.net/girlkoo/article/details/42110683

Related Article

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.