From patchwork Wed Oct 19 08:33:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp265180wrs; Wed, 19 Oct 2022 04:21:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DpfXKce8eCrnflEH6Z6eHatI3uPqCW2qn2CAKfxCf3tE+alucRdU6tCwg+nKVkvIm67qM X-Received: by 2002:a17:902:d4c5:b0:183:6e51:503 with SMTP id o5-20020a170902d4c500b001836e510503mr7876208plg.84.1666178508643; Wed, 19 Oct 2022 04:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178508; cv=none; d=google.com; s=arc-20160816; b=xw/2oMJpDfVNmhrzYPFGApDqkI5ozGfRt9uY3ymiSHyGJjHxT89aQB2FpStOPCZS2h 5lAFwzAEkNyqPm5CgYrUxOLaQ7EUdELSFkxGIxrvVPenTyE3DVUVja8oD9FYkLB+AD/i OTnsQu9SxyksNYZBelikmylzc89Ca5dLhL+bfoBK24eZNiev+5Zk5nLw8J3KbA4RjFZ5 EnbfkzTtZfMG0jkUQDXtfjKMmphxOMXgl+3GLEjbmGEmOQjdg9hNePXZidcAaenlazov 6IJpUVxkfA8D9t0hi3IWgpWT1Slyenb6ws2lvrwqjpHPT/kxE+qq6y8/ksGkbwEl+RIy uAtQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2MAEoHH6W1OVf/XG1TWO/OngIIi9aLMr3pc7Y+hGwYQ=; b=cexvrts2Wdga/GzkiBB7bsoL4NRsk0fd9Cl5qqJkcg0O2IWZuepiHqN3n6404oE6zW vl66ylPWx1/7Ju8N0tc1/Op/Q9bWLMorw2MGMM39CrEr+mL1hIbTKFd7ZBhlaflWgoBY 04mNGJhLCddm9ITl2ThZ8SQkfcv02GzrjwzWQhvRD0/H4MuAY4wlAmMVvwEzhmOVgbsA EOcKuEEI6WFO9dWn1n97d8t9+dA+Sbg1XqKHkZeTrQXTHSlk3bSGSWzehVDk+O+wFYsl wUgDxNRCUgmTlmvVVErRoLAMKaC/m/c7y188YfOVaj3ITBwHYt7CUczOeteZf5fgLgi1 BPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMJY1SKN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020aa78895000000b0056353f0bd40si18527613pfe.29.2022.10.19.04.21.26; Wed, 19 Oct 2022 04:21:48 -0700 (PDT) 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=pass header.i=@linuxfoundation.org header.s=korg header.b=vMJY1SKN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiJSLKP (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234639AbiJSLJG (ORCPT ); Wed, 19 Oct 2022 07:09:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCE1717FD72; Wed, 19 Oct 2022 03:37:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 674B5CE21A8; Wed, 19 Oct 2022 09:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F0FC433D7; Wed, 19 Oct 2022 09:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170626; bh=6I0oFww5l0V1IzzU+8y7drAJe30wzaT6tIKTcnOoUOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMJY1SKNMNuAJiDTIVqV2YD7QwVYKTx1FT9qN711DSLfEDw3+PigTrmzQVg92UrNT p5vb5dpVJU2xPJwMLQi0qe87RQTKEOHDFodtZz1d1OmUVcJGdePC8OwmvC6Oc8JLPV yX1pr2vE/UYTvihhuTbR7Q9iyWxHG58vej7k8Y9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Jarkko Nikula , Wolfram Sang , Sasha Levin Subject: [PATCH 6.0 726/862] i2c: designware-pci: Group AMD NAVI quirk parts together Date: Wed, 19 Oct 2022 10:33:33 +0200 Message-Id: <20221019083322.017596727@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747114795777842263?= X-GMAIL-MSGID: =?utf-8?q?1747114795777842263?= From: Andy Shevchenko [ Upstream commit 65769162ae4b7f2d82e54998be446226b05fcd8f ] The code is ogranized in a way that all related parts to the certain platform quirk go together. This is not the case for AMD NAVI. Shuffle code to make it happen. While at it, drop the frequency definition and use hard coded value as it's done for other platforms and add a comment to the PCI ID list. Signed-off-by: Andy Shevchenko Acked-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-designware-pcidrv.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 608e61209455..ca368482b246 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -27,7 +27,6 @@ #include "i2c-ccgx-ucsi.h" #define DRIVER_NAME "i2c-designware-pci" -#define AMD_CLK_RATE_HZ 100000 enum dw_pci_ctl_id_t { medfield, @@ -100,11 +99,6 @@ static u32 mfld_get_clk_rate_khz(struct dw_i2c_dev *dev) return 25000; } -static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) -{ - return AMD_CLK_RATE_HZ; -} - static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); @@ -126,15 +120,6 @@ static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) return -ENODEV; } -static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) -{ - struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); - - dev->flags |= MODEL_AMD_NAVI_GPU; - dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; - return 0; -} - static int mrfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { /* @@ -159,6 +144,20 @@ static u32 ehl_get_clk_rate_khz(struct dw_i2c_dev *dev) return 100000; } +static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) +{ + return 100000; +} + +static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); + + dev->flags |= MODEL_AMD_NAVI_GPU; + dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; + return 0; +} + static struct dw_pci_controller dw_pci_controllers[] = { [medfield] = { .bus_num = -1, @@ -389,6 +388,7 @@ static const struct pci_device_id i2_designware_pci_ids[] = { { PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake }, + /* AMD NAVI */ { PCI_VDEVICE(ATI, 0x7314), navi_amd }, { PCI_VDEVICE(ATI, 0x73a4), navi_amd }, { PCI_VDEVICE(ATI, 0x73e4), navi_amd },