[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121219123201.B636A3E0AD7@localhost>
Date: Wed, 19 Dec 2012 12:32:01 +0000
From: Grant Likely <grant.likely@...retlab.ca>
To: Naveen Krishna Chatradhi <ch.naveen@...sung.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-samsung-soc@...r.kernel.org
Cc: w.sang@...gutronix.de, khali@...ux-fr.org, ben-linux@...ff.org,
devicetree-discuss@...ts.ozlabs.org, sjg@...omium.org,
grundler@...omium.org, naveen@...omium.org,
broonie@...nsource.wolfsonmicro.com
Subject: Re: [PATCH 1/2] i2c-core: Add gpio based bus arbitration implementation
On Fri, 14 Dec 2012 11:20:53 +0530, Naveen Krishna Chatradhi <ch.naveen@...sung.com> wrote:
> The arbitrator is a general purpose function which uses two GPIOs to
> communicate with another device to claim/release a bus.
>
> i2c_transfer()
> if adapter->gpio_arbit
> i2c_bus_claim();
> __i2c_transfer();
> i2c_bus_release();
>
> Signed-off-by: Simon Glass <sjg@...omium.org>
> Cc: Grant Grundler <grundler@...omium.org>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@...sung.com>
Hi Naveen,
I'm not convinced on the design of this protocol. It won't scale beyond
2 bus masters and it seems very specific to the design of a specific
piece of hardware. I don't think it is mature enough to bake into the
core i2c infrastructure or bindings. Nor do I think it will handle other
busses properly.
I can see two alternatives here.
1) build in hooks for doing i2c bus claim/release, but don't put this
specific implementation into the core infrastructure
2) Create an i2c bridge driver. This would kind of be like an i2c
multiplexer, but it would only have one bus and it would include the
knowledge of how to use the GPIO lines for bus arbitration.
I think option 2 would be the cleanest option. It would be straight
forward to design a binding for it by placing a node between the i2c
bus and all the i2c clients. For example:
i2c@...00000 {
compatible = "acme,some-i2c-device";
#address-cells = <1>;
#size-cells = <0>;
i2c-bridge {
#address-cells = <1>;
#size-cells = <0>;
compatible = "samaung,i2c-gpio-arbitrate";
bus-arbitration-gpios = <&gpf0 3 1 0 0>, /* AP_CLAIM */
<&gpe0 4 0 3 0>; /* EC_CLAIM */
bus-arbitration-slew-delay-us = <10>;
bus-arbitration-wait-retry-us = <2000>;
bus-arbitration-wait-free-us = <50000>;
i2c@52 {
// Normal i2c device
};
};
};
I don't know what the state of the i2c subsystem is with regard to
supporting i2c multiplexer devices, so there might be some changes
needed there, but I can't see it being particularly complex. It should
just be a device in the middle. Any i2c device that is a child of the
bridge would send transfers to the bridge, and the bridge would be
responsible to claim the bus and then pass the transfer through
unchanged.
That eliminates the problem of trying to design an arbitration scheme
that works for all.
g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists