--- trunk/stable-14/sys/dev/firmware/arm/scmi.c 2025-03-19 20:51:14.876326000 +0100
+++ branches/stable-14-deepcore/sys/dev/firmware/arm/scmi.c 2025-03-19 20:23:55.152581000 +0100
@@ -44,10 +44,15 @@
#include <dev/ofw/ofw_bus_subr.h>
#include "dev/mailbox/arm/arm_doorbell.h"
+#include "dev/psci/psci.h"
#include "scmi.h"
#include "scmi_protocols.h"
+enum scmi_transport {
+ SCMI_SMC = 1,
+ SCMI_MBOX,
+};
struct scmi_softc {
struct simplebus_softc simplebus_sc;
device_t dev;
@@ -55,6 +60,8 @@
struct arm_doorbell *db;
struct mtx mtx;
int req_done;
+ uint32_t smc_id;
+ uint8_t ttype;
};
static device_t
@@ -110,7 +117,7 @@
scmi_request_locked(struct scmi_softc *sc, struct scmi_req *req)
{
struct scmi_smt_header hdr;
- int timeout;
+ int timeout, status;
bzero(&hdr, sizeof(struct scmi_smt_header));
@@ -127,7 +134,8 @@
hdr.msg_header = req->protocol_id << SMT_HEADER_PROTOCOL_ID_S;
hdr.msg_header |= req->message_id << SMT_HEADER_MESSAGE_ID_S;
hdr.length = sizeof(hdr.msg_header) + req->in_size;
- hdr.flags |= SCMI_SHMEM_FLAG_INTR_ENABLED;
+ if (sc->ttype == SCMI_MBOX)
+ hdr.flags |= SCMI_SHMEM_FLAG_INTR_ENABLED;
/* Write header */
scmi_shmem_write(sc->tx_shmem, 0, &hdr, SMT_HEADER_SIZE);
@@ -135,32 +143,38 @@
/* Write request */
scmi_shmem_write(sc->tx_shmem, SMT_HEADER_SIZE, req->in_buf,
req->in_size);
+ if (sc->ttype == SCMI_MBOX) {
- sc->req_done = 0;
+ sc->req_done = 0;
- /* Interrupt SCP firmware. */
- arm_doorbell_set(sc->db);
+ /* Interrupt SCP firmware. */
+ arm_doorbell_set(sc->db);
- timeout = 200;
+ timeout = 200;
- dprintf("%s: request\n", __func__);
+ dprintf("%s: request\n", __func__);
- do {
- if (cold) {
- if (arm_doorbell_get(sc->db))
- break;
- DELAY(10000);
- } else {
- msleep(sc, &sc->mtx, 0, "scmi", hz / 10);
- if (sc->req_done)
- break;
- }
- } while (timeout--);
+ do {
+ if (cold) {
+ if (arm_doorbell_get(sc->db))
+ break;
+ DELAY(10000);
+ } else {
+ msleep(sc, &sc->mtx, 0, "scmi", hz / 10);
+ if (sc->req_done)
+ break;
+ }
+ } while (timeout--);
- if (timeout <= 0)
- return (-1);
+ if (timeout <= 0)
+ return (-1);
- dprintf("%s: got reply, timeout %d\n", __func__, timeout);
+ dprintf("%s: got reply, timeout %d\n", __func__, timeout);
+ } else {
+ status = psci_call(sc->smc_id, 0, 0, 0);
+ if (status)
+ return (status);
+ }
/* Read header. */
scmi_shmem_read(sc->tx_shmem, 0, &hdr, SMT_HEADER_SIZE);
@@ -168,7 +182,6 @@
/* Read response */
scmi_shmem_read(sc->tx_shmem, SMT_HEADER_SIZE, req->out_buf,
req->out_size);
-
return (0);
}
@@ -187,13 +200,18 @@
return (error);
}
+
+static struct ofw_compat_data compat_data[] = {
+ {"arm,scmi", SCMI_MBOX},
+ {"arm,scmi-smc", SCMI_SMC},
+ {NULL, 0}
+};
static int
scmi_probe(device_t dev)
{
+ if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+ return (ENXIO);
- if (!ofw_bus_is_compatible(dev, "arm,scmi"))
- return (ENXIO);
-
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -211,7 +229,7 @@
sc = device_get_softc(dev);
sc->dev = dev;
-
+ sc->ttype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
node = ofw_bus_get_node(dev);
if (node == -1)
return (ENXIO);
@@ -222,16 +240,22 @@
return (ENXIO);
}
- sc->db = arm_doorbell_ofw_get(sc->dev, "tx");
- if (sc->db == NULL) {
- device_printf(dev, "Doorbell device not found.\n");
+ if (sc->ttype == SCMI_MBOX) {
+ sc->db = arm_doorbell_ofw_get(sc->dev, "tx");
+ if (sc->db == NULL) {
+ device_printf(dev, "Doorbell device not found.\n");
+ return (ENXIO);
+ }
+
+ arm_doorbell_set_handler(sc->db, scmi_callback, sc);
+ } else {
+ if (OF_getencprop(node, "arm,smc-id", &sc->smc_id, sizeof(sc->smc_id)) <= 0) {
+ device_printf(dev, "arm,smc-id not found.\n");
return (ENXIO);
- }
+ }
+ }
mtx_init(&sc->mtx, device_get_nameunit(dev), "SCMI", MTX_DEF);
-
- arm_doorbell_set_handler(sc->db, scmi_callback, sc);
-
simplebus_init(dev, node);
/*
@@ -267,5 +291,5 @@
DEFINE_CLASS_1(scmi, scmi_driver, scmi_methods, sizeof(struct scmi_softc),
simplebus_driver);
-DRIVER_MODULE(scmi, simplebus, scmi_driver, 0, 0);
+EARLY_DRIVER_MODULE(scmi, simplebus, scmi_driver, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_LATE);
MODULE_VERSION(scmi, 1);
--- trunk/stable-14/sys/dev/flash/mx25l.c 2025-03-19 20:51:14.921293000 +0100
+++ branches/stable-14-deepcore/sys/dev/flash/mx25l.c 2025-03-19 20:23:55.196304000 +0100
@@ -122,6 +122,7 @@
{ "en25q64", 0x1c, 0x3017, 64 * 1024, 128, FL_ERASE_4K },
{ "m25p32", 0x20, 0x2016, 64 * 1024, 64, FL_NONE },
{ "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE },
+ { "xm25qu128c", 0x20, 0x4118, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K },
{ "mx25l1606e", 0xc2, 0x2015, 64 * 1024, 32, FL_ERASE_4K},
{ "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE },
{ "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE },
@@ -144,6 +145,8 @@
{ "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K },
{ "w25q128", 0xef, 0x4018, 64 * 1024, 256, FL_ERASE_4K },
{ "w25q256", 0xef, 0x4019, 64 * 1024, 512, FL_ERASE_4K },
+ { "w25q128jw", 0xef, 0x6018, 64 * 1024, 256, FL_ERASE_4K },
+ { "w25q256jw", 0xef, 0x6019, 64 * 1024, 512, FL_ERASE_4K },
/* Atmel */
{ "at25df641", 0x1f, 0x4800, 64 * 1024, 128, FL_ERASE_4K },
@@ -154,6 +157,9 @@
/* Integrated Silicon Solution */
{ "is25wp256", 0x9d, 0x7019, 64 * 1024, 512, FL_ERASE_4K | FL_ENABLE_4B_ADDR},
+
+ /* zbit */
+ { "zb25vq128", 0x5e, 0x4018, 64 * 1024, 256, FL_ERASE_4K },
};
static int