Advertisement

【sdx62】PBL阶段修改GPIO操作

阅读量:

SDX62 GPIO

GPIO序号

复制代码
 GPIO_0 ~ GPIO_9

    
 GPIO_10 ~ GPIO_19
    
 GPIO_20 ~ GPIO_29
    
 GPIO_30 ~ GPIO_39
    
 GPIO_40 ~ GPIO_49
    
 GPIO_50 ~ GPIO_59
    
 GPIO_60 ~ GPIO_69
    
 GPIO_70 ~ GPIO_79
    
 GPIO_80 ~ GPIO_89
    
 GPIO_90 ~ GPIO_99
    
 GPIO_100 ~ GPIO_107
    
    
    
    
    代码解读

内核中对应关系

复制代码
  
    
 gpiochip0: GPIOs 916-1023, parent: platform/f100000.pinctrl, f100000.pinctrl:
    
  gpio0   : in  low  func0 2mA pull down
    
  gpio1   : in  low  func0 2mA pull down
    
  gpio2   : in  low  func0 2mA pull down
    
  gpio3   : in  low  func0 2mA pull down
    
  gpio4   : in  low  func0 2mA pull down
    
  gpio5   : in  low  func0 2mA pull down
    
  gpio6   : in  high func0 2mA pull down
    
  gpio7   : in  low  func0 2mA pull down
    
  gpio8   : in  high func2 2mA no pull
    
  gpio9   : in  high func2 2mA no pull
    
  gpio10  : out low  func3 2mA pull up
    
  gpio11  : out low  func3 2mA pull up
    
  gpio12  : in  low  func0 2mA pull down
    
  gpio13  : in  low  func0 2mA pull down
    
  gpio14  : in  low  func0 2mA pull down
    
  gpio15  : in  low  func0 2mA pull down
    
  gpio16  : out high func0 2mA pull down
    
  gpio17  : in  high func0 2mA pull down
    
  gpio18  : in  high func0 2mA no pull
    
  gpio19  : in  high func0 2mA no pull
    
  gpio20  : in  high func0 2mA pull down
    
  gpio21  : in  high func0 2mA pull down
    
  gpio22  : in  low  func0 2mA pull down
    
  gpio23  : out high func0 2mA pull down
    
  gpio24  : in  high func0 2mA pull down
    
  gpio25  : in  high func0 2mA pull up
    
  gpio26  : out low  func0 2mA no pull
    
  gpio27  : out low  func0 2mA pull up
    
  gpio28  : out low  func1 4mA pull down
    
  gpio29  : in  low  func0 2mA pull down
    
  gpio30  : in  low  func0 2mA pull down
    
  gpio31  : in  low  func0 2mA pull down
    
  gpio32  : in  low  func0 2mA pull down
    
  gpio33  : in  low  func0 2mA pull down
    
  gpio34  : out low  func1 4mA no pull
    
  gpio35  : in  low  func1 16mA no pull
    
  gpio36  : in  low  func1 2mA pull down
    
  gpio37  : in  low  func1 2mA pull down
    
  gpio38  : in  high func0 2mA no pull
    
  gpio39  : in  high func0 2mA no pull
    
  gpio40  : out low  func0 2mA no pull
    
  gpio41  : out low  func0 2mA no pull
    
  gpio42  : in  low  func0 2mA pull down
    
  gpio43  : in  high func0 2mA pull up
    
  gpio44  : out low  func1 2mA pull up
    
  gpio45  : in  high func1 2mA no pull
    
  gpio46  : in  high func0 2mA pull down
    
  gpio47  : in  low  func0 2mA no pull
    
  gpio48  : in  low  func0 2mA pull down
    
  gpio49  : in  low  func0 2mA pull down
    
  gpio50  : in  low  func0 2mA pull down
    
  gpio51  : in  low  func0 2mA pull down
    
  gpio52  : in  low  func0 2mA pull down
    
  gpio53  : in  high func0 2mA pull up
    
  gpio54  : in  low  func0 2mA pull down
    
  gpio55  : in  low  func0 2mA pull down
    
  gpio56  : in  high func1 2mA pull up
    
  gpio57  : out high func0 2mA pull down
    
  gpio58  : in  low  func0 2mA pull down
    
  gpio59  : in  low  func0 2mA pull down
    
  gpio60  : in  low  func0 2mA pull down
    
  gpio61  : in  low  func0 2mA pull down
    
  gpio62  : in  low  func0 2mA pull down
    
  gpio63  : out high func0 2mA pull down
    
  gpio64  : in  high func0 2mA pull down
    
  gpio65  : in  low  func0 2mA pull down
    
  gpio66  : in  low  func0 2mA pull down
    
  gpio67  : out low  func1 2mA no pull
    
  gpio68  : in  high func1 2mA pull up
    
  gpio69  : out low  func1 2mA no pull
    
  gpio70  : out low  func1 2mA no pull
    
  gpio71  : in  low  func0 2mA pull down
    
  gpio72  : out low  func1 4mA no pull
    
  gpio73  : in  low  func1 16mA no pull
    
  gpio74  : out low  func1 4mA pull down
    
  gpio75  : in  low  func0 2mA pull down
    
  gpio76  : in  low  func0 2mA pull down
    
  gpio77  : out low  func0 2mA pull down
    
  gpio78  : out low  func0 2mA pull down
    
  gpio79  : out high func0 2mA pull down
    
  gpio80  : out high func0 2mA pull down
    
  gpio81  : in  low  func0 2mA no pull
    
  gpio82  : in  high func0 2mA no pull
    
  gpio83  : in  high func0 2mA no pull
    
  gpio84  : in  low  func2 10mA no pull
    
  gpio85  : in  high func2 10mA no pull
    
  gpio86  : in  high func0 8mA pull up
    
  gpio87  : in  low  func0 2mA pull down
    
  gpio88  : in  low  func0 2mA pull down
    
  gpio89  : in  low  func5 10mA no pull
    
  gpio90  : in  high func5 10mA no pull
    
  gpio91  : out high func0 16mA pull up
    
  gpio92  : out high func0 16mA pull up
    
  gpio93  : in  low  func0 2mA pull down
    
  gpio94  : in  low  func0 2mA pull down
    
  gpio95  : out high func0 2mA pull up
    
  gpio96  : in  high func0 2mA pull up
    
  gpio97  : in  low  func0 2mA pull down
    
  gpio98  : out low  func0 8mA pull down
    
  gpio99  : in  high func0 2mA pull up
    
  gpio100 : out low  func0 8mA pull down
    
  gpio101 : out high func0 8mA pull down
    
  gpio102 : out high func0 2mA pull up
    
  gpio103 : in  low  func0 2mA no pull
    
  gpio104 : in  low  func0 2mA pull down
    
  gpio105 : in  low  func0 2mA pull down
    
  gpio106 : out high func0 2mA pull down
    
  gpio107 : out high func0 2mA pull down
    
    
    
    
    代码解读

问题描述

某些功能在开发阶段需要设置GPIO的高、低电平参数;这要求在启动过程中重新配置GPIO。

解决方案

方法一:修改LMMChipset.xml

如果功能对于电平的要求不高且仅限于增减操作,可以直接更换TLMMChipset.xml

**boot_images/boot/QcomPkg/SocPkg/Olympic/Settings/TLMM/loader/TLMMChipset.xml

文件内容如下:

复制代码
 <?xml version="1.0" encoding="utf-8"?>

    
 <driver name="TLMM">
    
  
    
   <include file="GPIODevCfg.h"/>
    
  
    
   <global_def>
    
     <var_seq name="DALTLMMBSP_LowPowerCfg" type="DALPROP_DATA_TYPE_UINT32_SEQ">
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_OUTPUT | PIN_PULL_UP   | PIN_OUT_HIGH | PIN_PRG_YES, 
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       PIN_INPUT  | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
    
       end
    
     </var_seq>
    
   </global_def>
    
   <device id="DALDEVICEID_TLMM">
    
     <props name="tlmm_sleep" type="DALPROP_ATTR_TYPE_UINT32_SEQ_PTR">
    
       DALTLMMBSP_LowPowerCfg
    
     </props>
    
   </device>
    
 </driver>
    
    
    
    
    代码解读

例如,在进行GPIO95默认设置时

PIN_INPUT | PIN_PULL_DOWN | PIN_OUT_LOW | PIN_PRG_NO,
修改为

PIN_OUTPUT | PIN_PULL_UP | PIN_OUT_HIGH | PIN_PRG_YES,

方法二:修改ButtonsDxe.c文件

为了将电平设置为3.3v,则必须对C语言代码进行调整。然后,在ButtonsDxe.c文件中的GetSdamStoredKeys函数内进行相应的代码添加。

文件路径./boot_images/boot/QcomPkg/Drivers/ButtonsDxe/ButtonsDxe.c

复制代码
 if (EFI_SUCCESS != TLMMProtocol->GpioOut((UINT32)EFI_GPIO_CFG(95, 0, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_16MA), GPIO_HIGH_VALUE))

    
     {
    
       DEBUG((EFI_D_WARN, "GPIO %d high failed!\n", 95));
    
     }
    
    
    
    
    代码解读

全部评论 (0)

还没有任何评论哟~