Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp56415lfe; Fri, 15 Apr 2022 19:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKEGRxIb4jNJV1RyPr6yXP3PmKwIFqKmwu+Ee7V44mfHJ3GQ5Xaac8hcqsr0OdWqmvwUym X-Received: by 2002:a17:90a:8595:b0:1bb:fbfd:bfbf with SMTP id m21-20020a17090a859500b001bbfbfdbfbfmr7050699pjn.125.1650075422004; Fri, 15 Apr 2022 19:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075421; cv=none; d=google.com; s=arc-20160816; b=CZbS0lJCjGKkGTRWwJKBLwat2SkAZaIW1ZbHOW5Wyy5UnFzyZxMZdUAznDOTdJAjZk Yf+fIwglb4Fku6b0RLFjcV3XSWeyw5OO1EdG2ePFKsPF3ND5qfEs1/DEhFqMz1geKOWa JmonNIvVaW03VvXhl1YEuk5vckIuaFn/zvK6ICUwI3cEFcLJ80PY54Hg1/QOdKd3uExr N9WMkGAdzJ9CcJK7PHnMhSI+GhPMKvgHAckk8UZjOvVNaKYsCLxBkq2YDZhpHl71DTDu Nc9mfI3c+wmEuGh2647jC51RxOgWSK0Q3+jOUZ4/AwOMekgjOQVkv//9Hcn9tl2hslVW 5Ghg== 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 :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=XRWVXKW+RZN7vxEYxFynwfobJo7XniIQKD+eb2wTdOc=; b=Mgl3EFUE1UaXLm7ttykP12yfzQZQnONYzggI77CSKgN8N+Cvpqa9KW2sBg1677zFl7 c5s5RpCFngVY/Z85ZsGbdDHEmtp6/TJ69i3n/pRSE8gOJQo8cnvpGMdVV4fOlSuFwsxl 9w4kgJG3Esu08SgnPyebElJrs5NTHYi1LG6m4svoBFoNiUwSi6B0FHe9SA/YshGgexV9 OimyVsIxfPbeoSGec9UJaHfTOvSpvBNRtUR/0HVYF01kFQmf2HgQkz1NdI9sSMu4+w9u fubx/fzvi6wn4Nu/Dh+Io68dnMpL3PZ5spYnF1uEvEViz9+9/EVzHSyabq1mqDS+4Q/N OZFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=o+MOZCEA; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ik17-20020a170902ab1100b0015817cea8a3si2664025plb.406.2022.04.15.19.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:17:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=o+MOZCEA; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1ECF214062; Fri, 15 Apr 2022 18:32:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354807AbiDOPHI (ORCPT + 99 others); Fri, 15 Apr 2022 11:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiDOPHB (ORCPT ); Fri, 15 Apr 2022 11:07:01 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6655415838; Fri, 15 Apr 2022 08:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1650035066; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XRWVXKW+RZN7vxEYxFynwfobJo7XniIQKD+eb2wTdOc=; b=o+MOZCEA+EYYqJcDDf9v+gfNQWTX15W/ct4ImD4k2t4pcDD/fftevnqeK4QRv0jcSQ3vcv 5o5nxEqFodGTaJD1WKhzcOU0uuk/zSmLToMZJJf6jBt30cz29mMAmbAPmK6N2XCmZhGQkW pFWBhJ3cTDeDpVYAzaz0Ysvq0juJLRo= Date: Fri, 15 Apr 2022 16:04:16 +0100 From: Paul Cercueil Subject: Re: [PATCH 3/3] SPI: Ingenic: Add support for new Ingenic SoCs. To: =?UTF-8?b?5ZGo55Cw5p2w?= Cc: broonie@kernel.org, robh+dt@kernel.org, krzk+dt@kernel.org, linux-spi@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, contact@artur-rojek.eu, dongsheng.qiu@ingenic.com, aric.pzqi@ingenic.com, rick.tyliu@ingenic.com, sernia.zhou@foxmail.com, zhenwenjin@gmail.com, reimu@sudomaker.com Message-Id: <47ZDAR.RKPJNNUQZQO22@crapouillou.net> In-Reply-To: <1650032528-118220-4-git-send-email-zhouyanjie@wanyeetech.com> References: <1650032528-118220-1-git-send-email-zhouyanjie@wanyeetech.com> <1650032528-118220-4-git-send-email-zhouyanjie@wanyeetech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Le ven., avril 15 2022 at 22:22:08 +0800, =E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou= Yanjie)=20 a =C3=A9crit : > 1.Since it would be dangerous to specify a newer SoC's compatible > string as the fallback of an older SoC's compatible string, we > add support for the "ingenic,jz4775-spi" compatible string in > the driver. >=20 > This will permit to support the JZ4775 by having: > compatible =3D "ingenic,jz4775-spi"; >=20 > Instead of doing: > compatible =3D "ingenic,jz4775-spi", "ingenic,jz4780-spi"; >=20 > 2.Add support for probing the spi-ingenic driver on the X1000 SoC > from Ingenic. From the X1000 SoC onwards, the maximum frequency > allowed by the SSI module of Ingenic SoCs has been changed from > 54MHz to 50MHz. So "max_speed_hz" is introduced in "jz_soc_info" > to set different maximum frequency values. >=20 > 3.Add support for probing the spi-ingenic driver on the X2000 SoC > from Ingenic. The X2000 SoC has only one native chip select line, > so "max_native_cs" is introduced in "jz_soc_info" to set different > maximum number of native chip select lines. >=20 > 4.Because of the introduction of support for the X-series SoCs, the > current driver is not only applicable to the JZ-series SoCs, so > the description texts has been modified to avoid misunderstanding. >=20 > Signed-off-by: =E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou Yanjie) Reviewed-by: Paul Cercueil Cheers, -Paul > --- > drivers/spi/Kconfig | 4 ++-- > drivers/spi/spi-ingenic.c | 42=20 > +++++++++++++++++++++++++++++++++++++----- > 2 files changed, 39 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig > index d2815eb..cca92a8 100644 > --- a/drivers/spi/Kconfig > +++ b/drivers/spi/Kconfig > @@ -419,10 +419,10 @@ config SPI_IMX > This enables support for the Freescale i.MX SPI controllers. >=20 > config SPI_INGENIC > - tristate "Ingenic JZ47xx SoCs SPI controller" > + tristate "Ingenic SoCs SPI controller" > depends on MACH_INGENIC || COMPILE_TEST > help > - This enables support for the Ingenic JZ47xx SoCs SPI controller. > + This enables support for the Ingenic SoCs SPI controller. >=20 > To compile this driver as a module, choose M here: the module > will be called spi-ingenic. > diff --git a/drivers/spi/spi-ingenic.c b/drivers/spi/spi-ingenic.c > index 672e4ed..ff507c8 100644 > --- a/drivers/spi/spi-ingenic.c > +++ b/drivers/spi/spi-ingenic.c > @@ -1,8 +1,9 @@ > // SPDX-License-Identifier: GPL-2.0 > /* > - * SPI bus driver for the Ingenic JZ47xx SoCs > + * SPI bus driver for the Ingenic SoCs > * Copyright (c) 2017-2021 Artur Rojek > * Copyright (c) 2017-2021 Paul Cercueil > + * Copyright (c) 2022 =E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou Yanjie)=20 > > */ >=20 > #include > @@ -52,6 +53,9 @@ struct jz_soc_info { > u32 bits_per_word_mask; > struct reg_field flen_field; > bool has_trendian; > + > + unsigned int max_speed_hz; > + unsigned int max_native_cs; > }; >=20 > struct ingenic_spi { > @@ -418,7 +422,7 @@ static int spi_ingenic_probe(struct=20 > platform_device *pdev) >=20 > if (of_property_read_u32(dev->of_node, "num-cs", &num_cs)) { > dev_warn(dev, "Number of chip select lines not specified.\n"); > - num_cs =3D 2; > + num_cs =3D pdata->max_native_cs; > } >=20 > platform_set_drvdata(pdev, ctlr); > @@ -433,9 +437,9 @@ static int spi_ingenic_probe(struct=20 > platform_device *pdev) > ctlr->max_dma_len =3D SPI_INGENIC_FIFO_SIZE; > ctlr->bits_per_word_mask =3D pdata->bits_per_word_mask; > ctlr->min_speed_hz =3D 7200; > - ctlr->max_speed_hz =3D 54000000; > + ctlr->max_speed_hz =3D pdata->max_speed_hz; > ctlr->use_gpio_descriptors =3D true; > - ctlr->max_native_cs =3D 2; > + ctlr->max_native_cs =3D pdata->max_native_cs; > ctlr->num_chipselect =3D num_cs; > ctlr->dev.of_node =3D pdev->dev.of_node; >=20 > @@ -459,17 +463,44 @@ static const struct jz_soc_info jz4750_soc_info=20 > =3D { > .bits_per_word_mask =3D SPI_BPW_RANGE_MASK(2, 17), > .flen_field =3D REG_FIELD(REG_SSICR1, 4, 7), > .has_trendian =3D false, > + > + .max_speed_hz =3D 54000000, > + .max_native_cs =3D 2, > }; >=20 > static const struct jz_soc_info jz4780_soc_info =3D { > .bits_per_word_mask =3D SPI_BPW_RANGE_MASK(2, 32), > .flen_field =3D REG_FIELD(REG_SSICR1, 3, 7), > .has_trendian =3D true, > + > + .max_speed_hz =3D 54000000, > + .max_native_cs =3D 2, > +}; > + > +static const struct jz_soc_info x1000_soc_info =3D { > + .bits_per_word_mask =3D SPI_BPW_RANGE_MASK(2, 32), > + .flen_field =3D REG_FIELD(REG_SSICR1, 3, 7), > + .has_trendian =3D true, > + > + .max_speed_hz =3D 50000000, > + .max_native_cs =3D 2, > +}; > + > +static const struct jz_soc_info x2000_soc_info =3D { > + .bits_per_word_mask =3D SPI_BPW_RANGE_MASK(2, 32), > + .flen_field =3D REG_FIELD(REG_SSICR1, 3, 7), > + .has_trendian =3D true, > + > + .max_speed_hz =3D 50000000, > + .max_native_cs =3D 1, > }; >=20 > static const struct of_device_id spi_ingenic_of_match[] =3D { > { .compatible =3D "ingenic,jz4750-spi", .data =3D &jz4750_soc_info }, > + { .compatible =3D "ingenic,jz4775-spi", .data =3D &jz4780_soc_info }, > { .compatible =3D "ingenic,jz4780-spi", .data =3D &jz4780_soc_info }, > + { .compatible =3D "ingenic,x1000-spi", .data =3D &x1000_soc_info }, > + { .compatible =3D "ingenic,x2000-spi", .data =3D &x2000_soc_info }, > {} > }; > MODULE_DEVICE_TABLE(of, spi_ingenic_of_match); > @@ -483,7 +514,8 @@ static struct platform_driver spi_ingenic_driver=20 > =3D { > }; >=20 > module_platform_driver(spi_ingenic_driver); > -MODULE_DESCRIPTION("SPI bus driver for the Ingenic JZ47xx SoCs"); > +MODULE_DESCRIPTION("SPI bus driver for the Ingenic SoCs"); > MODULE_AUTHOR("Artur Rojek "); > MODULE_AUTHOR("Paul Cercueil "); > +MODULE_AUTHOR("=E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou Yanjie) "); > MODULE_LICENSE("GPL"); > -- > 2.7.4 >=20