7 Control gpio

V0.0.1

7.1 Histroy

  • 2014-04-09, rayoslee, release V0.0.1

7.2 FAQ

  1. How to control led using gpio (GPD0~GPD4) in S605-32 demo-kit?
    • # make menuconfig and go to Device Drivers > GPIO Support > /sys/class/gpio/… (sysfs interface), please enable it.
    • In S605-32 console(if kernel supported), go to /sys/class/gpio
    • Calculate gpio No.
    GPD0's gpio No. is 32*3+0=96
    GPD1's gpio No. is 32*3+1=97
    ps: A=0, B=32, C=64, D=96, E=128..
    • Create gpio folder
       echo 96 > export  //GPD0, TCK
       echo 97 > export  //GPD1, TMS
       echo 98 > export  //GPD2, TDI
       echo 99 > export  //GPD3, TDO
       echo 100 > export //GPD4, TRST
    • On/Off gpio
    echo high > gpio99/direction
    echo low > gpio99/direction
    ps: other commands, in, out, high, low
    • Add GPD0~GPD2 in sound/soc/w55fa93/w55fa93_pcm.c
    In defaults, GPD3 and GPD4 have bees set ON.
    You can add the sample code as below:
    if (1)
    1106         {
    1107             outl(inl(REG_GPDFUN) & ~MF_GPD2, REG_GPDFUN);               
    1108         outl(inl(REG_GPIOD_OMD) | (0x0006), REG_GPIOD_OMD);         
    1109         outl(inl(REG_GPIOD_PUEN) | (0x0006), REG_GPIOD_PUEN);       
    1110
    1111     
    1112         outl(inl(REG_GPDFUN) & ~MF_GPD1, REG_GPDFUN);
    1113         outl(inl(REG_GPIOD_OMD) | (0x0004), REG_GPIOD_OMD);
    1114         outl(inl(REG_GPIOD_PUEN) | (0x0004), REG_GPIOD_PUEN);       
    1115 
    1116 
    1117         outl(inl(REG_GPDFUN) & ~MF_GPD0, REG_GPDFUN);              
    1118         outl(inl(REG_GPIOD_OMD) | (0x0002), REG_GPIOD_OMD);         
    1119         outl(inl(REG_GPIOD_PUEN) | (0x0002), REG_GPIOD_PUEN);       
    1120     }