From: Scott Wood <scottwood@freescale.com>
To: <ying.zhang@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, Xie Xiaobo <X.Xie@freescale.com>,
Ying Zhang <b40530@freescale.com>
Subject: Re: [3/3] P1021RDB: Add QE TDM support
Date: Fri, 17 Apr 2015 16:39:15 -0500 [thread overview]
Message-ID: <20150417213915.GA4847@home.buserror.net> (raw)
In-Reply-To: <1427361377-4789-1-git-send-email-ying.zhang@freescale.com>
On Thu, Mar 26, 2015 at 05:16:17PM +0800, ying.zhang@freescale.com wrote:
> @@ -96,37 +102,63 @@ static void __init mpc85xx_rdb_setup_arch(void)
> #ifdef CONFIG_QUICC_ENGINE
> mpc85xx_qe_init();
> mpc85xx_qe_par_io_init();
> -#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
> - if (machine_is(p1025_rdb)) {
> - struct device_node *np;
> -
> - struct ccsr_guts __iomem *guts;
> -
> - np = of_find_node_by_name(NULL, "global-utilities");
> - if (np) {
> - guts = of_iomap(np, 0);
> - if (!guts) {
> -
> - pr_err("mpc85xx-rdb: could not map global utilities register\n");
> +#ifdef CONFIG_SPI_FSL_SPI
> + for_each_node_by_name(qe_spi, "spi")
> + par_io_of_config(qe_spi);
Why are you assuming that any node named "spi" is a QE SPI?
> +#endif /* CONFIG_SPI_FSL_SPI */
>
> - } else {
> - /* P1025 has pins muxed for QE and other functions. To
> - * enable QE UEC mode, we need to set bit QE0 for UCC1
> - * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
> - * and QE12 for QE MII management singals in PMUXCR
> - * register.
> - */
> + np = of_find_node_by_name(NULL, "global-utilities");
> + if (np) {
> + guts = of_iomap(np, 0);
> + if (!guts)
> + pr_err("mpc85xx-rdb: could not map global %s\n",
> + "utilities register");
> + else {
Don't put a bunch of code in the else of an error check. Factor this out
to its own function and return early if you don't find what you're
looking for.
-Scott
prev parent reply other threads:[~2015-04-17 21:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 9:16 [PATCH 3/3] P1021RDB: Add QE TDM support ying.zhang
2015-04-17 21:39 ` Scott Wood [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=20150417213915.GA4847@home.buserror.net \
--to=scottwood@freescale.com \
--cc=X.Xie@freescale.com \
--cc=b40530@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ying.zhang@freescale.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).