From owner-freebsd-questions@FreeBSD.ORG Tue Feb 5 16:16:33 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 541DA16A419 for ; Tue, 5 Feb 2008 16:16:33 +0000 (UTC) (envelope-from artem_kim@inbox.ru) Received: from mx4.mail.ru (fallback.mail.ru [194.67.57.14]) by mx1.freebsd.org (Postfix) with ESMTP id 0AC0613C4E7 for ; Tue, 5 Feb 2008 16:16:32 +0000 (UTC) (envelope-from artem_kim@inbox.ru) Received: from mx34.mail.ru (mx34.mail.ru [194.67.23.200]) by mx4.mail.ru (mPOP.Fallback_MX) with ESMTP id C3DFDA5F79 for ; Tue, 5 Feb 2008 01:28:08 +0300 (MSK) Received: from [87.251.152.6] (port=57719 helo=[172.16.0.3]) by mx34.mail.ru with asmtp id 1JM9nJ-00094N-00 for freebsd-questions@freebsd.org; Tue, 05 Feb 2008 01:28:05 +0300 From: Artem Kim To: freebsd-questions@freebsd.org Date: Tue, 5 Feb 2008 01:28:12 +0300 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200802050128.12155.artem_kim@inbox.ru> X-Spam: Not detected Subject: i2c driver newbie question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2008 16:16:33 -0000 Can anybody help my to write i2c drivers for saa7146 ? I do not good understand how to connect this device to existing iicbus=20 infrastructure. I do: static device_method_t saa7146_i2c_methods[] =3D { /* device interface */ DEVMETHOD(device_probe, saa7146_i2c_probe), DEVMETHOD(device_attach, saa7146_i2c_attach), DEVMETHOD(device_detach, saa7146_i2c_detach), =20 /* iicbus interface */ DEVMETHOD(iicbus_callback, iicbus_null_callback), DEVMETHOD(iicbus_repeated_start, saa7146_i2c_repeated_start), DEVMETHOD(iicbus_start, saa7146_i2c_start), DEVMETHOD(iicbus_stop, saa7146_i2c_stop), DEVMETHOD(iicbus_write, saa7146_i2c_write), DEVMETHOD(iicbus_read, saa7146_i2c_read), DEVMETHOD(iicbus_reset, saa7146_i2c_rst_card), { 0, 0 } }; static int saa7146_i2c_probe(device_t dev) { =2E...... } static int saa7146_i2c_attach(device_t dev) { =09 //... Allocation of some resources //add child if ((sc->i2c_dev =3D device_add_child(dev, "iicbus", -1)) =3D=3D NULL) device_printf(dev, "could not allocate iicbus instance\n"); bus_generic_attach(dev); device_printf(dev, "%s complite\n", __FUNCTION__); return (0); } static int saa7146_i2c_start (device_t dev, u_char slave, int timeout) { ...... } =2E.... DRIVER_MODULE (saa7146_i2c, pci, saa7146_i2c_driver, saa7146_i2c_devclass,= 0,=20 0); MODULE_DEPEND (saa7146_i2c, iicbus, SAA7146_I2C_MINVER, SAA7146_I2C_PREFVE= R,=20 SAA7146_I2C_MAXVER); MODULE_VERSION (saa7146_i2c, SAA7146_I2C_MODVER); But this now work. =F3hild-device do not use any resource and is no active,= and=20 calling any method of this device lead to panic. What do I do wrong? Thanks, Artem