[iMX6] Fix build for SSI driver and add dependency for SDMA driver

- Pass correct pointer to OF_getencprop
- Check the size of "dmas" property
- Add dependency on sdma driver

Reviewed by:	br
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8873
This commit is contained in:
Oleksandr Tymoshenko 2016-12-21 01:32:19 +00:00
parent abc551b1d8
commit bbcd5f00d0

View File

@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val)
#define SSI_NCHANNELS 1
#define DMAS_TOTAL 8
/* i.MX6 SSI registers */
@ -187,8 +188,8 @@ struct sc_info {
struct sdma_conf *conf;
struct ssi_rate *sr;
struct sdma_softc *sdma_sc;
int sdma_ev_rx;
int sdma_ev_tx;
uint32_t sdma_ev_rx;
uint32_t sdma_ev_tx;
int sdma_channel;
};
@ -437,7 +438,7 @@ find_sdma_controller(struct sc_info *sc)
struct sdma_softc *sdma_sc;
phandle_t node, sdma_node;
device_t sdma_dev;
int dts_value[8];
pcell_t dts_value[DMAS_TOTAL];
int len;
if ((node = ofw_bus_get_node(sc->dev)) == -1)
@ -446,7 +447,14 @@ find_sdma_controller(struct sc_info *sc)
if ((len = OF_getproplen(node, "dmas")) <= 0)
return (ENXIO);
OF_getencprop(node, "dmas", &dts_value, len);
if (len != sizeof(dts_value)) {
device_printf(sc->dev,
"\"dmas\" property length is invalid: %d (expected %d)",
len, sizeof(dts_value));
return (ENXIO);
}
OF_getencprop(node, "dmas", dts_value, sizeof(dts_value));
sc->sdma_ev_rx = dts_value[1];
sc->sdma_ev_tx = dts_value[5];
@ -850,4 +858,5 @@ static driver_t ssi_pcm_driver = {
DRIVER_MODULE(ssi, simplebus, ssi_pcm_driver, pcm_devclass, 0, 0);
MODULE_DEPEND(ssi, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER);
MODULE_DEPEND(ssi, sdma, 0, 0, 0);
MODULE_VERSION(ssi, 1);