Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1484927imm; Thu, 19 Jul 2018 02:29:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWD98LyoF16QZ13l2PiOlmpFEZKf47E5rMWOoGiBQNwCsRGGG9sR+Dyc3P93mVflwtEIEn X-Received: by 2002:a62:90d4:: with SMTP id q81-v6mr8854330pfk.37.1531992540317; Thu, 19 Jul 2018 02:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531992540; cv=none; d=google.com; s=arc-20160816; b=IP6sXiaEn8rTeYk1vreIIyyxPcw4mJZqIEPlWtc84R7b5XxK8t34qm8PJZPh2R0LQI 3zNvEOhn4zRCUYhlzPEeIuLnkJzw78bvaN/KOS7q7us8UxlovaJ1Gv9xpHy2QLmauvU0 24VEpKvDRgkCJ1rtj/I0Y2vlimZb0OUfYWHqxZ9Bmmtu5xWo8FC9lWeClgrD3v23aBTH t+7Wd5MEzrzj3DT//ApP/0Fw5vG35wQJAhevlcV1nYcsbWoE+nYFII5hgLr+qwsf5YHl AbqMWw/ZFXVvOPGWVNeFY24Uo2cdJb7Sb/RvSul0i7lid88/lSIDowLbpqebxnxzjyXe 3GwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=WsdhEd2VDaIdSmww7xoRkoMOxSc9rx0DEPf0MsRunIU=; b=Sm0O0my5U1HeWT1GwaJyQqPrOnP7ogexAnzUsorg8hQKzvpsfb3AUpFVJhOi0eltAS mmhQIkBhRSOXSorFbgymkyGrh6Pw9h5qZr2f7guz4ucK8KYJpOIeKri+aL/0Ifo4v4T/ ADryI9w5Gqo6aSo0s1GtH8NDpYM8S75cGz3LuYcqnncnAEnRKshoJOjzzU+M1WzOGDae U7Xg/6gkKx8MwSBS8zwYISZsUASQdBrWnGi0b6JSpwUNqrVbfsBAh1jKvS4Qmv+C6a07 sO+xuPpUL+C5qN71gRiT6FMIcGr9Q332D3L5W/Z7rm8eCFG6p9wnQhzLYA/8ZVivTA3u WKBg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16-v6si5462100pff.13.2018.07.19.02.28.45; Thu, 19 Jul 2018 02:29:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728049AbeGSKJo (ORCPT + 99 others); Thu, 19 Jul 2018 06:09:44 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:21968 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbeGSKJo (ORCPT ); Thu, 19 Jul 2018 06:09:44 -0400 X-IronPort-AV: E=Sophos;i="5.51,374,1526367600"; d="scan'208";a="13757175" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Jul 2018 02:27:28 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch06.mchp-main.com (10.10.76.107) with Microsoft SMTP Server id 14.3.352.0; Thu, 19 Jul 2018 02:27:27 -0700 Date: Thu, 19 Jul 2018 11:26:17 +0200 From: Ludovic Desroches To: Neil Armstrong CC: , , , , , , , , Subject: Re: [PATCH v2 0/2] add ISO7816 support Message-ID: <20180719092617.ubfh45wffjqqkt4e@M43218.corp.atmel.com> Mail-Followup-To: Neil Armstrong , linux-serial@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alexandre.belloni@bootlin.com, arnd@arndb.de, richard.genoud@gmail.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, jslaby@suse.com References: <20180719084737.1490-1-ludovic.desroches@microchip.com> <034fe4ed-979b-51ee-db7c-5dc7137b98e5@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <034fe4ed-979b-51ee-db7c-5dc7137b98e5@baylibre.com> User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Neil, On Thu, Jul 19, 2018 at 10:59:47AM +0200, Neil Armstrong wrote: > Hi Ludovic, > > On 19/07/2018 10:47, Ludovic Desroches wrote: > > Hi, > > > > This patchset adds support for the ISO7816 standard. The USART devices in > > Microchip SoCs have an ISO7816 mode. It allows to let the USART managing > > the CLK and I/O signals of a smart card. > > Wow, I would have loved to have this at the time... > I'm curious, do you have an example of userspace code using this ? > The ATR rx needs a very weird handling, I'm curious how you managed it. > Unfortunately, I have nothing I can give you at the moment. I am doing some experiments. Before going further, I need to have the interface with the kernel accepted. Of course, I can give more details about the experiments I am doing. First of all, I am not used to ISO7816 so every feedback are appreciated. On the userspace part, there is the PCSC Lite library. It needs a userspace driver. From what I've seen, most of the readers are managed by the CCID driver. This driver handle different hardware capabilities. Some hardware are very close to what we provide with our SoC ie. just sending the data on the line and not manage the procedure bytes. The CCID driver includes a lot of things related to the ISO7816 protocol so I tried to plug my code into it to reuse this code. The issue is that I am not a CCID device. At the moment, I am writing my own PCSC driver and I am copying/pasting code I need. The USART only manages the CLK and I/O signals. Others one are handled by the PCSC driver with the help of GPIOs. At a time, I was thinking about a CCID driver (which interprets the CCID header and interacts with the device handling ISO7816) in the kernel to easily interface with the PCSC CCID driver but I am not sure it's the right way to go. Regards Ludovic > Thanks, > Neil > > > > > Changes: > > - v2 > > - uart_get_iso7816_config: check there is an iso7816_config function > > - use IOCTL macros to generate the IOCTL number > > - check that reserved field is not used > > - remove debug logs > > - check that the iso7816_config is right before doing any action > > - change the error from nack and max iteration status to a debug message > > - remove patch 3 as it concerns both rs485 and iso7816 to think more > > about the need of adding a lock or not > > > > Nicolas Ferre (2): > > tty/serial_core: add ISO7816 infrastructure > > tty/serial: atmel: add ISO7816 support > > > > arch/alpha/include/uapi/asm/ioctls.h | 2 + > > arch/mips/include/uapi/asm/ioctls.h | 2 + > > arch/powerpc/include/uapi/asm/ioctls.h | 2 + > > arch/sh/include/uapi/asm/ioctls.h | 2 + > > arch/sparc/include/uapi/asm/ioctls.h | 2 + > > arch/xtensa/include/uapi/asm/ioctls.h | 2 + > > drivers/tty/serial/atmel_serial.c | 170 +++++++++++++++++++++++++++++++-- > > drivers/tty/serial/atmel_serial.h | 3 +- > > drivers/tty/serial/serial_core.c | 60 ++++++++++++ > > include/linux/serial_core.h | 3 + > > include/uapi/asm-generic/ioctls.h | 2 + > > include/uapi/linux/serial.h | 17 ++++ > > 12 files changed, 256 insertions(+), 11 deletions(-) > > >