Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp748883imu; Thu, 13 Dec 2018 03:57:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/XH7dL2q3nNqkgweqGcOgn8B9FvTSGOHnT1gybnKbBKSzUDArqyGeuyNpDqCmGsxoMaqZIm X-Received: by 2002:a17:902:442:: with SMTP id 60mr22015802ple.73.1544702259942; Thu, 13 Dec 2018 03:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544702259; cv=none; d=google.com; s=arc-20160816; b=RJleUhj+svEm5SthIBIPWPuLU6uDqJfe+tm5X0qoLIT2DVsQdAvgzlbk3Q8bFCpkhM LD19LkWIcnDsyZnLDJBHHq1Y9MvonYuq14oWStYtQyxOTma872VMuutz/tzYs1OZZF2p JHk4IZTs3BmcLdz6ko/f9BnYw+Ezg4HyfU11+PvjrcLrxb08Q61v+F017zunLgkNw/DQ YdFAp8It1kWkzDMVVwj1q+8xKoLpA2MfVR99zwogI41/rolRmR986fbHPhuYoBk8hkBb /3T3buSGAs5r1NF9kF23wWyX5/G3JlRQ+cYofiQcB+vJJI3Ei49fO/26YQRmzHnOIegW Jc6g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=2fk+9iL2DGpCKvu7WoI3b0Y+HYzK86OI/AoPazvANKI=; b=y1co0Pg2Hs/KJN1l1C7VZMEnlAJdT/iBUeT2i8u9W42tDml0Y55+lBS/aH7oHHqWnW gKrdard2fyaUP8PrDoVjHYQpmEFbIunjrNnz9AK+CIT+WSrBSgYhqTifLOwsWlEofTW7 XU3Q3COlcWg4B4SbQmDFMeho3ZU9oU4An2gWwfcOvEYKjn55dU715Urppg0YZ+26SRwr L6T6aimdU9T6kRLsl15ibTRL0eyIOu19spstdhEbHvllJn3IoUSHL6IpfzSJ+ZOHX7+n Ej7bOAgErbIvVvmLTlY+ZeeHAIXOhK1QjpV/I6nX/0GTprOKNfhJBr7MF69c+G4tyD4r 2z9Q== 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 e16si1444557pge.364.2018.12.13.03.57.25; Thu, 13 Dec 2018 03:57:39 -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 S1728928AbeLMLzD (ORCPT + 99 others); Thu, 13 Dec 2018 06:55:03 -0500 Received: from mail-sz2.amlogic.com ([211.162.65.114]:56120 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728756AbeLMLzC (ORCPT ); Thu, 13 Dec 2018 06:55:02 -0500 Received: from [10.28.18.96] (10.28.18.96) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 13 Dec 2018 19:55:15 +0800 Subject: Re: [PATCH v2 1/3] spi: meson-axg: support MAX 80M clock To: Neil Armstrong , Mark Brown CC: Yixun Lan , Jerome Brunet , Kevin Hilman , Carlo Caione , Jianxin Pan , Xingyu Chen , , , , References: <1544690354-16409-1-git-send-email-sunny.luo@amlogic.com> <1544690354-16409-2-git-send-email-sunny.luo@amlogic.com> <2d438907-91b5-7443-24f9-57a406aaa040@baylibre.com> From: Sunny Luo Message-ID: <13e10889-50ce-4f67-cf60-f7a4917f84f5@amlogic.com> Date: Thu, 13 Dec 2018 19:55:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <2d438907-91b5-7443-24f9-57a406aaa040@baylibre.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.96] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Neil, On 2018/12/13 16:49, Neil Armstrong wrote: > Hi Sunny, > > On 13/12/2018 09:39, Sunny Luo wrote: >> The SPICC controller in Meson-AXG is capable of running at 80M clock. >> The ASIC IP is improved and the clock is actually running higher than >> previous old SoCs. >> >> Signed-off-by: Sunny Luo >> Signed-off-by: Yixun Lan >> --- >> drivers/spi/spi-meson-spicc.c | 37 +++++++++++++++++++++++++++++-------- >> 1 file changed, 29 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c >> index 7fe4488..b56249d 100644 >> --- a/drivers/spi/spi-meson-spicc.c >> +++ b/drivers/spi/spi-meson-spicc.c >> @@ -9,11 +9,13 @@ >> >> #include >> #include >> +#include >> #include >> #include >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -34,7 +36,6 @@ >> * to have a CS go down over the full transfer >> */ >> >> -#define SPICC_MAX_FREQ 30000000 >> #define SPICC_MAX_BURST 128 >> >> /* Register Map */ >> @@ -120,6 +121,10 @@ >> #define SPICC_BURST_MAX 16 >> #define SPICC_FIFO_HALF 10 >> >> +struct meson_spicc_data { >> + unsigned int max_speed_hz; >> +}; >> + >> struct meson_spicc_device { >> struct spi_master *master; >> struct platform_device *pdev; >> @@ -127,6 +132,7 @@ struct meson_spicc_device { >> struct clk *core; >> struct spi_message *message; >> struct spi_transfer *xfer; >> + const struct meson_spicc_data *data; >> u8 *tx_buf; >> u8 *rx_buf; >> unsigned int bytes_per_word; >> @@ -517,6 +523,9 @@ static int meson_spicc_probe(struct platform_device *pdev) >> spicc->pdev = pdev; >> platform_set_drvdata(pdev, spicc); >> >> + spicc->data = (const struct meson_spicc_data *) >> + of_device_get_match_data(&pdev->dev); >> + >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> spicc->base = devm_ioremap_resource(&pdev->dev, res); >> if (IS_ERR(spicc->base)) { >> @@ -567,11 +576,9 @@ static int meson_spicc_probe(struct platform_device *pdev) >> master->unprepare_transfer_hardware = meson_spicc_unprepare_transfer; >> master->transfer_one = meson_spicc_transfer_one; >> >> - /* Setup max rate according to the Meson GX datasheet */ >> - if ((rate >> 2) > SPICC_MAX_FREQ) >> - master->max_speed_hz = SPICC_MAX_FREQ; >> - else >> - master->max_speed_hz = rate >> 2; >> + /* Setup max rate according to the Meson datasheet */ >> + master->max_speed_hz = min_t(unsigned int, rate >> 1, >> + spicc->data->max_speed_hz); > > I think "rate >> 1" here depends on patch 3, either move patch 3 before this one > or keep "rate >> 2" and change it back to "rate >> 1" on patch 3. > Yes, this change should be in patch 3. >> >> ret = devm_spi_register_master(&pdev->dev, master); >> if (ret) { >> @@ -602,9 +609,23 @@ static int meson_spicc_remove(struct platform_device *pdev) >> return 0; >> } >> >> +static const struct meson_spicc_data meson_spicc_gx_data = { >> + .max_speed_hz = 30000000, >> +}; >> + >> +static const struct meson_spicc_data meson_spicc_axg_data = { >> + .max_speed_hz = 80000000, >> +}; >> + >> static const struct of_device_id meson_spicc_of_match[] = { >> - { .compatible = "amlogic,meson-gx-spicc", }, >> - { .compatible = "amlogic,meson-axg-spicc", }, >> + { >> + .compatible = "amlogic,meson-gx-spicc", >> + .data = &meson_spicc_gx_data, >> + }, >> + { >> + .compatible = "amlogic,meson-axg-spicc", >> + .data = &meson_spicc_axg_data, >> + }, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, meson_spicc_of_match); >> > > . >