diff --git a/sys/dev/spibus/ofw_spibus.c b/sys/dev/spibus/ofw_spibus.c index 313d4e6533f0..c89db2cf9949 100644 --- a/sys/dev/spibus/ofw_spibus.c +++ b/sys/dev/spibus/ofw_spibus.c @@ -78,7 +78,7 @@ ofw_spibus_attach(device_t dev) struct spibus_softc *sc = device_get_softc(dev); struct ofw_spibus_devinfo *dinfo; phandle_t child; - pcell_t paddr; + pcell_t clock, paddr; device_t childdev; sc->dev = dev; @@ -102,6 +102,14 @@ ofw_spibus_attach(device_t dev) continue; } + /* + * Get the maximum clock frequency for device, zero means + * use the default bus speed. + */ + if (OF_getencprop(child, "spi-max-frequency", &clock, + sizeof(clock)) == -1) + clock = 0; + /* * Now set up the SPI and OFW bus layer devinfo and add it * to the bus. @@ -111,6 +119,7 @@ ofw_spibus_attach(device_t dev) if (dinfo == NULL) continue; dinfo->opd_dinfo.cs = paddr; + dinfo->opd_dinfo.clock = clock; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF);