Hello. > On Tue, Dec 10, 2013 at 4:26 PM, Alexander Shiyan <shc_work@xxxxxxx> wrote: > > > SYSCON driver was designed for using memory areas (registers) > > that are used in several subsystems. There are systems (CPUs) > > which use bits in one register for various purposes and thus > > should be handled by various kernel subsystems. This driver > > allows you to use the individual SYSCON bits as GPIOs. > > > > Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx> > (...) > > --- > > +Required properties: > > +- compatible: Should be "gpio-syscon". > > +- syscon: Phandle to syscon device node. > > +- gpio-controller: Marks the device node as a gpio controller. > > +- #gpio-cells: Should be two. The first cell is the pin number and > > + the second cell is used to specify the gpio polarity: > > + 0 = Active high, > > + 1 = Active low. > > +- bit-offset: Offset to the first bit used by driver. > > +- bit-count: Number of bits used. > > + > > +Example: > > + sysgpio: sysgpio { > > + compatible = "gpio-syscon"; > > + syscon = <&syscon>; > > + gpio-controller; > > + #gpio-cells = <2>; > > + bit-offset = <4>; > > + bit-count = <1>; > > I take it that bit-offset can be say 1024 and bit count > 32 for a 32-bit register at syscon_base + 0x80? This can be represented in DT as (0x80 << 4). > I have a real big problem with encoding register offsets into > the device tree as I have stated before, it is starting to > get real hard to debug this, like: > > "hmmm where did this go wrong?" > > "in the byte offset from the base stored in this > other driver plus ... 1024? no wait, that is stored > it bit notation so I need to divide by 8 ... hm which > was it now ... and where do I have all these figures > in my ICE debugger?" > > The code is not helpful anymore, you have to go in > and reverse-engineer this and bring up a calculator > to figure out what is going on. > > I sort of like the syscon driver but I don't like the idea > of encoding register offsets into the device tree, even > less do I like the idea of encoding it in bit notation. I also have no idea how to present it differently. Can try to specify the byte offset through the "reg" property? The "bit-offset" will remain, but will point offset from the "reg" byte. > I prefer that you put a header with all the offsets > into <linux/mfd/syscon-foo.h> and define all the > offsets there, then to reuse this driver with several > GPIO controllers all doing this GPIO-in-syscon > business, to #include <linux/mfd/syscon-bar.h> > etc and use the compatible string to figure out > which file to pick the offsets from. No headers is needed. Driver will be used in DTS only. ... --- ��.n��������+%������w��{.n����z�{��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f