linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Jan Glauber <jglauber@cavium.com>, <linux-kernel@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>, David Daney <david.daney@cavium.com>
Subject: Re: [PATCH v6 10/19] i2c: octeon: Add support for cn78xx chips
Date: Wed, 20 Apr 2016 15:28:15 -0700	[thread overview]
Message-ID: <5718027F.7050707@caviumnetworks.com> (raw)
In-Reply-To: <20160420215218.GE1546@katana>

On 04/20/2016 02:52 PM, Wolfram Sang wrote:
> On Mon, Apr 11, 2016 at 05:28:41PM +0200, Jan Glauber wrote:
>> From: David Daney <david.daney@cavium.com>
>>
>> cn78xx has a different interrupt architecture, so we have to manage
>> the interrupts differently.
>
> I'd appreciate if you could explain here why interrupts use NOAUTOEN and
> have to be manually en-/disabled? This is surely unusual.

It is quite nice, isn't it?

Since there were enable bits in both the interrupt controller *and* the 
I2C bus hardware, we had redundancy that could profitably be eliminated.

Now with the advent of the cn78xx, the system is much better.  This 
redundancy has been eliminated and interrupts are enabled only in the 
interrupt controller.

Fortunately, the kernel supplies us with convenience functions for 
manipulating these interrupt enable bits (enable_irq() and 
disable_irq()).  Since we don't want to irqs enabled when the driver is 
probed we have to set NOAUTOEN before calling request_irq().

Personally, I preferred the old way where each device had interrupt 
enable bits that could be controlled independently of the interrupt 
controller.  I have been told that I should abandon my preference for 
that type of antiquated architecture and welcome the brave new world of 
the unified interrupt enable bit.  Never the less, I still feel some 
nostalgia for the old way.

The good news is that it is not very much work to add software support 
for the cn78xx style interrupt enabling/masking.  The hooks we add can 
also be used to support the MSI-X interrupts in the Thunder support 
patch that follows.

David.


>
>>
>> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
>> Signed-off-by: Jan Glauber <jglauber@cavium.com>
>> ---
>>   drivers/i2c/busses/i2c-octeon.c | 131 ++++++++++++++++++++++++++++++++++++----
>>   1 file changed, 120 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
>> index 0bb9f0b..fff1ac0 100644
>> --- a/drivers/i2c/busses/i2c-octeon.c
>> +++ b/drivers/i2c/busses/i2c-octeon.c
>> @@ -11,6 +11,7 @@
>>    * warranty of any kind, whether express or implied.
>>    */
>>
>> +#include <linux/atomic.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/interrupt.h>
>>   #include <linux/kernel.h>
>> @@ -112,11 +113,18 @@ struct octeon_i2c {
>>   	wait_queue_head_t queue;
>>   	struct i2c_adapter adap;
>>   	int irq;
>> +	int hlc_irq;		/* For cn7890 only */
>>   	u32 twsi_freq;
>>   	int sys_freq;
>>   	void __iomem *twsi_base;
>>   	struct device *dev;
>>   	bool hlc_enabled;
>> +	void (*int_en)(struct octeon_i2c *);
>> +	void (*int_dis)(struct octeon_i2c *);
>> +	void (*hlc_int_en)(struct octeon_i2c *);
>> +	void (*hlc_int_dis)(struct octeon_i2c *);
>
> I'd prefer having 'enable' and 'disable' written out, but I leave that
> to you.
>
>> +	atomic_t int_en_cnt;
>> +	atomic_t hlc_int_en_cnt;
>>   };
>>

  reply	other threads:[~2016-04-20 22:43 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11 15:28 [PATCH v6 00/19] i2c-octeon and i2c-thunderx drivers Jan Glauber
2016-04-11 15:28 ` [PATCH v6 01/19] i2c: octeon: Increase retry default and use fixed timeout value Jan Glauber
2016-04-13  8:39   ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 02/19] i2c: octeon: Move set-clock and init-lowlevel upward Jan Glauber
2016-04-13  8:39   ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 03/19] i2c: octeon: Rename [read|write]_sw to reg_[read|write] Jan Glauber
2016-04-13  8:44   ` Wolfram Sang
2016-04-14  7:58     ` Jan Glauber
2016-04-14  8:58       ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 04/19] i2c: octeon: Introduce helper functions for register access Jan Glauber
2016-04-13  8:45   ` Wolfram Sang
2016-04-14  8:05     ` Jan Glauber
2016-04-14  8:58       ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 05/19] i2c: octeon: Remove superfluous check in octeon_i2c_test_iflg Jan Glauber
2016-04-14  8:59   ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 06/19] i2c: octeon: Improve error status checking Jan Glauber
2016-04-13  8:55   ` Wolfram Sang
2016-04-14  8:10     ` Jan Glauber
2016-04-14  9:01       ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 07/19] i2c: octeon: Use i2c recovery framework Jan Glauber
2016-04-20 21:31   ` Wolfram Sang
2016-04-21 13:08     ` Jan Glauber
2016-04-21 13:54       ` Wolfram Sang
2016-04-21 17:51         ` Jan Glauber
2016-04-21 21:33           ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 08/19] i2c: octeon: Enable High-Level Controller Jan Glauber
2016-04-20 21:43   ` Wolfram Sang
2016-04-20 21:55     ` David Daney
2016-04-21 13:40       ` Jan Glauber
2016-04-21 13:55         ` Wolfram Sang
2016-04-21 14:10     ` Jan Glauber
2016-04-11 15:28 ` [PATCH v6 09/19] dt-bindings: i2c: Add Octeon cn78xx TWSI Jan Glauber
2016-04-11 15:28 ` [PATCH v6 10/19] i2c: octeon: Add support for cn78xx chips Jan Glauber
2016-04-20 21:52   ` Wolfram Sang
2016-04-20 22:28     ` David Daney [this message]
2016-04-25 21:45       ` Wolfram Sang
2016-04-11 15:28 ` [PATCH v6 11/19] i2c: octeon: Flush TWSI writes with readback Jan Glauber
2016-04-11 15:28 ` [PATCH v6 12/19] i2c: octeon: Faster operation when IFLG signals late Jan Glauber
2016-04-11 15:28 ` [PATCH v6 13/19] i2c: octeon: Add workaround for broken irqs on CN3860 Jan Glauber
2016-04-11 15:28 ` [PATCH v6 14/19] i2c: octeon: Move read function before write Jan Glauber
2016-04-11 15:28 ` [PATCH v6 15/19] i2c: octeon: Rename driver to prepare for split Jan Glauber
2016-04-11 15:28 ` [PATCH v6 16/19] i2c: octeon: Split the driver into two parts Jan Glauber
2016-04-11 15:28 ` [PATCH v6 17/19] i2c: thunderx: Add i2c driver for ThunderX SOC Jan Glauber
2016-04-11 15:28 ` [PATCH v6 18/19] i2c: octeon,thunderx: Move register offsets to struct Jan Glauber
2016-04-11 15:28 ` [PATCH v6 19/19] i2c: thunderx: Add smbus alert support Jan Glauber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5718027F.7050707@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=david.daney@cavium.com \
    --cc=jglauber@cavium.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).