From: Kishon Vijay Abraham I <kishon@ti.com>
To: Loc Ho <lho@apm.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Suman Tripathi <stripathi@apm.com>, Arnd Bergmann <arnd@arndb.de>,
Jon Masters <jcm@redhat.com>, "patches@apm.com" <patches@apm.com>,
linux-kernel@vger.kernel.org, Olof Johansson <olof@lixom.net>,
Don Dutile <ddutile@redhat.com>, Tejun Heo <tj@kernel.org>,
Tuan Phan <tphan@apm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RESEND v10 3/4] PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver
Date: Thu, 27 Feb 2014 11:32:23 +0530 [thread overview]
Message-ID: <530ED4EF.1060000@ti.com> (raw)
In-Reply-To: <CAPw-ZT=eLbxt3wPL7hrZFtxTP9vGxbRyBY2Yoh77pq9ypphCaw@mail.gmail.com>
On Thursday 27 February 2014 02:15 AM, Loc Ho wrote:
> Hi,
>
>>>
>>> +config PHY_XGENE
>>> + tristate "APM X-Gene 15Gbps PHY support"
>>> + depends on ARM64 || COMPILE_TEST
>>> + select GENERIC_PHY
>>
>>
>> depends on HAS_IOMEM and CONFIG_OF..
>
> I will make it depends as "HAS_IOMEM && OF && (ARM64 || COMPILE_TEST)
>
>>>
>>> +/* PLL Clock Macro Unit (CMU) CSR accessing from SDS indirectly */
>>> +#define CMU_REG0 0x00000
>>> +#define CMU_REG0_PLL_REF_SEL_MASK 0x00002000
>>> +#define CMU_REG0_PLL_REF_SEL_SET(dst, src) \
>>> + (((dst) & ~0x00002000) | (((u32)(src) << 0xd) & 0x00002000))
>>
>>
>> using decimals for shift value would be better. No strong feeling though.
>
> I will change to integer value.
>
>>> +/*
>>> + * For chip earlier than A3 version, enable this flag.
>>> + * To enable, pass boot argument phy_xgene.preA3Chip=1
>>> + */
>>> +static int preA3Chip;
>>> +MODULE_PARM_DESC(preA3Chip, "Enable pre-A3 chip support (1=enable 0=disable)");
>>> +module_param_named(preA3Chip, preA3Chip, int, 0444);
>>
>>
>> Do we need to have module param for this? I mean we can differentiate between
>> different chip versions in dt data only.
>
> This is only required for the short term. Once all the pre-A3 system
> are replaced, there isn't an need for this. For those who still has an
> pre-A3 silicon system, this would provide an short term solution for
> them. DT isn't quite correct here. This is an global thing. I guess I
> can OR all node. If it is still better to put in the DT, let me know
> and I will move it.
>
>>> +
>>> +static void sds_wr(void __iomem *csr_base, u32 indirect_cmd_reg,
>>> + u32 indirect_data_reg, u32 addr, u32 data)
>>> +{
>>> + u32 val;
>>> + u32 cmd;
>>> +
>>> + cmd = CFG_IND_WR_CMD_MASK | CFG_IND_CMD_DONE_MASK;
>>> + cmd = CFG_IND_ADDR_SET(cmd, addr);
>>
>>
>> This looks hacky. If 'CFG_IND_WR_CMD_MASK | CFG_IND_CMD_DONE_MASK' should be set then it should be part of the second argument. From the macro 'CFG_IND_ADDR_SET' the first argument should be more like the current value present in the register right? I feel the macro (CFG_IND_ADDR_SET) is not used in the way it is intended to.
>
> The macro XXX_SET is intended to update an field within the register.
> The update field is returned. The first assignment lines are setting
> another field. Those two lines can be written as:
>
> cmd = 0;
> cmd |= CFG_IND_WR_CMD_MASK; ==> Set the CMD bit
> cmd |= CFG_IND_CMD_DONE_MASK; ==> Set the DONE bit
> cmd = CFG_IND_ADDR_SET(cmd, addr); ===> Set the field ADDR
#define CFG_IND_ADDR_SET(dst, src) \
(((dst) & ~0x003ffff0) | (((u32)(src)<<4) & 0x003ffff0))
From this macro the first argument should be the present value in that
register. Here you reset the address bits and write the new address bits.
IMO the first argument should be the value in 'csr_base +
indirect_cmd_reg'. So it resets the address bits in 'csr_base +
indirect_cmd_reg' and write down the new address bits.
Thanks
Kishon
next prev parent reply other threads:[~2014-02-27 6:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-25 6:14 [PATCH RESEND v10 0/4] PHY: Add APM X-Gene SoC 15Gbps Multi-purpose PHY support Loc Ho
[not found] ` <1393308882-3964-1-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>
2014-02-25 6:14 ` [PATCH RESEND v10 1/4] PHY: Add function set_speed to generic PHY framework Loc Ho
[not found] ` <1393308882-3964-2-git-send-email-lho-qTEPVZfXA3Y@public.gmane.org>
2014-02-25 6:14 ` [PATCH RESEND v10 2/4] Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation Loc Ho
2014-02-25 6:14 ` [PATCH RESEND v10 3/4] PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver Loc Ho
2014-02-26 9:42 ` Kishon Vijay Abraham I
[not found] ` <530DB713.6000701-l0cyMroinI0@public.gmane.org>
2014-02-26 20:45 ` Loc Ho
2014-02-27 6:02 ` Kishon Vijay Abraham I [this message]
[not found] ` <530ED4EF.1060000-l0cyMroinI0@public.gmane.org>
2014-02-27 6:25 ` Loc Ho
2014-02-27 6:34 ` Kishon Vijay Abraham I
[not found] ` <530EDC65.8060106-l0cyMroinI0@public.gmane.org>
2014-02-27 6:41 ` Loc Ho
2014-02-27 6:47 ` Kishon Vijay Abraham I
2014-02-27 6:42 ` Kishon Vijay Abraham I
2014-02-25 13:51 ` [PATCH RESEND v10 2/4] Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation Kishon Vijay Abraham I
2014-02-25 12:05 ` [PATCH RESEND v10 1/4] PHY: Add function set_speed to generic PHY framework Kishon Vijay Abraham I
[not found] ` <530C8711.4000600-l0cyMroinI0@public.gmane.org>
2014-02-25 13:45 ` Tejun Heo
2014-02-25 13:50 ` Kishon Vijay Abraham I
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=530ED4EF.1060000@ti.com \
--to=kishon@ti.com \
--cc=arnd@arndb.de \
--cc=ddutile@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=jcm@redhat.com \
--cc=lho@apm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@lixom.net \
--cc=patches@apm.com \
--cc=stripathi@apm.com \
--cc=tj@kernel.org \
--cc=tphan@apm.com \
/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).