public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 18/18] arm: mx6: cm_fx6: add sata support
Date: Tue, 19 Aug 2014 17:51:13 +0300	[thread overview]
Message-ID: <53F36461.8030305@compulab.co.il> (raw)
In-Reply-To: <53EC60E8.1070204@compulab.co.il>

Hi Igor,

On 14/08/14 10:10, Igor Grinberg wrote:
>> +
>> +static void cm_fx6_sata_power(int on)
>
> Will it be/look better to use bool here?

This will create a situation where a bool is passed to a function which
takes an int (gpio_direction_output()), and that irks me a little. At
least treating ints as bools is a common C idiom; the inverse is not.

>
>> +{
>> +	int i;
>> +
>> +	if (!on) { /* tell the iSSD that the power will be removed */
>> +		gpio_direction_output(CM_FX6_SATA_PWLOSS_INT, 1);
>> +		mdelay(10);
>> +	}
>> +
>> +	for (i = 0; i < ARRAY_SIZE(cm_fx6_issd_gpios); i++) {
>> +		gpio_direction_output(cm_fx6_issd_gpios[i], on);
>> +		udelay(100);
>> +	}
>> +
>> +	if (!on) /* for compatibility lower the power loss interrupt */
>> +		gpio_direction_output(CM_FX6_SATA_PWLOSS_INT, 0);
>> +}
>
> [...]
>
>> +static void cm_fx6_setup_issd(void)
>> +{
>> +	SETUP_IOMUX_PADS(sata_pads);
>> +	/* Make sure this gpio has logical 0 value */
>> +	gpio_direction_output(CM_FX6_SATA_PWLOSS_INT, 0);
>> +	udelay(100);
>> +
>> +	cm_fx6_sata_power(0);
>> +	mdelay(250);
>> +	cm_fx6_sata_power(1);
>> +}
>> +
>> +#define CM_FX6_SATA_INIT_RETRIES	10
>> +int sata_initialize(void)
>> +{
>> +	int err, i;
>> +
>> +	cm_fx6_setup_issd();
>> +	for (i = 0; i < CM_FX6_SATA_INIT_RETRIES; i++) {
>> +		err = setup_sata();
>> +		if (err) {
>> +			printf("SATA setup failed: %d\n", err);
>> +			return err;
>> +		}
>> +
>> +		udelay(100);
>> +
>> +		err = __sata_initialize();
>> +		if (!err)
>> +			break;
>> +
>> +		/* There is no device on the SATA port */
>> +		if (sata_port_status(0, 0) == 0)
>> +			break;
>> +
>> +		/* There's a device, but link not established. Retry */
>> +	}
>> +
>> +	return err;
>> +}
>> +#else
>> +static void cm_fx6_setup_issd(void) {}
>
> Why do you need this one?
> It is only called from sata_initialize(), which is inside
> #ifdef CONFIG_DWC_AHSATA
> and is not available otherwise.
>

Yes you're right. This is a remnant of a past version.
Will remove.

>> +#endif
>> +
>>   #ifdef CONFIG_SYS_I2C_MXC
>>   #define I2C_PAD_CTRL	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
>>   			PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
>
> [...]
>
>> diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
>> index adfd55e..88925cd 100644
>> --- a/include/configs/cm_fx6.h
>> +++ b/include/configs/cm_fx6.h
>> @@ -132,6 +132,19 @@
>>   	"mmcboot=echo Booting from mmc ...; " \
>>   		"run mmcargs; " \
>>   		"run doboot\0" \
>> +	"satadev=0\0" \
>> +	"sataroot=/dev/sda2 rw rootwait\0" \
>> +	"sataargs=setenv bootargs console=${console} " \
>> +		"root=${sataroot} " \
>> +		"${video}\0" \
>> +	"loadsatabootscript=fatload sata ${satadev} ${loadaddr} ${bootscr}\0" \
>> +	"satabootscript=echo Running bootscript from sata ...; " \
>> +		"source ${loadaddr}\0" \
>> +	"sataloadkernel=fatload sata ${satadev} ${loadaddr} ${kernel}\0" \
>> +	"sataloadfdt=fatload sata ${satadev} ${fdtaddr} ${fdtfile}\0" \
>
> Can we switch to use load instead of explicit fatload?

Sure

  reply	other threads:[~2014-08-19 14:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10 17:12 [U-Boot] [PATCH V2 00/18] Introduce cm-fx6 board (partial V2 cont.) Nikita Kiryanov
2014-08-10 17:12 ` [U-Boot] [PATCH V2 10/18] arm: mx6: ddr: configure MMDC for slow_pd Nikita Kiryanov
2014-08-12 11:29   ` Igor Grinberg
2014-08-10 17:12 ` [U-Boot] [PATCH V2 11/18] arm: mx6: ddr: fix cs0_end calculation Nikita Kiryanov
2014-08-10 17:12 ` [U-Boot] [PATCH V2 12/18] arm: mx6: add support for Compulab cm-fx6 CoM Nikita Kiryanov
2014-08-10 20:53   ` Marek Vasut
2014-08-11 16:22   ` [U-Boot] [PATCH V3 " Nikita Kiryanov
2014-08-12 14:48     ` Simon Glass
2014-08-13 10:57       ` Nikita Kiryanov
2014-08-13 12:55     ` Igor Grinberg
2014-08-14  7:16       ` Igor Grinberg
2014-08-19 15:19         ` Nikita Kiryanov
2014-08-19 15:17       ` Nikita Kiryanov
2014-08-20 11:23       ` Nikita Kiryanov
2014-08-10 17:12 ` [U-Boot] [PATCH V2 13/18] arm: mx6: cm_fx6: add nand support Nikita Kiryanov
2014-08-13 14:29   ` Igor Grinberg
2014-08-10 17:12 ` [U-Boot] [PATCH V2 14/18] arm: mx6: cm_fx6: add ethernet support Nikita Kiryanov
2014-08-13 13:53   ` Igor Grinberg
2014-08-10 17:12 ` [U-Boot] [PATCH V2 15/18] arm: mx6: cm_fx6: add usb support Nikita Kiryanov
2014-08-13 14:04   ` Igor Grinberg
2014-08-19 14:49     ` Nikita Kiryanov
2014-08-10 17:12 ` [U-Boot] [PATCH V2 16/18] arm: mx6: cm_fx6: add i2c support Nikita Kiryanov
2014-08-14  6:55   ` Igor Grinberg
2014-08-10 17:12 ` [U-Boot] [PATCH V2 17/18] arm: mx6: cm_fx6: use eeprom Nikita Kiryanov
2014-08-14  6:59   ` Igor Grinberg
2014-08-10 17:13 ` [U-Boot] [PATCH V2 18/18] arm: mx6: cm_fx6: add sata support Nikita Kiryanov
2014-08-14  7:10   ` Igor Grinberg
2014-08-19 14:51     ` Nikita Kiryanov [this message]
2014-08-11  0:11 ` [U-Boot] [PATCH V2 00/18] Introduce cm-fx6 board (partial V2 cont.) Simon Glass
2014-08-11  8:05   ` Igor Grinberg
2014-08-11  8:20   ` Nikita Kiryanov
2014-08-11 14:15     ` Simon Glass
2014-08-11 14:39       ` Nikita Kiryanov
2014-08-12 14:39         ` Simon Glass

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=53F36461.8030305@compulab.co.il \
    --to=nikita@compulab.co.il \
    --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