From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C30CC67839 for ; Thu, 13 Dec 2018 11:55:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 387C02086D for ; Thu, 13 Dec 2018 11:55:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oueB6dop" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 387C02086D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amlogic.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VzpubGoqzoNBCx7yuhjHe43qcv17o7Y0C3qY5mRs3oM=; b=oueB6doplBiYRWWoWk4n+WiYD lNGZAvr0s/YNd5Yljo8Q03mumSO/A2otZjYUDF07uFLPBX35zM1XEzQuxDbFZjN7QHox1xR/14lns 6Ug8YqWzE8TGUDevqqr6fiqX7e8sBdadH7vgzrUk1Bju22PtXLATKx8xDeoN16jEq1TW13ivNqz2l E516DQYmGkp3zflazd+xPKLeqJvG4zmMDnL8hvohpI8X1HqXZkPJyRVXAyeaulb6ZN3RP/lO33OZu gOb30arelfjPG5p41/lnGxEPvkuvOkLUj2TxIzYU6xTqMtgFr6H3itqZfEfTi0DgocUntfIl97g/T 42PXkQonA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXPaU-0000T0-Ij; Thu, 13 Dec 2018 11:55:30 +0000 Received: from mail-sz2.amlogic.com ([211.162.65.114]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXPaC-0007DH-4r; Thu, 13 Dec 2018 11:55:14 +0000 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 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-Language: en-GB 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) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181213_035512_276351_52FCB13E X-CRM114-Status: GOOD ( 14.18 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jianxin Pan , Kevin Hilman , Yixun Lan , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Carlo Caione , linux-amlogic@lists.infradead.org, Xingyu Chen , Jerome Brunet Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.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); >> > > . > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic