[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbcq+e099mT+TVwv9vDjXwkf8QdB_4b4UXuysPF+40oUQ@mail.gmail.com>
Date: Thu, 20 Jun 2013 13:33:10 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Michal Simek <monstr@...str.eu>
Cc: Michal Simek <michal.simek@...inx.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <rob.herring@...xeda.com>,
"devicetree-discuss@...ts.ozlabs.org"
<devicetree-discuss@...ts.ozlabs.org>,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>
Subject: Re: [PATCH 1/2] GPIO: Add support for dual channel in gpio-xilinx.c
On Thu, Jun 20, 2013 at 12:59 PM, Michal Simek <monstr@...str.eu> wrote:
> On 06/20/2013 11:23 AM, Linus Walleij wrote:
>> What about something like this:
>>
>> static bool is_dual (struct device_node *np)
>> {
>> struct property *prop = of_find_property(np, "xlnx,is-dual", NULL);
>> int ret;
>> u32 val;
>>
>> if (!prop)
>> return false;
>>
>> ret = of_property_read_u32(np, "xlnx,is-dual", &val);
>> if (ret < 0)
>> return true; /* node exists but has no cells */
>>
>> return !!val;
>> }
>
> we can do it in this way but what I don't like on this is that IP
> is design to support 2 channels right now.
> It can happen that Xilinx decides to extend this for new channels.
> Register map is prepared for it and there is enough space to do it.
>
> And when this is done then is-dual (which is current name which
> is used in hardware configuration from design tools) will contain
> larger value >1.
> I agree that is-dual is not the best name.
You don't say. It's about as smart as this:
#define NUMBER_TWO 4
Oh well, that's not your fault.
But seriously:
xlnx,is-dual;
without an argument can still be taken to mean "2", and
you still need to inperpret the absence if this parameter
as "1" do you not?
> What about to do it differently?
> Generate number of channel in the description.
> And also do for() loop in the probe function to read values based
> on this channel number.
Sorry I can't translate this, can you send a patch?
Yours,
Linus Walleij
--
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