From patchwork Thu Dec 12 16:15:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 181497 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1097602ile; Thu, 12 Dec 2019 08:18:12 -0800 (PST) X-Google-Smtp-Source: APXvYqw/SJNUQnPp9gdObNlVfnearvqoKuUMWc1l+KfHlCckVG8AvTE1Ej2W2n0VyWYM3OfKpNav X-Received: by 2002:a05:6830:1047:: with SMTP id b7mr9340142otp.77.1576167492654; Thu, 12 Dec 2019 08:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576167492; cv=none; d=google.com; s=arc-20160816; b=B3bDVTRNAO9tJuXyRsnL5GN2DI2hE4dfNam6eD+Ipo3iXPZZSJKZzP3Pfndh3wROUv ObxeOUWILzDNaU6SDadDKhyrNDjpyK/DxSK/4HydJYci7BchTEFeB33AwtzKhePrbdbk m5r77i2xKzppYJuLwDbsbKpreA2P/0kjB4+BG0fFrTjeirn4qeonVrkof9hWXjNH+qLi 7ULi9p8Wq75KApdmiOm2yFxSLwBa7z0sP3XxiLNocK3D5mmxeMJwaEmNpAl1eoAlCyhF u1QvL3/jK0Yvkj69eT2+0dT+kaUwVLCxP2TFglMxBCHRUvbHMjid4eTw6kDNEohr2MjX GAOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nkLQXRQ87/SfQSBWWiilrp7/xPrpCi1hyGz8PEvF/Ss=; b=gSIpPP7WerK3I9izW71bmJFsnY8d2LH3p9V8GFq0My0cYhlMQC377kQRFo9YPdu5a2 iwSJqvcs6g98ubBURRh32BSWm9AlTIUjf6a/SloXdAJuNwtIVvKh/83xxZK21FctQrsL TQ/ZLsjzKpN3PApp5Zg+w4xv6s/xxWt2dAPkQs9NDUwMPMfkMDbKMPcboJa6HG0quvaK 53u87wz0xU9NEYgulvZ6oL2dZSezKAgXBrd2aJCM/i0Xx1ZtDQMzGzG70jJm4mel8kWv GMgf2DDGW8ibAVFVWorgmltf3LLk1qn3pvxPfgujcMPF5XzWOa6g9fJbjt+7ZB95k6Yq H2ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MePKYqk8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y130si3355037oiy.28.2019.12.12.08.18.12; Thu, 12 Dec 2019 08:18:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MePKYqk8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729845AbfLLQSL (ORCPT + 27 others); Thu, 12 Dec 2019 11:18:11 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:54824 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729591AbfLLQSK (ORCPT ); Thu, 12 Dec 2019 11:18:10 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBCGHvLv077744; Thu, 12 Dec 2019 10:17:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576167477; bh=nkLQXRQ87/SfQSBWWiilrp7/xPrpCi1hyGz8PEvF/Ss=; h=From:To:CC:Subject:Date; b=MePKYqk8/SzAObjqBi4Ei8Jj/L7n8dXOapx3cZPfRREr2XbqjHMo6qeDpjL7JMINx aorcAwPvlEPWZENyarLXp1EPYBvJm2qxB1jHrZijLpIj8QeJWoDQo3inBbCpxzaSvI Napit0EFcN1FLgXCYEA5W99U2Xu74ez1rBaoyGY8= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBCGHvK9122783 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Dec 2019 10:17:57 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 12 Dec 2019 10:17:57 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 12 Dec 2019 10:17:57 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBCGHvpu030666; Thu, 12 Dec 2019 10:17:57 -0600 From: Dan Murphy To: , , , , CC: Dan Murphy Subject: [PATCH linux-can/testing] can: tcan4x5x: Disable the INH pin device-state GPIO is unavailable Date: Thu, 12 Dec 2019 10:15:36 -0600 Message-ID: <20191212161536.23264-1-dmurphy@ti.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the device state GPIO is not connected to the host then disable the INH output from the TCAN device per section 8.3.5 of the data sheet. Signed-off-by: Dan Murphy --- drivers/net/can/m_can/tcan4x5x.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.23.0 diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c index b5d2ea0999c1..6a1f242d1876 100644 --- a/drivers/net/can/m_can/tcan4x5x.c +++ b/drivers/net/can/m_can/tcan4x5x.c @@ -102,6 +102,7 @@ #define TCAN4X5X_MODE_NORMAL BIT(7) #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) +#define TCAN4X5X_DISABLE_INH_MSK BIT(9) #define TCAN4X5X_SW_RESET BIT(2) @@ -360,6 +361,15 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) TCAN4X5X_DISABLE_WAKE_MSK, 0x00); } +static int tcan4x5x_disable_state(struct m_can_classdev *cdev) +{ + struct tcan4x5x_priv *tcan4x5x = cdev->device_data; + + return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG, + TCAN4X5X_DISABLE_INH_MSK, 0x01); + +} + static int tcan4x5x_parse_config(struct m_can_classdev *cdev) { struct tcan4x5x_priv *tcan4x5x = cdev->device_data; @@ -383,8 +393,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, "device-state", GPIOD_IN); - if (IS_ERR(tcan4x5x->device_state_gpio)) + if (IS_ERR(tcan4x5x->device_state_gpio)) { tcan4x5x->device_state_gpio = NULL; + tcan4x5x_disable_state(cdev); + } return 0; }