Received: by 10.223.164.202 with SMTP id h10csp1212930wrb; Fri, 10 Nov 2017 00:00:18 -0800 (PST) X-Google-Smtp-Source: ABhQp+S4ZVrnLeDovkWYD1Sonlst6vV6leqiAGfikPBgbuO0Af+WzY/p8GoEvhWnJqSrXtdzqdpO X-Received: by 10.99.102.6 with SMTP id a6mr3188391pgc.298.1510300818496; Fri, 10 Nov 2017 00:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510300818; cv=none; d=google.com; s=arc-20160816; b=0YlMlQ4DtwDTQG3KW3YkL1k5k2CWGdmgNjWmltD3+HYlKIR/2dMODbQl/+a5Nf+hvc YzeIQLJePeZjlZqK0z2SG7FpZV9qHjKdMnTbriy7YJwPUC+ZBQ/Q3q/HvXrq8SlemZLM XSCoC7ADbBfr0i3CHz309JqcT20SEQwehlCZUkf5EWNoSJql2WQZxHKhdya4Pc6OYG9O +xErDPJBwlIpkD1LgqwQZIGVEGoyIg+Ild+i3YueBzKJwl743/I0hUDx3wYdTCzKxPw5 All2zJd162Lor8o+c4UzRl10vOgO/vi9FaNqYNX+N4nAVEMmbggnAWXI92AHsNT65A4Y oZug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9ayS+XETPffPBzhsb5iSbIW3luCYttMq3FyHO3gaIuE=; b=j45CenjHIfsBN7cXoaLGSgZcgDNJ98+fZzhsJwLNPvij7PRAagY9WInJ0g3MIVE0Cc imnSxxGPzER1CDZwzJwgXuzigvAiOporpJwxFEjn0V7Mpa+PBbUTO/YWEW6RXyZ0hGxZ BJDwZ/6yBYk3Ked9vz+cn4Xsofqofivl/6DcbW9C59mQWej7WzMBkpvCJ7wYd0npGdT9 rWmTHAuQAdC6EEllSX0/ONRfQgK22b25VPBsKMyab/b1mxEQzzoYOuqmPO2uj5+bOirY R94GdRQ4FYnFC3gHJfKRlXKrQVm8AmwFMhoxlxQ7h2DFbK0ZYm9WBTufON7eKAp9QxgV 8gtw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q72si9048793pfd.33.2017.11.10.00.00.07; Fri, 10 Nov 2017 00:00:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755893AbdKJH6Z (ORCPT + 83 others); Fri, 10 Nov 2017 02:58:25 -0500 Received: from ispman.iskranet.ru ([62.213.33.10]:41401 "EHLO ispman.iskranet.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755536AbdKJH6T (ORCPT ); Fri, 10 Nov 2017 02:58:19 -0500 Received: by ispman.iskranet.ru (Postfix, from userid 8) id 8EEA1821EE3; Fri, 10 Nov 2017 14:50:31 +0700 (KRAT) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on ispman.iskranet.ru X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.2 Received: from KB00016249.iskra.kb (unknown [62.213.40.60]) (Authenticated sender: asolokha@kb.kras.ru) by ispman.iskranet.ru (Postfix) with ESMTPA id 4FCAE8219CA; Fri, 10 Nov 2017 14:50:31 +0700 (KRAT) From: Arseny Solokha To: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Valentin Longchamp , Arseny Solokha Subject: [PATCH 2/4] i2c: mpc: unify obtaining the MPC8533/44 I2C clock prescaler w/ MPC8xxx Date: Fri, 10 Nov 2017 14:50:13 +0700 Message-Id: <20171110075015.23906-3-asolokha@kb.kras.ru> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171110075015.23906-1-asolokha@kb.kras.ru> References: <20171110075015.23906-1-asolokha@kb.kras.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 8ce795cb0c6b ("i2c: mpc: assign the correct prescaler from SVR") introduced the common helper function for obtaining the actual clock prescaler value for MPC85xx. However, getting the prescaler for MPC8544 which depends on the SEC frequency ratio on this platform, has been always performed separately based on the corresponding Device Tree configuration. Move special handling of MPC8544 into that common helper. Make it dependent on the SoC version and not on Device Tree compatible node, as is the case with all other SoCs. Handle MPC8533 the same way which is similar to MPC8544 in this regard, according to AN2919 "Determining the I2C Frequency Divider Ratio for SCL". Signed-off-by: Arseny Solokha --- drivers/i2c/busses/i2c-mpc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index bf0c86d41f1a..f47916466b82 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -350,7 +350,11 @@ static u32 mpc_i2c_get_sec_cfg_8xxx(void) static u32 mpc_i2c_get_prescaler_8xxx(void) { - /* mpc83xx and mpc82xx all have prescaler 1 */ + /* + * According to the AN2919 all MPC824x have prescaler 1, while MPC83xx + * may have prescaler 1, 2, or 3, depending on the power-on + * configuration. + */ u32 prescaler = 1; /* mpc85xx */ @@ -367,6 +371,10 @@ static u32 mpc_i2c_get_prescaler_8xxx(void) || (SVR_SOC_VER(svr) == SVR_8610)) /* the above 85xx SoCs have prescaler 1 */ prescaler = 1; + else if ((SVR_SOC_VER(svr) == SVR_8533) + || (SVR_SOC_VER(svr) == SVR_8544)) + /* the above 85xx SoCs have prescaler 3 or 2 */ + prescaler = mpc_i2c_get_sec_cfg_8xxx() ? 3 : 2; else /* all the other 85xx have prescaler 2 */ prescaler = 2; @@ -383,8 +391,6 @@ static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock, int i; /* Determine proper divider value */ - if (of_device_is_compatible(node, "fsl,mpc8544-i2c")) - prescaler = mpc_i2c_get_sec_cfg_8xxx() ? 3 : 2; if (!prescaler) prescaler = mpc_i2c_get_prescaler_8xxx(); -- 2.15.0 From 1587227120751993997@xxx Tue Dec 19 15:35:39 +0000 2017 X-GM-THRID: 1586143291278350156 X-Gmail-Labels: Inbox,Category Forums