u-boot transplantation (7)---code modification---storage controller

Publisher:upsilon30Latest update time:2023-07-03 Source: elecfansKeywords:u-boot Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Conditions for CPU to access the chip

  

  The CPU reads data from external devices by accessing the storage controller.

  If the CPU wants to access a chip, it needs the following conditions (configuration information):


    • address line

    • Data line: 8-bit/16-bit/32-bit data width

    • Clock frequency 

    • Other chip-related features: such as SDRAM, including row address, column address and bank

  The principle of SDRAM access is the same as that of table retrieval. First specify a row (Row), and then specify a column (Columu), and you can accurately find the required cell. This cell is called a storage unit, and this table (storage array) is a logical Bank (Logical Bank, or L-Bank). SDRAM generally contains 4 L-banks.  

  

  Only after configuring the storage manager can you know how to access external devices.

2. Storage controller accesses SDRAM

  2.1 Schematic diagram

  

  CPU side:

      

  

  

  

  

  You can look at the functions of these pins and check the SDRAM chip manual.

  LADDR: address interface

  

  LnWBE[0:3]: bank operation mode

  

  LDATA: data interface

  

  LnWE

  

  See the data sheet for more information.

3. Configuration of storage manager  

  • bit width

  • Row and column address

  • refresh cycle

  Detailed registers can be viewed at DATASHEET.

4. 2440 startup method

4.1 NAND FALSH startup

  

4.2 NOR FLASH

  

5. Code

   Memory controller initialization code:

  Here we are booting from nor flash, so the parameter defined by CONFIG_SYS_TEXT_BASE is 0x0.

  lowlevel_init.S (boardsamsungjz2440) 

  1 #define BWSCON    0x48000000

  2 

  3 /* BWSCON */

  4 #define DW8            (0x0)

  5 #define DW16            (0x1)

  6 #define DW32            (0x2)

  7 #define WAIT            (0x1<<2)

  8 #define UBLB            (0x1<<3)

  9 

 10 #define B1_BWSCON        (DW32)

 11 #define B2_BWSCON        (DW16)

 12 #define B3_BWSCON        (DW16 + WAIT + UBLB)

 13 #define B4_BWSCON (DW16)

 14 #define B5_BWSCON        (DW16)

 15 #define B6_BWSCON        (DW32)

 16 #define B7_BWSCON        (DW32)

 17 

 18 /* BANK0CON */

 19 #define B0_Tacs            0x0    /*  0clk */

 20 #define B0_Tcos            0x0    /*  0clk */

 21 #define B0_Tacc 0x7 /* 14clk */

 22 #define B0_Tcoh            0x0    /*  0clk */

 23 #define B0_Tah            0x0    /*  0clk */

 24 #define B0_Tacp            0x0

 25 #define B0_PMC            0x0    /* normal */

 26 

 27 /* BANK1CON */

 28 #define B1_Tacs            0x0    /*  0clk */

 29 #define B1_Tcos            0x0    /*  0clk */

 30 #define B1_Tacc 0x7 /* 14clk */

 31 #define B1_Tcoh            0x0    /*  0clk */

 32 #define B1_Tah            0x0    /*  0clk */

 33 #define B1_Tacp            0x0

 34 #define B1_PMC            0x0

 35 

 36 #define B2_Tacs            0x0

 37 #define B2_Tcos            0x0

 38 #define B2_Tacc 0x7

 39 #define B2_Tcoh            0x0

 40 #define B2_Tah 0x0

 41 #define B2_Tacp            0x0

 42 #define B2_PMC            0x0

 43 

 44 #define B3_Tacs            0x0    /*  0clk */

 45 #define B3_Tcos            0x3    /*  4clk */

 46 #define B3_Tacc 0x7 /* 14clk */

 47 #define B3_Tcoh            0x1    /*  1clk */

 48 #define B3_Tah 0x0 /* ​​0clk */

 49 #define B3_Tacp 0x3 /* 6clk */

 50 #define B3_PMC            0x0    /* normal */

 51 

 52 #define B4_Tacs            0x0    /*  0clk */

 53 #define B4_Tcos            0x0    /*  0clk */

 54 #define B4_Tacc            0x7    /* 14clk */

 55 #define B4_Tcoh            0x0    /*  0clk */

 56 #define B4_Tah 0x0 /* ​​0clk */

 57 #define B4_Tacp            0x0

 58 #define B4_PMC            0x0    /* normal */

 59 

 60 #define B5_Tacs            0x0    /*  0clk */

 61 #define B5_Tcos            0x0    /*  0clk */

 62 #define B5_Tacc 0x7 /* 14clk */

 63 #define B5_Tcoh            0x0    /*  0clk */

 64 #define B5_Tah            0x0    /*  0clk */

 65 #define B5_Tacp            0x0

 66 #define B5_PMC            0x0    /* normal */

 67 

 68 #define B6_MT 0x3 /* SDRAM */

 69 #define B6_Trcd 0x1

 70 #define B6_SCAN            0x1    /* 9bit */

 71 

 72 #define B7_MT 0x3 /* SDRAM */

 73 #define B7_Trcd            0x1    /* 3clk */

 74 #define B7_SCAN            0x1    /* 9bit */

 75 

 76 /* REFRESH parameter */

 77 #define REFEN 0x1 /* Refresh enable */

 78 #define TREFMD            0x0    /* CBR(CAS before RAS)/Auto refresh */

 79 #define Trp            0x0    /* 2clk */

 80 #define Trc            0x3    /* 7clk */

 81 #define Tchr            0x2    /* 3clk */

 82 #define REFCNT            1113    /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */

 83 /**************************************/

 84 

 85 .globl lowlevel_init

 86 lowlevel_init:

 87     /* memory control configuration */

 88     /* make r0 relative the current location so that it */

 89     /* reads SMRDATA out of FLASH rather than memory ! */

 90 /* Initialize memory*/

 91 ldr r0, =SMRDATA /* Place the first address (first .long) memory unit data of SMRDATA into the r0 register r0=eac */

 92     ldr    r1, =CONFIG_SYS_TEXT_BASE    /* CONFIG_SYS_TEXT_BASE=0x0(include/configs/jz2440中定义) 

 93 Base address of code*/

 94     sub    r0, r0, r1                    /* r0 = r0 -r1 */

 95 ldr r1, =BWSCON /* Bus Width Status Controller,BWSCON=0x48000000, defined in this file*/

 96 add r2, r0, #13*4 /* Assign the SMRDATA address to r2*/

 97 0:

 98 ldr r3, [r0], #4 /* Put the memory unit represented by the value of r0 into r3, and then the value of r0 is offset by 4 bits*/

 99 str r3, [r1], #4 /* Put the value of r3 into the address represented by the value of r1, and the address represented by the value of r1 is offset by 4 bits*/

100 cmp r2, r0 /* Compare r2 and r0, if not equal, execute the next sentence*/

101 bne 0b /* Jump backward to label 0*/

102 

103     /* everything is fine now */

104 mov pc, lr /* return*/

105 

106 .ltorg

107 /* the literal pools origin */

108 

109 /* 

110 * Initialize the storage controller. After this initialization, the memory can be used

111  */

112 /* The address is 0x00000eb0 */

113 SMRDATA:

114         .long 0x22011110     //BWSCON

115 .long 0x00000700 //BANKCON0

116 .long 0x00000700 //BANKCON1

117         .long 0x00000700     //BANKCON2

118         .long 0x00000700     //BANKCON3  

119 .long 0x00000740 //BANKCON4

120         .long 0x00000700     //BANKCON5

121         .long 0x00018005     //BANKCON6

122         .long 0x00018005     //BANKCON7

123         .long 0x008C04F4     //REFRESH

124 .long 0x000000B1 //BANKSIZE

125         .long 0x00000030     //MRSRB6

126         .long 0x00000030     //MRSRB7


Keywords:u-boot Reference address:u-boot transplantation (7)---code modification---storage controller

Previous article:u-boot transplantation (8)---code modification---storage controller--MMU
Next article:u-boot transplantation (6)---code modification---serial port

Recommended ReadingLatest update time:2024-11-22 21:32

【ARM】Use J-Link to download u-boot to Mini2440 development board
#1 Introduction to various guide systems ##1.1 bios 1 BIOS is the abbreviation of "Basic Input Output System". In fact, it is a set of programs fixed on a ROM chip on the motherboard of the computer. It stores the most important basic input and output programs of the computer, system setting information, self-test pro
[Microcontroller]
【ARM】Use J-Link to download u-boot to Mini2440 development board
Using U-Boot as the system bootloader to implement the transplantation of uClinux to S3C44B0
    1 Introduction     S3C44B0 is a 32-bit processor developed by Samsung for handheld devices or other general-purpose devices. It is based on the ARM7TDMI core and has no memory management unit (MMU). uClinux is widely used in embedded systems that use microprocessors without MMU. As a derivative of linux, it has th
[Microcontroller]
Using U-Boot as the system bootloader to implement the transplantation of uClinux to S3C44B0
SMDK2440 transplantation u-boot notes
//Wei Dongshan u-boot transplantation notes 1. Download, build source insight project, compile, burn, if it does not run, analyze the reason tar xjf u-boot-2012.04.01.tar.bz2 cd u-boot-2012.04.01 make smdk2410_config make 2. Analyze u-boot: Analyze the component files through the link command, read the code and analy
[Microcontroller]
Implementation of Bootloader in AT91RM9200 System
The AT91RM9200 chip based on the ARM920T core has a lot of room for application in embedded development in the field of industrial control due to its rich internal peripherals, processing speed of up to 200MIPS, and wide temperature range. Bootloader is a boot loader used to boot the operating system. It is used to
[Microcontroller]
Implementation of Bootloader in AT91RM9200 System
u-boot-2011.09 porting on ST2410 - running in RAM
u-boot version: u-boot-2011.09 Operating environment: Window7 Vmware workstation7.1 CentOS6.0 Cross-compilation environment: Arm-linux-gcc-4.3.2 with EABI Hardware environment: ST2410X development board (CPU: S3C2410X, 64M SDRAM: 2 HY57V561620FTP-H, 2M norflash: 39VF1601, 64M nandflash: K9F1208U0M, network card:
[Microcontroller]
Detailed explanation of U-boot transplantation on S3C2440 (1)
1. Transplantation environment Host: VMWare--Fedora 9 Development board: Mini2440--64MB Nand, Kernel:2.6.30.4 Compiler: arm-linux-gcc-4.3.2.tgz u-boot:u-boot-2009.08.tar.bz2 2. Transplantation steps Features of this transplant include: Support Nand Flash reading and writing Support booting from Nor/Nand Flash
[Microcontroller]
Detailed explanation of U-boot transplantation on S3C2440 (1)
Chapter 8. Timing and Principle of Eight SDRAM Transplantation in Tiny4412 U-BOOT
DDR originated from SDRAM. Strictly speaking, it should be called DDR SDRAM. DDR SDRAM is the abbreviation of Double Data Rate SDRAM, which means double data rate synchronous dynamic random access memory. Therefore, to a large extent, the two are the same. Understand SDRAM, and then understand DDR. The improvement on
[Microcontroller]
Chapter 8. Timing and Principle of Eight SDRAM Transplantation in Tiny4412 U-BOOT
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号