lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <A5YFAR.5U5RNX82OXJY1@crapouillou.net>
Date:   Sat, 16 Apr 2022 17:36:46 +0100
From:   Paul Cercueil <paul@...pouillou.net>
To:     Zhou Yanjie <zhouyanjie@...yeetech.com>,
        Mark Brown <broonie@...nel.org>
Cc:     broonie@...nel.org, robh+dt@...nel.org, krzk+dt@...nel.org,
        linux-spi@...r.kernel.org, linux-mips@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        contact@...ur-rojek.eu, dongsheng.qiu@...enic.com,
        aric.pzqi@...enic.com, rick.tyliu@...enic.com,
        sernia.zhou@...mail.com, zhenwenjin@...il.com, reimu@...omaker.com
Subject: Re: [PATCH 1/3] SPI: Ingenic: Add support for use GPIO as chip select
 line.

Hi Zhou,

Le sam., avril 16 2022 at 19:55:13 +0800, Zhou Yanjie 
<zhouyanjie@...yeetech.com> a écrit :
> Hi Paul,
> 
> On 2022/4/15 下午11:00, Paul Cercueil wrote:
>> Hi Zhou,
>> 
>> Le ven., avril 15 2022 at 22:22:06 +0800, 周琰杰 (Zhou Yanjie) 
>> <zhouyanjie@...yeetech.com> a écrit :
>>> Add support for using GPIOs as chip select lines on Ingenic SoCs.
>>> 
>>> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@...yeetech.com>
>>> ---
>>>  drivers/spi/spi-ingenic.c | 11 +++++++++--
>>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/drivers/spi/spi-ingenic.c b/drivers/spi/spi-ingenic.c
>>> index 03077a7..672e4ed 100644
>>> --- a/drivers/spi/spi-ingenic.c
>>> +++ b/drivers/spi/spi-ingenic.c
>>> @@ -380,7 +380,7 @@ static int spi_ingenic_probe(struct 
>>> platform_device *pdev)
>>>      struct spi_controller *ctlr;
>>>      struct ingenic_spi *priv;
>>>      void __iomem *base;
>>> -    int ret;
>>> +    int num_cs, ret;
>>> 
>>>      pdata = of_device_get_match_data(dev);
>>>      if (!pdata) {
>>> @@ -416,6 +416,11 @@ static int spi_ingenic_probe(struct 
>>> platform_device *pdev)
>>>      if (IS_ERR(priv->flen_field))
>>>          return PTR_ERR(priv->flen_field);
>>> 
>>> +    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 = 2;
>>> +    }
>>> +
>>>      platform_set_drvdata(pdev, ctlr);
>>> 
>>>      ctlr->prepare_transfer_hardware = spi_ingenic_prepare_hardware;
>>> @@ -429,7 +434,9 @@ static int spi_ingenic_probe(struct 
>>> platform_device *pdev)
>>>      ctlr->bits_per_word_mask = pdata->bits_per_word_mask;
>>>      ctlr->min_speed_hz = 7200;
>>>      ctlr->max_speed_hz = 54000000;
>>> -    ctlr->num_chipselect = 2;
>>> +    ctlr->use_gpio_descriptors = true;
>> 
>> I wonder if this should be set conditionally instead. Maybe set it 
>> to "true" if the "num-cs" property exists?
>> 
> 
> I'm not too sure, but it seems some other drivers like "spi-sun6i.c", 
> "spi-stm32.c", "spi-s3c64xx.c", "spi-pic32.c", etc. set it 
> unconditionally.

Ok, maybe Mark can enlighten us here.

Cheers,
-Paul


>> The rest looks good to me.
>> 
>> Cheers,
>> -Paul
>> 
>>> +    ctlr->max_native_cs = 2;
>>> +    ctlr->num_chipselect = num_cs;
>>>      ctlr->dev.of_node = pdev->dev.of_node;
>>> 
>>>      if (spi_ingenic_request_dma(ctlr, dev))
>>> --
>>> 2.7.4
>>> 
>> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ