diff options
| author | Adrian Chadd <adrian@FreeBSD.org> | 2016-05-26 06:37:33 +0000 |
|---|---|---|
| committer | Adrian Chadd <adrian@FreeBSD.org> | 2016-05-26 06:37:33 +0000 |
| commit | 055486964ba7320871c0cab03e966ef113d99130 (patch) | |
| tree | d111ae9adbc087027d3171bcdb325128d42f1e3d /sys/dev/spibus | |
| parent | 63b92359c13c28420a248d6d135f8c675e60a400 (diff) | |
Notes
Diffstat (limited to 'sys/dev/spibus')
| -rw-r--r-- | sys/dev/spibus/ofw_spibus.c | 11 |
1 files changed, 10 insertions, 1 deletions
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; @@ -103,6 +103,14 @@ ofw_spibus_attach(device_t dev) } /* + * 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); |
