linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: "vooon341@gmail.com" <vooon341@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/4] powerpc/mpc512x: Add initial support for TWR-MPC5125
Date: Fri, 18 Mar 2011 13:36:37 +0100	[thread overview]
Message-ID: <20110318123637.GB2155@pengutronix.de> (raw)
In-Reply-To: <AANLkTimy3Qu=KiPp8mhAiuL=GzqUHuNLTZ3cwmNKkrF7@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3003 bytes --]

On Fri, Mar 18, 2011 at 02:35:24PM +0300, vooon341@gmail.com wrote:

> diff --git a/arch/powerpc/platforms/512x/clock.c
> b/arch/powerpc/platforms/512x/clock.c
> index 3dc2a8d..5cadf8e 100644
> --- a/arch/powerpc/platforms/512x/clock.c
> +++ b/arch/powerpc/platforms/512x/clock.c
> @@ -606,6 +606,21 @@ static void rate_clks_init(void)
>   */
>  struct clk dev_clks[2][32];
> 
> +char *mpc512x_select_psc_compat(void)
> +{
> +	char *psc_compats[] = {
> +		"fsl,mpc5121-psc",
> +		"fsl,mpc5125-psc"
> +	};
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(psc_compats); i++)
> +		if (of_find_compatible_node(NULL, NULL, psc_compats[i]))
> +			return psc_compats[i];
> +
> +	return NULL;
> +}

Function looks good to me. Shouldn't that rather be in mpc512x_shared?

> +// IOCTL registers for USB1/FEC2

No c++-style comments, please (here and later).

> +static void mpc5125_psc_iopad_init(void __iomem *ioctl, char *name)
> +{
> +	struct device_node *np;
> +	const u32 *cell_index;
> +	char *default_psc = "fsl,mpc5125-psc";
> +	char *psc_name;
> +
> +	if (name)
> +		psc_name = name;
> +	else
> +		psc_name = default_psc;

Caller sets name to NULL. Is this really used?

> +
> +	for_each_compatible_node(np, NULL, psc_name) {
> +		cell_index = of_get_property(np, "cell-index", NULL);

I seem to recall 'cell-index' is deprecated. Grant?

> +		if (cell_index) {
> +			u8 __iomem *pscioctl;
> +			int psc_num = *cell_index;
> +			if (psc_num > 1)
> +				continue;
> +
> +			pscioctl = ioctl + PSC_TO_IOCTL_OFFSET(psc_num);
> +			out_8(pscioctl + IOCTL_PSCx_0, IOCTL_PSCx_0_MODE); // NOTE maybe wrong

Why is it 'maybe wrong'? Can it be improved somehow?

> +			out_8(pscioctl + IOCTL_PSCx_1, IOCTL_DEFAULT_MODE);
> +			out_8(pscioctl + IOCTL_PSCx_2, IOCTL_DEFAULT_MODE);
> +			out_8(pscioctl + IOCTL_PSCx_3, IOCTL_DEFAULT_MODE);
> +			out_8(pscioctl + IOCTL_PSCx_4, IOCTL_DEFAULT_MODE);

The defines make it much more readable, thanks.

> +		}
> +	}
> +}

Is this function really board-specific or platform specific?


> +static void mpc5125_fec2_usb_io_init(void __iomem *ioctl, int isusb)
> +{
> +	int i;
> +	const u8 offset[12] = {
> +		IOCTL_USB1_DATA0, IOCTL_USB1_DATA1,
> +		IOCTL_USB1_DATA2, IOCTL_USB1_DATA3,
> +		IOCTL_USB1_DATA4, IOCTL_USB1_DATA5,
> +		IOCTL_USB1_DATA6, IOCTL_USB1_DATA7,
> +		IOCTL_USB1_STOP, IOCTL_USB1_CLK,
> +		IOCTL_USB1_NEXT, IOCTL_USB1_DIR
> +	};
> +	u8 mode;
> +
> +	mode = (isusb) ? IOCTL_DEFAULT_MODE : IOCTL_FEC2_MODE;
> +	for (i = 0; i < ARRAY_SIZE(offset); i++)
> +		out_8(ioctl + offset[i], mode);
> +}

Same question here and later. If it is board specific, the function name should
have something like 'twr' in it; but a few things seem mpc5125-generic
to me, if I am not mistaken?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-03-18 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 23:29 [PATCH 1/4] powerpc/mpc512x: Add initial support for TWR-MPC5125 Vladimir Ermakov
2011-03-17 21:25 ` Wolfram Sang
2011-03-18 11:35   ` vooon341
2011-03-18 12:36     ` Wolfram Sang [this message]
2011-03-18 15:22       ` [PATCH 1/4, v3] " vooon341
2011-03-22 14:03         ` [PATCH 1/3, v4] " vooon341

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=20110318123637.GB2155@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=vooon341@gmail.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).