public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] imx: Add titanium board support (i.MX6 based)
Date: Thu, 11 Apr 2013 10:00:27 +0200	[thread overview]
Message-ID: <51666D9B.2050301@denx.de> (raw)
In-Reply-To: <20130410121353.A843820146E@gemini.denx.de>

Hi Wolfgang,

On 10.04.2013 14:13, Wolfgang Denk wrote:
>> +int board_mmc_init(bd_t *bis)
>> +{
>> +	s32 status = 0;
>> +	u32 index = 0;
>> +
>> +	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
>> +
>> +	for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
>> +		switch (index) {
>> +		case 0:
>> +			imx_iomux_v3_setup_multiple_pads(
>> +				usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
>> +			break;
>> +		default:
>> +			printf("Warning: you configured more USDHC controllers"
>> +			       "(%d) then supported by the board (%d)\n",
>> +			       index + 1, CONFIG_SYS_FSL_USDHC_NUM);
>> +			return status;
>> +		}
>> +
>> +		status |= fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
>> +	}
>> +
>> +	return status;
>> +}
> 
> CONFIG_SYS_FSL_USDHC_NUM is a #defined constant, so the test can be
> done at compile time.  Doing this at run time makes no sense at all.
> 
> Drop the whole loop here, it is not needed for a single interface.  It
> is just a waste of code that obfuscates what you are doing.

Okay.

> You return "status" but where do you actually set it?  And where do
> you test for errors of imx_iomux_v3_setup_multiple_pads() ?

With only one pad-IF to configure I can use imx_iomux_v3_setup_pad()
which does not return an error:

int imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)
{
	u32 mux_ctrl_ofs = (pad & MUX_CTRL_OFS_MASK) >> MUX_CTRL_OFS_SHIFT;
	u32 mux_mode = (pad & MUX_MODE_MASK) >> MUX_MODE_SHIFT;
	u32 sel_input_ofs =
		(pad & MUX_SEL_INPUT_OFS_MASK) >> MUX_SEL_INPUT_OFS_SHIFT;
	u32 sel_input =
		(pad & MUX_SEL_INPUT_MASK) >> MUX_SEL_INPUT_SHIFT;
	u32 pad_ctrl_ofs =
		(pad & MUX_PAD_CTRL_OFS_MASK) >> MUX_PAD_CTRL_OFS_SHIFT;
	u32 pad_ctrl = (pad & MUX_PAD_CTRL_MASK) >> MUX_PAD_CTRL_SHIFT;

	if (mux_ctrl_ofs)
		__raw_writel(mux_mode, base + mux_ctrl_ofs);

	if (sel_input_ofs)
		__raw_writel(sel_input, base + sel_input_ofs);

	if (!(pad_ctrl & NO_PAD_CTRL) && pad_ctrl_ofs)
		__raw_writel(pad_ctrl, base + pad_ctrl_ofs);

	return 0;
}

So we can change this function to void:

void imx_iomux_v3_setup_pad(iomux_v3_cfg_t pad)

And this makes returning an error in the multiple version also
useless. I can change it to void as well.

> Guess that should be fixed globally (and for some other boards as
> well).

Yes, I'll look into this. Thanks for the review.

Best regards,
Stefan

  reply	other threads:[~2013-04-11  8:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  7:17 [U-Boot] [PATCH] imx: Add titanium board support (i.MX6 based) Stefan Roese
2013-04-10  7:52 ` Heiko Schocher
2013-04-10 12:05 ` Wolfgang Denk
2013-04-10 12:13 ` Wolfgang Denk
2013-04-11  8:00   ` Stefan Roese [this message]
2013-04-11  3:36 ` Fabio Estevam
2013-04-11  5:41   ` Wolfgang Denk
2013-04-11  9:04 ` [U-Boot] [PATCH v2] " Stefan Roese
2013-04-16  7:19   ` [U-Boot] [PATCH v3] " Stefan Roese
2013-04-16  7:50     ` Stefano Babic
2013-04-16 12:05       ` Stefan Roese
2013-04-16 12:55   ` [U-Boot] [PATCH v4] " Stefan Roese
2013-04-17  8:22     ` Stefano Babic
2013-04-17  8:27   ` [U-Boot] [PATCH 4 (resend)] " Stefan Roese
2013-04-17 10:15     ` Wolfgang Denk
2013-04-17 10:27       ` Stefan Roese
2013-04-17 10:32   ` [U-Boot] [PATCH v5] " Stefan Roese
2013-04-11 15:48 ` [U-Boot] [PATCH] " Fabio Estevam
2013-04-11 16:39   ` Stefan Roese
2013-04-11 16:54     ` Fabio Estevam
2013-04-22  8:07 ` Stefano Babic
2013-04-22  8:12   ` Stefan Roese
2013-04-22  8:33     ` Stefano Babic

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=51666D9B.2050301@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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