Date: Thu, 26 May 2016 06:37:33 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300712 - head/sys/dev/spibus Message-ID: <201605260637.u4Q6bXH1098140@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Thu May 26 06:37:33 2016 New Revision: 300712 URL: https://svnweb.freebsd.org/changeset/base/300712 Log: [spibus] implement maximum clock frequency lookup from ofw. Obtained from: loos Modified: head/sys/dev/spibus/ofw_spibus.c Modified: head/sys/dev/spibus/ofw_spibus.c ============================================================================== --- head/sys/dev/spibus/ofw_spibus.c Thu May 26 06:36:58 2016 (r300711) +++ head/sys/dev/spibus/ofw_spibus.c Thu May 26 06:37:33 2016 (r300712) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605260637.u4Q6bXH1098140>