From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751954AbcBNJbp (ORCPT ); Sun, 14 Feb 2016 04:31:45 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:33629 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751826AbcBNJbh (ORCPT ); Sun, 14 Feb 2016 04:31:37 -0500 Reply-To: Subject: Re: [RFC PATCH] SPI/ACPI: DesignWare: Add ACPI support for Designware SPI driver References: <1454656280-130658-1-git-send-email-qiujiang@huawei.com> <20160205110900.GA12311@sirena.org.uk> To: Mark Brown CC: , , , , , , Andy Shevchenko , Jarkko Nikula From: Jiang Qiu Message-ID: <56C04962.7080206@huawei.com> Date: Sun, 14 Feb 2016 17:31:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160205110900.GA12311@sirena.org.uk> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.160.152] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.56C04975.0043,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e4358de5d46076ed8932f73b12f88262 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, Many thanks for your review, I'm so sorry for late reply because The Chinese new year holiday. See my replies below. Best Regards Jiang 在 2016/2/5 19:09, Mark Brown 写道: > On Fri, Feb 05, 2016 at 03:11:20PM +0800, qiujiang wrote: > >> This patch added ACPI support for DesignWare SPI mmio driver. It >> was based the corresponding DT driver and compatible for this two >> way. This patch has been tested on Hisilicon D02 board. It relies >> on the GPIO patchset. > Intel are heavy users of this driver on their systems which also use > ACPI. Have you discussed this binding with them? I've copied Andy and > Jarkko who've worked on the driver recently. I'm going to ask Andy to get some ideas that how to use this spi-dw-mmio driver by ACPI binding. > > Please use subject lines matching the style for the subsystem. This > makes it easier for people to identify relevant patches. Thanks for the reminder, I will fix it in the next version. > >> + char propname[32]; > That's a magic number, where did it come from and why is it a magic > nummber? I'm sorry for here without any comments. This number define is come from gpiolib.c. It means the max size of gpio property name. The reference code located in line 1815 of gpiolib.c. >> + if (ACPI_COMPANION(&pdev->dev)) { >> + for (i = 0; i < dws->num_cs; i++) { >> + snprintf(propname, sizeof(propname), "cs%d", i); >> + gpiod = devm_gpiod_get(&pdev->dev, >> + propname, GPIOD_ASIS); >> + if (IS_ERR(gpiod)) { >> + dev_err(&pdev->dev, "Get gpio desc failed!\n"); >> + return PTR_ERR(gpiod); >> + } >> + } >> + } > I'm not seeing anywhere where we store the GPIO in this loop. It is > therefore unclear to me how the chip select is going to work? In DT binding, of_get_named_gpio and devm_gpio_request were used to parse gpio pins defined in DTs and then request these pins. Similarly, for ACPI, devm_gpiod_get can do that two operation in a single function. It is a unified interface to ACPI and DT binding. If the gpiod is valid, the corresponding gpio pins has been requested. We do not need to save this gpiod any more. which gpio pin was used is defined in spi_device, named cs_gpio, the configuration to the gpio pins will be done in the setup callback routine of each device. What the spi master should do is just request these pins to the gpio subsystem. >> +static const struct acpi_device_id dw_spi_mmio_acpi_match[] = { >> + {"HISI0171", 0}, >> + { } >> +}; >> +MODULE_DEVICE_TABLE(acpi, dw_spi_mmio_acpi_match); > I really do wish ACPI had some more sensible system for allocating > device IDs so the tables were a little more legible. :( This is really a question, I will do this feedback to ACPI maintainers.