All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] Add OHCI USB support for SH7786
Date: Tue, 03 Mar 2009 06:50:45 +0000	[thread overview]
Message-ID: <20090303065045.GC30177@linux-sh.org> (raw)
In-Reply-To: <uy6vozecn.wl%morimoto.kuninori@renesas.com>

On Mon, Mar 02, 2009 at 02:16:06PM +0900, Kuninori Morimoto wrote:
> +static u64 usb_ohci_dma_mask = 0xffffffffUL;

Please use DMA_BIT_MASK(32) here for the initializer instead. The
definition is in linux/dma-mapping.h.

> +static struct platform_device usb_ohci_device = {
> +	.name		= "sh_ohci",
> +	.id		= -1,
> +	.dev = {
> +		.dma_mask		= &usb_ohci_dma_mask,
> +		.coherent_dma_mask	= 0xffffffff,
> +	},

Likewise for the coherent_dma_mask.

> +int __init sh7786_usb_setup(int exclock)
> +{
Where is this function used?

> +	int i;
> +	u32 val;
> +
> +	ctrl_outl(0x00ff0040, 0xffe70094);
> +	ctrl_outl(0x00000001, 0xffe7009c);
> +
This needs documenting. Also, please use __raw_writel() and friends
instead of the ctrl_xxx() variants for new code.

> +	val = ctrl_inl(USBCTL0) & 0xffffff7f;
> +	if (exclock)
> +		val |= 0x00000080;
> +	ctrl_outl(val, USBCTL0);
> +
The above mask and bit definition should have macros associated with
them, so we know precisely what is changing.

> +	/* Set the PHY ENB bit */
> +	i = 1000000;
> +	ctrl_outl(0x00000001, USBPCTL1);
> +	while (i-- && !(ctrl_inl(USBST) & (1 << 30)))
> +		;
> +
This is not sufficient, all new versions of gcc will optimize this away.
At the very least, you will need a cpu_relax(); to prevent the loop
optimization.

> +	/* Set the PLL ENB bit */
> +	i = 1000000;
> +	ctrl_outl(0x00000003, USBPCTL1);
> +	while (i-- && ((ctrl_inl(USBST) & (0x3 << 30)) != (0x3 << 30)))
> +		;
> +
Likewise.

      reply	other threads:[~2009-03-03  6:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02  5:16 [PATCH] Add OHCI USB support for SH7786 Kuninori Morimoto
2009-03-03  6:50 ` Paul Mundt [this message]

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=20090303065045.GC30177@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /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.