Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1100242rwb; Thu, 1 Dec 2022 12:22:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5I2cxERWDPzTTR+KJZwXm3yE0nWQWKiqc11h1MPtaSwsTI1isQhGYfEDrSYNcFD8HhowZv X-Received: by 2002:a17:906:d0da:b0:7ad:9891:8756 with SMTP id bq26-20020a170906d0da00b007ad98918756mr58182237ejb.203.1669926139797; Thu, 01 Dec 2022 12:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669926139; cv=none; d=google.com; s=arc-20160816; b=z/iJpNuzsfyPUuFmVnYOw2fk6yfuDbG/0MsBVZ12vBzTGPjFU8AjDHqFXRZKir1qnU 5M1SiV/feohYBVMNY4m51CGqOIkub2Dh+tTi4Hcc3ILKTQR+iDMKdrTTXmqG3QE4CRZ2 VKCongQZacdFFZsZrSYCu8nEJw2Vp+LzApMjzjkYTZWjSmU1Ls/0MV25lmnkKNhRTDtl 8mJpumzGB0y3P1jb4iug2MMT2FhLH/kSlAIk/AQ5uPqWR8e9P9YfXizr7qA9AvTXkzJ9 kgzs9mMy2v8q+XoFGprDzYM3chh6nFJ8EUIb+yLDCjHv/sLF9X4A4tO5Y6woZ+iQE6EW 1usw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RMNXYrumhI3yLofiZI7k3r2DEJ+lXONtPLs3WFv5g+o=; b=If3ANZtxQtEn73qVdNaXdsEJT1wjLr4oPzcoYg+meAKfAHGQ8WT3dFaz2QCxbJrePA SU6c5/LNcm+1IxyRs41ROHl/AKWGPTjfR9VN7cmW/L61Uy1mlTs3YbaWAhj+RrHJ1muH nPPQB38UucQRCuM0SPeicFv0pkm9IsnH2gAW2f3RUNRQTqgMRY4SsmTmnrAyAADL925t wjPXHilFvWmzY8YSnkAHhwt+3YwVmA8JxnhZhyoLlBM+ER5iM2ijWjuEjx7R+YOdKM+U +m0e6BaweDhNwZCzHPj+02zJJxdgiX6qwi5WxnicP/hJypd35CsStQYZmusS+YyGuivC YrWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=KmvMek2D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020a170906739e00b007c0b71dfd96si1214001ejl.734.2022.12.01.12.21.57; Thu, 01 Dec 2022 12:22:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=KmvMek2D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230101AbiLAUDX (ORCPT + 82 others); Thu, 1 Dec 2022 15:03:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiLAUDV (ORCPT ); Thu, 1 Dec 2022 15:03:21 -0500 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0B4E8E5B6; Thu, 1 Dec 2022 12:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RMNXYrumhI3yLofiZI7k3r2DEJ+lXONtPLs3WFv5g+o=; b=KmvMek2D0898QGmqEiuvfzwohH nW1t8viI/Dd08ZHHPuMlqkwDQIF2FJzMuEOIE4pEfnfPHQbjDLW9J6cFWs/dHbUVKnMOfhMLTRkS5 dU7OgrMqHIQueeD0/0Ll6enN87ICcQKmjqpgAVKCLwhty5mGwUtgvfpoUODLN6UN0hLEUP/SCkkfC 6hvUCB3ARqkLJizAfqUnYP+gfa9v+COAOoNsW92S51M8alakzp0e91oLyatS/da1Rgp7XC/WYIXiO L+9ZPN9s49sHHa5bUfGz2SzYlJAUFfjc2d/EsBOoweVoDhJ/wlflPx6/g7BwTB5CVPJ5EJgzOVe1/ Ea0mJ7AA==; Received: from p200300ccff169a001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff16:9a00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1p0pm5-0008Pf-91; Thu, 01 Dec 2022 21:03:13 +0100 Received: from andi by aktux with local (Exim 4.94.2) (envelope-from ) id 1p0pm4-00En9o-5D; Thu, 01 Dec 2022 21:03:12 +0100 From: Andreas Kemnade To: tony@atomide.com, lee@kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andreas Kemnade , Bin Liu Subject: [PATCH RESEND] mfd: twl: fix TWL6032 phy vbus detection Date: Thu, 1 Dec 2022 21:02:30 +0100 Message-Id: <20221201200230.3525505-1-andreas@kemnade.info> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.0 (-) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TWL6032 has a few charging registers prepended before the charging registers the TWL6030 has. To be able to use common register defines declare the additional registers as additional module. At the moment this affects the access to CHARGERUSB_CTRL1 in phy-twl6030-usb. Without this patch, it is accessing the wrong register on TWL6032. The consequence is that presence of Vbus is not reported. Cc: Bin Liu Cc: Tony Lindgren Signed-off-by: Andreas Kemnade --- drivers/mfd/twl-core.c | 8 ++++---- include/linux/mfd/twl.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index f6b4b9d94bbd..5a7ed71d0e30 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -111,6 +111,7 @@ #define TWL6030_BASEADD_GASGAUGE 0x00C0 #define TWL6030_BASEADD_PIH 0x00D0 #define TWL6030_BASEADD_CHARGER 0x00E0 +/* A few regs prepended before the 6030 regs */ #define TWL6032_BASEADD_CHARGER 0x00DA #define TWL6030_BASEADD_LED 0x00F4 @@ -353,6 +354,9 @@ static struct twl_mapping twl6030_map[] = { { 2, TWL6030_BASEADD_ZERO }, { 1, TWL6030_BASEADD_GPADC_CTRL }, { 1, TWL6030_BASEADD_GASGAUGE }, + + /* TWL6032 specific charger registers */ + { 1, TWL6032_BASEADD_CHARGER }, }; static const struct regmap_config twl6030_regmap_config[3] = { @@ -802,10 +806,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) if ((id->driver_data) & TWL6030_CLASS) { twl_priv->twl_id = TWL6030_CLASS_ID; twl_priv->twl_map = &twl6030_map[0]; - /* The charger base address is different in twl6032 */ - if ((id->driver_data) & TWL6032_SUBCLASS) - twl_priv->twl_map[TWL_MODULE_MAIN_CHARGE].base = - TWL6032_BASEADD_CHARGER; twl_regmap_config = twl6030_regmap_config; } else { twl_priv->twl_id = TWL4030_CLASS_ID; diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h index eaa233038254..6e3d99b7a0ee 100644 --- a/include/linux/mfd/twl.h +++ b/include/linux/mfd/twl.h @@ -69,6 +69,8 @@ enum twl6030_module_ids { TWL6030_MODULE_GPADC, TWL6030_MODULE_GASGAUGE, + /* A few extra registers before the registers shared with the 6030 */ + TWL6032_MODULE_CHARGE, TWL6030_MODULE_LAST, }; -- 2.30.2