Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp27183imm; Tue, 22 May 2018 13:21:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr1WcKjs/vetbDhChE1Ws9nzWx68pcJT+rDaYqtD5j2T8faByc1PqtA9oIyOrDz4jPbXgcb X-Received: by 2002:a17:902:7149:: with SMTP id u9-v6mr25981641plm.356.1527020502338; Tue, 22 May 2018 13:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527020502; cv=none; d=google.com; s=arc-20160816; b=Wyzl8hBt1fgj+CVnhZlRZa2tHRdjckn+Wx/Y7Tty6fUD2i8zgq4MKDWKM0zNzkb6oE HuH+NwWUoLZcJ2vR8mdWQToI/TY7sAeVi+F5NM3Y4MqhOfr+sFYYi7l+ewPame2fGZJ9 WzSFjMYvmvdvlTRpNv0GcYdf3akXV3Ku7N38SfCwYCAXPiZAa+/3C+bcrOA6ncW5s7ic WH1LvSP5FHWm2ndzvXeLiTUnKONaZB1BnsSoOIilz2LjlPflvrn6Mfw9/Kt1pnEsSNHP 2crbpguBYKlFhL1TcWRzu2ZhbvxgyrbZYW2fC+h83/ArYCfe2/U5TtPQi8QeOMi+UqZV 9iug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0F99He8TphMnyIuMuEtYljvIxgUbjCm1IEBHBBlbo2Y=; b=prdpfuw2g5JoYqgYZsVwqgoUzvi+3td+yylNysDnjXEqhfFoSp0gTAPdQUAStjKWQF 9d6SR0S+iqz9RzkinAPtCBHNF11i8g6kLeyVhKxXe6kKg4H7/niJoJvzPJMAlQbhtwIX V0oyUqCLDsERknUq8xAWfxXZO2Au6RiowiAl2dqkfdutWcr1Tb02UjMu3tdSyZIHXiVh a4VZh4L97vL7EWZZfY/w/VzEtfQckwQ0084UkGGUpVDwqCVa49OTsLOSsbaMlrkStLEm 4/tq9LeeA8T+a39hIwHZh7HCbDFCpVkZwZTC0kZ5FV7V0z8Pn/hjElb0Bh8zRyqxZXhV KH0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ei1rj6ju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24-v6si16248485pfm.257.2018.05.22.13.21.27; Tue, 22 May 2018 13:21:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ei1rj6ju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbeEVUVK (ORCPT + 99 others); Tue, 22 May 2018 16:21:10 -0400 Received: from mail-qt0-f176.google.com ([209.85.216.176]:39357 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbeEVUVH (ORCPT ); Tue, 22 May 2018 16:21:07 -0400 Received: by mail-qt0-f176.google.com with SMTP id f1-v6so25214262qtj.6; Tue, 22 May 2018 13:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0F99He8TphMnyIuMuEtYljvIxgUbjCm1IEBHBBlbo2Y=; b=Ei1rj6judLnhxWEqK93pP/dhf1Ie1K8nsfgtgiCz8jNvZPufYSVm3pVCxdbBEcHjsc s0rJqy+m+KyKFfLha8t9tlHiYVj1H2awkJbX73Lmo0UvZlMHur4gHwV0016qQ0MW7N6s 9nhcgro0hw2Cq0VnkJGYiNJJQH9O/cV6sn6lxT5ElhvWLWUoVmoJu88rukJlfeEF+sZx pfbFvfVUuwClfTFvz6ZCu70s74T6oCOGqEvUsUSgGbs8Y493/PGq4f/UFbOOJqj+ha4V 8yW4HCkb0DXlKWcBHUhgSY1G2Z03xbi/zHrhHXRF9blURkofc/QHbXFeOLtMKif3vsMM aeLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0F99He8TphMnyIuMuEtYljvIxgUbjCm1IEBHBBlbo2Y=; b=aDsoJfjbe9roke6lrQnv/Q+b+2+EVZU6cfKZwrKbkE3riTJbaMa+25/3GB1OcZP0xk PymynqYHexhaqijn3npnzZcgKt5210D+6XNiwxGgnyyjiE1fuE2A8RytRKtCO6BujJAy 7xSSK6tyMr5Wl8uwROqin6RTwfyWMlNwbzdM+8+f14rLZtz1yw0OLyCfFm+JFSWvxHDC KHqDT7d+XNcZ4uN6tvxqLTWP+3T5h2JUWYBATCELb/O531O1rdA2o//Xy/hgafJvZdi5 2XC8QBz9Bp5RX+8okv3IztJX/QrROyS/ME2SOsRUXqUsODJsLwMTx1WxiMomMswb5vup DgJQ== X-Gm-Message-State: ALKqPweu2e6mYa35ojOgLFWfWJ98I6Tr4U0QIWJ1fNdcwCenfRpgOgY6 /d0REzGoqBHt7d5lf+xkg4EkpJIuraw+DClW+SE= X-Received: by 2002:a0c:bd89:: with SMTP id n9-v6mr22940544qvg.153.1527020466719; Tue, 22 May 2018 13:21:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9896:0:0:0:0:0 with HTTP; Tue, 22 May 2018 13:21:06 -0700 (PDT) In-Reply-To: References: <1526394095-5069-1-git-send-email-oleksandrs@mellanox.com> <1526394095-5069-3-git-send-email-oleksandrs@mellanox.com> From: Andy Shevchenko Date: Tue, 22 May 2018 23:21:06 +0300 Message-ID: Subject: Re: [patch v21 2/4] drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master driver To: Oleksandr Shamray Cc: Greg Kroah-Hartman , Arnd Bergmann , Linux Kernel Mailing List , linux-arm Mailing List , devicetree , "openbmc@lists.ozlabs.org" , Joel Stanley , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , Tobias Klauser , "open list:SERIAL DRIVERS" , Vadim Pasternak , system-sw-low-level , Rob Herring , "openocd-devel-owner@lists.sourceforge.net" , "linux-api@vger.kernel.org" , "David S. Miller" , Mauro Carvalho Chehab , Jiri Pirko Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 6:00 PM, Oleksandr Shamray wrote: > Ok. Changed to: > #define ASPEED_JTAG_IOUT_LEN(len) \ > (ASPEED_JTAG_CTL_ENG_EN | \ > ASPEED_JTAG_CTL_ENG_OUT_EN | \ > ASPEED_JTAG_CTL_INST_LEN(len)) > > #define ASPEED_JTAG_DOUT_LEN(len) \ > (ASPEED_JTAG_CTL_ENG_EN | \ > ASPEED_JTAG_CTL_ENG_OUT_EN | \ > ASPEED_JTAG_CTL_DATA_LEN(len)) What about #define _JTAG_OUT_ENABLE \ ( _ENG_EN | _ENG_OUT_EN) #define _IOUT_LEN(len) \ (_ENABLE | _INST_LEN(len)) #define _DOUT_LEN(len) \ ... ? >> > + apb_frq = clk_get_rate(aspeed_jtag->pclk); >> >> > + div = (apb_frq % freq == 0) ? (apb_frq / freq) - 1 : >> > + (apb_frq / freq); >> >> Isn't it the same as >> >> div = (apb_frq - 1) / freq; >> >> ? > Seems it is same. Thanks. Though be careful if apb_frq == 0. In either case the hw will be screwed, but differently. >> > + if (xfer->direction == JTAG_READ_XFER) >> > + tdi = UINT_MAX; >> > + else >> > + tdi = data[index]; >> >> > + if (xfer->direction == JTAG_READ_XFER) >> > + tdi = UINT_MAX; >> > + else >> > + tdi = data[index]; >> >> Take your time to think how the above duplication can be avoided. >> > > In both cases data[] is different, so I should check it twice, but I will > change it to, macro like: > > #define ASPEED_JTAG_GET_TDI(direction, data) \ > (direction == JTAG_READ_XFER) ? UNIT_MAX : data Perhaps choose better name for data, b/c in the above you are using data[index]. >> > + dev_err(aspeed_jtag->dev, "irq status:%x\n", >> > + status); >> Huh, really?! SPAM. > I will review and delete redundant debug messages. Just to be sure you got a point. This is interrupt context. Imagine what might go wrong. >> > + err = jtag_register(jtag); >> >> Perhaps we might have devm_ variant of this. Check how SPI framework >> deal with a such. >> > > Jtag driver uses miscdevice and related misc_register and misc_deregister > calls for creation and destruction. There is no device object prior > to call to misc_register, which could be used in devm_jtag_register. Same question as per previous patch. -- With Best Regards, Andy Shevchenko