From: Dan Carpenter <dan.carpenter@oracle.com>
To: wei_wang@realsil.com.cn
Cc: gregkh@linuxfoundation.org, devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
cjb@laptop.org, arnd@arndb.de, sameo@linux.intel.com,
aaron.lu@amd.com, bp@alien8.de
Subject: Re: [PATCH 1/2] drivers/mfd: Add realtek pcie card reader driver
Date: Mon, 13 Aug 2012 09:40:13 +0300 [thread overview]
Message-ID: <20120813064012.GC4559@mwanda> (raw)
In-Reply-To: <1344823586-2956-1-git-send-email-wei_wang@realsil.com.cn>
On Mon, Aug 13, 2012 at 10:06:26AM +0800, wei_wang@realsil.com.cn wrote:
> +int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val)
> +{
> + int err, i, finished = 0;
> + u16 data = 0;
> + u8 *ptr, tmp;
> +
> + rtsx_pci_init_cmd(pcr);
> +
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYADDR, 0xFF, addr);
> + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PHYRWCTL, 0xFF, 0x80);
> +
> + err = rtsx_pci_send_cmd(pcr, 100);
> + if (err < 0)
> + return err;
> +
> + for (i = 0; i < 100000; i++) {
> + err = rtsx_pci_read_register(pcr, PHYRWCTL, &tmp);
> + if (err < 0)
> + return err;
> +
> + if (!(tmp & 0x80)) {
> + finished = 1;
> + break;
> + }
> + }
> +
> + if (!finished)
> + return -ETIMEDOUT;
> +
> + rtsx_pci_init_cmd(pcr);
> +
> + rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA0, 0, 0);
> + rtsx_pci_add_cmd(pcr, READ_REG_CMD, PHYDATA1, 0, 0);
> +
> + err = rtsx_pci_send_cmd(pcr, 100);
> + if (err < 0)
> + return err;
> +
> + ptr = rtsx_pci_get_cmd_data(pcr);
> + data = ((u16)ptr[1] << 8) || ptr[0];
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Looks like bitwise OR was intended here.
> +
> + if (val)
> + *val = data;
> +
> + return 0;
> +}
regards,
dan carpenter
next prev parent reply other threads:[~2012-08-13 6:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-13 2:06 [PATCH 1/2] drivers/mfd: Add realtek pcie card reader driver wei_wang
2012-08-13 2:06 ` wei_wang
2012-08-13 6:40 ` Dan Carpenter [this message]
2012-08-13 7:10 ` wwang
2012-08-13 7:13 ` Dan Carpenter
2012-08-13 13:06 ` Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2012-08-14 5:30 wei_wang
2012-08-14 5:30 ` wei_wang
2012-08-14 9:32 ` Arnd Bergmann
2012-08-14 9:46 ` wwang
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=20120813064012.GC4559@mwanda \
--to=dan.carpenter@oracle.com \
--cc=aaron.lu@amd.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=cjb@laptop.org \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=wei_wang@realsil.com.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.