bootloader程式邏輯(8250 board)

bootloader(8250 board)

linux中keypad driver


board-qsd8x50.c

qsd8x50_init(){
....
#if defined(CONFIG_QSD_GPIO_KEYPAD)
halibut_init_keypad(machine_is_qsd8x50_ffa());
#endif
....
}

board-halibut-keypad.c

void halibut_init_keypad(int ffa)
{
if(ffa)
halibut_matrix_info.keymap = halibut_keymap_ffa;
platform_device_register(&halibut_keypad_device);
}

static struct gpio_event_matrix_info halibut_matrix_info = {
.info.func = halibut_gpio_event_matrix_func,
.keymap = halibut_keymap,
.output_gpios = halibut_row_gpios,
.input_gpios = halibut_col_gpios,
.noutputs = ARRAY_SIZE(halibut_row_gpios),
.ninputs = ARRAY_SIZE(halibut_col_gpios),
.settle_time.tv.nsec = 0,
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
};

struct gpio_event_info *halibut_keypad_info[] = {
&halibut_matrix_info.info
};

static struct gpio_event_platform_data halibut_keypad_data = {
.name = "halibut_keypad",
.info = halibut_keypad_info,
.info_count = ARRAY_SIZE(halibut_keypad_info)
};

static struct platform_device halibut_keypad_device = {
.name = GPIO_EVENT_DEV_NAME,
.id = -1,
.dev = {
.platform_data = &halibut_keypad_data,
},
};


I/O functions 定義於

AMSS/products/8650/drivers/hw/inc/msmhwio.h
AMSS/products/8650/drivers/hw/inc/8650B/msmhwioreg_port.h
AMSS/products/8650/drivers/bio/bio.h
AMSS/products/8650/drivers/bio/bio_mb8650.h
AMSS/products/8650/drivers/hw/inc/8650B/plat/phys/msmhwiobase.h

DBL main control流程:

(1) dbl_create_vector_table()=>
Copy Vector table from RAM into IRAM.
(2) dbl_enable_arm9_instruction_cach()=>Enable the ARM926 instruction cache; Please refer to ARM9 tech menu.
(3) dbl_ram_init()=>
1. Copy initialized data (RW-DATA) into RAM.
2. Zero-out (ZI-DATA) in RAM.
3.dbl_nand.scl 是DBL load到RAM的配置圖

P.S.
ARM程序(指在ARM系统中正在执行的程序,而非保存在ROM中的bin文件)的组成
一个ARM程序包含3部分:RO段,RW段和ZI段
RO是程序中的指令和常量(readonly)
RW是程序中的已初始化变量(read/write)
ZI是程序中的未初始化的变量(zero)

所谓ARM映像文件就是指烧录到ROM中的bin文件,也成为image文件。
以下用Image文件来称呼它。Image文件包含了RO和RW数据。
之所以Image文件不包含ZI数据,是因为ZI数据都是0,没必要包含,
只要程序运行之前将ZI数据所在的区域一律清零即可。包含进去反而浪费存储空间。

因為RO中的指令和常量以及RW中初始化過的變量是不能像ZI那樣“無中生有”的。
ARM程序的执行过程从以上两点可以知道,烧录到ROM中的image文件与实际运行时的 ARM程序之间并不是完全一样的。 ARM程序的執行過程從以上兩點可以知道,燒錄到ROM中的image文件與實際運行時的ARM程序之間並不是完全一樣的。 因此就有必要了解ARM程序是如何从ROM中的image到达实际运行状态的。因此就有必要了解ARM程序是如何從ROM中的image到達實際運行狀態的。

实际上,RO中的指令至少应该有这样的功能:實際上,RO中的指令至少應該有這樣的功能:
1. 将RW从ROM中搬到RAM中,因为RW是变量,变量不能存在ROM中。
2. 将ZI所在的RAM区域全部清零,因为ZI区域并不在Image中,所以需要程序根据编译器给出的ZI地址及大小来将相应得RAM区域清零。 ZI中也是变量,同理:变量不能存在ROM中在程序运行的最初阶段,RO中的指令完成了这两项工作后C程序才能正常访问变量。 否则只能运行不含变量的代码。

(4)dbl_shared_data_init()=>
儲存從PBL接收過來的data

(5)dbl_interface_to_target_init()=>
1. 初始化the target interface so that generic DBL code can use it 
2. 從pbl得到system clock frequency資訊(AIX:48MHz, ARM926:48MHz)
3. initializes DBL clobber protection

(6)執行dbl_init_func_tbl[]中的所有程序:

dbl_auth_init()=> Init AUTH Routines. This function should also verify that the data
from PBL has not been altered.
dbl_flash_init()=> This function calls call boot_pbl_get_flash_type() to detect the flash type and call the appropriate driver code to initialize the global structure.
dbl_configure_hardware()=>
(1)Configure CLK.
系統將被設定在low speed mode: ARM926=48MHz AIX=48MHz
(2) Configure EBI2.
因為我們系統是NAND_FLASH所以會執行 dbl_ebi2_configure_nand() (dbl_ebi2.c) dbl_ebi2_configure_nand() 被宣告於dbl_ebi2_nand.c,該method會依據NAND的page size和data width去選取對應的flash device做設定(系統用的K9F2G08R0A其page size=2K bytes data width=8 bits)
(3)Configure EBI1.
在AIX=48MHz 下執行clock independent settings, clock dependent settings, init sequence,和setup static CDC calibration (參考dbl_ebi.c)
dbl_partition_table_supported()=>Get the Partition Table's location if the flash device supports it.
dbl_load_fsbl_image()=> Load FSBL image.
dbl_load_osbl_image()=>Load OSBL image.
dbl_auth_image()=>Authenticate OSBL Image.

(7)dbl_copy_data_for_osbl()=>將欲傳送給OSBL的data資料(dbl_shared_data.dbl_data_for_osbl)內容準備好
(8)dbl_shared_data.entry_ptr(dbl_shared_data.dbl_data_for_osbl)=> Transfer control to the OSBL

OSBL main control流程:

(1) osbl_create_vector_table()=> Create the vector table for exception handlers.
(2) mmu_enable_instruction_cache()=>Enable the instruction cache.
(3)osbl_ram_init()=>Initialize memory according to scatter load file.
(4)osbl_retrieve_shared_info_from_dbl( &bl_shared_data, dbl_shared_info_ptr )=> Retrieve info passed from DBL/PBL and put in bl_shared_data structure

(5)osbl_init_fsbl_modules( &bl_shared_data )=>Initialize the FSBL modules.
(6)boot_fsbl_config_set_clock_speed( bl_shared_data.clk_speed )=>Update the FSBL clock speed structure to use the OSBL copy

(7) boot_clobber_add_global_protection_region( (void*) OSBL_CODE_BASE, OSBL_MAX_IMAGE_SIZE )=>Add the OSBL address range to the memory protection.

(8) osbl_do_procedures( &bl_shared_data, osbl_main_procs )=>Process the target-dependent OSBL procedures.

osbl_save_reset_register_log()=>
osbl_dload_get_reset_status()=>Retrieve the dload reset flags from shared memory
osbl_smem_boot_init()=>Initialize shared memory
osbl_cache_set_memory_barrier()=>Set the memory barrier pointer to shared memory

osbl_hw_init()=>This function performs hardware initialization.Only common hardware that is needed prior to performing USB charger initialization is initialized here.
1. Set AXI interconnect read and write pipeline depth to 8 for
all AXI slaves with fair round-robin arbitration mode to
increase system performance.
2. tlmm_misc_init()=> Initialize MSM top level mode mux and other miscellaneous hardware.
a. bsp_Init(NULL, BSP_CFG_SURF_ID)=>Initialize the global HAL BSP Data Structure for this image. 
b.gpio_init()=>Initialize GPIO pin signal mux settings.
因為keypad被設成3X3所以須更改AMSS/products/8650/drivers/tlmm/bsp/source/tlmm_bsp.c

const BSP_ConfigType KEYSENSE_CONFIGS[] =
{
//BSP_GPIO_IN_36,
//BSP_GPIO_IN_37,
BSP_GPIO_IN_38,
BSP_GPIO_IN_39,
BSP_GPIO_IN_40
};

const BSP_ConfigType KEYPAD_CONFIGS[] =
{
// BSP_GPIO_OUT_35,
// BSP_GPIO_OUT_34,
BSP_GPIO_OUT_33,
BSP_GPIO_OUT_32,
BSP_GPIO_OUT_31
//BSP_GPIO_IN_41
//#ifndef TLMM_USES_BT_QSOC
//, BSP_GPIO_OUT_42
//#endif
};

const BSP_ConfigType MULTIPLE_KEYPRESS_CONFIGS[] =
{
// BSP_GPIO_IN_35,
// BSP_GPIO_IN_34,
BSP_GPIO_IN_33,
BSP_GPIO_IN_32,
BSP_GPIO_IN_31
//BSP_GPIO_IN_36
};



c.HWIO_OUT( KEYSENSE_CFG, 0x7C )=>
Initialize keysense lines used for interrupt.由於我們的keypqd是3x3用GPIO 38,39,40當作KEYSENSE,所以KEYSENSE_CFG之bit 5(GPIO 37) 與bit 6(GPIO 36)須設成 0所以該行須改成HWIO_OUT( KEYSENSE_CFG, 0x1C ),KEYSENSE_CFG請參考"SOFTWARE INTERFACE MANUAL p. 1093"

3. Program the UART clocks for the apps only build.
4.Update clock pause variable for current clock speed.
5. sbi_clocks_init()=>Configure and enable SBI clocks.
6. boot_pm_init()=>Initialize the SSBI and PMIC.


osbl_increase_clk_speed()=> Increase clk speed after charging is done.系統將被設定在low speed mode: ARM926=256MHz AIX=128MHz

osbl_hw_init_secondary()=> This function performs hardware initialization. All hardware that is not needed prior to performing USB charger initialization is initialized here.
The clock pause variable is updated in case secondary config data changes the clock speed.
1.Update clock pause variable for current clock speed
2. ebi2_init()=> Initialize EBI2 external bus interface memory controller chip
selects and display devices.
3. osbl_vreg_init()=>Initialize the PMIC voltage regulators.
4. splash_screen_hw_init()=>Initialize HW necessary to display a splash screen from the aARM
boot loader.
5. Enable clock for mDM access
6. dmov_init( NULL ) => Initialize the Data Mover
7. Write-once register to disable PA bypass, to prevent malicious code from turning on PA and jamming the network
8.Enable peripheral web clock before booting Scorpion
9. boot_fsbl_usb_init()=>Initializing PHY from ARM9 for ARM11 to configure HSUSB.

osbl_boot_cache_mmu_init()=>Setup the pagetable and MMU, enable the data cache.
osbl_init_modules()=> Initialize the OSBL modules and lock the interfaces.
osbl_flash_init()=> Initialize the flash device
osbl_share_flash_data()=>Get shared data out of the flash device module
osbl_init_amss_image=>Initialize the data structures for loading the AMSS image
osbl_process_amss_debug_flag=> Retrieve the JTAG debug flag from the AMSS image and update the hardware
osbl_dload_check()=> Check to see if DLOAD mode needs to be entered


osbl_auth_amss_image()=>Authenticate the AMSS image

osbl_hw_disable_imem_access=>Disable access to IMEM now that we don't need DBL functionality

/*-----------------------------------------------------------------------
* Establish the trusted platform for secure boot.
*-----------------------------------------------------------------------*/
osbl_setup_axi_mpu()
osbl_setup_peripheral_bus_mpu()
osbl_setup_flash_mpu()


osbl_load_adsp()=> Load the QDSP6 image
osbl_setup_adsp_clk()=>Configure the QDSP6 PLL and clock
osbl_boot_adsp()=>Release the QDSP6 from reset

osbl_load_appsbl()=>Load the aARM boot loader from flash
osbl_create_aarm_partition_tbl()=>Create the aARM partition table in shared memory
osbl_create_aarm_bad_block_table()=>Create the aARM bad block table in shared memory
osbl_write_aarm_freq()=>Write the desired Scorpion clock frequency to shared memory
osbl_boot_aarm()=> Boot the aARM processor


osbl_load_amss_image()=>Load the AMSS image

osbl_prog_boot_share_amss_header_wrapper()=>Allocate memory in shared memory to save prog_hdr_info. Note: This has to be done after shared mem is initilaized.Otherwise, contents will be wiped out.

(9) cache_mmu_disable()=>Disable caches and MMU before jumping to AMSS.

(10) bl_shared_data.amss_entry_ptr()=>Transfer control to the AMSS.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值