-/* $OpenBSD: qcpmic.c,v 1.1 2022/11/08 19:40:08 patrick Exp $ */
+/* $OpenBSD: qcpmic.c,v 1.2 2024/08/14 10:54:58 mglocker Exp $ */
/*
* Copyright (c) 2022 Patrick Wildt <patrick@blueri.se>
*
err = spmi_cmd_read(sc->sc_tag, sc->sc_sid, SPMI_CMD_EXT_READL,
addr, ®, sizeof(reg));
if (err)
- printf("%s: error (%u) reading 0x%x\n", sc->sc_dev.dv_xname,
+ printf("%s: error (%u) reading 0x%x", sc->sc_dev.dv_xname,
err, addr);
return reg;
-/* $OpenBSD: qcspmi.c,v 1.5 2024/07/04 21:54:38 kettenis Exp $ */
+/* $OpenBSD: qcspmi.c,v 1.6 2024/08/14 10:54:58 mglocker Exp $ */
/*
* Copyright (c) 2022 Patrick Wildt <patrick@blueri.se>
*
SPMI_OBSV_OFF(sc, sc->sc_ee, apid) + SPMI_STATUS);
if (reg & SPMI_STATUS_DONE)
break;
+ if (reg & SPMI_STATUS_FAILURE) {
+ printf(": transaction failed\n");
+ return EIO;
+ }
+ if (reg & SPMI_STATUS_DENIED) {
+ printf(": transaction denied\n");
+ return EIO;
+ }
+ if (reg & SPMI_STATUS_DROPPED) {
+ printf(": transaction dropped\n");
+ return EIO;
+ }
}
- if (i == 0)
+ if (i == 0) {
+ printf("\n");
return ETIMEDOUT;
-
- if (reg & SPMI_STATUS_FAILURE ||
- reg & SPMI_STATUS_DENIED ||
- reg & SPMI_STATUS_DROPPED)
- return EIO;
+ }
if (len > 0) {
reg = HREAD4(sc, QCSPMI_REG_OBSRVR,