Lines Matching +full:slave +full:- +full:kernel

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
31 #include <sys/kernel.h>
61 int slave;
129 if (device_find_child(parent, "smb", -1) == NULL)
136 if (smbus_get_addr(dev) != -1)
151 sc->sc_dev = dev;
160 error = make_dev_s(&mda, &sc->sc_devnode, "smb%d", mda.mda_unit);
170 destroy_dev(sc->sc_devnode);
181 CP(*uaddr, *kaddr, slave);
199 struct smb_softc *sc = dev->si_drv1;
200 device_t smbdev = sc->sc_dev;
206 * If a specific slave device is being used, override any passed-in
207 * slave.
211 s->slave = unit & 0x03ff;
216 if (s->slave & 0x1)
253 error = smbus_error(smbus_quick(parent, s->slave, SMB_QWRITE));
260 error = smbus_error(smbus_quick(parent, s->slave, SMB_QREAD));
267 error = smbus_error(smbus_sendb(parent, s->slave, s->cmd));
274 error = smbus_error(smbus_recvb(parent, s->slave, &s->cmd));
281 error = smbus_error(smbus_writeb(parent, s->slave, s->cmd,
282 s->wdata.byte));
289 error = smbus_error(smbus_writew(parent, s->slave,
290 s->cmd, s->wdata.word));
300 error = smbus_error(smbus_readb(parent, s->slave, s->cmd,
301 &s->rdata.byte));
304 if (s->rbuf && s->rcount >= 1) {
305 error = copyout(&s->rdata.byte, s->rbuf, 1);
306 s->rcount = 1;
317 error = smbus_error(smbus_readw(parent, s->slave, s->cmd,
318 &s->rdata.word));
321 if (s->rbuf && s->rcount >= 2) {
322 buf[0] = (u_char)s->rdata.word;
323 buf[1] = (u_char)(s->rdata.word >> 8);
324 error = copyout(buf, s->rbuf, 2);
325 s->rcount = 2;
336 error = smbus_error(smbus_pcall(parent, s->slave, s->cmd,
337 s->wdata.word, &s->rdata.word));
340 if (s->rbuf && s->rcount >= 2) {
341 buf[0] = (u_char)s->rdata.word;
342 buf[1] = (u_char)(s->rdata.word >> 8);
343 error = copyout(buf, s->rbuf, 2);
344 s->rcount = 2;
353 if (s->wcount < 0) {
357 if (s->wcount > SMB_MAXBLOCKSIZE)
358 s->wcount = SMB_MAXBLOCKSIZE;
359 if (s->wcount)
360 error = copyin(s->wbuf, buf, s->wcount);
363 error = smbus_error(smbus_bwrite(parent, s->slave, s->cmd,
364 s->wcount, buf));
371 if (s->rcount < 0) {
375 if (s->rcount > SMB_MAXBLOCKSIZE)
376 s->rcount = SMB_MAXBLOCKSIZE;
377 error = smbus_error(smbus_bread(parent, s->slave, s->cmd,
381 if (s->rcount > bcount)
382 s->rcount = bcount;
383 error = copyout(buf, s->rbuf, s->rcount);
404 if (s->rbuf == NULL)