From: Li Ye-B37916 <b37916@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] imx: mx6 sabreauto: Add board support for USB EHCI
Date: Mon, 13 Oct 2014 13:56:31 +0800 [thread overview]
Message-ID: <543B698F.6000602@freescale.com> (raw)
In-Reply-To: <CAOMZO5DPuVtRCHvBy0ML0encsCqMnQv24zF+zNfqUBb5fQunpw@mail.gmail.com>
On 10/10/2014 7:46 PM, Fabio Estevam wrote:
> On Fri, Oct 10, 2014 at 6:01 AM, Ye.Li <B37916@freescale.com> wrote:
>> On mx6 sabreauto board, there are two USB ports:
>> 0: OTG
>> 1: HOST
>> The EHCI driver is enabled for this board, but the IOMUX and VBUS power
>> control is not implemented, which cause both USB port failed to work.
>> This patch fix the problem by adding the BSP support.
> BSP is a broad term here.
>
>> Since the power control uses the GPIO pin from port expander MAX7310,
>> the PCA953X driver is enabled for accessing the MAX7310.
>>
>> The ID pin of OTG Port needs to configure the GPR1 bit 13 for selecting
>> its daisy chain. Add a new function "imx_iomux_set_gpr_register" to
>> handle GPR register setting.
>>
>> Signed-off-by: Ye.Li <B37916@freescale.com>
>> ---
>> arch/arm/imx-common/iomux-v3.c | 17 +++++-
>> arch/arm/include/asm/imx-common/iomux-v3.h | 7 ++-
>> board/freescale/mx6qsabreauto/mx6qsabreauto.c | 89 ++++++++++++++++++++++++-
>> include/configs/mx6qsabreauto.h | 5 +-
>> 4 files changed, 114 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
>> index 22cd11a..2d96655 100644
>> --- a/arch/arm/imx-common/iomux-v3.c
>> +++ b/arch/arm/imx-common/iomux-v3.c
>> @@ -4,7 +4,7 @@
>> * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
>> * <armlinux@phytec.de>
>> *
>> - * Copyright (C) 2004-2011 Freescale Semiconductor, Inc.
>> + * Copyright (C) 2004-2014 Freescale Semiconductor, Inc.
> I don't see the need for changing the copyright everytime you touch a
> file. Same apply to other files in this patch.
>
>> +static int port_exp_direction_output(unsigned gpio, int value)
>> +{
>> + int ret;
>> +
>> + i2c_set_bus_num(2);
>> + if (i2c_probe(PORTEXP_IO_TO_CHIP(gpio)))
>> + return -ENXIO;
> Would be better like this:
>
> ret = i2c_probe(PORTEXP_IO_TO_CHIP(gpio))
> if (ret)
> return ret;
>
>> +
>> + ret = pca953x_set_dir(PORTEXP_IO_TO_CHIP(gpio),
>> + (1 << PORTEXP_IO_TO_PIN(gpio)),
>> + (PCA953X_DIR_OUT << PORTEXP_IO_TO_PIN(gpio)));
> Here you can do:
>
> if (ret)
> return ret;
>
>> +
>> + if (!ret)
> Then you don't need to check for !ret here
>
>> + ret = pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
>> + (1 << PORTEXP_IO_TO_PIN(gpio)),
>> + (value << PORTEXP_IO_TO_PIN(gpio)));
>> +
>> + if (ret)
>> + ret = -EIO;
>> +
>> + return ret;
>> +}
> if (ret)
> return ret;
>
> return 0;
>
>> +int board_ehci_hcd_init(int port)
>> +{
>> + switch (port) {
>> + case 0:
>> + imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
>> + ARRAY_SIZE(usb_otg_pads));
>> +
>> + /*set daisy chain for otg_pin_id on 6q. for 6dl, this bit is reserved*/
>> + imx_iomux_set_gpr_register(1, 13, 1, 0);
>> + break;
>> + case 1:
>> + break;
>> + default:
>> + printf("MXC USB port %d not yet supported\n", port);
>> + return 1;
> return -EINVAL;
>
>> +int board_ehci_power(int port, int on)
>> +{
>> + switch (port) {
>> + case 0:
>> + if (on)
>> + port_exp_direction_output(USB_OTG_PWR, 1);
>> + else
>> + port_exp_direction_output(USB_OTG_PWR, 0);
>> + break;
>> + case 1:
>> + if (on)
>> + port_exp_direction_output(USB_HOST1_PWR, 1);
>> + else
>> + port_exp_direction_output(USB_HOST1_PWR, 0);
>> + break;
>> + default:
>> + printf("MXC USB port %d not yet supported\n", port);
>> + return 1;
> return -EINVAL;
I will update per your comments.
For the copyright, in FSL we are asked to update it when applying any change to the file. what's the rule used in community?
Best regards,
Ye Li
next prev parent reply other threads:[~2014-10-13 5:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 9:01 [U-Boot] [PATCH] imx: mx6 sabreauto: Add board support for USB EHCI Ye.Li
2014-10-10 11:46 ` Fabio Estevam
2014-10-13 5:56 ` Li Ye-B37916 [this message]
2014-10-13 11:03 ` Fabio Estevam
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=543B698F.6000602@freescale.com \
--to=b37916@freescale.com \
--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