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 15/18] arm: mx6: cm_fx6: add usb support
Date: Tue, 19 Aug 2014 17:49:49 +0300	[thread overview]
Message-ID: <53F3640D.7070701@compulab.co.il> (raw)
In-Reply-To: <53EB7080.2080205@compulab.co.il>

Hi Igor,

On 13/08/14 17:04, Igor Grinberg wrote:
> On 08/10/14 20:12, Nikita Kiryanov wrote:
>> Add USB and USB OTG host support for Compulab CM-FX6 CoM.
>>
>> Cc: Igor Grinberg <grinberg@compulab.co.il>
>> Cc: Stefano Babic <sbabic@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
>> ---
>> Changes in V2:
>> 	- No changes
>>
>>   board/compulab/cm_fx6/cm_fx6.c | 75 ++++++++++++++++++++++++++++++++++++++++++
>>   board/compulab/cm_fx6/common.h |  3 ++
>>   include/configs/cm_fx6.h       | 10 ++++++
>>   3 files changed, 88 insertions(+)
>>
>> diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
>> index e993de2..28c54b4 100644
>> --- a/board/compulab/cm_fx6/cm_fx6.c
>> +++ b/board/compulab/cm_fx6/cm_fx6.c
>
> [...]
>
>> +static int cm_fx6_usb_hub_reset(void)
>> +{
>> +	int err;
>> +
>> +	err = gpio_request(CM_FX6_USB_HUB_RST, "usb hub rst");
>> +	if (err) {
>> +		printf("USB hub rst gpio request failed: %d\n", err);
>> +		return -1;
>> +	}
>> +
>> +	SETUP_IOMUX_PAD(PAD_SD3_RST__GPIO7_IO08 | MUX_PAD_CTRL(NO_PAD_CTRL));
>> +	gpio_direction_output(CM_FX6_USB_HUB_RST, 0);
>> +	udelay(10);
>> +	gpio_direction_output(CM_FX6_USB_HUB_RST, 1);
>> +	mdelay(1);
>> +
>> +	return 0;
>> +}
>> +
>> +static void cm_fx6_init_usb_otg(void)
>
> Can this function also return int as the one above?

Sure.

>
>> +{
>> +	int ret;
>> +	struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
>> +
>> +	ret = gpio_request(SB_FX6_USB_OTG_PWR, "usb-pwr");
>> +	if (ret)
>> +		printf("USB OTG pwr gpio request failed: %d\n", ret);
>> +
>> +	SETUP_IOMUX_PAD(PAD_EIM_D22__GPIO3_IO22 | MUX_PAD_CTRL(NO_PAD_CTRL));
>> +	SETUP_IOMUX_PAD(PAD_ENET_RX_ER__USB_OTG_ID |
>> +						MUX_PAD_CTRL(WEAK_PULLDOWN));
>> +	clrbits_le32(&iomux->gpr[1], IOMUXC_GPR1_OTG_ID_MASK);
>> +	/* disable ext. charger detect, or it'll affect signal quality at dp. */
>> +	gpio_direction_output(SB_FX6_USB_OTG_PWR, 0);
>> +}
>> +
>> +#define MX6_USBNC_BASEADDR	0x2184800
>> +#define USBNC_USB_H1_PWR_POL	(1 << 9)
>> +int board_ehci_hcd_init(int port)
>> +{
>> +	u32 *usbnc_usb_uh1_ctrl = (u32 *)(MX6_USBNC_BASEADDR + 4);
>> +	u32 val;
>> +
>> +	switch (port) {
>> +	case 0:
>> +		cm_fx6_init_usb_otg();
>> +		break;
>> +	case 1:
>> +		SETUP_IOMUX_PAD(PAD_GPIO_0__USB_H1_PWR |
>> +						MUX_PAD_CTRL(NO_PAD_CTRL));
>> +
>> +		/* Set PWR polarity to match power switch's enable polarity */
>> +		val = __raw_readl(usbnc_usb_uh1_ctrl);
>> +		val |= USBNC_USB_H1_PWR_POL;
>> +		__raw_writel(val, usbnc_usb_uh1_ctrl);
>
> Can we have setbits_le32() here?

Sure.

>
>> +		return cm_fx6_usb_hub_reset();
>> +	default:
>> +		break;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +int board_ehci_power(int port, int on)
>> +{
>> +	return port ? 0 : gpio_direction_output(SB_FX6_USB_OTG_PWR, on);
>
> Here port is a port number, not some bool conditional.
> Please be explicit about it and don't use the construct above for such cases.

OK I'll rewrite it.

  reply	other threads:[~2014-08-19 14:49 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 [this message]
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
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=53F3640D.7070701@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