From patchwork Thu Oct 28 07:03:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 12589407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 093F2C433F5 for ; Thu, 28 Oct 2021 07:05:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA27460FF2 for ; Thu, 28 Oct 2021 07:05:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CA27460FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=6by6NXL/IaOuGZrjfjIuEXjjNGJ4D0tYKBbaaqqe604=; b=hhAESJ3mU6EoV/ oR+doWyK4zLoP3fGCElhnTssEbF0g9GHsGJ2XS2tpeLc9GKaP6D2T2DVtrrn04u8SWryLl/voKRlv EmRnxQfFOtrUV+SBn1mC1BnfLzU0GWzed4WeBV5h1qqglaY/nRmknEAl4JX3EN6RaWX7FMkbztJE4 PvWZPV7lcjOBdFilP0JccyFEkQ6DEzXe9qhKYw6HnZhMpog4V0EJXiG3bwawLxjwG/RWIbpOwjmdX MniyXvvpTBHnD/elvlZAlSqtW3NW3CPkzS1P2qpkgduBZALqTk0JPU3UQ7u3phZ9O+Egtspf6LPRc E6Osd6MJXDMUYymdarnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzS6-0073m8-Qd; Thu, 28 Oct 2021 07:03:55 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfzS3-0073ks-1G for linux-arm-kernel@lists.infradead.org; Thu, 28 Oct 2021 07:03:52 +0000 Received: by mail-wr1-x429.google.com with SMTP id d3so8315223wrh.8 for ; Thu, 28 Oct 2021 00:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tYJf3pPXy66b6fOeFSuwXiQ13fKQDUAgQENZhWkIem0=; b=pp6s8C2MnjyDkTBNBkmTo91foNk3zr0KIlSe/h+ScJQSuVSn5RIpnlMjwUF8rRJnAn 0sakS0pMa5m9GXqERtRNB0As3ROYmhA1IGWtpmzN3pEuABqtvwJqOe8axJ5PjJXfYca2 +u7bIud0OjwLEvQuLAcmva0Wu6qGlMjKaQ3czMTk7rwIilv/6zPpskLiJ3ZhSHS1Ywcb 3e/BXL1Om2SUgmPhqhhyRvYDS8XQxCICe0vPvTSHOo1+efutMWhexkUKETy+ZZLDiL0v 4x592WhTGR84o0987uCjbvXbfQde+kNqBTk4d0ywVkxWrAqqitPPCQig8Vf4X85T/M2e waLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tYJf3pPXy66b6fOeFSuwXiQ13fKQDUAgQENZhWkIem0=; b=Th93F2tZWuwFx0M2ywtzPdbqKhnv4xhOYR8ChAda9CKUO3h/mUWdoSzVEXvX5HK6Sf e5tM/zIG31o79XbNYvj4DigOFv0cehHgp7jXQf/0WhYWn4VSY3bNj82FPo2M8iwwG97L pgkQdUnbLFaw+vg+SeantOAFSbN4MWN+cWlSCU4wAVumPfQkqSrQf7oIO95eL7AvUrxF ShQkx8zkgsgy+hezkCTf0l+0FXUzbg3NhkSk4bGUrk6e3dvPIaBjQ1AJXzRM9CJZxzmx 0gTi+Dd6I6a1AdvrWrohou8yh5K8jnrIw68i4bkNehqdvqkDGJICcY+rrIj698KNs+R7 tihA== X-Gm-Message-State: AOAM532xCyG3DOZA1bxjzvOspjqgVFl6bZb37D/JwFwbuMTpo5YNLknN De+JRjZ8bgY0OBWt01T6N5VyEwmOz+g= X-Google-Smtp-Source: ABdhPJx82lbZL/Ko7/2tCtLAVKWmH9SkWfTr4pyYw6eZs5gcLHZ+PAeiJTo+6Fcj1g/kal3POynyJA== X-Received: by 2002:adf:d1c2:: with SMTP id b2mr3324666wrd.73.1635404625873; Thu, 28 Oct 2021 00:03:45 -0700 (PDT) Received: from debian64.daheim (p5b0d7857.dip0.t-ipconnect.de. [91.13.120.87]) by smtp.gmail.com with ESMTPSA id y5sm2469651wrd.75.2021.10.28.00.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 00:03:45 -0700 (PDT) Received: from chuck by debian64.daheim with local (Exim 4.95) (envelope-from ) id 1mfzRw-0003IE-Vy; Thu, 28 Oct 2021 09:03:44 +0200 From: Christian Lamparter To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com Cc: Florian Fainelli , Hauke Mehrtens , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Matthew Hagan Subject: [PATCH v1] ARM: BCM53016: MR32: convert to Broadcom iProc I2C Driver Date: Thu, 28 Oct 2021 09:03:44 +0200 Message-Id: <20211028070344.12652-1-chunkeey@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_000351_100312_C90306EB X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org replaces the bit-banged i2c-gpio provided i2c functionality with the hardware in the SoC. During review of the MR32, Florian Fainelli pointed out that the SoC has a real I2C-controller. Furthermore, the connected pins (SDA and SCL) would line up perfectly for use. Back then I couldn't get it working though and I left it with i2c-gpio (which worked). Now we know the reason: the interrupt was incorrectly specified. (Hence, this patch depends on Florian Fainelli's "ARM: dts: BCM5301X: Fix I2C controller interrupt" patch). Cc: Florian Fainelli Cc: Rafał Miłecki Cc: Matthew Hagan Signed-off-by: Christian Lamparter --- arch/arm/boot/dts/bcm53016-meraki-mr32.dts | 62 ++++++++++------------ 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts index c58e75dde7b3..6ae74c3d85c3 100644 --- a/arch/arm/boot/dts/bcm53016-meraki-mr32.dts +++ b/arch/arm/boot/dts/bcm53016-meraki-mr32.dts @@ -84,40 +84,6 @@ blue { max-brightness = <255>; }; }; - - i2c { - /* - * The platform provided I2C does not budge. - * This is a replacement until I can figure - * out what are the missing bits... - */ - - compatible = "i2c-gpio"; - sda-gpios = <&chipcommon 5 GPIO_ACTIVE_HIGH>; - scl-gpios = <&chipcommon 4 GPIO_ACTIVE_HIGH>; - i2c-gpio,delay-us = <10>; /* close to 100 kHz */ - #address-cells = <1>; - #size-cells = <0>; - - current_sense: ina219@45 { - compatible = "ti,ina219"; - reg = <0x45>; - shunt-resistor = <60000>; /* = 60 mOhms */ - }; - - eeprom: eeprom@50 { - compatible = "atmel,24c64"; - reg = <0x50>; - pagesize = <32>; - read-only; - #address-cells = <1>; - #size-cells = <1>; - - mac_address: mac-address@66 { - reg = <0x66 0x6>; - }; - }; - }; }; &uart0 { @@ -228,3 +194,31 @@ fixed-link { }; }; }; + +&i2c0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinmux_i2c>; + + clock-frequency = <100000>; + + current_sense: ina219@45 { + compatible = "ti,ina219"; + reg = <0x45>; + shunt-resistor = <60000>; /* = 60 mOhms */ + }; + + eeprom: eeprom@50 { + compatible = "atmel,24c64"; + reg = <0x50>; + pagesize = <32>; + read-only; + #address-cells = <1>; + #size-cells = <1>; + + mac_address: mac-address@66 { + reg = <0x66 0x6>; + }; + }; +};