Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751116AbdCQN3Y (ORCPT ); Fri, 17 Mar 2017 09:29:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:44952 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbdCQN3X (ORCPT ); Fri, 17 Mar 2017 09:29:23 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,176,1486454400"; d="scan'208";a="945441296" Subject: Re: [RESEND PATCH v6 5/6] i2c: designware: add SLAVE mode functions To: Luis Oliveira , wsa@the-dreams.de, robh+dt@kernel.org, mark.rutland@arm.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <07463ebe12af8c88c21c24601cf54b0cd2077e07.1488383202.git.lolivei@synopsys.com> <4296eedb-aede-649c-8035-56342b096d9c@synopsys.com> Cc: Ramiro.Oliveira@synopsys.com, Joao.Pinto@synopsys.com, CARLOS.PALMINHA@synopsys.com From: Jarkko Nikula Message-ID: <885561e7-ef1e-172d-fe39-7b9effecf175@linux.intel.com> Date: Fri, 17 Mar 2017 15:29:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <4296eedb-aede-649c-8035-56342b096d9c@synopsys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3097 Lines: 71 On 03/17/17 13:24, Luis Oliveira wrote: > On 02-Mar-17 15:17, Luis Oliveira wrote: >> On 02-Mar-17 14:33, Jarkko Nikula wrote: >>> On 03/01/17 17:59, Luis Oliveira wrote: >>>> - Changes in Kconfig to enable I2C_DESIGNWARE_SLAVE support >>>> - Slave functions added to core library file >>>> - Slave abort sources added to common source file >>>> - New driver: i2c-designware-slave added >>>> - Changes in the Makefile to compile the I2C_DESIGNWARE_SLAVE module >>>> when supported by the architecture. >>>> >>>> All the SLAVE flow is added but it is not enabled via platform >>>> driver. >>>> >>>> Signed-off-by: Luis Oliveira >>>> --- >>>> V5->V6 >>>> - Enable Slave mode using a different option (kbuild reported an error) >>>> - Identation fixes needed >>>> - Changed debug prints to dev_vdbg >>>> - Fixed slave enumeration >>>> >>>> drivers/i2c/busses/Kconfig | 14 +- >>>> drivers/i2c/busses/Makefile | 1 + >>>> drivers/i2c/busses/i2c-designware-common.c | 7 + >>>> drivers/i2c/busses/i2c-designware-core.h | 3 + >>>> drivers/i2c/busses/i2c-designware-slave.c | 403 +++++++++++++++++++++++++++++ >>>> 5 files changed, 427 insertions(+), 1 deletion(-) >>>> create mode 100644 drivers/i2c/busses/i2c-designware-slave.c >>>> >>> ... >>>> diff --git a/drivers/i2c/busses/i2c-designware-common.c >>>> b/drivers/i2c/busses/i2c-designware-common.c >>>> index 6357c7c78f6d..24641635aa20 100644 >>>> --- a/drivers/i2c/busses/i2c-designware-common.c >>>> +++ b/drivers/i2c/busses/i2c-designware-common.c >>>> @@ -56,6 +56,13 @@ static char *abort_sources[] = { >>>> "trying to use disabled adapter", >>>> [ARB_LOST] = >>>> "lost arbitration", >>>> + [ABRT_SLAVE_FLUSH_TXFIFO] = >>>> + "read command so flush old data in the TX FIFO", >>>> + [ABRT_SLAVE_ARBLOST] = >>>> + "slave lost the bus while transmitting data to a remote master", >>>> + [ABRT_SLAVE_RD_INTX] = >>>> + "slave request for data to be transmitted and there is a 1 in " >>>> + "bit 8 of IC_DATA_CMD", >>>> }; >>> >>> I know ABRT_SLAVE_RD_INTX case is from the specification but I would prefer here >>> one-line error text so it will be easier to grep from sources. >>> >>> I would like it to be also be more understandable. I don't know did I understood >>> it correctly but does it occur when attempting to read controller while >>> transmitting or something like that? >> >> It happens in the "slave-transmitter" mode, when the processor side responds to >> a request for data to be transmitted and at the same time someone writes 1 to >> the bit 8 of the IC_DATA_CMD. This bit in "slave-transmitter" mode has to be "0" >> to indicate the data is to be transmitted. >> >> In "slave-receiver" mode it has no purpose since writes to this register are not >> required. > > If you agree for the v7 I can change it to "incorrect slave-transmitter mode > configuration", it's not as clear but it gives a clue of where the error comes from. > I'm fine with it. I think it's more understandable. -- Jarkko