From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751885AbcF2RSv (ORCPT ); Wed, 29 Jun 2016 13:18:51 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:49803 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbcF2RSt (ORCPT ); Wed, 29 Jun 2016 13:18:49 -0400 From: Vitaly Andrianov To: Mark Brown , Lee Jones , Arnd Bergmann , Subject: using the same regmap by multiple device drivers Message-ID: <57740329.1080702@ti.com> Date: Wed, 29 Jun 2016 13:19:37 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I'm working on two drivers "crypto" and "hwrng", which use the same hardware module and the same block of registers. Actually the drivers don't need to access the same registers except several common ones. Here is fragment of dts. sa_subsys: subsys@1234000 { compatible = "syscon"; reg = <0x1234000 0x1000>; }; crypto@1234000 { compatible = "ti,netcp-sa-crypto"; syscon-subsys = <&sa_subsys>; clocks = <&clksa>; ..... }; rng@1234000 { compatible = "ti,keystone-rng"; syscon-subsys = <&sa_subsys>; clocks = <&clksa>; }; The both drivers use regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "syscon-subsys"); to get pointers to "struct regmap". Unfortunately I can get the first driver working only. When the second driver tries to call regmap_read() kernel gives "Division by zero in kernel" error. Here is my question. Is that actually possible to use in regmap framework the same registers in multiple different drivers? Thank you, -Vitaly