Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933263AbcKHLp2 (ORCPT ); Tue, 8 Nov 2016 06:45:28 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:51273 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932185AbcKHLog (ORCPT ); Tue, 8 Nov 2016 06:44:36 -0500 From: Arnd Bergmann To: Anurup M Cc: linux-arm-kernel@lists.infradead.org, Tan Xiaojun , anurup.m@huawei.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, shyju.pv@huawei.com, gabriele.paoloni@huawei.com, john.garry@huawei.com, will.deacon@arm.com, linuxarm@huawei.com, xuwei5@hisilicon.com, zhangshaokun@hisilicon.com, sanil.kumar@hisilicon.com, shiju.jose@huawei.com Subject: Re: [PATCH v1 03/11] drivers: soc: hisi: Add support for Hisilicon Djtag driver Date: Tue, 08 Nov 2016 12:43:41 +0100 Message-ID: <22120038.dbaYpsQoUH@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <582180F7.5060100@gmail.com> References: <1478101374-18778-1-git-send-email-anurup.m@huawei.com> <58217871.6050609@huawei.com> <582180F7.5060100@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:qPU6Yn3gxzz0YOLeAPBnq3gLmyfi2w7AKGr9LDl6oAxbVKd7soF aVnievl0chzTZJaeurwAeE3KVfD9d5opT6OSJYHpMbEIR3RyQHa5gZvP3iJxtKFjmiVXS1O CR9epOA0/h8cp3aN5dQ6Qyyyi1MI012e1nrqGASC8m2B2hro5P9UbEiCECCeblTgKSmmiQ1 /mEolegODaFzMQWZSWlGA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Lw93sYsIla8=:mZIFBOSagqbyW2+HUhpa6G gtCwqmm0drBaVRIzeDpPJ9jFHs3Qc1xmHQnGAKziXJNbFgAM73UG6Tgr95vzXEigZ8CqaFQJ3 c+UQMb0eZjUqaQOBC92jdnsMNJNcirzT7EXqWINEnBRV/UEM3m6ZaGcHPGEYZ3VxMgytDoknj akUWiHrtFLM4BqPQXVH+PF5MdaCBZhHp7ZgZQjA4re8VO6+mGldpJO/FTQos7DUPY5NHPvO74 hZdWZtkwLi0hhJD8vTDzAJ0jB6k5RJMUTyX0O/d5avkAlwwPB1IiNvFvEtUq7KeTt/6vfAyxr hjDiRuHd+r+28/PohNoIf9NVwdkYNU9VzoG28TJoaJbGd3+q2IYNYX86DB0nzHXKU/xI6DGuJ TbGiZywTb0uCvJSMKKF19AjhnKdOX7tSlBzWPwVAiLC2AYtmDjrytnLAxS7NB81kKRm+sdCKC sl35x7C13MOrBmsivvoBAhR3z2E+gkzR9LE17P29Wp015V0drzYT957lIqzqUQzbnpfrIuXCS /R0FgUxF9gUlSvrBlxUnmRMoDlaWUNX8L1Vsfodr/R0oUjVxF0uW4QGRvq3A13QNbvcYspQwP XloIdfZaMBgebyAPSQl3jEdT6fEoYvxqg3JGuVbZ6bqZx6Vldhe9FDXZrkHv6P36BK2Q+DUbT DZGnW7EMVhCtbnXIez98p1RIwde0mwZLY3iwlSDzJdRjhIQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2535 Lines: 65 On Tuesday, November 8, 2016 1:08:31 PM CET Anurup M wrote: > On Tuesday 08 November 2016 12:32 PM, Tan Xiaojun wrote: > > On 2016/11/7 21:26, Arnd Bergmann wrote: > >> On Wednesday, November 2, 2016 11:42:46 AM CET Anurup M wrote: > >>> From: Tan Xiaojun > >>> + /* ensure the djtag operation is done */ > >>> + do { > >>> + djtag_read32_relaxed(regs_base, SC_DJTAG_MSTR_START_EN_EX, &rd); > >>> + > >>> + if (!(rd & DJTAG_MSTR_START_EN_EX)) > >>> + break; > >>> + > >>> + udelay(1); > >>> + } while (timeout--); > >> This one is obviously not performance critical at all, so use a non-relaxed > >> accessor. Same for the other two in this function. > >> > >> Are these functions ever called from atomic context? If yes, please document > >> from what context they can be called, otherwise please consider changing > >> the udelay calls into sleeping waits. > >> > > Yes, this is not reentrant. > The read/write functions shall also be called from irq handler (for > handling counter overflow). > So need to use udelay calls. Shall Document it in v2. Ok. > >>> +static const struct of_device_id djtag_of_match[] = { > >>> + /* for hip05(D02) cpu die */ > >>> + { .compatible = "hisilicon,hip05-cpu-djtag-v1", > >>> + .data = (void *)djtag_readwrite_v1 }, > >>> + /* for hip05(D02) io die */ > >>> + { .compatible = "hisilicon,hip05-io-djtag-v1", > >>> + .data = (void *)djtag_readwrite_v1 }, > >>> + /* for hip06(D03) cpu die */ > >>> + { .compatible = "hisilicon,hip06-cpu-djtag-v1", > >>> + .data = (void *)djtag_readwrite_v1 }, > >>> + /* for hip06(D03) io die */ > >>> + { .compatible = "hisilicon,hip06-io-djtag-v2", > >>> + .data = (void *)djtag_readwrite_v2 }, > >>> + /* for hip07(D05) cpu die */ > >>> + { .compatible = "hisilicon,hip07-cpu-djtag-v2", > >>> + .data = (void *)djtag_readwrite_v2 }, > >>> + /* for hip07(D05) io die */ > >>> + { .compatible = "hisilicon,hip07-io-djtag-v2", > >>> + .data = (void *)djtag_readwrite_v2 }, > >>> + {}, > >>> +}; > >> > >> If these are backwards compatible, just mark them as compatible in DT, > >> e.g. hip06 can use > >> > >> compatible = "hisilicon,hip06-cpu-djtag-v1", "hisilicon,hip05-cpu-djtag-v1"; > >> > >> so you can tell the difference if you need to, but the driver only has to > >> list the oldest one here. > >> > >> What is the difference between the cpu and io djtag interfaces? > On some chips like hip06, the djtag version is different for IO die. In what way? The driver doesn't seem to care about the difference. Arnd