From owner-freebsd-hackers@freebsd.org Sun Feb 25 14:49:40 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A91B8F319EF for ; Sun, 25 Feb 2018 14:49:40 +0000 (UTC) (envelope-from embaudarm@gmail.com) Received: from mail-ot0-x22f.google.com (mail-ot0-x22f.google.com [IPv6:2607:f8b0:4003:c0f::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 30DD27F8D1 for ; Sun, 25 Feb 2018 14:49:40 +0000 (UTC) (envelope-from embaudarm@gmail.com) Received: by mail-ot0-x22f.google.com with SMTP id w38so11236760ota.8 for ; Sun, 25 Feb 2018 06:49:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gnDCmiqQjcMTyYi4lL3owpQrWqocMHiwTMIJjqlY9ZE=; b=rRfdWNTcPFt2LQB1QkKK2bbR0aF0VOCXS4BKCQmyhtfL55pm+OqBg6VoXVN9Fu1jzS a9lyftjfDki4OcAJhItcV+yY4NNUtqreu+M3QO/lVgjaiXiNre8UMQhW01a46OYOe2lY C1iXrtRLe7wVSgTNjGQE2Mx5A/hmlBN75xkURf+H8MZqtg+q+x8H3WwXYrOOQU3yxoJR 59Q4oUjraUwOXi3n5GepZumuHaSsbxHQE4Zi1t9jlOoB6tLMkxdlkT9nB+FS4su3hb8N W3ztmqowfnWkDS3k8zGgb3krZdBn+FAuSFt42lHowhqCsx2y8Xj5q0xt5wSksM9Bdd4r IWFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gnDCmiqQjcMTyYi4lL3owpQrWqocMHiwTMIJjqlY9ZE=; b=IbbbXXwcMEGOJwmreQUW55kp2VFAeV1CxpzSGgkNbqZOblTYlMBpGn3ZezOg66s8l8 meqzdaTxwKSq9dWaGWrKs2ccqbYS8Zj28S6cMswwGYeNQazN8BQ2ZwlVa9XR+YvdrOfj th7iDiKIzwoYw5ai9QjSILkMMtTMjFcKCJKqd8N04jBvXK8SWoXYAyTOAF5Y0OoDxH8c wmfT1cNZhN/fWIPJ0gJ9BYzgCzd4da/lpToXUsrEVKOCEKg9Zv8NA6FTxR1OjAMP5ZCb 0iKUgPgTiV1EM/gs3ur5vksSNghPSlkqDf9pryr+M2g5BvF6mqDUVTjwo8JQ8Jr0lZ7D S6Zw== X-Gm-Message-State: APf1xPDJw0nUNU+mNBo7x7HIZafIuQEVDpXZ6jf9MhWvy+u2JoQHR+qo 5LqIk0uFFUI3+TSf1CUhGg1QuevhZuboAnjNAYAhIA== X-Google-Smtp-Source: AG47ELt6VCeNVNijiEF/CH9z8yfTZ2BQ9XZvLbPXhWi0CqSqpO2Gy4BTqPnx6F+ZdzH0UrtGRkxGjujSZmSpE11lAL0= X-Received: by 10.157.32.228 with SMTP id x91mr5728259ota.176.1519570179300; Sun, 25 Feb 2018 06:49:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.45.194 with HTTP; Sun, 25 Feb 2018 06:48:58 -0800 (PST) From: Lee D Date: Sun, 25 Feb 2018 09:48:58 -0500 Message-ID: Subject: Help, please, with getting a custom I2C real time clock module to load To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 14:49:41 -0000 Hi Everyone, I have written a new I2C driver (for the Xilinx Zynq) and a new real time clock chip driver (for the ST M41T82) to use with hardware on my custom board. This is for 11.0.1. The I2C driver works fine, but I can't seem to get my RTC driver to load. The m41t82_probe() function is never even called. Both are loaded with kldload at the moment. I think the problem is something in DRIVER_MODULE macro that is preventing the kernel from even trying to let it probe. One clue is that if I change "iicbus" to "simplebus" in the DRIVER_MODULE macro of the RTC, it will then at least call m41t82_probe(). It's like the kernel thinks that I have no iicbus driver and thus won't even try to load the RTC module. I have turned on "device iic" and "device iicbus" in my kernel config file. No messages are given when I try to load the m41t82 module. It just silently loads and does nothing. Here is a code snippet from my I2C driver: ------------------------------------------ static driver_t i2c_driver = { "i2c", i2c_methods, sizeof(struct i2c_softc), }; static devclass_t i2c_devclass; DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); And here is a code snippet from my RTC driver: ---------------------------------------------- static device_method_t m41t82_methods[] = { DEVMETHOD(device_probe, m41t82_probe), DEVMETHOD(device_attach, m41t82_attach), DEVMETHOD(device_detach, m41t82_detach), DEVMETHOD(clock_gettime, m41t82_gettime), DEVMETHOD(clock_settime, m41t82_settime), DEVMETHOD_END }; static driver_t m41t82_driver = { "m41t82", m41t82_methods, sizeof(struct m41t82_softc), }; static devclass_t m41t82_devclass; DRIVER_MODULE(m41t82, iicbus, m41t82_driver, m41t82_devclass, NULL, NULL); MODULE_VERSION(m41t82, 1); MODULE_DEPEND(m41t82, iicbus, 1, 1, 1); This is the relevant portion of my DTS file: -------------------------------------------- ps7io@e0000000 { device_type = "soc"; compatible = "simple-bus"; #address-cells = <0x1>; #size-cells = <0x1>; ranges = <0x0 0xe0000000 0x300000>; ... Other hardware ... i2c@4000 { compatible = "xlnx,zy7_i2c"; status = "okay"; reg = <0x4000 0x1000>; #address-cells = <0x1>; #size-cells = <0x0>; rtc@d0 { status = "okay"; compatible = "st,m41t82"; reg = <0xd0>; }; }; }; Any clues about how to go about debugging this problem would be very helpful. Thanks, Lee