Smart gpio error path and minor fixes (#772)

* smart_gpio: fix error path

If chip driver disable in FW, disabled in settings or failed to init
we still need to ocupy its gpio range.

* smart_gpio: get tle6240 CS from config

* smart_gpio: fix debug messaging
This commit is contained in:
dron0gus 2019-04-21 17:35:13 +03:00 committed by rusefi
parent 2ec933a81c
commit e9aed8dd7a
1 changed files with 8 additions and 6 deletions

View File

@ -129,14 +129,16 @@ struct tle8888_config tle8888_cfg = {
void initSmartGpio() {
startSmartCsPins();
int ret;
int ret = -1;
#if (BOARD_TLE6240_COUNT > 0)
if (engineConfiguration->tle6240_cs != GPIO_UNASSIGNED) {
tle6240.spi_config.ssport = getHwPort("tle6240 CS", engineConfiguration->tle6240_cs);
tle6240.spi_config.sspad = getHwPin("tle6240 CS", engineConfiguration->tle6240_cs);
tle6240.spi_bus = getSpiDevice(engineConfiguration->tle6240spiDevice);
ret = tle6240_add(0, &tle6240);
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_TLE6240_COUNT > 0) */
@ -146,13 +148,13 @@ void initSmartGpio() {
#if (BOARD_MC33972_COUNT > 0)
if (boardConfiguration->mc33972_cs != GPIO_UNASSIGNED) {
// todo: reuse initSpiCs method?
mc33972.spi_config.ssport = getHwPort("tle8888 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.sspad = getHwPin("tle8888 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.ssport = getHwPort("mc33972 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.sspad = getHwPin("mc33972 CS", boardConfiguration->mc33972_cs);
mc33972.spi_bus = getSpiDevice(engineConfiguration->mc33972spiDevice);
// todo: propogate 'basePinOffset' parameter
ret = mc33972_add(0, &mc33972);
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_MC33972_COUNT > 0) */
@ -173,7 +175,7 @@ void initSmartGpio() {
efiAssertVoid(OBD_PCM_Processor_Fault, ret == TLE8888_PIN_1, "tle8888");
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_TLE6240_COUNT > 0) */