gpio3 only when new kernel

This commit is contained in:
2021-11-02 14:23:14 +01:00
parent dcae1b7a2b
commit 05c9fcfe19
3 changed files with 29 additions and 15 deletions

View File

@ -44,18 +44,16 @@ void defineGPIOpins() {
if (!gpioDefined) { if (!gpioDefined) {
// define the gpio pins // define the gpio pins
system("echo 7 > /sys/class/gpio/export"); system("echo 7 > /sys/class/gpio/export");
system("echo 9 > /sys/class/gpio/export"); LOG(logINFO, ("\tgpio7: defined\n"));
// define their direction
system("echo in > /sys/class/gpio/gpio7/direction"); system("echo in > /sys/class/gpio/gpio7/direction");
system("echo out > /sys/class/gpio/gpio9/direction"); LOG(logINFO, ("\tgpio7: setting intput\n"));
LOG(logINFO, ("gpio pins defined\n")); system("echo 9 > /sys/class/gpio/export");
LOG(logINFO, ("\tgpio9: defined\n"));
if (latestKernelVerified == 1) { if (latestKernelVerified == 1) {
// gpio 3 = not chip enable // gpio 3 = not chip enable
system("echo 3 > /sys/class/gpio/export"); system("echo 3 > /sys/class/gpio/export");
system("echo out > /sys/class/gpio/gpio3/direction"); LOG(logINFO, ("\tgpio3: defined\n"));
LOG(logINFO, ("gpio pin for !ChipEnable defined\n"));
} }
gpioDefined = 1; gpioDefined = 1;
} else } else
@ -66,9 +64,22 @@ void FPGAdontTouchFlash() {
#ifdef VIRTUAL #ifdef VIRTUAL
return; return;
#endif #endif
// define as output pins
system("echo out > /sys/class/gpio/gpio9/direction");
LOG(logINFO, ("\tgpio9: setting output\n"));
if (latestKernelVerified == 1) {
// gpio 3 = not chip enable
system("echo out > /sys/class/gpio/gpio3/direction");
LOG(logINFO, ("\tgpio3: setting output\n"));
}
// tell FPGA to not touch flash // tell FPGA to not touch flash
system("echo 0 > /sys/class/gpio/gpio9/value"); system("echo 0 > /sys/class/gpio/gpio9/value");
system("echo 1 > /sys/class/gpio/gpio3/value"); LOG(logINFO, ("\tgpio9: fpga dont touch flash\n"));
if (latestKernelVerified == 1) {
system("echo 1 > /sys/class/gpio/gpio3/value");
LOG(logINFO, ("\tgpio3: fpga dont touch flash\n"));
}
// usleep(100*1000); // usleep(100*1000);
} }
@ -77,8 +88,12 @@ void FPGATouchFlash() {
return; return;
#endif #endif
// tell FPGA to touch flash to program itself // tell FPGA to touch flash to program itself
system("echo 1 > /sys/class/gpio/gpio9/value"); system("echo in > /sys/class/gpio/gpio9/direction");
system("echo 0 > /sys/class/gpio/gpio3/value"); LOG(logINFO, ("\tgpio9: setting input\n"));
if (latestKernelVerified == 1) {
system("echo in > /sys/class/gpio/gpio3/direction");
LOG(logINFO, ("\tgpio3: setting input\n"));
}
} }
void resetFPGA() { void resetFPGA() {
@ -174,10 +189,9 @@ int copyToFlash(ssize_t fsize, char *clientChecksum, char *mess) {
return FAIL; return FAIL;
} }
/* ignoring this until a consistent way to read from bfin flash /* ignoring this until flash fixed
if (verifyChecksumFromFlash(mess, clientChecksum, flashDriveName, fsize) if (verifyChecksumFromFlash(mess, clientChecksum, flashDriveName, fsize) == FAIL) { return FAIL;
== FAIL) { return FAIL; }
}
*/ */
if (waitForFPGAtoTouchFlash(mess) == FAIL) { if (waitForFPGAtoTouchFlash(mess) == FAIL) {
return FAIL; return FAIL;

View File

@ -10,6 +10,6 @@
#define APICTB 0x211029 #define APICTB 0x211029
#define APIGOTTHARD 0x211029 #define APIGOTTHARD 0x211029
#define APIGOTTHARD2 0x211029 #define APIGOTTHARD2 0x211029
#define APIJUNGFRAU 0x211029
#define APIMYTHEN3 0x211029 #define APIMYTHEN3 0x211029
#define APIMOENCH 0x211028 #define APIMOENCH 0x211028
#define APIJUNGFRAU 0x211102